private static TaskDialogResult ShowMessage(TaskDialogOptions option) { // Suppress auto shutdown Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; try { return TaskDialog.Show(option); } finally { Application.Current.ShutdownMode = ShutdownMode.OnLastWindowClose; } }
private void Application_Startup(object sender, StartupEventArgs e) { // enable multi-core JIT. // see reference: http://msdn.microsoft.com/en-us/library/system.runtime.profileoptimization.aspx if (IsMulticoreJitEnabled) { ProfileOptimization.SetProfileRoot(ConfigurationDirectoryPath); ProfileOptimization.StartProfile(ProfileFileName); } // initialize dispatcher helper DispatcherHelper.UIDispatcher = Dispatcher; DispatcherHolder.Initialize(Dispatcher); // set rendering mode if (!IsHardwareRenderingEnabled) { System.Windows.Media.RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly; } // Check run duplication string mutexStr = null; switch (ExecutionMode) { case ExecutionMode.Default: case ExecutionMode.Roaming: mutexStr = ExecutionMode.ToString(); break; case ExecutionMode.Standalone: mutexStr = "Standalone_" + ExeFilePath.Replace('\\', '*'); break; } _appMutex = new Mutex(true, "Krile_StarryEyes_" + mutexStr); if (_appMutex.WaitOne(0, false) == false) { MessageBox.Show("Krileは既に起動しています。"); Environment.Exit(0); } // set exception handlers Current.DispatcherUnhandledException += (sender2, e2) => HandleException(e2.Exception); AppDomain.CurrentDomain.UnhandledException += (sender2, e2) => HandleException(e2.ExceptionObject as Exception); // set exit handler Current.Exit += (_, __) => AppFinalize(true); // Initialize service points ServicePointManager.Expect100Continue = false; // disable expect 100 continue for User Streams connection. ServicePointManager.DefaultConnectionLimit = Int32.MaxValue; // Limit Break! // Initialize special image handlers SpecialImageResolvers.Initialize(); // Load plugins PluginManager.Load(); // Load settings if (!Setting.LoadSettings()) { Current.Shutdown(); return; // fail } // Set CK/CS for accessing twitter. ApiEndpoint.DefaultConsumerKey = Setting.GlobalConsumerKey.Value ?? ConsumerKey; ApiEndpoint.DefaultConsumerSecret = Setting.GlobalConsumerSecret.Value ?? ConsumerSecret; ApiEndpoint.UserAgent = Setting.UserAgent.Value; // Load key assigns KeyAssignManager.Initialize(); // Load cache store CacheStore.Initialize(); // Initialize core systems if (Setting.DatabaseCorruption.Value) { var option = new TaskDialogOptions { MainIcon = VistaTaskDialogIcon.Error, Title = "Krile データストア初期化エラー", MainInstruction = "データストアの破損が検出されています。", Content = "データストアが破損している可能性があります。" + Environment.NewLine + "データストアを初期化するか、またはKrileを終了してバックアップを取ることができます。", CommandButtons = new[] { "データストアを初期化して再起動", "Krileを終了", "無視して起動を続ける" } }; var result = TaskDialog.Show(option); if (result.CommandButtonResult.HasValue) { switch (result.CommandButtonResult.Value) { case 0: StatusStore.Shutdown(); UserStore.Shutdown(); // clear data ClearStoreData(); Setting.DatabaseCorruption.Value = false; Setting.Save(); _appMutex.Dispose(); Process.Start(ResourceAssembly.Location); Current.Shutdown(); Process.GetCurrentProcess().Kill(); return; case 1: _appMutex.Dispose(); // shutdown Current.Shutdown(); Process.GetCurrentProcess().Kill(); return; case 2: Setting.DatabaseCorruption.Value = false; break; } } } StatusStore.Initialize(); UserStore.Initialize(); AccountsStore.Initialize(); StatisticsService.Initialize(); PostLimitPredictionService.Initialize(); StreamingEventsHub.Initialize(); ReceiveInbox.Initialize(); // Activate plugins PluginManager.LoadedPlugins.ForEach(p => p.Initialize()); // Activate scripts ScriptingManager.ExecuteScripts(); // finalize handlers StreamingEventsHub.RegisterDefaultHandlers(); ReceiversManager.Initialize(); BackstageModel.Initialize(); RaiseSystemReady(); }
private void ShowTaskDialogMessage(TaskDialogOptions options) { this._parent.Parent.Messenger.RaiseSafe(() => new TaskDialogMessage(options)); }
public static void ShowTaskDialog(TaskDialogOptions options) { if (!_isUserInterfaceReady) { _taskDialogQueue.Enqueue(options); } TaskDialogRequested.SafeInvoke(options); }
public static void ShowTaskDialog(TaskDialogOptions options) { if (!_isUserInterfaceReady) { _taskDialogQueue.Enqueue(options); } var handler = TaskDialogRequested; if (handler != null) handler(options); }