/// <summary> ///単一アプリケーション オブジェクトを初期化します。これは、実行される作成したコードの ///最初の行であるため、論理的には main() または WinMain() と等価です。 /// </summary> public App() { InitializeComponent(); Suspending += OnSuspending; Model = new WSBManagerModel(); }
/// <summary> /// Constructor /// </summary> /// <param name="selectedIndex">Index of the configuration item to edit (if -1, new creattion)</param> public SandboxConfigEditorViewModel(int selectedIndex = -1) { model = (App.Current as App)?.Model; if (model == null) { throw new Exception($"Failed to get reference of model instance on the {GetType()} class."); } this.selectedIndex = selectedIndex; IsNew = selectedIndex <= -1; if (IsNew) { EditingItem = new WSBConfigManagerModel { Name = resourceLoader.GetString("NewSandboxName") }; } else { EditingItem = new WSBConfigManagerModel(model.WSBConfigCollection[selectedIndex]); foreach (var mf in EditingItem.MappedFolders) { EditingMappedFolders.Add(mf); } } model.PropertyChanged += (sender, e) => PropertyChanged?.Invoke(sender, e); }
/// <summary> /// Creates a new instance of the <see cref="WSBManagerViewModel"/> class. /// </summary> public WSBManagerViewModel() { model = (App.Current as App)?.Model; if (model == null) { throw new Exception($"Failed to get reference of model instance on the {GetType()} class."); } model.PropertyChanged += (sender, e) => PropertyChanged?.Invoke(sender, e); }