private void KillProcess(ProcessInfo info, bool entireProcessTree) { var title = entireProcessTree ? TextKillProcessTree : TextKillProcess; modalAlert.Show(title, string.Format(TextAskToKillProcess, info.Id, info.Name), () => { Task.Run(() => { try { #pragma warning disable CA1416 // 验证平台兼容性 var process = Process.GetProcessById(info.Id); if (process == null) { throw new ApplicationException($"Can't found process[Id:{info.Id}]."); } process.Kill(entireProcessTree); search(); #pragma warning restore CA1416 // 验证平台兼容性 } catch (Exception ex) { Task.Delay(100).ContinueWith(task => modalAlert.Show(TextFailed, ex.Message, null, null)); } }); }, null); }
// Update is called once per frame void Update() { // show controls after login if (DidLogin) { CanvasGroup group = GameObject.Find("UserDataGroup").GetComponent <CanvasGroup> (); group.alpha = 1; group.interactable = true; DidLogin = false; } // update editor fields and reload table data if (HasNewData && _inventory != null) { InputField strawberries = GameObject.Find("Input1").GetComponent <InputField> (); InputField melons = GameObject.Find("Input2").GetComponent <InputField> (); InputField lemons = GameObject.Find("Input3").GetComponent <InputField> (); InputField medicine = GameObject.Find("Input4").GetComponent <InputField> (); //Debug.Log ("strawberries: " + _inventory.strawberries + " melons: " + _inventory.melons + " lemons: " + _inventory.lemons + " medicine: " + _inventory.medicine); strawberries.text = _inventory.strawberries.ToString(); melons.text = _inventory.melons.ToString(); lemons.text = _inventory.lemons.ToString(); medicine.text = _inventory.medicine.ToString(); ReloadTableData(); HasNewData = false; } // Display modal where there is a new message if (_message != null) { Debug.Log("Show message:" + _message.message); _modalAlert.Show(_message.message, _message.title); _message = null; } }
// Update is called once per frame void Update() { // Only update table when there is new data if (_tableView != null && HasNewData) { Debug.Log("Refresh Table Data"); SetInteractableScrollbars(false); _tableView.ReloadData(); SetInteractableScrollbars(true); HasNewData = false; } // Display new score details if (_score != null) { Debug.Log("Show score:" + _score.ToString()); DisplayScore(_score); _score = null; } // Display modal where there is a new message if (_message != null) { Debug.Log("Show message:" + _message.message); _modalAlert.Show(_message.message, _message.title); _message = null; } }
private void Reboot() { modalAlert.Show(TextReboot, TextRebootConfirm, () => { var cmdLine = (string)null; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { cmdLine = "shutdown /r /t 00"; } else { cmdLine = "reboot"; } ConsoleCommand = cmdLine; executeCommand(cmdLine); InvokeAsync(StateHasChanged); }, null); }
private void btnCreateFolder_Click() { prompt.Show(TextNewFolderPrompt, TextNewFolder, dir_name => { try { var newDirPath = Path.Combine(CurrentPath, dir_name); Directory.CreateDirectory(newDirPath); alert.Show(TextNewFolder, TextSuccess); refresh(); InvokeAsync(StateHasChanged); } catch (Exception ex) { alert.Show(TextNewFolder, TextFailed + Environment.NewLine + ExceptionUtils.GetExceptionMessage(ex)); } }, () => { }); }