44using System . IO ;
55using System . Linq ;
66using System . Threading . Tasks ;
7+ using Avalonia . Threading ;
78using CommunityToolkit . Mvvm . ComponentModel ;
89using CommunityToolkit . Mvvm . Input ;
910using GeneralUpdate . Tool . Avalonia . Common ;
@@ -16,7 +17,6 @@ namespace GeneralUpdate.Tool.Avalonia.ViewModels;
1617public class ExtensionViewModel : ObservableObject
1718{
1819 #region Private Members
19-
2020
2121 private ExtensionConfigModel ? _configModel ;
2222 private AsyncRelayCommand ? _generateCommand ;
@@ -32,6 +32,11 @@ public class ExtensionViewModel : ObservableObject
3232
3333 #endregion
3434
35+ public ExtensionViewModel ( )
36+ {
37+ LoadedCommand . Execute ( null ) ;
38+ }
39+
3540 #region Public Properties
3641
3742 public RelayCommand LoadedCommand
@@ -140,30 +145,33 @@ private void LoadedAction()
140145
141146 private void ResetAction ( )
142147 {
143- ConfigModel . Name = string . Empty ;
144- ConfigModel . Version = "1.0.0.0" ;
145- ConfigModel . Description = string . Empty ;
146- ConfigModel . ExtensionDirectory = string . Empty ;
147- ConfigModel . Path = string . Empty ;
148- ConfigModel . Dependencies = string . Empty ;
149- ConfigModel . IsUploadToServer = false ;
150- ConfigModel . Platform = Platforms . First ( ) ;
151- ConfigModel . DisplayName = string . Empty ;
152- ConfigModel . Publisher = string . Empty ;
153- ConfigModel . License = string . Empty ;
154- ConfigModel . CategoriesText = string . Empty ;
155- ConfigModel . MinHostVersion = string . Empty ;
156- ConfigModel . MaxHostVersion = string . Empty ;
157- ConfigModel . ReleaseDate = DateTime . Now ;
158- ConfigModel . IsPreRelease = false ;
159- ConfigModel . Format = ".zip" ;
160- ConfigModel . Hash = string . Empty ;
161- SelectedDependency = null ;
162- ConfigModel . CustomProperties . Clear ( ) ;
163- ConfigModel . ShowCustomProperties = false ;
164- CustomPropertiesCollection . Clear ( ) ;
165- NewCustomPropertyKey = string . Empty ;
166- NewCustomPropertyValue = string . Empty ;
148+ Dispatcher . UIThread . Invoke ( ( ) =>
149+ {
150+ ConfigModel . Name = string . Empty ;
151+ ConfigModel . Version = "1.0.0.0" ;
152+ ConfigModel . Description = string . Empty ;
153+ ConfigModel . ExtensionDirectory = string . Empty ;
154+ ConfigModel . Path = string . Empty ;
155+ ConfigModel . Dependencies = string . Empty ;
156+ ConfigModel . IsUploadToServer = false ;
157+ ConfigModel . Platform = Platforms . First ( ) ;
158+ ConfigModel . DisplayName = string . Empty ;
159+ ConfigModel . Publisher = string . Empty ;
160+ ConfigModel . License = string . Empty ;
161+ ConfigModel . CategoriesText = string . Empty ;
162+ ConfigModel . MinHostVersion = string . Empty ;
163+ ConfigModel . MaxHostVersion = string . Empty ;
164+ ConfigModel . ReleaseDate = DateTime . Now ;
165+ ConfigModel . IsPreRelease = false ;
166+ ConfigModel . Format = ".zip" ;
167+ ConfigModel . Hash = string . Empty ;
168+ SelectedDependency = null ;
169+ ConfigModel . CustomProperties . Clear ( ) ;
170+ ConfigModel . ShowCustomProperties = false ;
171+ CustomPropertiesCollection . Clear ( ) ;
172+ NewCustomPropertyKey = string . Empty ;
173+ NewCustomPropertyValue = string . Empty ;
174+ } ) ;
167175 }
168176
169177 private async Task SelectFolderAction ( string ? value )
0 commit comments