private void ApplicationStartup(object sender, StartupEventArgs e) { Exit += (o, args) => ExitAction.Invoke(); Window.Show(); InitializationAction.Invoke(); // DataBase.GetCollection<AlgorithmResult>().DeleteAll(); }
ActionResult?CheckFrameAction(EntityState aEntityState) { if (aEntityState.mobData?.canFall != true) { return(null); } EntityAction currentEntityAction = this.stateMachine.GetState() as EntityAction; Debug.Assert(currentEntityAction != null); if (!currentEntityAction.canBeInterrupted) { return(null); } FallAction fallAction = new FallAction(this.id); ActionResult fallActionResult = fallAction.GetActionResult(GM.boardManager.currentState); if (fallActionResult.boardState != null) { return(fallActionResult); } ExitAction exitAction = new ExitAction(this.id); ActionResult exitActionResult = exitAction.GetActionResult(GM.boardManager.currentState); if (exitActionResult.boardState != null) { return(exitActionResult); } return(null); }
/// <summary> /// Stops the recording or the Pre-Start countdown. /// </summary> private async void Stop() { try { _capture.Stop(); FrameRate.Stop(); if (Stage != Stage.Stopped && Stage != Stage.PreStarting && Project.Any) { #region Stop if (UserSettings.All.AsyncRecording) { _stopRequested = true; } await Task.Delay(100); ExitArg = ExitAction.Recorded; //DialogResult = false; Close(); #endregion } else if ((Stage == Stage.PreStarting || Stage == Stage.Snapping) && !Project.Any) { #region if Pre-Starting or in Snapmode and no Frames, Stops //Only returns to the stopped stage if it was recording. Stage = Stage == Stage.Snapping ? Stage.Snapping : Stage.Stopped; //Enables the controls that are disabled while recording; FpsIntegerUpDown.IsEnabled = true; RecordPauseButton.IsEnabled = true; HeightIntegerBox.IsEnabled = true; WidthIntegerBox.IsEnabled = true; IsRecording = false; Topmost = true; Title = "Screen To Gif"; AutoFitButtons(); #endregion } } catch (NullReferenceException nll) { LogWriter.Log(nll, "NullPointer on the Stop function"); ErrorDialog.Ok("ScreenToGif", "Error while stopping", nll.Message, nll); } catch (Exception ex) { LogWriter.Log(ex, "Error on the Stop function"); ErrorDialog.Ok("ScreenToGif", "Error while stopping", ex.Message, ex); } }
private void UnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { MessageBox.Show("Возникло исключение: " + e.Exception.Message + "\n Приложение будет закрыто", "Исключение", MessageBoxButton.OK, MessageBoxImage.Warning); ExitAction.Invoke(); }
/// <summary> /// Stops the recording or the Pre-Start countdown. /// </summary> private void Stop() { try { FrameCount = 0; _capture.Stop(); FrameRate.Stop(); if (Stage != Stage.Stopped && Stage != Stage.PreStarting && Project.Any) { #region Stop ExitArg = ExitAction.Recorded; if (IsDialog) { DialogResult = false; } else { Close(); } #endregion } else if ((Stage == Stage.PreStarting || Stage == Stage.Snapping) && !Project.Any) { #region if Pre-Starting or in Snapmode and no Frames, Stops Stage = Stage.Stopped; //Enables the controls that are disabled while recording; FpsNumericUpDown.IsEnabled = true; HeightIntegerBox.IsEnabled = true; WidthIntegerBox.IsEnabled = true; IsRecording = false; Topmost = true; Title = FindResource("Board.Title") as string + " ■"; AutoFitButtons(); #endregion } } catch (NullReferenceException nll) { ErrorDialog.Ok(FindResource("Board.Title") as string, "Error while stopping", nll.Message, nll); LogWriter.Log(nll, "NullPointer on the Stop function"); } catch (Exception ex) { ErrorDialog.Ok(FindResource("Board.Title") as string, "Error while stopping", ex.Message, ex); LogWriter.Log(ex, "Error on the Stop function"); } }
public override void Close(ExitAction EA) { exitAction = EA; displayState = DisplayState.Closing; for (i = 0; i < aui_instances.Count; i++) { aui_instances[i].Close(); } }
private void Stop_Executed(object sender, ExecutedRoutedEventArgs e) { try { _frameCount = 0; _timer.Stop(); if (Stage != Stage.Stopped && Stage != Stage.PreStarting && Project.Any) { #region If not Already Stoped nor Pre Starting and FrameCount > 0, Stops ExitArg = ExitAction.Recorded; if (IsDialog) { DialogResult = false; } else { Close(); } #endregion } else if ((Stage == Stage.PreStarting || Stage == Stage.Snapping) && !Project.Any) { #region if Pre-Starting or in Snapmode and no Frames, Stops Stage = Stage.Stopped; //Enables the controls that are disabled while recording; FpsNumericUpDown.IsEnabled = true; RecordPauseButton.IsEnabled = true; RefreshButton.IsEnabled = true; VideoDevicesComboBox.IsEnabled = true; Topmost = true; Title = "Screen To Gif"; #endregion } } catch (NullReferenceException nll) { LogWriter.Log(nll, "NullPointer in the Stop function"); ErrorDialog.Ok("ScreenToGif", "Error while stopping", nll.Message, nll); } catch (Exception ex) { LogWriter.Log(ex, "Error in the Stop function"); ErrorDialog.Ok("ScreenToGif", "Error while stopping", ex.Message, ex); } }
public override void Close(ExitAction exitAction) { for (uint i = 0; i < Buttons_Levels.GetLength(0); i++) { for (uint j = 0; j < Buttons_Levels.GetLength(1); j++) { Buttons_Levels[i, j].Close(); } } }
/// <summary> /// Stops the recording or the Pre-Start countdown. /// </summary> private async void Stop() { try { _capture.Stop(); FrameRate.Stop(); await Task.Delay(100); FrameCount = 0; if (Stage != Stage.Stopped && Stage != Stage.PreStarting && ListFrames.Any()) { #region Stop ExitArg = ExitAction.Recorded; DialogResult = false; #endregion } else if ((Stage == Stage.PreStarting || Stage == Stage.Snapping) && !ListFrames.Any()) { #region if Pre-Starting or in Snapmode and no Frames, Stops Stage = Stage.Stopped; //Enables the controls that are disabled while recording; FpsNumericUpDown.IsEnabled = true; RecordPauseButton.IsEnabled = true; HeightIntegerBox.IsEnabled = true; WidthIntegerBox.IsEnabled = true; IsRecording = false; Topmost = true; Title = "Screen To Gif"; AutoFitButtons(); #endregion } } catch (NullReferenceException nll) { var errorViewer = new Other.ExceptionViewer(nll); errorViewer.ShowDialog(); LogWriter.Log(nll, "NullPointer on the Stop function"); } catch (Exception ex) { var errorViewer = new Other.ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Error on the Stop function"); } }
void ExitToolBarItem_Clicked(object sender, EventArgs e) { if (ViewModel.Order.IsOpen) { ExitAndDiscardAction.Invoke(); } else { ExitAction.Invoke(); } }
/// <summary> /// Exit action to invoke the callback /// fallback is to exit to root /// </summary> protected virtual void Exit() { if (ExitAction.HasDelegate) { ExitAction.InvokeAsync(); } else { this.NavManager.NavigateTo("/"); } }
private void InitCommands() { SelectRootFolderCommand = new DelegateCommand(SelectRootFolder); SaveCommand = new DelegateCommand<MusicFileTag>(Save); SearchOnlineCommand = new AsyncCommand(SearchOnline); TagFromFileNameCommand = new DelegateCommand(this.TagFromFilename); SaveFromFNCommand = new DelegateCommand(this.SaveFromFN); ExitCommand = new DelegateCommand(() => ExitAction.Invoke()); OpenAboutCommand = new DelegateCommand(this.OpenAbout); ClearCommand = new DelegateCommand(this.ClearList); ClearSelectionCommand = new DelegateCommand(() => ClearSelectionAction.Invoke()); }
public override void Close(ExitAction exitAction) { Button_Play.Close(); Button_Quit.Close(); #if DEBUG Button_Editor.Close(); #endif if (exitAction == ExitAction.ExitGame) { ScreenTransition.Begin(() => Data.Root.Exit()); } }
private void Stop_Executed(object sender, ExecutedRoutedEventArgs e) { try { _frameCount = 0; _timer.Stop(); if (Stage != Stage.Stopped && Stage != Stage.PreStarting && ListFrames.Any()) { #region If not Already Stoped nor Pre Starting and FrameCount > 0, Stops ExitArg = ExitAction.Recorded; DialogResult = false; #endregion } else if ((Stage == Stage.PreStarting || Stage == Stage.Snapping) && !ListFrames.Any()) { #region if Pre-Starting or in Snapmode and no Frames, Stops Stage = Stage.Stopped; //Enables the controls that are disabled while recording; FpsNumericUpDown.IsEnabled = true; RecordPauseButton.IsEnabled = true; RefreshButton.IsEnabled = true; VideoDevicesComboBox.IsEnabled = true; Topmost = true; RecordPauseButton.Text = Properties.Resources.btnRecordPause_Record; RecordPauseButton.Content = (Canvas)FindResource("Vector.Record.Dark"); Title = Properties.Resources.TitleStoped; #endregion } } catch (NullReferenceException nll) { var errorViewer = new ExceptionViewer(nll); errorViewer.ShowDialog(); LogWriter.Log(nll, "NullPointer in the Stop function"); } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Error in the Stop function"); } }
static void InitializeChoiceService() { var downloadAction = new DownloadAction(); var exitAction = new ExitAction(); ChoiceService.Instance .Register(downloadAction.Handle, downloadAction.Name) .Register(exitAction.Handle, exitAction.Name) .PrintChoice() .Selecting() .Action .Invoke(null); Console.WriteLine("..."); Console.ReadLine(); }
public void SetIsAttacker() { isAttacker = true; int lastNormalAction = (int)(actions.Count / 3.0f); int attackAt = Random.Range(0, lastNormalAction); Action attackAction = new StartAttack(); attackAction.SetActionTaker(this); Action exitAction = new ExitAction(); exitAction.SetActionTaker(this); actions.Insert(lastNormalAction + attackAt, attackAction); actions.Insert(lastNormalAction + attackAt + 1, exitAction); }
public void SetUpActions() { actions.Clear(); for (int i = 0; i < noOfActions; i++) { ActionTypes actionType = (ActionTypes)Random.Range(0, Action.noOfActionTypes); Action action = null; switch (actionType) { case ActionTypes.DrinkWater: action = new DrinkWater(); break; case ActionTypes.SitDown: action = new SitDown(); break; case ActionTypes.Exit: action = new SitDown(); break; case ActionTypes.UseCashier: action = new UseCashier(); break; case ActionTypes.StartAttack: action = new SitDown(); break; default: break; } action.SetActionTaker(this); actions.Add(action); } Action exitAction = new ExitAction(); exitAction.SetActionTaker(this); actions.Add(exitAction); currActionIndex = 0; }
/// <summary> /// Method to exit the form /// </summary> protected virtual void Exit() { // If we're in a modal context, call Close on the cascaded Modal object if (this._isModal) { this.Modal.Close(ModalResult.OK()); } // If there's a delegate registered on the ExitAction, execute it. else if (ExitAction.HasDelegate) { ExitAction.InvokeAsync(); } // else fallback action is to navigate to root else { this.NavManager.NavigateTo("/"); } }
protected override bool CustomChecks() { ExitAction ea = Action as ExitAction; var r = false; if (first) { r = !wasInside && !ea.OnlyFromInside; first = false; } if (!Element.Geometry.InsideInfluence(LatLon)) { if (wasInside) { wasInside = false; r = wasInside; } } return(r); }
/// <summary> /// Displays help via the LineWriter action /// </summary> /// <param name="options"></param> /// <typeparam name="T"></typeparam> public virtual void DisplayHelp <T>(CommandlineArgument[] options) { if (ShowedHelp) { return; } ShowedHelp = true; var head = GenerateHelpHead <T>(); var headSpacer = head.Any() ? OneLine : NoLines; var body = GenerateArgumentHelp <T>(options.Where( o => !o.IsImplicit || o.Key == CommandlineArgument.HELP_FLAG_KEY ).ToArray()); var footer = GenerateHelpFooter <T>(); var footerSpacer = footer.Any() ? OneLine : NoLines; var negateMessage = options.Any(o => o.IsFlag && !o.IsImplicit) ? new[] { "", NegateMessage } : NoLines; headSpacer.And(head) .And(headSpacer) .And(body) .And(negateMessage) .And(footerSpacer) .And(footer) .And("") .ForEach(s => LineWriter(s.TrimEnd())); if (ExitOnError) { ExitAction?.Invoke(ExitCodes.SHOWED_HELP); } ShowedHelp = true; }
/// <summary> /// Stops the recording or the Pre-Start countdown. /// </summary> private void Stop() { try { _capture.Stop(); FrameRate.Stop(); FrameCount = 0; if (Stage != Stage.Stopped && Stage != Stage.PreStarting && ListFrames.Any()) { #region Stop ExitArg = ExitAction.Recorded; DialogResult = false; #endregion } else if ((Stage == Stage.PreStarting || Stage == Stage.Snapping) && !ListFrames.Any()) { #region if Pre-Starting or in Snapmode and no Frames, Stops Stage = Stage.Stopped; //Enables the controls that are disabled while recording; FpsNumericUpDown.IsEnabled = true; RecordPauseButton.IsEnabled = true; HeightTextBox.IsEnabled = true; WidthTextBox.IsEnabled = true; IsRecording(false); Topmost = true; Title = "Screen To Gif"; AutoFitButtons(); #endregion } } catch (NullReferenceException nll) { var errorViewer = new ExceptionViewer(nll); errorViewer.ShowDialog(); LogWriter.Log(nll, "NullPointer on the Stop function"); } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Error on the Stop function"); } }
public virtual void Close(ExitAction exitAction) { DisplayState = DisplayState.Closed; }
private void Application_Startup(object sender, StartupEventArgs e) { #region Unhandled Exceptions AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; #endregion #region Arguments try { if (e.Args.Length > 0) { //TODO: Watch for Args... } } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Generic Exception - Arguments"); } #endregion #region Upgrade Application Settings //See http://stackoverflow.com/questions/534261/how-do-you-keep-user-config-settings-across-different-assembly-versions-in-net if (Settings.Default.UpgradeRequired) { Settings.Default.Upgrade(); Settings.Default.UpgradeRequired = false; Settings.Default.Save(); } #endregion #region Language try { if (!Settings.Default.Language.Equals("auto")) { Thread.CurrentThread.CurrentCulture = new CultureInfo(Settings.Default.Language); Thread.CurrentThread.CurrentUICulture = new CultureInfo(Settings.Default.Language); } } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Language Settings Exception"); } #endregion try { #region Startup if (Settings.Default.StartUp == 0) { var startup = new Startup(); Current.MainWindow = startup; startup.ShowDialog(); } else if (Settings.Default.StartUp == 4) { var edit = new Editor(); Current.MainWindow = edit; edit.ShowDialog(); } else { var editor = new Editor(); List <FrameInfo> frames = null; ExitAction exitArg = ExitAction.Exit; bool? result = null; #region Recorder or Webcam if (Settings.Default.StartUp == 1) { var rec = new Recorder(true); result = rec.ShowDialog(); exitArg = rec.ExitArg; frames = rec.ListFrames; } else if (Settings.Default.StartUp == 2) { var web = new Windows.Webcam(); result = web.ShowDialog(); exitArg = web.ExitArg; frames = web.ListFrames; } else if (Settings.Default.StartUp == 3) { var board = new Board(); result = board.ShowDialog(); exitArg = board.ExitArg; frames = board.ListFrames; } #endregion if (result.HasValue && result.Value) { #region If Close Environment.Exit(0); #endregion } else if (result.HasValue) { #region If Backbutton or Stop Clicked if (exitArg == ExitAction.Recorded) { editor.ListFrames = frames; Current.MainWindow = editor; editor.ShowDialog(); } #endregion } } #endregion } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Generic Exception - Root"); } }
private void Application_Startup(object sender, StartupEventArgs e) { #region Unhandled Exceptions AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; #endregion #region Arguments try { if (e.Args.Length > 0) { //TODO: Watch for Args... } } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Generic Exception - Arguments"); } #endregion #region Language try { if (!Settings.Default.Language.Equals("auto")) { Thread.CurrentThread.CurrentCulture = new CultureInfo(Settings.Default.Language); Thread.CurrentThread.CurrentUICulture = new CultureInfo(Settings.Default.Language); } } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Language Settings Exception"); } #endregion try { #region Startup if (Settings.Default.StartUp == 0) { var startup = new Startup(); Current.MainWindow = startup; startup.ShowDialog(); } else if (Settings.Default.StartUp == 3) { var edit = new Editor(); Current.MainWindow = edit; edit.ShowDialog(); } else { var editor = new Editor(); List <FrameInfo> frames = null; ExitAction exitArg = ExitAction.Exit; bool? result = null; #region Recorder or Webcam if (Settings.Default.StartUp == 1) { var rec = new Recorder(true); result = rec.ShowDialog(); exitArg = rec.ExitArg; frames = rec.ListFrames; } else if (Settings.Default.StartUp == 2) { var web = new Windows.Webcam(); result = web.ShowDialog(); exitArg = web.ExitArg; frames = web.ListFrames; } #endregion if (result.HasValue && result.Value) { #region If Close Environment.Exit(0); #endregion } else if (result.HasValue) { #region If Backbutton or Stop Clicked if (exitArg == ExitAction.Recorded) { editor.ListFrames = frames; Current.MainWindow = editor; editor.ShowDialog(); } #endregion } } #endregion } catch (Exception ex) { var errorViewer = new ExceptionViewer(ex); errorViewer.ShowDialog(); LogWriter.Log(ex, "Generic Exception - Root"); } }
/// <summary> /// Invokes ExitAction event. /// </summary> /// <param name="symbol"></param> public void OnExitAction(TInSymbol symbol) { ExitAction?.Invoke(this, new ActionEventArgs(symbol)); }
protected void FillNode(XmlNode node, ExitAction target, params IDOMWriterParam[] options) { AddChild(node, "only-from-inside", target.OnlyFromInside.ToString()); }
public virtual void Close(ExitAction EA) { }
public void TryExit() { ExitAction?.Invoke(); }
public void Clean() { exitAction = null; attackAction = null; }