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 If Not h Is Nothing Then _HostKey = h.Key
End Set End Set
End Property End Property
Private Sub ResetHost() Friend Sub ResetHost()
_HostObtained = False _HostObtained = False
End Sub End Sub
Friend Property HostStatic As Boolean = False Implements IUserData.HostStatic Friend Property HostStatic As Boolean = False Implements IUserData.HostStatic

View File

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

View File

@@ -430,6 +430,7 @@ Namespace Editors
If Not UserInstance Is Nothing Then If Not UserInstance Is Nothing Then
With DirectCast(UserInstance, UserDataBase) With DirectCast(UserInstance, UserDataBase)
.User = User .User = User
.ResetHost()
Dim setFriendly As Boolean = True Dim setFriendly As Boolean = True
If FriendlyNameIsSiteName Then If FriendlyNameIsSiteName Then
If Not FriendlyNameChanged Then If Not FriendlyNameChanged Then
@@ -590,7 +591,7 @@ CloseForm:
End Sub End Sub
Private _AccountsRefilling As Boolean = False 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 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 End Sub
Private Sub CH_TEMP_CheckedChanged(sender As Object, e As EventArgs) Handles CH_TEMP.CheckedChanged 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 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) PauseButtons = New DownloadObjects.AutoDownloaderPauseButtons(DownloadObjects.AutoDownloaderPauseButtons.ButtonsPlace.MainFrame)
ProgramLogInitialize() ProgramLogInitialize()
With ProgramLog With ProgramLog
AddHandler ProgramLog.TextAdded, AddressOf ProgramLog_TextAdded AddHandler .TextAdded, AddressOf ProgramLog_TextAdded
AddHandler ProgramLog.TextCleared, AddressOf ProgramLog_TextCleared AddHandler .TextCleared, AddressOf ProgramLog_TextCleared
End With End With
End Sub End Sub
#Region "Users" #Region "Users"

View File

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

View File

@@ -143,6 +143,9 @@ Namespace Plugin.Hosts
End Set End Set
End Property End Property
Friend ReadOnly Property [Default] As Boolean 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 IsSeparatedTasks As Boolean = False
Friend ReadOnly Property IsSavedPostsCompatible As Boolean = False Friend ReadOnly Property IsSavedPostsCompatible As Boolean = False
Private ReadOnly _TaskCountDefined As Integer? = Nothing Private ReadOnly _TaskCountDefined As Integer? = Nothing

View File

@@ -122,7 +122,7 @@ Namespace Plugin.Hosts
AddHandler Host.OkClick, AddressOf Hosts_OkClick AddHandler Host.OkClick, AddressOf Hosts_OkClick
AddHandler Host.Deleted, AddressOf Hosts_Deleted AddHandler Host.Deleted, AddressOf Hosts_Deleted
AddHandler Host.CloneClick, AddressOf Hosts_CloneClick 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 End Sub
Private Sub Hosts_OkClick(ByVal Obj As SettingsHost) Private Sub Hosts_OkClick(ByVal Obj As SettingsHost)
If Obj.Index = -1 Then If Obj.Index = -1 Then