private void RunOnBackground() { lock (this) { _isRunning = true; } OnStart?.Invoke(); try { DoWork?.Invoke(); } catch (Exception ex) { OnError?.Invoke(ex); } finally { OnExit?.Invoke(); lock (this) { _isRunning = false; } } }
private void OnTriggerExit2D(Collider2D obj) { if (obj.tag == "Ball") { OnExit?.Invoke(); } }
private void SetContextMenu(bool isShutDownInProgress) { var cm = new ContextMenu(); var openMi = new MenuItem(); openMi.Text = "Open"; openMi.Click += (s, e) => { OnOpen?.Invoke(); }; cm.MenuItems.Add(openMi); if (isShutDownInProgress) { var cancelMi = new MenuItem(); cancelMi.Text = "Cancel delayed operation"; cancelMi.Click += (s, e) => { OnCancel?.Invoke(); }; cm.MenuItems.Add(1, cancelMi); } var closeMi = new MenuItem(); closeMi.Text = "Exit"; closeMi.Click += (s, e) => { OnExit?.Invoke(); }; cm.MenuItems.Add(closeMi); if (_ni.ContextMenu != null) { _ni.ContextMenu.Dispose(); } _ni.ContextMenu = cm; }
/* * It's button func on ExitButton */ public void OnExitClicked() { audioM.Click(); OnExit?.Invoke(this, new ExitArgs { action = WindowAction.Open, qNum = currentQuestionNum }); }
private void OnTriggerExit(Collider other) { if (IsActivePlayer(other)) { OnExit.Invoke(); } }
/// <summary> /// Goes to the previous Menu Item /// </summary> /// <returns>The new page</returns> public Menu GoBack() { // Trigger exit if nothing exists IMenuNavigationHook currentPage = Peek(); if (currentPage == null) { OnExit?.Invoke(this, new object()); return(null); } // Unload the Previous Menu currentPage.InvokeOnNavigatingFrom(this, new object()); currentPage = m_backStack.Pop(); currentPage.InvokeOnUnloaded(this, new object()); // Resume the previous page IMenuNavigationHook newPage = Peek(); if (newPage == null) { OnExit?.Invoke(this, new object()); return(null); } newPage?.InvokeOnNavigatingTo(this, new object()); newPage?.InvokeOnNavigated(this, new object()); newPage?.InvokeOnLoaded(this, new object()); // Return the new menu return(newPage as Menu); }
private void OnMouseExit() { if (!_isMoving) { OnExit?.Invoke(this, EventArgs.Empty); } }
public void ExitBase() { SetState = null; m_GameStore.StoreDidUpdate -= StoreDidUpdate; Exit(); OnExit?.Invoke(this, EventArgs.Empty); }
private void OnTriggerExit(Collider other) { print("DeToggled"); if (OnEnterAndExit) { OnExit.Invoke(); } }
void OnTriggerExit2D(Collider2D col) { if (col.gameObject.Equals(player)) { OnExit.Invoke(col); } }
/// <summary> /// 离开 /// </summary> public virtual void OnDistanceExit(DistanceInteraction distanceInteraction) { if (OnExit != null) { OnExit.Invoke(distanceInteraction); } }
private static async void Connect() { var client = new Client(); client.Handler = HandleSignal; await client.Initialize(Config.UserId.ToString()); var retry = 0; var resetTimer = new Timer(10000); resetTimer.Elapsed += (s, e) => retry = 0; IsRunning = true; OnConnect?.Invoke(); while (!await client.Start() && retry < 3) { if (retry > 0) { resetTimer.Stop(); } retry++; resetTimer.Start(); } IsRunning = false; OnExit?.Invoke(); }
/// <summary> /// Запуск процесса закачки /// </summary> public void Start(decimal sessNo) { ProcessStartInfo psi = new ProcessStartInfo { Arguments = $"ETLApp.dll {sessNo} -h", FileName = "dotnet", RedirectStandardOutput = true, UseShellExecute = false, WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory }; prc = Process.Start(psi); ProcessID = prc.Id; prc.EnableRaisingEvents = true; Logger.WriteToTrace($"Процесс закачки \"{ProgramID}\" ({ProcessID}) запущен."); IsExecuting = true; // Событие запуска OnStart?.Invoke(this, EventArgs.Empty); prc.Exited += (s, a) => { Logger.WriteToTrace($"Процесс закачки \"{ProgramID}\" ({ProcessID}) завершён."); // Обновляем статус после окончания закачки LastStatus = GetStatus(sessNo); IsExecuting = false; OnExit?.Invoke(this, a); // После завершения процесса очищаем все обработчики OnStart?.GetInvocationList().ToList().ForEach(d => OnStart -= (StartEventHandler)d); OnExit?.GetInvocationList().ToList().ForEach(d => OnExit -= (ExitEventHandler)d); }; }
public void Run() { OnStart?.Invoke(this, EventArgs.Empty); var windowSettings = _config.WindowSettings; if (windowSettings == null) { throw new Exception("Window settings option is null"); } _window = new MainWindow(windowSettings); MainWindowUtils.Initialize(_window); _window.Closed += (sender, args) => { ShouldExit = true; }; _window.Run(); var eventArgs = new EventArgs(); while (!ShouldExit) { MainLoop?.Invoke(this, eventArgs); } OnExit?.Invoke(this, EventArgs.Empty); }
public virtual Dictionary <string, object> Exit(IState to) { Debug.Log("EXIT de..." + this.Name); OnExit?.Invoke(this, to); HasStarted = false; return(null); }
public void OnExitBackClicked() { audioM.Click(); // hello OnExit?.Invoke(this, new ExitArgs { action = WindowAction.Close }); }
public override bool ProcessKey(KeyEvent keyEvent) { if (keyEvent.Key != Key.Enter) { return(_filesView.ProcessKey(keyEvent)); } var selectedItem = _fileViewSource[_filesView.SelectedItem]; if (selectedItem.IsDirectory) { _currentPath = selectedItem.GoToFile(); _currentDirectoryText.Text = _currentPath; _fileViewSource = GetListViewSource(); _filesView.SetSource(_fileViewSource); } else { AppController.GetLogger() .Info( $"File {selectedItem.ParentDirectory}{Path.DirectorySeparatorChar}{selectedItem.FileName} was selected."); OnExit?.Invoke(selectedItem); } return(true); }
protected virtual void OnTriggerExit2D(Collider2D collision) { if (collision.gameObject == player) { OnExit?.Invoke(); } }
void OnTriggerExit(Collider other) { if (0 != (layers.value & 1 << other.gameObject.layer)) { OnExit.Invoke(); } }
private void InvokeOnExit(object sender = null, EventArgs e = null) { if (OnExit != null) { OnExit.Invoke(this, new EventArgs()); } }
private void OnTriggerExit2D(Collider2D collision) { if (singleUse) { return; } OnExit.Invoke(); }
// cleans up and sets m_CanExecuteButtons to false protected override void ExecuteOnExit(Collider2D other) { m_InZone = false; m_InputController = null; m_InteractingCollider = null; OnExit.Invoke(); Debug.Log("[" + other.gameObject.name + "] has left [" + name + "]"); }
private void Update() { if (GlobalInputManager.instance.GetButtonDown(0, Action.Cancel)) { OnExit?.Invoke(); gameObject.SetActive(false); } }
private void OnTriggerExit2D(Collider2D collision) { if (!ZoneEnabled) { return; } OnExit?.Invoke(collision.gameObject); }
public WinConsoleCtrl() { SetConsoleCtrlHandler(t => { OnExit?.Invoke(this, EventArgs.Empty); return(false); }, true); }
public override void Exit() { m_alreadySelect = false; if (OnExit != null) { OnExit.Invoke(); } }
/// <summary> /// Exits the application. /// </summary> public static void Exit() { is_exiting = true; OnExit?.Invoke(null, EventArgs.Empty); _mainLoopCancellationTokenSource?.Cancel(); }
private void Cancel() { Cancelled = true; Value = StartingValue; Focused = false; OnExit?.Invoke(false); Audio.Play(SFX.ui_main_button_back); }
void OnTriggerExit(Collider other)//触发器停止时执行 { if (0 != (layers.value & 1 << other.gameObject.layer)) //如果图层的属性与1右移这个位数之后的结果不为0 { OnExit.Invoke();//在OE里调用这个other碰撞器 } }
/// <summary> /// On exit, we reset our staying bool and invoke our OnExit event /// </summary> /// <param name="collider"></param> public override void TriggerExitAction(GameObject collider) { _stayingGameObjects.Remove(collider); if (OnExit != null && Activable) { OnExit.Invoke(); } }