2023.12.26.0

SiteEditorForm: sort controls only if some of them have numbers
UserCreatorForm: reset site options for new user only; add host reset when changing account for created user
PropertyValueHost: add 'UpdateMember' function
SettingsHost: add 'DefaultInstanceChanged' function to update properties when setting default instance
SettingsHostCollection: update properties when setting default instance
This commit is contained in:
Andy
2023-12-26 14:34:53 +03:00
parent e3da1bf1d3
commit c458f1cd1d
7 changed files with 28 additions and 11 deletions

View File

@@ -205,7 +205,7 @@ Namespace API.Base
If Not h Is Nothing Then _HostKey = h.Key
End Set
End Property
Private Sub ResetHost()
Friend Sub ResetHost()
_HostObtained = False
End Sub
Friend Property HostStatic As Boolean = False Implements IUserData.HostStatic

View File

@@ -213,7 +213,7 @@ Namespace Editors
Dim loAdded As Boolean = False
Dim pArr() As Boolean
If .PropList.Exists(Function(p) If(p.Options?.IsAuth, False)) Then pArr = {True, False} Else pArr = {False}
.PropList.Sort()
If .PropList.Exists(Function(p) p.ControlNumber >= 0) Then .PropList.Sort()
For Each pAuth As Boolean In pArr
For Each prop As PropertyValueHost In .PropList
If Not prop.Options Is Nothing Then

View File

@@ -430,6 +430,7 @@ Namespace Editors
If Not UserInstance Is Nothing Then
With DirectCast(UserInstance, UserDataBase)
.User = User
.ResetHost()
Dim setFriendly As Boolean = True
If FriendlyNameIsSiteName Then
If Not FriendlyNameChanged Then
@@ -590,7 +591,7 @@ CloseForm:
End Sub
Private _AccountsRefilling As Boolean = False
Private Sub CMB_ACCOUNT_ActionSelectedItemChanged(ByVal Sender As Object, ByVal e As EventArgs, ByVal Item As ListViewItem) Handles CMB_ACCOUNT.ActionSelectedItemChanged
If Not _AccountsRefilling Then SetParamsBySite(False)
If Not _AccountsRefilling And UserInstance Is Nothing Then SetParamsBySite(False)
End Sub
Private Sub CH_TEMP_CheckedChanged(sender As Object, e As EventArgs) Handles CH_TEMP.CheckedChanged
If CH_TEMP.Checked Then CH_FAV.Checked = False : CH_READY_FOR_DOWN.Checked = False

View File

@@ -21,8 +21,8 @@ Friend Class MainFrameObjects : Implements INotificator
PauseButtons = New DownloadObjects.AutoDownloaderPauseButtons(DownloadObjects.AutoDownloaderPauseButtons.ButtonsPlace.MainFrame)
ProgramLogInitialize()
With ProgramLog
AddHandler ProgramLog.TextAdded, AddressOf ProgramLog_TextAdded
AddHandler ProgramLog.TextCleared, AddressOf ProgramLog_TextCleared
AddHandler .TextAdded, AddressOf ProgramLog_TextAdded
AddHandler .TextCleared, AddressOf ProgramLog_TextCleared
End With
End Sub
#Region "Users"

View File

@@ -23,6 +23,7 @@ Namespace Plugin.Hosts
Private ReadOnly Keeper As SettingsHost
Protected Source As Object 'ReadOnly
Protected Member As MemberInfo
Private ReadOnly MemberRef As MemberInfo
Friend ReadOnly Options As PropertyOption
Friend Overridable ReadOnly Property Name As String
Protected _Type As Type
@@ -41,7 +42,7 @@ Namespace Plugin.Hosts
#End Region
#Region "Control"
Friend Property Control As Control
Protected ControlNumber As Integer = -1
Friend Property ControlNumber As Integer = -1
Friend ReadOnly Property ControlHeight As Integer
Get
If Not Control Is Nothing Then
@@ -245,13 +246,12 @@ Namespace Plugin.Hosts
Me.Keeper = Keeper
Source = PropertySource
Name = Member.Name
MemberRef = Member
ControlNumber = If(Member.GetCustomAttribute(Of ControlNumber)()?.PropertyNumber, -1)
If DirectCast(Member, PropertyInfo).PropertyType Is GetType(PropertyValue) Then
ExternalValue = DirectCast(DirectCast(Member, PropertyInfo).GetValue(Source), PropertyValue)
_Value = ExternalValue.Value
AddHandler ExternalValue.ValueChanged, AddressOf ExternalValueChanged
UpdateMember()
Options = Member.GetCustomAttribute(Of PropertyOption)()
IsTaskCounter = Not Member.GetCustomAttribute(Of TaskCounter)() Is Nothing
_XmlName = If(Member.GetCustomAttribute(Of PXML)()?.ElementName, String.Empty)
@@ -274,9 +274,22 @@ Namespace Plugin.Hosts
Next
End If
End Sub
Friend Sub UpdateMember()
If Not ExternalValue Is Nothing Then
Try : RemoveHandler ExternalValue.ValueChanged, AddressOf ExternalValueChanged : Catch : End Try
End If
_ExternalValue = DirectCast(DirectCast(MemberRef, PropertyInfo).GetValue(Source), PropertyValue)
_Value = ExternalValue.Value
AddHandler ExternalValue.ValueChanged, AddressOf ExternalValueChanged
End Sub
#End Region
#Region "Value"
Protected ReadOnly Property ExternalValue As PropertyValue
Private _ExternalValue As PropertyValue = Nothing
Private ReadOnly Property ExternalValue As PropertyValue
Get
Return _ExternalValue
End Get
End Property
Friend ReadOnly Property XValue As IXMLValue
Protected _Value As Object
Friend Overloads Property Value As Object Implements IPropertyValue.Value

View File

@@ -143,6 +143,9 @@ Namespace Plugin.Hosts
End Set
End Property
Friend ReadOnly Property [Default] As Boolean
Friend Sub DefaultInstanceChanged()
If PropList.Count > 0 Then PropList.ForEach(Sub(p) p.UpdateMember())
End Sub
Friend ReadOnly Property IsSeparatedTasks As Boolean = False
Friend ReadOnly Property IsSavedPostsCompatible As Boolean = False
Private ReadOnly _TaskCountDefined As Integer? = Nothing

View File

@@ -122,7 +122,7 @@ Namespace Plugin.Hosts
AddHandler Host.OkClick, AddressOf Hosts_OkClick
AddHandler Host.Deleted, AddressOf Hosts_Deleted
AddHandler Host.CloneClick, AddressOf Hosts_CloneClick
If Host.Index > 0 Then Host.Source.DefaultInstance = [Default].Source
If Host.Index > 0 Then Host.Source.DefaultInstance = [Default].Source : Host.DefaultInstanceChanged()
End Sub
Private Sub Hosts_OkClick(ByVal Obj As SettingsHost)
If Obj.Index = -1 Then