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 override void _Input(InputEvent @event) { base._Input(@event); if (@event.IsActionPressed("ui_tech_tree")) { // hide the Leaderboard leaderBoard.Visible = false; // toggle the TechTree techTree.Visible = !techTree.Visible; gui.Visible = map.Visible = asteroidManager.Visible = !techTree.Visible; } else if (@event.IsActionPressed("ui_leaderboard")) { // hide the TechTree techTree.Visible = false; // toggle the LeaderBoard leaderBoard.Visible = !leaderBoard.Visible; gui.Visible = map.Visible = asteroidManager.Visible = !leaderBoard.Visible; } else if (@event.IsActionPressed("escape")) { // hide the UIs techTree.Visible = false; leaderBoard.Visible = false; map.Show(); asteroidManager.Show(); } else if (@event.IsActionPressed("quit")) { quitPopup.Show(); } }
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 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(); }
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 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 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 void RequestCloseDocument(Document document) { if (!document.ChangesSaved) { ConfirmationType result = ConfirmationDialog.Show(ConfirmationDialogMessage); if (result == ConfirmationType.Yes) { Owner.FileSubViewModel.SaveDocument(false); } else if (result == ConfirmationType.Canceled) { return; } } Owner.BitmapManager.CloseDocument(document); }
public Task <int> ConfirmTriple(string msg, string Title, string Yes = "Ok", string No = "Cancel", bool cancellable = true, string Neutral = "") { var task = new TaskCompletionSource <int>(); var dialog = new ConfirmationDialog(ActivityContext); dialog.Title = Title; dialog.Message = msg; dialog.Positive = Yes; dialog.Negative = No; dialog.Neutral = Neutral; dialog.IsCancellable = cancellable; dialog.OnNegative += () => task.TrySetResult(0); dialog.OnPositive += () => task.TrySetResult(1); dialog.OnNeutral += () => task.TrySetResult(2); dialog.Show(); return(task.Task); }
/// <summary> /// Show confirmation popup /// </summary> /// <param name="title"></param> /// <param name="message"></param> /// <param name="onClosedCallback"></param> public void Confirm(string title, string message, Action <DialogResult> onClosedCallback) { _alertDialog.Close(); _confirmationDialog.Title = title; _confirmationDialog.Message = message; _confirmationDialog.Closed += (s, e) => { if (onClosedCallback != null) { DialogResult result = new DialogResult(); result.Result = _confirmationDialog.DialogResult; onClosedCallback(result); } }; _confirmationDialog.Width = Width; _confirmationDialog.Height = Height; _confirmationDialog.Show(); }
public Task <Tuple <string, string> > NewPasswordInputDialog(string msgContent, bool hasOld, string oldPwdContent = null, string newPwdContent = null) { var complete = new TaskCompletionSource <Tuple <string, string> >(); var content = new LinearLayout(ActivityContext); content.Orientation = Orientation.Vertical; LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); layoutParams.SetMargins(20, 5, 20, 5); var msg = new TextView(ActivityContext); msg.Text = msgContent; content.AddView(msg, layoutParams); EditText oldPassword = null; if (hasOld) { oldPassword = new EditText(ActivityContext); oldPassword.InputType = Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextVariationPassword; oldPassword.Hint = "Old Password"; oldPassword.Text = oldPwdContent; content.AddView(oldPassword, layoutParams); } var newPwd = new EditText(ActivityContext); newPwd.InputType = Android.Text.InputTypes.ClassText | Android.Text.InputTypes.TextVariationPassword; newPwd.Hint = "New Password"; newPwd.Text = newPwdContent; content.AddView(newPwd, layoutParams); var repeatPwd = new EditText(ActivityContext); repeatPwd.InputType = newPwd.InputType; repeatPwd.Hint = "Repeat Password"; repeatPwd.Text = newPwdContent; content.AddView(repeatPwd, layoutParams); var dialog = new ConfirmationDialog(ActivityContext); dialog.Title = "Change Password"; dialog.Positive = "Change"; dialog.Content = content; dialog.OnPositive += async() => { await Task.Delay(150); if (newPwd.Text == repeatPwd.Text) { HideKeyboard(); if (hasOld) { complete.SetResult(new Tuple <string, string>(oldPassword.Text, newPwd.Text)); } else { complete.SetResult(new Tuple <string, string>(null, newPwd.Text)); } } else { msg.Text = "Passwords don't match!"; dialog.Reshow(); } }; dialog.OnNegative += () => { HideKeyboard(); complete.SetResult(null); }; dialog.Show(); return(complete.Task); }
public ResourceTableEntry MoveToResource([CanBeNull] EnvDTE.Document document) { var extension = Path.GetExtension(document?.FullName); if (extension == null) { return(null); } var fileName = Path.GetFileNameWithoutExtension(document.FullName); var configurationItems = _exportProvider.GetExportedValue <DteConfiguration>().MoveToResources.Items; var configuration = configurationItems .FirstOrDefault(item => item.ParseExtensions().Contains(extension, StringComparer.OrdinalIgnoreCase)); if (configuration == null) { return(null); } var selection = GetSelection(document); if (selection == null) { return(null); } IParser parser = new GenericParser(); var text = !selection.IsEmpty ? selection.Text?.Trim('"') : parser.LocateString(selection, true); if (string.IsNullOrEmpty(text)) { return(null); } var patterns = configuration.ParsePatterns().ToArray(); var resourceViewModel = _exportProvider.GetExportedValue <ResourceViewModel>(); resourceViewModel.Reload(); var resourceManager = _exportProvider.GetExportedValue <ResourceManager>(); var entities = resourceManager.ResourceEntities .Where(entity => !entity.IsWinFormsDesignerResource) .ToList(); var filter = EntityFilter.BuildFilter(Settings.Default.ResourceFilter); if (filter != null) { entities.RemoveAll(item => !filter(item.ToString())); } var projectResources = new HashSet <ResourceEntity>(GetResourceEntiesFromProject(document, entities)); // put resources from the same project on top entities.RemoveAll(entity => projectResources.Contains(entity)); entities.InsertRange(0, projectResources); // put the last used entry on top, if it's in the same project, or the last access was cross-project. if (_lastUsedEntity != null) { if (!_isLastUsedEntityInSameProject || IsInProject(_lastUsedEntity, document)) { entities.Remove(_lastUsedEntity); entities.Insert(0, _lastUsedEntity); } } var viewModel = new MoveToResourceViewModel(patterns, entities, text, extension, selection.ClassName, selection.FunctionName, fileName); var confirmed = ConfirmationDialog.Show(_exportProvider, viewModel, Resources.MoveToResource, null).GetValueOrDefault(); if (!confirmed || string.IsNullOrEmpty(viewModel.Key)) { return(null); } ResourceTableEntry entry = null; if (!viewModel.ReuseExisiting) { var entity = _lastUsedEntity = viewModel.SelectedResourceEntity; if (entity == null) { return(null); } _isLastUsedEntityInSameProject = IsInProject(entity, document); entry = entity.Add(viewModel.Key); if (entry == null) { return(null); } entry.Values[null] = viewModel.Value; entry.Comment = viewModel.Comment; } selection.ReplaceWith(viewModel.Replacement?.Value); return(entry); }
public ResourceTableEntry MoveToResource(EnvDTE.Document document) { var extension = Path.GetExtension(document?.FullName); if (extension == null) { return(null); } var configurationItems = _compositionHost.GetExportedValue <DteConfiguration>().MoveToResources.Items; var configuration = configurationItems .FirstOrDefault(item => item.ParseExtensions().Contains(extension, StringComparer.OrdinalIgnoreCase)); if (configuration == null) { return(null); } Contract.Assume(document != null); var selection = GetSelection(document); if (selection == null) { return(null); } IParser parser = new GenericParser(); var text = !selection.IsEmpty ? selection.Text?.Trim('"') : parser.LocateString(selection, true); if (string.IsNullOrEmpty(text)) { return(null); } var patterns = configuration.ParsePatterns().ToArray(); var resourceViewModel = _compositionHost.GetExportedValue <ResourceViewModel>(); resourceViewModel.Reload(); var resourceManager = _compositionHost.GetExportedValue <ResourceManager>(); var entities = resourceManager.ResourceEntities .Where(entity => !entity.IsWinFormsDesignerResource) .ToArray(); var filter = Settings.Default?.ResourceFilter?.Trim(); if (!string.IsNullOrEmpty(filter)) { var regex = new Regex(filter, RegexOptions.IgnoreCase | RegexOptions.Singleline); entities = entities .Where(item => regex.Match(item.ToString()).Success) .ToArray(); } var favorites = new[] { GetPreferredResourceEntity(document, entities), _lastUsedEntity } .Where(item => item != null) .ToArray(); entities = favorites .Concat(entities.Except(favorites)) .ToArray(); var viewModel = new MoveToResourceViewModel(patterns, entities, text, extension, selection.ClassName, selection.FunctionName); var confirmed = ConfirmationDialog.Show(_compositionHost.Container, viewModel, Resources.MoveToResource).GetValueOrDefault(); if (confirmed && !string.IsNullOrEmpty(viewModel.Key)) { ResourceTableEntry entry = null; if (!viewModel.ReuseExisiting) { var entity = _lastUsedEntity = viewModel.SelectedResourceEntity; entry = entity?.Add(viewModel.Key); if (entry == null) { return(null); } entry.Values[null] = viewModel.Value; entry.Comment = viewModel.Comment; } selection.ReplaceWith(viewModel.Replacement); return(entry); } return(null); }
public static bool Confirm(ConfirmationDialogType dialogType, Window parent) { string username = SquiggleContext.Current.ChatClient.Coalesce(c => c.CurrentUser.DisplayName, String.Empty); return(ConfirmationDialog.Show(username, dialogType, parent)); }
public void DeleteAllData() { ConfirmationDialog.Show("Are you sure you want to", ClearAllDataCallback); }
public ResourceTableEntry MoveToResource(Document document) { var extension = Path.GetExtension(document?.FullName); if (extension == null) { return(null); } var configurationItems = _exportProvider.GetExportedValue <DteConfiguration>().MoveToResources.Items; var configuration = configurationItems .FirstOrDefault(item => item.ParseExtensions().Contains(extension, StringComparer.OrdinalIgnoreCase)); if (configuration == null) { return(null); } Contract.Assume(document != null); var selection = GetSelection(document); if (selection == null) { return(null); } IParser parser = new GenericParser(); var text = !selection.IsEmpty ? selection.Text?.Trim('"') : parser.LocateString(selection, true); if (string.IsNullOrEmpty(text)) { return(null); } var patterns = configuration.ParsePatterns().ToArray(); var resourceManager = _exportProvider.GetExportedValue <ResourceManager>(); resourceManager.Reload(ResourceLoadOptions.None); var entities = resourceManager.ResourceEntities .Where(entity => !entity.IsWinFormsDesignerResource) .ToArray(); var viewModel = new MoveToResourceViewModel(patterns, entities, text, extension, selection.ClassName, selection.FunctionName) { SelectedResourceEntity = GetPreferredResourceEntity(document, entities) ?? _lastUsedEntity }; var confirmed = ConfirmationDialog.Show(_exportProvider, viewModel, Resources.MoveToResource).GetValueOrDefault(); if (confirmed && !string.IsNullOrEmpty(viewModel.Key)) { ResourceTableEntry entry = null; if (!viewModel.ReuseExisiting) { var entity = _lastUsedEntity = viewModel.SelectedResourceEntity; entry = entity?.Add(viewModel.Key); if (entry == null) { return(null); } entry.Values[null] = viewModel.Value; entry.Comment = viewModel.Comment; } selection.ReplaceWith(viewModel.Replacement); return(entry); } ; return(null); }