/// <summary> /// 新しいインスタンスを初期化します。 /// </summary> public HomeViewModel() { _client = MovselexClientFactory.Create(Assembly.GetExecutingAssembly(), Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ApplicationDefinitions.DefaultAppConfigFilePath)); _client.ExceptionThrowed += ClientOnExceptionThrowed; CreateReadOnlyDispatcherCollection(); CreateListener(); //_client.Refreshed += (sender, args) => //{ // //LibraryCount = _client.Libraries.Count(); // // フィルタリング選択復元 // //var filteringSelect = _filterings.FirstOrDefault(x => x.Model.DisplayValue == AppConfig.SelectFiltering); // //if (filteringSelect != null) filteringSelect.IsSelected = true; // // データベース選択復元 // //CurrentDatabase = Databases.SingleOrDefault(x=> x.Name == _client.AppConfig.SelectDatabase); //}; // 初回データベース読み込みを行う _client.Initialized += (sender, args) => { _client.UpdateLibrary(); _log.Debug("Initialized MovselexClinet."); }; _client.Initialize(); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); DispatcherHelper.UIDispatcher = Dispatcher; AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomainUnhandledException); ViewModelRoot = new HomeViewModel(); Client = ViewModelRoot.Client; Config = ViewModelRoot.AppConfig; this.MainWindow = new MainWindow { DataContext = ViewModelRoot }; this.MainWindow.Show(); }