public VMMainMenu() { Exit = new MVVMCommand(p => { App.Current.Shutdown(0); }); OpenLoggingWindow = new MVVMCommand(p => { new LogWindow().Show(); }); OpenUpdateLogs = new MVVMCommand(p => MainWindowBus.ShowSlice(new UpdateLog(), "Farewell under the stars")); OpenSettings = new MVVMCommand(p => new SettingsWindow().ShowDialog()); UpdateCheck = new MVVMCommand(P => MainWindowBus.Info("wtf")); OpenOSInformation = new MVVMCommand(p => MainWindowBus.ShowSlice(new OpenSourceInformation(), "Open Source")); OpenShell = new MVVMCommand(p => { ProcessStartInfo info = new ProcessStartInfo { WorkingDirectory = Adb.AdbToolsDir.FullName, FileName = "cmd", UseShellExecute = false, Verb = "runas", }; info.EnvironmentVariables["ANDROID_ADB_SERVER_PORT"] = Adb.Server.Port.ToString(); if (Properties.Settings.Default.EnvVarCmdWindow) { var pathEnv = info.EnvironmentVariables["path"]; info.EnvironmentVariables["path"] = $"{Adb.AdbToolsDir.FullName};" + pathEnv; } if (Properties.Settings.Default.StartCmdAtDesktop) { info.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); } info.FileName = p?.ToString() ?? "cmd.exe"; Process.Start(info); }); }
public static void Do() { var getter = new RemoteVersionInfoGetter(); if (!isFristCheck) { MainWindowBus.Info("Update.CheckingUpdate"); } getter.Advance().ContinueWith(task => { if (task.IsFaulted) { if (!isFristCheck) { MainWindowBus.Error("Update.Failed"); } } else { if (task.Result.Version > Self.Version) { App.Current.Dispatcher.Invoke(() => { DoAsk(task.Result); }); } else { MainWindowBus.Success("Update.IsLatestVersion"); } } isFristCheck = false; }); }
public static void Do() { new ToastMotdGetter().Try(e => { if (!e.Enable) { return; } App.Current.Dispatcher.Invoke(() => { MainWindowBus.Info(e.Title + System.Environment.NewLine + e.Message); }); }); }
public async Task Do(APIIndex index) { var result = await new NetReader().Read(index.MotdUrl) .ContinueWith(task => task.Result.ToJson <Result>()); SLogger <MOTDHandler> .Info(result.Message); if (result.ClickUrl != null) { Growl.Ask(new GrowlInfo() { Message = result.Message, ShowCloseButton = true, ConfirmStr = result.GoBtnStr ?? "Go", Token = MainWindowBus.TOKEN_PANEL_MAIN }); } else { MainWindowBus.Info(result.Message); } }
public void SendNotification(string msg, string title = null, Action clickHandler = null) { MainWindowBus.Info(msg); }