private void ExitConfirmation(object sender, EventArgs e) { var confirmDialog = new ConfirmationDialog("Are you sure you would like to exit?"); confirmDialog.OnConfirm += (s, a) => { if(confirmDialog.Confirm == false) { Gui.Screen.Desktop.Children.Remove(confirmDialog); } else { Game.Exit(); } }; Gui.Screen.Desktop.Children.Add(confirmDialog); confirmDialog.Bounds = new UniRectangle( (1024 - confirmDialog.Bounds.Size.X.Offset) / 2.0F, (768 - confirmDialog.Bounds.Size.Y.Offset) / 2.0F, confirmDialog.Bounds.Size.X.Offset, confirmDialog.Bounds.Size.Y.Offset ); }
public override void LoadContent() { base.LoadContent(); Dialog = new ConfirmationDialog<LevelShopItem>(_game); Dialog.Initialize(); Dialog.DrawColor = new Color(0.2f, 0.2f, 0.2f, 0.5f); Dialog.NeedDisplayText += i => i.ItemTitle; Dialog.Item = Item; Dialog.CancelButton.Selected += (s, e) => LoadingScreen.Load(ScreenManager, false, new LevelMenuScreen { SelectedTab = LevelMenuScreen.Tabs.Shop, ShopSelectedCategory = ShopSelectedCategory }); Dialog.OkButton.Selected += (s, e) => { Item.OnBuy(); LoadingScreen.Load(ScreenManager, false, new LevelMenuScreen { SelectedTab = LevelMenuScreen.Tabs.Shop, ShopSelectedCategory = ShopSelectedCategory }); }; }
public Task <Tuple <int, string> > TextInputDialogTriple(string message, string title, string Ok, string cancel = "Cancel", string initialValue = "", string Neutral = "") { var task = new TaskCompletionSource <Tuple <int, string> >(); var content = new EditText(ActivityContext); content.Text = initialValue; var dialog = new ConfirmationDialog(ActivityContext); dialog.Title = title; dialog.Message = message; dialog.Positive = Ok; dialog.Neutral = Neutral; dialog.Content = content; dialog.OnPositive += () => { HideKeyboard(content); task.TrySetResult(new Tuple <int, string>(1, content.Text)); }; dialog.OnNegative += () => { HideKeyboard(content); task.TrySetResult(new Tuple <int, string>(0, null)); }; dialog.OnNeutral += () => { HideKeyboard(content); task.TrySetResult(new Tuple <int, string>(2, null)); }; dialog.Show(); ShowKeyboard(content); return(task.Task); }
public async void ShowCloseSceneDialog() { (bool success, _) = await Base.GameManager.Instance.CloseScene(false); if (!success) { GameManager.Instance.HideLoadingScreen(); string message = "Are you sure you want to close current scene? "; if (SceneManager.Instance.SceneChanged) { message += "Unsaved changes will be lost"; if (SceneManager.Instance.SceneStarted) { message += " and system will go offline"; } message += "."; } else if (SceneManager.Instance.SceneStarted) { message += "System will go offline."; } ConfirmationDialog.Open("Close scene", message, () => CloseScene(), () => ConfirmationDialog.Close()); } }
public void ThenISeeAConfirmationDialog(string expMessage) { ConfirmationDialog confirm = ((ConfirmationDialog)GetSharedPageObjectFromContext("Confirmation Dialog")); confirm.IsVisibleConfirmationDialog.Should().BeTrue("Confirmation dialog appears when attempting to delete a record"); confirm.DialogMessage.Should().Be(expMessage, "Confirmation dialog message is correct"); }
public static async Task CleanData() { var redistributables = FindRedistributables(); var totalFiles = redistributables.Count; var dialog = new ConfirmationDialog { MessageTextBlock = { Text = "Are you sure you wish to do this? " + totalFiles + " files will be permanently deleted." } }; var result = await DialogHost.Show(dialog); if (!"1".Equals(result)) { return; } var progressBar = new ProgressBar { Maximum = redistributables.Count, Width = 300, Margin = new Thickness(32) }; await DialogHost.Show(progressBar, (DialogOpenedEventHandler) ((o, args) => DeleteFiles(redistributables, progressBar, args.Session))); }
public async Task Handle(StartRequest <ReleaseEnvironmentWidget> request, CancellationToken cancellationToken) { var dialog = new ConfirmationDialog($"Are you sure you want to start {request.DataContext.Name}?"); if (_dialogService.ShowDialog(dialog) != DialogResult.Yes) { return; } if (request.DataContext.Parent is ReleaseWidget parent) { var api = new AzureDevOpsApi(parent.ConnectionSettings); var response = await api.GetReleasesAsync(parent.Project, parent.DefinitionId, 1, cancellationToken).ConfigureAwait(false); if (response.Count == 0) { throw new Exception("Release not found."); } var release = response.Value.First(); await api.DeployAsync(parent.Project, release.Id, request.DataContext.DeploymentId, cancellationToken).ConfigureAwait(false); request.DataContext.State = State.Queued; } }
public override void _Ready() { // load in some nodes asteroidManager = GetNode <AsteroidManager>("AsteroidManager"); endGameDelayTimer = GetNode <Timer>("EndGameDelayTimer"); canvasLayer = GetNode <CanvasLayer>("CanvasLayer"); map = GetNode <Map>("Map"); gui = canvasLayer.GetNode <GUI>("GUI"); techTree = canvasLayer.GetNode <Control>("TechTree"); leaderBoard = canvasLayer.GetNode <Control>("Leaderboard"); quitPopup = canvasLayer.GetNode <ConfirmationDialog>("QuitPopup"); Signals.FinalWaveCompleteEvent += OnFinalWaveComplete; Signals.TerritoryDestroyedEvent += OnTerritoryDestroyed; gui.TechTreeButtonPressedEvent += OnTechTreeButtonPressed; gui.LeaderBoardButtonPressedEvent += OnLeaderBoardButtonPressed; quitPopup.Connect("confirmed", this, nameof(OnQuitPopupConfirmed)); // setup our list of territories per owner map.Territories.ForEach(t => numTerritoriesPerPlayer[t.TerritoryOwner - 1]++); asteroidManager.Territories = map.Territories; AddPlayersToWorld(); // after the world is setup, tell the server to start the timer and begin the game Server.Instance.PostBeginGame(); }
private void deleteButton_Click(object sender, RoutedEventArgs e) { if (rental_HistoryDataGrid.SelectedItem == null) { return; } String confirmMessage = "Are you sure you want to delete this rental entry?"; if (rental_HistoryDataGrid.SelectedItems != null && rental_HistoryDataGrid.SelectedItems.Count > 1) { confirmMessage = "Are you sure you want to delete these " + rental_HistoryDataGrid.SelectedItems.Count + " rental entries?"; } deleteConfirmation = new ConfirmationDialog("Delete Rental Confirmation", confirmMessage); deleteConfirmation.ShowDialog(); if (!deleteConfirmation.YesClicked) { return; } deleteRentalsHelper(rental_HistoryDataGrid.SelectedItems); updateDataGrid(); }
private void CheckForDownloadedUpdates() { string dir = AppDomain.CurrentDomain.BaseDirectory; UpdateDownloader.CreateTempDirectory(); bool updateZipExists = Directory.GetFiles(UpdateDownloader.DownloadLocation, "update-*.zip").Length > 0; string[] updateExeFiles = Directory.GetFiles(UpdateDownloader.DownloadLocation, "update-*.exe"); bool updateExeExists = updateExeFiles.Length > 0; string updaterPath = Path.Join(dir, "PixiEditor.UpdateInstaller.exe"); if (updateZipExists || updateExeExists) { ViewModelMain.Current.UpdateSubViewModel.UpdateReadyToInstall = true; var result = ConfirmationDialog.Show("Update is ready to install. Do you want to install it now?"); if (result == Models.Enums.ConfirmationType.Yes) { if (updateZipExists && File.Exists(updaterPath)) { InstallHeadless(updaterPath); } else if (updateExeExists) { OpenExeInstaller(updateExeFiles[0]); } } } }
public async Task Handle(StartRequest <VSTSRelease_v1> request, CancellationToken cancellationToken) { var dialog = new ConfirmationDialog($"Are you sure you want to create a new release of {request.DataContext.Name}?"); var result = _dialogService.ShowDialog(dialog); if (result != DialogResult.Yes) { return; } if (!request.DataContext.ReleaseId.HasValue) { throw new InvalidOperationException("Release id was not set."); } _logger.Info($"Creating a new release of \"{request.DataContext.Name}\"..."); var client = new AnyStatus.VSTS(); request.DataContext.MapTo(client); var body = new { definitionId = request.DataContext.ReleaseId }; await client.Send("release/releases?api-version=4.1-preview.6", body, true).ConfigureAwait(false); request.DataContext.State = State.Queued; _logger.Info($"Release \"{request.DataContext.Name}\" has been queued."); }
public async Task Process(Request request, CancellationToken cancellationToken) { if (_context.Session.IsNotDirty) { return; } var dialog = new ConfirmationDialog("Would you like to save changes before exiting?", "Save Changes?") { Cancellable = true }; switch (await _dialogService.ShowDialogAsync(dialog)) { case DialogResult.Yes: var saved = await _mediator.Send(new Save.Request(), cancellationToken); if (!saved) { request.Cancel = true; } break; case DialogResult.None: request.Cancel = true; break; default: break; } }
private async void OnBeginRoundsModeButtonClick(object sender, RoutedEventArgs e) { var tb = sender as ToggleButton; if (tb.IsChecked == false) { ConfirmationDialog confDiag = new ConfirmationDialog( "Ending Rounds Mode will log you out of this machine. Are you sure you want to continue?", "Confirm End of Rounds Mode", "Continue", "Cancel" ); confDiag.PrimaryButtonClick += (s, args) => { VM.ChangeOperationMode(OperationMode.Preparation); (tb.Content as TextBlock).Text = "BEGIN ROUNDS MODE"; Messenger.Default.Send(new LoggingOutMessage(isLocallyRequested: true)); }; confDiag.SecondaryButtonClick += (s, args) => { tb.IsChecked = true; }; await confDiag.ShowAsync(); } else { VM.ChangeOperationMode(OperationMode.Rounds); (tb.Content as TextBlock).Text = "END ROUNDS MODE"; } }
public async Task Process(Request request, CancellationToken cancellationToken) { if (_context.Session.IsDirty) { var dialog = new ConfirmationDialog("Would you like to save changes before exiting?", "Save Changes?") { Cancellable = true }; var result = _dialogService.ShowDialog(dialog); switch (result) { case DialogResult.Cancel: request.Cancel = true; break; case DialogResult.Yes: var saved = await _mediator.Send(new SaveCommand.Request(), cancellationToken).ConfigureAwait(false); if (!saved) { request.Cancel = true; } break; default: break; } } }
public void WhenIClickOnDeleteButton() { SuperAdminPage superadmin = ((SuperAdminPage)GetSharedPageObjectFromContext("Super Admin")); ConfirmationDialog confirm = superadmin.ClickDeleteButton(); SetSharedPageObjectInCurrentContext("Confirmation Dialog", confirm); }
public async Task Handle(StartRequest <VSTSBuild_v1> request, CancellationToken cancellationToken) { var dialog = new ConfirmationDialog($"Are you sure you want to start {request.DataContext.Name}?"); var result = _dialogService.ShowDialog(dialog); if (result != DialogResult.Yes) { return; } _logger.Info($"Starting \"{request.DataContext.Name}\"..."); var client = new VstsClient(new VstsConnection()); request.DataContext.MapTo(client.Connection); if (request.DataContext.DefinitionId == null) { var definition = await client.GetBuildDefinitionAsync(request.DataContext.DefinitionName).ConfigureAwait(false); request.DataContext.DefinitionId = definition.Id; } await client.QueueNewBuildAsync(request.DataContext.DefinitionId.Value).ConfigureAwait(false); _logger.Info($"Build \"{request.DataContext.Name}\" has been triggered."); }
public override void _Ready() { // Options control buttons resetButton = GetNode <Button>(ResetButtonPath); saveButton = GetNode <Button>(SaveButtonPath); // Tab selector buttons graphicsButton = GetNode <Button>(GraphicsButtonPath); soundButton = GetNode <Button>(SoundButtonPath); performanceButton = GetNode <Button>(PerformanceButtonPath); miscButton = GetNode <Button>(MiscButtonPath); // Graphics graphicsTab = GetNode <Control>(GraphicsTabPath); vsync = GetNode <CheckBox>(VSyncPath); fullScreen = GetNode <CheckBox>(FullScreenPath); msaaResolution = GetNode <OptionButton>(MSAAResolutionPath); colourblindSetting = GetNode <OptionButton>(ColourblindSettingPath); chromaticAberrationToggle = GetNode <CheckBox>(ChromaticAberrationTogglePath); chromaticAberrationSlider = GetNode <Slider>(ChromaticAberrationSliderPath); // Sound soundTab = GetNode <Control>(SoundTabPath); masterVolume = GetNode <Slider>(MasterVolumePath); masterMuted = GetNode <CheckBox>(MasterMutedPath); musicVolume = GetNode <Slider>(MusicVolumePath); musicMuted = GetNode <CheckBox>(MusicMutedPath); ambianceVolume = GetNode <Slider>(AmbianceVolumePath); ambianceMuted = GetNode <CheckBox>(AmbianceMutedPath); sfxVolume = GetNode <Slider>(SFXVolumePath); sfxMuted = GetNode <CheckBox>(SFXMutedPath); guiVolume = GetNode <Slider>(GUIVolumePath); guiMuted = GetNode <CheckBox>(GUIMutedPath); // Performance performanceTab = GetNode <Control>(PerformanceTabPath); cloudInterval = GetNode <OptionButton>(CloudIntervalPath); cloudResolution = GetNode <OptionButton>(CloudResolutionPath); runAutoEvoDuringGameplay = GetNode <CheckBox>(RunAutoEvoDuringGameplayPath); // Misc miscTab = GetNode <Control>(MiscTabPath); playIntro = GetNode <CheckBox>(PlayIntroPath); playMicrobeIntro = GetNode <CheckBox>(PlayMicrobeIntroPath); tutorialsEnabledOnNewGame = GetNode <CheckBox>(TutorialsEnabledOnNewGamePath); cheats = GetNode <CheckBox>(CheatsPath); autosave = GetNode <CheckBox>(AutoSavePath); maxAutosaves = GetNode <SpinBox>(MaxAutoSavesPath); maxQuicksaves = GetNode <SpinBox>(MaxQuickSavesPath); tutorialsEnabled = GetNode <CheckBox>(TutorialsEnabledPath); customUsernameEnabled = GetNode <CheckBox>(CustomUsernameEnabledPath); customUsername = GetNode <LineEdit>(CustomUsernamePath); backConfirmationBox = GetNode <WindowDialog>(BackConfirmationBoxPath); defaultsConfirmationBox = GetNode <ConfirmationDialog>(DefaultsConfirmationBoxPath); errorAcceptBox = GetNode <AcceptDialog>(ErrorAcceptBoxPath); selectedOptionsTab = SelectedOptionsTab.Graphics; }
public void ShowStopPackageDialog() { GameManager.Instance.HideLoadingScreen(); ConfirmationDialog.Open("Stop package", "Are you sure you want to stop execution of current package?", () => StopPackage(), () => ConfirmationDialog.Close()); }
public override void _Ready() { loadingItem = GetNode <Control>(LoadingItemPath); savesList = GetNode <BoxContainer>(SavesListPath); deleteConfirmDialog = GetNode <ConfirmationDialog>(DeleteConfirmDialogPath); listItemScene = GD.Load <PackedScene>("res://src/saving/SaveListItem.tscn"); }
public void Show(string title, string message,bool OkCancel) { ConfirmationDialog dialog = new ConfirmationDialog(message, OkCancel); dialog.Title = title; dialog.Width = Width; dialog.Height = Height; dialog.Show(); }
private void BtnRemoveVariation_Click(object sender, EventArgs e) { ConfirmationDialog removeConfirmation = new ConfirmationDialog(REMOVE_VARIATION_TITLE, REMOVE_VARIATION_TEXT); if (removeConfirmation.ShowDialog() == DialogResult.Yes) { presenter.RemoveVariation(LbxVariation.SelectedIndex); } }
/// <summary> /// Method to be called when player clicks the copy button. /// </summary> private void CopyDialog(Farmer who) { ConfirmationDialog confDialog = Game1.activeClickableMenu as ConfirmationDialog; string code = this.Helper.Reflection.GetField <string>(confDialog, "message").GetValue() .Replace(GetFirstPartOfInviteMessage(), "") .Trim(); this.SetClipboardText(code); }
protected override void OnSessionEnding(SessionEndingCancelEventArgs e) { base.OnSessionEnding(e); if (ViewModelMain.Current.BitmapManager.Documents.Any(x => !x.ChangesSaved)) { ConfirmationType confirmation = ConfirmationDialog.Show($"{e.ReasonSessionEnding} with unsaved data. Are you sure?", $"{e.ReasonSessionEnding}"); e.Cancel = confirmation != ConfirmationType.Yes; } }
public async Task Handle(StartRequest <VSTSReleaseEnvironment> request, CancellationToken cancellationToken) { var dialog = new ConfirmationDialog($"Are you sure you want to deploy to {request.DataContext.Name}?"); var result = _dialogService.ShowDialog(dialog); if (result != DialogResult.Yes) { return; } _logger.Info($"Starting deployment to \"{request.DataContext.Name}\"..."); var client = new AnyStatus.VSTS(); if (request.DataContext.Parent is VSTSRelease_v1 release) { release.MapTo(client); } else { throw new InvalidOperationException("Release environment is not associated with a release."); } if (!release.ReleaseId.HasValue) { throw new InvalidOperationException("Release id was not set."); } var lastRelease = await client .GetLastReleaseAsync(release.ReleaseId.Value) .ConfigureAwait(false); if (lastRelease == null) { request.DataContext.State = State.Failed; _logger.Error("VSTS release definition was not released."); return; } var body = new { status = "inProgress" }; var url = $"release/releases/{lastRelease.Id}/environments/{request.DataContext.EnvironmentId}?api-version=4.1-preview.5"; await client.Send(url, body, true, true).ConfigureAwait(false); request.DataContext.State = State.Queued; _logger.Info($"Deployment to \"{request.DataContext.Name}\" has been queued."); }
public async void RunDebug(bool pause) { try { ConfirmationDialog.Close(); GameManager.Instance.ShowLoadingScreen("Starting..."); await WebsocketManager.Instance.TemporaryPackage(ProjectManager.Instance.GetAllBreakpoints(), pause); } catch (RequestFailedException ex) { Notifications.Instance.ShowNotification("Failed to debug project", ex.Message); GameManager.Instance.HideLoadingScreen(); } }
protected override async Task Handle(Request request, CancellationToken cancellationToken) { var dialog = new ConfirmationDialog($"Are you sure you want to delete {request.Endpoint.Name}?", "Delete"); if (await _dialogService.ShowDialogAsync(dialog) is DialogResult.Yes) { _context.Endpoints.Remove(request.Endpoint); _ = await _mediator.Send(new SaveEndpoints.Request()); } }
/// <summary> /// Confirms that file should be closed</summary> /// <param name="message">Confirmation message</param> /// <returns>Dialog result</returns> public FileDialogResult ConfirmFileClose(string message) { ConfirmationDialog dialog = new ConfirmationDialog("Close".Localize("Close file"), message); dialog.YesButtonText = "&Save".Localize("The '&' is optional and means that Alt+S is the keyboard shortcut on this button"); dialog.NoButtonText = "&Discard".Localize("The '&' is optional and means that Alt+D is the keyboard shortcut on this button"); DialogResult result = dialog.ShowDialog(GetDialogOwner()); dialog.Dispose(); return(DialogResultToFileDialogResult(result)); }
public DialogResult ShowConfirmationDialog(Project oldProject, Project newProject) { ConfirmationDialog confirmationDialog = new ConfirmationDialog(oldProject, newProject); DialogResult dialogResult; using (confirmationDialog) { dialogResult = confirmationDialog.ShowDialog(); } return dialogResult; }
public override void _Ready() { loadingItem = GetNode <Control>(LoadingItemPath); savesList = GetNode <BoxContainer>(SavesListPath); deleteConfirmDialog = GetNode <ConfirmationDialog>(DeleteConfirmDialogPath); loadOlderConfirmDialog = GetNode <ConfirmationDialog>(LoadOlderSaveDialogPath); loadNewerConfirmDialog = GetNode <ConfirmationDialog>(LoadNewerSaveDialogPath); loadInvalidConfirmDialog = GetNode <ConfirmationDialog>(LoadInvalidSaveDialogPath); loadIncompatibleDialog = GetNode <AcceptDialog>(LoadIncompatibleDialogPath); listItemScene = GD.Load <PackedScene>("res://src/saving/SaveListItem.tscn"); }
private async void ShowConfirmationDialogWithContentButtonClickHandler(object sender, RoutedEventArgs args) { ConfirmationDialogArguments dialogArgs = new ConfirmationDialogArguments { Title = "Sports", Message = "Which sports do you enjoy?", OkButtonLabel = "OK", CustomContent = FindResource("SimpleTextBox") }; await ConfirmationDialog.ShowDialogAsync(MainWindow.DialogHostName, dialogArgs); }
public virtual void Init(DialogReceiverInterface e, string startTextContent) { ConfirmationDialog window = this; reference = e; style = new GUIStyle(); style.fontStyle = FontStyle.Bold; question = startTextContent; window.position = new Rect(Screen.width / 2 - 50, Screen.height / 2 - 150, 500, 100); window.Show(); }
public IEnumerator Move() { ShowMove(); ToggleWindow(false, false); QuadTile target = null; // Wait for click while (!target) { if (Input.GetButtonDown("Fire1")) { target = QuadTileMap.GetTarget(LayerMask.GetMask("Viable Marker")); } yield return(null); } mover.StopUpdatingPath = true; ConfirmationDialog dialog = Instantiate(dialogPrefab, transform.parent); // Wait for dialog input while (dialog.Result == DialogResult.None) { yield return(null); } if (dialog.Result == DialogResult.Yes) { Destroy(dialog.gameObject); CharacterData data = turnManager.CurrentCharacter.Data; MoveParams moveParams = moved ? data.rushParams : data.moveParams; yield return(StartCoroutine(mover.Move(turnManager.CurrentCharacter, target.Path(), moveParams, data.jumpParams))); turnManager.CurrentCharacter.LoseActionPoints(moveCost); moveCost++; if (moved) { MoveButton.interactable = false; } moved = true; } else { Destroy(dialog.gameObject); } mover.Clear(PathfindingClear.Both); ToggleWindow(true, false); }
public DialogResult ShowConfirmationDialog(Project oldProject, Project newProject) { ConfirmationDialog confirmationDialog = new ConfirmationDialog(oldProject, newProject); DialogResult dialogResult; using (confirmationDialog) { dialogResult = confirmationDialog.ShowDialog(); } return(dialogResult); }
protected void OnPointerClick(PointerEventData eventData) { if (Mode != PVMode.Delete) { return; } var touchPosition = eventData.pressPosition; var ray = Camera.main.ScreenPointToRay(touchPosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { if (hit.transform.gameObject != null) { GameObject touchedObject = hit.transform.gameObject; Debug.Log("MobilePhysicalVisualizerManager::OnPointerClick - Touched " + touchedObject.transform.name); var selectable = touchedObject.GetComponent <SelectableSensor>(); if (selectable == null) { Debug.Log("MobilePhysicalVisualizerManager::OnPointerClick - Selectable sensor not found" + touchedObject.transform.name); return; } selectable.IsSelected = true; StartCoroutine(UpdateSelectionStates(touchedObject)); SelectedAnchor = touchedObject; string message = "Are you sure you want to delete this anchor?"; ConfirmationDialog.ShowDialog(ConfirmationDialogPrefab, DialogParent, message, (result) => { Debug.Log(string.Format("Delete dialog closed, result: {0}", result)); if (result && SelectedAnchor != null) { ShowLoadingIndicator("Deleting anchor..."); var panel = SelectedAnchor.GetComponent <ProximityVisibility>().Object; var cloudAnchor = SelectedAnchor.GetComponent <AnchorBinding>().Anchor; _anchorManager.DeleteAnchor(SelectedAnchor, panel, cloudAnchor); } }); } } }
public void Show(string title, string message, Action<bool?> onClosedCallback) { ConfirmationDialog dialog = new ConfirmationDialog(message); dialog.Title = title; dialog.Closed += (s, e) => { if (onClosedCallback != null) { onClosedCallback(dialog.DialogResult); } }; dialog.Width = Width; dialog.Height = Height; dialog.Show(); }
public static async void CheckForUpdates() { if (HasInternetConnection) { try { var _releasePageURL = ""; Version _newVersion = null; const string _versionConfig = "https://raw.github.com/Codeusa/SteamCleaner/master/version.xml"; var _reader = new XmlTextReader(_versionConfig); _reader.MoveToContent(); var _elementName = ""; try { if ((_reader.NodeType == XmlNodeType.Element) && (_reader.Name == "steamcleaner")) { while (_reader.Read()) { switch (_reader.NodeType) { case XmlNodeType.Element: _elementName = _reader.Name; break; default: if ((_reader.NodeType == XmlNodeType.Text) && _reader.HasValue) { switch (_elementName) { case "version": _newVersion = new Version(_reader.Value); break; case "url": _releasePageURL = _reader.Value; break; } } break; } } } } catch (Exception) { } finally { _reader.Close(); } var applicationVersion = Assembly.GetExecutingAssembly().GetName().Version; if (applicationVersion.CompareTo(_newVersion) < 0) { var dialog = new ConfirmationDialog { MessageTextBlock = { Text = "A new Steam Cleaner update is available, update now?" } }; var result = await DialogHost.Show(dialog); if ("1".Equals(result)) GotoSite(_releasePageURL); } } catch { // ignored } } }
/// <summary> /// Promts a confirmation dialog with two buttons options /// </summary> /// <param name="dataContext">DataContext of the dialog</param> /// <returns>The result of the confirmation</returns> protected virtual bool ShowConfirmationDialogInternal(IConfirmationDialogViewModel dataContext) { ConfirmationDialog dlg = new ConfirmationDialog { DataContext = dataContext, Owner = Application.Current.MainWindow != null && Application.Current.MainWindow.IsActive ? Application.Current.MainWindow : null }; return dlg.ShowDialog() == true; }
public static async Task CleanData() { var redistributables = FindRedistributables(); var totalFiles = redistributables.Count; var dialog = new ConfirmationDialog { MessageTextBlock = { Text = "Are you sure you wish to do this? " + totalFiles + " files will be permanently deleted." } }; var result = await DialogHost.Show(dialog); if (!"1".Equals(result)) return; var progressBar = new ProgressBar { Maximum = redistributables.Count, Width = 300, Margin = new Thickness(32) }; await DialogHost.Show(progressBar, (DialogOpenedEventHandler) ((o, args) => DeleteFiles(redistributables, progressBar, args.Session))); }