mirror of
https://github.com/AAndyProgram/SCrawler.git
synced 2026-03-14 15:52:18 +00:00
2023.9.29.0
UserDataBind: fix labels, colors, script when adding a new user UserCreatorForm: fix labels issue
This commit is contained in:
@@ -291,7 +291,7 @@ Namespace API
|
||||
End Property
|
||||
Friend Overrides Property ScriptUse As Boolean
|
||||
Get
|
||||
Return Count > 0 AndAlso Collections.Exists(Function(c) c.ScriptUse)
|
||||
Return Count > 0 AndAlso Collections.All(Function(c) c.ScriptUse)
|
||||
End Get
|
||||
Set(ByVal u As Boolean)
|
||||
If Count > 0 Then Collections.ForEach(Sub(ByVal c As IUserData)
|
||||
@@ -499,20 +499,20 @@ Namespace API
|
||||
Friend Overloads Sub Add(ByVal _Item As IUserData) Implements ICollection(Of IUserData).Add
|
||||
With _Item
|
||||
If .MoveFiles(CollectionName, CollectionPath) Then
|
||||
If Not _Item.IsVirtual And DataMerging Then DirectCast(.Self, UserDataBase).MergeData()
|
||||
Collections.Add(_Item)
|
||||
If Not .Self.IsVirtual And DataMerging Then DirectCast(.Self, UserDataBase).MergeData()
|
||||
ConsolidateLabels(.Self)
|
||||
ConsolidateScripts(.Self)
|
||||
ConsolidateColors(.Self)
|
||||
Collections.Add(.Self)
|
||||
With Collections.Last
|
||||
If Count > 1 Then
|
||||
If _CollectionName.IsEmptyString Then _CollectionName = .CollectionName
|
||||
.Temporary = Temporary
|
||||
.Favorite = Favorite
|
||||
.ReadyForDownload = ReadyForDownload
|
||||
ConsolidateLabels(_Item)
|
||||
ConsolidateScripts()
|
||||
ConsolidateColors(_Item)
|
||||
.UpdateUserInformation()
|
||||
End If
|
||||
MainFrameObj.ImageHandler(_Item, False)
|
||||
|
||||
If _CollectionName.IsEmptyString Then _CollectionName = .CollectionName
|
||||
.Temporary = Temporary
|
||||
.Favorite = Favorite
|
||||
.ReadyForDownload = ReadyForDownload
|
||||
.UpdateUserInformation()
|
||||
|
||||
MainFrameObj.ImageHandler(.Self, False)
|
||||
AddRemoveBttDeleteHandler(.Self, True)
|
||||
AddHandler .Self.UserUpdated, AddressOf User_OnUserUpdated
|
||||
End With
|
||||
@@ -550,8 +550,12 @@ Namespace API
|
||||
Private Sub ConsolidateLabels(ByVal Destination As UserDataBase)
|
||||
UpdateLabels(If(Destination, Me), ListAddList(Nothing, Labels.ListWithRemove(SpecialLabels)), 1, True)
|
||||
End Sub
|
||||
Private Sub ConsolidateScripts()
|
||||
If Count > 1 AndAlso ScriptUse Then Collections.ForEach(Sub(c) c.ScriptUse = True)
|
||||
Private Sub ConsolidateScripts(ByVal Destination As UserDataBase)
|
||||
If Count > 0 AndAlso ScriptUse Then
|
||||
Dim __scriptData$ = Collections(0).ScriptData
|
||||
Destination.ScriptUse = True
|
||||
If Collections.All(Function(c) c.ScriptData = __scriptData) Then Destination.ScriptData = __scriptData
|
||||
End If
|
||||
End Sub
|
||||
Private Sub ConsolidateColors(ByVal Destination As UserDataBase)
|
||||
If Count > 0 And Not Destination.ForeColor.HasValue And Not Destination.BackColor.HasValue Then
|
||||
|
||||
@@ -120,6 +120,7 @@ Namespace Editors
|
||||
Private SpecialPathHandler As PathMoverHandler = Nothing
|
||||
Friend ReadOnly Property UserLabels As List(Of String)
|
||||
Private LabelsIncludeSpecial As Boolean = False
|
||||
Private LabelsChanged As Boolean = False
|
||||
#End Region
|
||||
#Region "Initializers"
|
||||
''' <summary>Create new user</summary>
|
||||
@@ -327,6 +328,8 @@ Namespace Editors
|
||||
FriendlyNameChanged = False
|
||||
Catch ex As Exception
|
||||
MyDef.InvokeLoaderError(ex)
|
||||
Finally
|
||||
LabelsChanged = False
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub UserCreatorForm_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
|
||||
@@ -367,7 +370,7 @@ Namespace Editors
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not .Labels.ListEquals(UserLabels) Then _
|
||||
If LabelsChanged Then _
|
||||
UserDataBase.UpdateLabels(.Self, UserLabels, 1,
|
||||
Not DirectCast(.Self, UserDataBase).SpecialLabels.ListExists OrElse
|
||||
UserDataBase.UpdateLabelsKeepSpecial(1))
|
||||
@@ -596,7 +599,7 @@ CloseForm:
|
||||
Private Sub TXT_LABELS_ActionOnButtonClick(ByVal Sender As ActionButton, ByVal e As EventArgs) Handles TXT_LABELS.ActionOnButtonClick
|
||||
Select Case Sender.DefaultButton
|
||||
Case ADB.Open : ChangeLabels()
|
||||
Case ADB.Clear : UserLabels.Clear()
|
||||
Case ADB.Clear : UserLabels.Clear() : LabelsChanged = True
|
||||
Case ADB.Refresh : UpdateSpecificLabels(False)
|
||||
End Select
|
||||
End Sub
|
||||
@@ -784,8 +787,10 @@ CloseForm:
|
||||
Using fl As New LabelsForm(UserLabels)
|
||||
fl.ShowDialog()
|
||||
If fl.DialogResult = DialogResult.OK Then
|
||||
LabelsChanged = True
|
||||
UserLabels.ListAddList(fl.LabelsList, LAP.NotContainsOnly, LAP.ClearBeforeAdd)
|
||||
If UserLabels.ListExists Then
|
||||
UserLabels.Sort()
|
||||
TXT_LABELS.Text = UserLabels.ListToString
|
||||
Else
|
||||
TXT_LABELS.Clear()
|
||||
|
||||
Reference in New Issue
Block a user