// Use this for initialization void Start() { if (dialog != null) { dialog = this; } }
/// <summary> /// Checks if confirmation is needed before exiting, then exits. /// (Unless cancelled by the user) /// </summary> /// <param name="sender">Not used</param> /// <param name="eventArgs">Not used</param> private void ConfirmExitApplication(object sender, EventArgs eventArgs) { if (Settings.ConfirmExit) { var dialog = new YesNoDialog( "Are you sure you want to exit? SDownload requires this application to be running in order to download any songs!", "Close", "Cancel", CheckBoxState.NotChecked) { ResponseCallback = result => { if (result) { Exit(); } }, CheckBoxSettingCallback = result => Settings.ConfirmExit = !result }; dialog.Show(); } else { Exit(); } }
/// <summary> /// Reports an error to the user, and provides the option to report if the crash is critical enough /// </summary> /// <param name="message">Message to show to the user</param> /// <param name="inner">The exception that was thrown/raised</param> /// <param name="canReport">If the crash should be allowed to be reported to Bugsense</param> public static void Throw(String message, Exception inner, bool canReport = true) { Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); var handled = inner as HandledException; var criticalHandled = handled != null && handled.IsCritical; // Use the exception message if it is of type HandledException or a message wasn't passed through // If it is a HandledException, only provide the option to report if the exception is critical var dialog = new YesNoDialog("ERROR:\n" + (handled != null ? inner.Message : (message ?? inner.Message)), (handled == null && canReport) || criticalHandled ? "Report" : "Close", (handled == null && canReport) || criticalHandled ? "Close" : null) { ResponseCallback = result => { // Log exception only if 'Report' was chosen, and the exception was critical if (result && canReport) { BugSenseHandler.Instance.SendExceptionAsync(inner); } ClearExtras(); } }; dialog.Show(); }
protected override void OnClosing(CancelEventArgs e) { var dialog = new YesNoDialog { Message = "Do you really want to close this application?" }; e.Cancel = dialog.ShowDialog() == false; }
private static void ShowErrorDialog(Exception ex) { YesNoDialogViewModel dialogViewModel = new YesNoDialogViewModel("Error", ex.ToString(), "OK", string.Empty, null, null); YesNoDialog dialog = new YesNoDialog(dialogViewModel); dialog.ShowDialog(); }
/// <summary> /// 金増加アイテムを買う /// </summary> public void BuyGoldItem() { YesNoDialog.Show("購入しますか?", (Result) => { if (Result) { StoreController.InitiatePurchase(ProductIDs.AddMoneyItem); } }); }
public Boolean Interact() { Boolean isResumed = new YesNoDialog().Read(Message.RESUME.ToString()); if (isResumed) { this.Board.Reset(); } return(isResumed); }
private async void ButtonAddProfile_Click(object sender, RoutedEventArgs e) { var dialog = new ProfileDialog(); var dialogResult = await dialog.ShowAsync(); if (dialogResult == ContentDialogResult.Primary) { var profile = dialog.Result; if (profile != null) { var existingElement = ProfileExists(profile); if (existingElement != null) { var yesNoDialog = new YesNoDialog("Profil bereits vorhanden", string.Format("Das Profil mit der Profilnummer '{0:s}', einer Länge von '{1:s}' und der Farbe '{2:s}' ist bereits vorhanden. " + "Soll das vorhandene Profil geändert werden?", profile.ProfileNumber, profile.Length, profile.Surface)); await yesNoDialog.ShowAsync(); if (yesNoDialog.Result == YesNoDialogType.Yes) { existingElement.Count += profile.Count; existingElement.Amount += profile.Amount; await UpdateProfile(existingElement); } return; } if (PlantOrder != null) { profile.PlantOrderId = PlantOrder.Id; } if (FileEntry != null) { profile.Filename = FileEntry.Name; } var profileId = await Proxy.CreateProfile(profile); if (profileId > 0) { profile.ProfileId = profileId; var element = AutoMapperConfiguration.Map(profile); ElementCollection.Add(element); } else { var errorDialog = new InfoDialog("Beim Anlegen des Profil's ist ein Fehler aufgetreten!", "Information", InfoDialogType.Error); await errorDialog.ShowAsync(); } } } }
private static void Close_Click(object sender, RoutedEventArgs e) { if (Wind.Settings.YesNoDialogsEnabled) { YesNoDialog.SetMessage("Are you sure you want to quit?", "You will loose any changes.", "Yes", "No", CloseComplete); DialogManager.Show(Structures.DialogTypes.YesNoDialog); } else { CloseComplete(true); } }
//Method to display Yes No Dialog public static async Task <bool> ShowYesNoDialogAsync(string message) { var yesNoDialog = new YesNoDialog() { DataContext = new YesNoDialogViewModel(message) }; //show alert dialog var result = await DialogHost.Show(yesNoDialog, "RootDialog"); return(result != null ? (bool)result : false); }
public static void ResetButtonPressed(object sender, RoutedEventArgs args) { if (Wind.Settings.YesNoDialogsEnabled) { YesNoDialog.SetMessage("Are you sure?", "You will loose any changes.", "Yes", "No", ResetJson); DialogManager.Show(Structures.DialogTypes.YesNoDialog); } else { ResetJson(true); } }
public async void RemoveItemInMainTabCollection(object parameter = null) { var sampleMessageDialog = new YesNoDialog { DataContext = new YesNoDialogViewModel { TitleDialog = "Whant close?", MessageDialog = "You will lose not saved data. Do you really want close it?", TrueButtonDialog = "Close", FalseButtonDialog = "Cancel" } }; var dialogResult = await DialogHost.Show(sampleMessageDialog, "MainDialog"); if ((bool)dialogResult) { int viewsToShowTotalTabs = ViewsToShow.Count(); if (viewsToShowTotalTabs >= 0) { //var tabToRemove = ViewsToShow.FirstOrDefault(); var tabToRemove = (BaseViewModel)parameter; if (tabToRemove.CanCloseIt) { ViewsToShow.Remove(tabToRemove); } //SelectedViewToShow = ; } } var dialog = new OneIconDialog { DataContext = new OneIconDialogViewModel { TitleDialog = "Done!", MessageDialog = "Item closed ;)", IconName = "Check", } }; await CreateGenericOneIconDialog("Done!", "Item closed ;)", "Ok...", true, "check", ""); //await DialogHost.Show(dialog, "MainDialog"); // //var result = await DialogHost.Show("a", "MainDialog"); //return true; }
public static YesNoDialog Instance() { if (!yesNoPanel) { yesNoPanel = FindObjectOfType(typeof(YesNoDialog)) as YesNoDialog; if (!yesNoPanel) { Debug.LogError("There needs to be one active yesNoPanel script on a GameObject in your scene."); } } return(yesNoPanel); }
public void Interact(ResumeController resumeController) { Boolean isResumed = new YesNoDialog().Read(Message.RESUME.ToString()); if (isResumed) { resumeController.Reset(); } else { resumeController.NextState(); } }
public override void Init(Game _game) { base.Init(_game); background = new Sprite(Game.Content, "fie_burn"); background.Position = new Vector2(230, 0); background.Depth = 0.0f; Player = new Player(_game.Content); Player.Init(Game.Content); Computer = new Computer(); Computer.Init(Game.Content); switch (first) { case ePlayerId.PLAYER: Player.IsTurn = true; Computer.IsTurn = false; break; case ePlayerId.COMPUTER: Player.IsTurn = false; Computer.IsTurn = true; break; default: break; } YNDialog = new YesNoDialog(_game.Content, "String"); YNDialog.Position = new Vector2( x: this.Game.Window.ClientBounds.Center.X - YNDialog.Sprite.Bound.Width / 2, y: this.Game.Window.ClientBounds.Center.Y - YNDialog.Sprite.Bound.Height / 2); phaseSelector = new PhaseSelector(_game.Content); phaseSelector.DrawPhaseButton.ButtonEvent += new Action(DrawPhaseButton_ButtonEvent); phaseSelector.StandbyButton.ButtonEvent += new Action(StandbyButton_ButtonEvent); phaseSelector.Main1Button.ButtonEvent += new Action(Main1Button_ButtonEvent); phaseSelector.EndPhaseButton.ButtonEvent += new Action(EndPhaseButton_ButtonEvent); phaseSelector.Main2Button.ButtonEvent += new Action(Main2Button_ButtonEvent); phaseSelector.BattleButton.ButtonEvent += new Action(BattleButton_ButtonEvent); _rasterizerState = new RasterizerState() { ScissorTestEnable = true }; DetailSideBar = new DetailSideBar(_game.Content); battlePhase = new BattlePhase(_game.Content); }
private void Awake() { if (m_currentDialog == null) { m_currentDialog = this; } // Sets the canvas and deactivates it dialogCanvas = GetComponent <Canvas>(); dialogCanvas.enabled = false; // Adds action to the cancel button cancelButton.onClick.AddListener(() => OnCancelButtonPress()); }
private async void RemoveTraining(object sender, RoutedEventArgs e) { var button = (Button)sender; var window = new YesNoDialog { Message = $"Are you sure that you want to delete this training?" }; var result = window.ShowDialog(); if (result == true) { await ViewModel.RemoveModel((TrainingModel)button.Tag); } }
private async void ButtonDeleteFilter_Click(object sender, RoutedEventArgs e) { if (sender is Button button && button.DataContext is ElementFilterModel filter) { var yesNoDialog = new YesNoDialog("Filter löschen?", "Soll der Filter " + Environment.NewLine + Environment.NewLine + $"Eigenschaft: {filter.PropertyText}" + Environment.NewLine + $"Aktion: {filter.ActionText}" + Environment.NewLine + $"Filter: {filter.Filter}" + Environment.NewLine + Environment.NewLine + "wirklich gelöscht werden?"); await yesNoDialog.ShowAsync(); if (yesNoDialog.Result == Dialogs.Core.Enums.YesNoDialogType.Yes) { } } }
/* ------ File Traversal Methods ---- */ public void GotoNext() { PageMode.getNextPos(ref CurrentPosition); ImgStruct thisPic = FM.GetNextPos(ref CurrentPosition); if (!Settings.EndBeginAlerts || //This must be simplified and cleaned !thisPic.IsLastorFirstImage || YesNoDialog.AskForAction(new FinishingObject())) { updatePic(thisPic); } else { PageMode.getPrevPos(ref CurrentPosition); //Revert back to last picture } }
public void GoBack() { PageMode.getPrevPos(ref CurrentPosition); ImgStruct thisPic = FM.GetPrevPos(ref CurrentPosition); if (!Settings.EndBeginAlerts || !thisPic.IsLastorFirstImage || YesNoDialog.AskForAction(new BeginningObject())) { updatePic(thisPic); } else { PageMode.getNextPos(ref CurrentPosition); } }
public static void Run(Config config) { WindowRef.Wind.Settings.NumberOfUsesUntilMessage--; if (WindowRef.Wind.Settings.NumberOfUsesUntilMessage == 0) { WindowRef.Wind.Settings.NumberOfUsesUntilMessage = 4; YesNoDialog.SetMessage("Please Consider Donating.", "It took a lot of time to make this software available for free. If you like it, please consider making a donation to show your appreciation.", "Donate", "Ignore", (b) => ContinueRun(config, b)); DialogManager.Show(Structures.DialogTypes.YesNoDialog); Serialization.JsonSerializer.SaveSettings(WindowRef.Wind.Settings); return; } Serialization.JsonSerializer.SaveSettings(WindowRef.Wind.Settings); ContinueRun(config, false); }
public async Task <bool> CreateGenericYesNoDialog(string title = null, string message = null, string trueButton = null, string falseButton = null) { var sampleMessageDialog = new YesNoDialog { DataContext = new YesNoDialogViewModel { TitleDialog = title, MessageDialog = message, TrueButtonDialog = trueButton, FalseButtonDialog = falseButton, } }; var dialogResult = await DialogHost.Show(sampleMessageDialog, "MainDialog"); return((bool)dialogResult); }
private void EventListener_TouchEnded(CCTouch arg1, CCEvent arg2) { if (isNext) { return; } if (isSwiped) { isSwiped = false; return; } for (int i = 0; i < _rankPoints.Length; i++) { var point = _rankPoints[i]; if (point.Node.BoundingBox.ContainsPoint(arg1.Location)) { var filename = _rankingData.Ranks[i].RankedFileName; if (filename == "") { continue; } isNext = true; var dialog = new YesNoDialog($"{i + 1}位 ", $"このゲームをリプレイしますか?", _ => { var _dialog = (YesNoDialog)GetChildByTag(YesNoDialog.TAG); _dialog.Close(); ChangeScene(new Loading(new GameAssetsLoader(new GameAssets(), filename))); }, _ => { var _dialog = (YesNoDialog)GetChildByTag(YesNoDialog.TAG); _dialog.Close(); RemoveChild(_dialog); isNext = false; }); AddChild(dialog, 1, YesNoDialog.TAG); break; } } }
private async void ButtonCreateFilter_Click(object sender, RoutedEventArgs e) { var filter = TextBoxFilter.Text; if (string.IsNullOrWhiteSpace(filter)) { var infoDialog = new InfoDialog("Das Feld für den gesuchten Wert muss ausgefüllt sein!"); await infoDialog.ShowAsync(); return; } var yesNoDialog = new YesNoDialog("Filter speichern?", "Soll der Filter für dieses Projekt gespeichert werden?" + Environment.NewLine + Environment.NewLine + "[Ja] Der Filter wird gespeichert, wird unter 'Bekannte Filter' hinzugefügt und ist für dieses Projekt jeder Zeit abrufbar" + Environment.NewLine + Environment.NewLine + "[Nein] Der Filter wird unter 'Bekannte Filter' hinzugefügt, ist jedoch nach Beenden dieser Sitzung nicht mehr verfügbar" + Environment.NewLine + Environment.NewLine + "[Abbrechen] Der Filter wird nicht erstellt"); await yesNoDialog.ShowAsync(); if (yesNoDialog.Result != Dialogs.Core.Enums.YesNoDialogType.Abort && PlantOrder != null) { var selectedProperty = (ComboBoxFilterProperty.SelectedItem as ComboBoxItem).Tag.ToString(); var selectedAction = (ComboBoxFilterAction.SelectedItem as ComboBoxItem).Tag.ToString(); var elementFilter = new ElementFilterModel() { Action = selectedAction, PropertyName = selectedProperty, Filter = filter, EmployeeId = CurrentEmployee.EmployeeId, PlantOrderId = PlantOrder.Id }; FilterCollection.Add(elementFilter); TextBoxFilter.Text = string.Empty; FilterFlyout.Hide(); Filter(selectedProperty, selectedAction, filter); FilterCollection.SelectedFilter = elementFilter; if (yesNoDialog.Result == Dialogs.Core.Enums.YesNoDialogType.Yes) { elementFilter.FilterId = await Proxy.UpsertElementFilter(elementFilter); } } }
/// <summary> /// Display the Yes No dialog /// </summary> /// <param name="message">The message</param> /// <param name="yesAction">The action executed if the 'yes' button is tapped</param> /// <param name="noAction">The action executed if the 'no' button is tapped</param> /// <param name="title">The title used for the dialog</param> private async void ShowYesNoDialog(string message, Action yesAction, Action noAction, string title = null) { var dialog = new YesNoDialog() { Title = title, Message = message }; ContentDialogResult result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) { yesAction(); } else { noAction(); } }
private IEnumerator HandleDialogEvent(string name, string args, string dialog, int i) { newI = i; if (name.Equals("Lock Book")) { bool lockBook = System.Boolean.Parse(args.Trim()); left.enabled = !lockBook; right.enabled = !lockBook; leftLock.enabled = lockBook; rightLock.enabled = lockBook; yield return(new WaitForSeconds(0.1f)); result = true; done = true; yield return(true); } else if (name.Equals("Choice")) { string[] choices = args.Split(new char[] { ',' }); int yesChoice = System.Int32.Parse(choices [0].Trim()) - 1; int noChoice = System.Int32.Parse(choices [1].Trim()) - 1; YesNoDialog.dialog = yesNoDialog; yield return(StartCoroutine(YesNoDialog.ShowDialog(dialog))); if (YesNoDialog.Choice()) { newI = yesChoice; } else { newI = noChoice; } yield return(new WaitForSeconds(0.1f)); result = true; done = true; yield return(true); } result = false; done = true; yield return(false); }
/// <summary> /// A yes or no input box. /// </summary> /// <param name="message"></param> /// <param name="title"></param> /// <param name="primaryButtonText"></param> /// <param name="secondaryButtonText"></param> public static async Task <bool> InputBox(string message, string title, string primaryButtonText = "Yes", string secondaryButtonText = "No") { var confirmDialog = new YesNoDialog() { Title = title, Content = message, PrimaryButtonText = primaryButtonText, SecondaryButtonText = secondaryButtonText }; var result = await confirmDialog.ShowAsync(); if (result == ContentDialogResult.Secondary) { return(false); } return(true); }
private async void ExecuteWinDialog(bool reportWinning, Player player, WinningReason winningReason, Move invalidMove) { var yesNoDialogViewModel = new YesNoDialogViewModel(GetWinningOrLoosingMessage(reportWinning, winningReason, invalidMove)); var winningDialog = new YesNoDialog { DataContext = yesNoDialogViewModel }; var dialogResult = await DialogHost.Show(winningDialog, "RootDialog"); if ((bool)dialogResult) { var dialog = new SaveFileDialog() { Filter = "textFiles |*.txt", AddExtension = true, CheckFileExists = false, OverwritePrompt = true, ValidateNames = true, CheckPathExists = true, CreatePrompt = false, Title = Captions.PvB_SaveGameProgressFileDialogTitle }; var result = dialog.ShowDialog(); if (result.HasValue) { if (result.Value) { var fileText = CreateProgressText.FromBoardState(gameService.CurrentBoardState) .AndAppendWinnerAndReason(player, winningReason, invalidMove); File.WriteAllText(dialog.FileName, fileText); } } } yesNoDialogViewModel.Dispose(); }
private async void OnClosing(object sender, CancelEventArgs cancelEventArgs) { var mainWindowViewModel = AssociatedObject.DataContext as IMainWindowViewModel; if (mainWindowViewModel.PreventWindowClosingToAskUser) { cancelEventArgs.Cancel = true; var closingDialogViewModel = new YesNoDialogViewModel(Captions.ClosingDialogMessage); var closingDialog = new YesNoDialog { DataContext = closingDialogViewModel }; var closingDialogResult = await DialogHost.Show(closingDialog, "RootDialog"); if ((bool)closingDialogResult) { var savingDialogViewModel = new YesNoDialogViewModel(Captions.SavingDialogMessage); var savingDialog = new YesNoDialog { DataContext = savingDialogViewModel }; var savingDialogResult = await DialogHost.Show(savingDialog, "RootDialog"); if ((bool)savingDialogResult) { if (mainWindowViewModel.DumpProgressToFile.CanExecute(null)) { mainWindowViewModel.DumpProgressToFile.Execute(null); } } mainWindowViewModel.CloseWindow.Execute(null); } closingDialogViewModel.Dispose(); } }
private async void MenuItemDeleteDivision_Click(object sender, RoutedEventArgs e) { if (DataGridDivision.SelectedItem is DivisionModel division) { var dialog = new YesNoDialog("Abteilung löschen?", $"Soll die Abteilung '{division.Name}' wirklich gelöscht werden?"); await dialog.ShowAsync(); if (dialog.Result == YesNoDialogType.Yes) { var result = await Proxy.DeleteDivision(division.DivisionId); if (result) { ShowNofificationMessage($"{division.Name} wurde gelöscht"); Divisions.Remove(division); } else { ShowNofificationMessage($"{division.Name} konnte nicht gelöscht werden", true); } } } }