public ConfirmationDialog(ConfirmationMessage msg) { Content = msg.Content; Title = msg.Title; PrimaryButtonText = msg.PrimaryText; SecondaryButtonText = msg.SecondaryText; }
public void ConfirmReception(Guid guid, IPEndPoint endPoint) { ConfirmationMessage confirmation = new ConfirmationMessage(_name, guid); byte[] bytes = SerializeMessage(confirmation); _udpClient.Send(bytes, bytes.Length, endPoint); }
private void DeleteConfirm(ConfirmationMessage parameter) { if (parameter.Response.GetValueOrDefault()) { Delete(); } }
protected bool ConfirmDialog(String text, String title) { var message = new ConfirmationMessage(text, title , MessageBoxImage.Question, MessageBoxButton.YesNo, "Confirm"); Messenger.Raise(message); return message.Response.HasValue && message.Response.Value; }
public void RetweetThisTabAll() { Task.Factory.StartNew(() => { IEnumerable <TabDependentTweetViewModel> tweets; using (NotifyStorage.NotifyManually("タイムラインの内容を取得しています...")) { tweets = this.CurrentForegroundTimeline.CoreViewModel.TweetsSource.ToArrayVolatile(); } var msg = new ConfirmationMessage( "このタブに含まれるすべてのツイートをRetweetします。" + Environment.NewLine + "(対象ツイート: " + tweets.Count() + "件)" + Environment.NewLine + "よろしいですか?", "全てRetweet", System.Windows.MessageBoxImage.Warning, System.Windows.MessageBoxButton.OKCancel, "Confirm"); this.Parent.Messenger.Raise(msg); if (msg.Response.GetValueOrDefault()) { var lai = this.TabProperty.LinkAccountInfos.ToArray(); tweets.OrderBy(t => t.Tweet.CreatedAt) .ForEach(t => PostOffice.Retweet(lai, t.Tweet)); } }); }
public void DeleteMarkedItems() { ConfirmationMessage cm = new ConfirmationMessage(this, "Are you sure you want to delete the marked items?", async(selection) => { if (selection == true) { try { this.IsBusy = true; int deletedPhrases = await this.phraseDataService.DeleteAsync(this.GetMarkedPhrases()); await this.RemoveMarkedItemsAsync(); this.IsBusy = false; NotificationMessage deletedMessage = new NotificationMessage(this, $"{deletedPhrases} phrases have been deleted."); Messenger.Default.Send(deletedMessage); } catch (Exception ex) { ErrorMessage errorMessage = new ErrorMessage(this, ex.Message); Messenger.Default.Send(errorMessage); } finally { this.IsBusy = false; } } }); Messenger.Default.Send(cm); }
private void PrintAtenaSeal(ConfirmationMessage parameter) { if (parameter.Response == true) { PrintAtenaSealCore(); } }
private void PrintKokyakuDaicho(ConfirmationMessage parameter) { if (parameter.Response == true) { PrintKokyakuDaichoCore(); } }
protected bool ConfirmDialog(String text, String title) { var message = new ConfirmationMessage(text, title, MessageBoxImage.Question, MessageBoxButton.YesNo, "Confirm"); Messenger.Raise(message); return(message.Response.Value); }
public async void RemoveCompletedAll(IEnumerable selectedItems) { if (ShiftDown) { var items = Model.QueueItems .Where(item => item.Model.State == QueueState.Complete && item.Model.IsBatch).ToArray(); await RemoveTS(items); return; } var candidates = Model.QueueItems .Select(item => item.Model) .Where(s => s.State == QueueState.Complete || s.State == QueueState.PreFailed).ToArray(); if (candidates.Length > 0) { var message = new ConfirmationMessage( candidates.Length + "個のアイテムを削除します。", "Amatsukaze アイテム削除", MessageBoxImage.Question, MessageBoxButton.OKCancel, "Confirm"); await Messenger.RaiseAsync(message); if (message.Response == true) { Model.Server?.ChangeItem(new ChangeItemData() { ChangeType = ChangeItemType.RemoveCompleted }); } } }
public void DeleteSelectedOperations() { ConfirmationMessage cm = new ConfirmationMessage(this, "Are you sure you want to delete the selected operations?", async(selection) => { if (selection == true) { try { this.IsBusy = true; int deletedOperations = await this.operationDataService.DeleteAsync(this.GetSelectedOperations()); await this.LoadAllOperationsAsync(); await this.RefreshItemsAsync(); this.IsBusy = false; NotificationMessage deletedMessage = new NotificationMessage(this, $"{deletedOperations} operations have been deleted."); Messenger.Default.Send(deletedMessage); } catch (Exception ex) { ErrorMessage errorMessage = new ErrorMessage(this, ex.Message); Messenger.Default.Send(errorMessage); } finally { this.IsBusy = false; } } }); Messenger.Default.Send(cm); }
private async Task <bool> GetOutPath() { Item.Outputs[0].DstPath = Item.Outputs[0].DstPath.TrimEnd(Path.DirectorySeparatorChar); if (System.IO.Directory.Exists(Item.Outputs[0].DstPath) == false) { var message = new ConfirmationMessage( "出力先フォルダが存在しません。作成しますか?", "Amatsukaze フォルダ作成", System.Windows.MessageBoxImage.Information, System.Windows.MessageBoxButton.OKCancel, "Confirm"); await Messenger.RaiseAsync(message); if (message.Response != true) { return(false); } try { Directory.CreateDirectory(Item.Outputs[0].DstPath); } catch (Exception e) { Description = "フォルダの作成に失敗しました: " + e.Message; return(false); } } return(true); }
public Task <bool> ShowMessage(ConfirmationMessage confirmationMessage) { var modal = new MainModalViewModel(confirmationMessage); Modal = modal; return(modal.CompletionTask); }
public void FileExport() { var cm = new ConfirmationMessage( "色設定をエクスポートすると、現在の設定内容がKrileの設定に反映されます。" + "よろしいですか?", "色設定保存", System.Windows.MessageBoxImage.Warning, System.Windows.MessageBoxButton.YesNo, "Confirm"); this.Messenger.Raise(cm); if (cm.Response.GetValueOrDefault()) { var sfm = new SavingFileSelectionMessage("SaveFile"); sfm.Title = "色設定ファイルの保存"; sfm.Filter = "色設定ファイル|*.kcx"; this.Messenger.Raise(sfm); if (sfm.Response != null) { try { Apply(); XMLSerializer.SaveXML <ColoringProperty>(sfm.Response, Setting.Instance.ColoringProperty); } catch { this.Messenger.Raise(new InformationMessage("ファイルを読み込めません。", "色設定ファイルのロードエラー", System.Windows.MessageBoxImage.Error, "Message")); } } } }
public void RequestClose(ConfirmationMessage message) { if (message.Response == true) { Messenger.Raise(new WindowActionMessage("Close", WindowAction.Close)); } }
public async void Remove(IEnumerable selectedItems) { if (ShiftDown) { var selected = selectedItems.OfType <DisplayQueueItem>().ToArray(); var items = selected.Where(item => item.Model.State == QueueState.Complete && item.Model.IsBatch).ToArray(); if (selected.Length - items.Length > 0) { var message = new ConfirmationMessage( "TSファイルを削除できるのは、通常または自動追加のアイテムのうち\r\n" + "完了した項目だけです。" + (selected.Length - items.Length) + "件のアイテムがこれに該当しないため除外\r\nされます", "Amatsukaze TSファイル削除除外", MessageBoxImage.Information, MessageBoxButton.OK, "Confirm"); await Messenger.RaiseAsync(message); } await RemoveTS(items); return; } foreach (var item in selectedItems.OfType <DisplayQueueItem>().ToArray()) { var file = item.Model; Model.Server?.ChangeItem(new ChangeItemData() { ItemId = file.Id, ChangeType = ChangeItemType.RemoveItem }); } }
/// <summary> /// 確認ダイアログを表示する /// 使用するにはView側に、InteractionMessageTriggerの定義が必要 /// <param name="message"></param> /// <param name="title"></param> /// <returns>OKが押された場合はtrue</returns> public bool ShowConfirmDialog(string message, string title = "Confirm") { var confirmationMessage = new ConfirmationMessage(message, title, MessageBoxImage.Question, MessageBoxButton.OKCancel, ConfirmMessageKey); Messenger.Raise(confirmationMessage); return(confirmationMessage.Response ?? false); }
private void Delete(ConfirmationMessage message) { if (message.Response.HasValue && message.Response.Value) { _model.DeleteMap(); _model.UpdateParent(); } }
private void AllStop(ConfirmationMessage message) { if (message.Response.HasValue && message.Response.Value) { RecordersViewModel.StopAllRecorders(); PlayersViewModel.StopAllPlayers(); } }
protected override void AddAttributesToRender(HtmlTextWriter writer) { base.AddAttributesToRender(writer); string script = "confirmAsync('" + ConfirmationMessage.Replace("'", "\\'") + "', " + Callback() + ");" + "return false;"; writer.AddAttribute(HtmlTextWriterAttribute.Onclick, script, false); }
// #region FolderDialogKind変更通知プロパティ // private FolderSelectionDialogPreference _FolderDialogKind; // public FolderSelectionDialogPreference FolderDialogKind // { // get // { return _FolderDialogKind; } // set // { // if (EqualityComparer<FolderSelectionDialogPreference>.Default.Equals(_FolderDialogKind, value)) // return; // _FolderDialogKind = value; //#if NET4 // RaisePropertyChanged("FolderDialogKind"); //#elif NET45 // RaisePropertyChanged(); //#endif // } // } // #endregion public void RequestClose(ConfirmationMessage message) { if (message.Response.HasValue && message.Response.Value) { CanClose = true; Messenger.Raise(new WindowActionMessage(WindowAction.Close, "Close")); } }
public void SetDefaultColor(ConfirmationMessage parameter) { if (parameter.Response.GetValueOrDefault()) { // デフォルトカラーを設定 ApplyColoringProperty(new ColoringProperty()); } }
/// <summary> /// 任意の形式の確認メッセージを非同期で表示します。 /// </summary> /// <param name="self">ViewModel</param> /// <param name="messageBoxText">メッセージ本文</param> /// <param name="title">タイトル</param> /// <param name="buttonKinds">表示するボタンの種類</param> /// <param name="defaultResult">初期フォーカスをあてるボタン</param> /// <param name="messageKey">メッセージキー</param> /// <returns>結果</returns> private async static Task <ConfirmationMessage> ShowConfirmationTargetMessageAsync(ViewModel self, string messageBoxText, string title, MessageBoxButton buttonKinds, MessageBoxResult defaultResult, string messageKey) { var mes = new ConfirmationMessage(messageBoxText, title, MessageBoxImage.Question, buttonKinds, defaultResult, messageKey); mes = await self.Messenger.GetResponseAsync(mes); // Messenger.RaiseAsync() しつつ、戻り値を取得している? return(mes); }
public void Delete(ConfirmationMessage message) { if (message.Response != true) { return; } this.Model.Master.Delete(this.SelectedPerson.Value.Model.ID); }
public void ConfirmFromView([NotNull] ConfirmationMessage message) { if (message == null) { throw new ArgumentNullException(nameof(message)); } OutputMessage = $"{DateTime.Now}: ConfirmFromView: {message.Response ?? false}"; }
/// <summary> /// Confirmationメッセージを表示させ、どのボタンを押したかをキャッチする /// </summary> private void ConfirmationMethod() { // Yes Noボタンを表示させた場合 // Yes:result.Response=true No:result.Response=false ConfirmationMessage result = ShowConfirmationDialog("メッセージ", "タイトル", MessageBoxButton.YesNo, MessageBoxImage.Question); // OK キャンセルを表示させた場合 // OK:result.Response=true Cancel:result.Response=null result = ShowConfirmationDialog("メッセージ", "タイトル", MessageBoxButton.OKCancel, MessageBoxImage.Question); }
public async void ConfirmFromViewModel() { var message = new ConfirmationMessage("これはテスト用メッセージです。", "テスト", "MessageKey_Confirm") { Button = MessageBoxButton.OKCancel }; await Messenger.RaiseAsync(message); OutputMessage = $"{DateTime.Now}: ConfirmFromViewModel: {message.Response ?? false}"; }
private async void DoRestart() { var message = new ConfirmationMessage(Resource.ConfirmationNeeded, Resource.DoYouWantToRestartApplication); var res = await _MessageBox.ShowMessage(message); if (res) { _Application.Restart(); } }
protected bool ShowRetryCancel(Exception e) { var msg = new ConfirmationMessage(e.Message, XwtMessager.Retry); msg.Buttons.Clear(); msg.Buttons.Add(XwtMessager.Abort); msg.ConfirmButton = XwtMessager.Retry; msg.Icon = StockIcons.Error; return(MessageDialog.Confirm(msg)); }
public void ClearCount() { var msg = new ConfirmationMessage("開始回数データをすべて消去します。よろしいですか?", "警告", System.Windows.MessageBoxImage.Warning, System.Windows.MessageBoxButton.YesNo, "Confirmation"); Messenger.Raise(msg); if (msg.Response ?? false) { LauncherCoreViewModel.ClearCount(); Initialize(); } }
public async void OnClosing(CancelEventArgs cancelEvent) { cancelEvent.Cancel = true; var confirmationMessage = new ConfirmationMessage(Resource.ConfirmationNeeded, Resource.DoYouWantToCloseApplication, Resource.Ok, Resource.Cancel); var close = await _MessageBox.ShowMessage(confirmationMessage); if (close) { _Application.ForceClose(); } }
private static async Task ShowConfirmationDialogAsync(ConfirmationMessage message) { var window = new ConfirmationWindow() { VM = message.VM }; await window.ShowDialog(MainWindow); message.Process(message.VM.Result); }
private void Delete() { if (!this.Tweet.ShowDeleteButton) return; var conf = new ConfirmationMessage("ツイート @" + this.Tweet.Status.User.ScreenName + ": " + this.Tweet.Status.Text + " を削除してもよろしいですか?", "ツイートの削除", System.Windows.MessageBoxImage.Warning, System.Windows.MessageBoxButton.OKCancel, "Confirm"); this.Messenger.Raise(conf); if (conf.Response.GetValueOrDefault()) { PostOffice.RemoveTweet(AccountStorage.Get(this.Tweet.Status.User.ScreenName), this.Tweet.Status.Id); } }
public override void DeleteMultipleItems () { Set<SolutionEntityItem> projects = new Set<SolutionEntityItem> (); ConfirmationMessage confirmMsg = new ConfirmationMessage (); confirmMsg.ConfirmButton = AlertButton.Delete; confirmMsg.AllowApplyToAll = CurrentNodes.Length > 1; foreach (ITreeNavigator node in CurrentNodes) { ProjectFolder folder = (ProjectFolder) node.DataItem as ProjectFolder; Project project = folder.Project; ProjectFile[] files = project != null ? project.Files.GetFilesInPath (folder.Path) : null; if (files != null && files.Length == 0) { confirmMsg.Text = GettextCatalog.GetString ("Are you sure you want to permanently delete the folder {0}?", folder.Path); bool yes = MessageService.Confirm (confirmMsg); if (!yes) return; bool removeFiles = false; try { if (Directory.Exists (folder.Path)) // Indirect events will remove the files from the project FileService.DeleteDirectory (folder.Path); else removeFiles = true; } catch (Exception ex) { MessageService.ShowError (GettextCatalog.GetString ("The folder {0} could not be deleted from disk: {1}", folder.Path, ex.Message)); removeFiles = true; } if (removeFiles && project != null) { List<ProjectFile> list = new List<ProjectFile>(); list.AddRange (project.Files.GetFilesInVirtualPath (folder.Path.ToRelative (project.BaseDirectory))); ProjectFile pf = project.Files.GetFileWithVirtualPath (folder.Path.ToRelative (project.BaseDirectory)); if (pf != null) list.Add (pf); foreach (var f in list) project.Files.Remove (f); } } else { bool yes = MessageService.Confirm (GettextCatalog.GetString ("Do you really want to remove folder {0}?", folder.Name), AlertButton.Remove); if (!yes) return; ProjectFile[] inParentFolder = project.Files.GetFilesInPath (Path.GetDirectoryName (folder.Path)); if (inParentFolder.Length == files.Length) { // This is the last folder in the parent folder. Make sure we keep // a reference to the folder, so it is not deleted from the tree. ProjectFile folderFile = new ProjectFile (Path.GetDirectoryName (folder.Path)); folderFile.Subtype = Subtype.Directory; project.Files.Add (folderFile); } foreach (ProjectFile file in files) project.Files.Remove (file); projects.Add (project); } } IdeApp.ProjectOperations.Save (projects); }
private void Delete() { if (!this.Tweet.ShowDeleteButton) return; ConfirmationMessage conf = null; if (!User32.IsKeyPressed(VirtualKey.VK_SHIFT)) { var msg = String.Format("ツイート @{0}: {1} を削除してもよろしいですか?", this.Tweet.Status.User.ScreenName, this.Tweet.Status.Text); conf = new ConfirmationMessage(msg, "ツイートの削除", System.Windows.MessageBoxImage.Warning, System.Windows.MessageBoxButton.OKCancel, "Confirm"); this.RaiseMessage(conf); } if ((conf == null) || (conf.Response.GetValueOrDefault())) { if (this.Tweet.IsDirectMessage) { PostOffice.RemoveDirectMessage(AccountStorage.Get(this.Tweet.Status.User.ScreenName), this.Tweet.Status.Id); } else { PostOffice.RemoveTweet(AccountStorage.Get(this.Tweet.Status.User.ScreenName), this.Tweet.Status.Id); } } }
public void FileExport() { var cm = new ConfirmationMessage( "色設定をエクスポートすると、現在の設定内容がKrileの設定に反映されます。" + "よろしいですか?", "色設定保存", System.Windows.MessageBoxImage.Warning, System.Windows.MessageBoxButton.YesNo, "Confirm"); this.Messenger.Raise(cm); if (cm.Response.GetValueOrDefault()) { var sfm = new SavingFileSelectionMessage("SaveFile"); sfm.Title = "色設定ファイルの保存"; sfm.Filter = "色設定ファイル|*.kcx"; this.Messenger.Raise(sfm); if (sfm.Response != null) { try { Apply(); XMLSerializer.SaveXML<ColoringProperty>(sfm.Response, Setting.Instance.ColoringProperty); } catch { this.Messenger.Raise(new InformationMessage("ファイルを読み込めません。", "色設定ファイルのロードエラー", System.Windows.MessageBoxImage.Error, "Message")); } } } }
public void RetweetThisTabAll() { Task.Factory.StartNew(() => { IEnumerable<TabDependentTweetViewModel> tweets; using (NotifyStorage.NotifyManually("タイムラインの内容を取得しています...")) { tweets = this.CurrentForegroundTimeline.CoreViewModel.TweetsSource.ToArrayVolatile(); } var msg = new ConfirmationMessage( "このタブに含まれるすべてのツイートをRetweetします。" + Environment.NewLine + "(対象ツイート: " + tweets.Count() + "件)" + Environment.NewLine + "よろしいですか?", "全てFavorite", System.Windows.MessageBoxImage.Warning, System.Windows.MessageBoxButton.OKCancel, "Confirm"); this.Parent.Messenger.Raise(msg); if (msg.Response.GetValueOrDefault()) { var lai = this.TabProperty.LinkAccountInfos.ToArray(); tweets.OrderBy(t => t.Tweet.CreatedAt) .ForEach(t => PostOffice.Retweet(lai, t.Tweet)); } }); }
public void UnfavoriteThisTabAll() { Task.Factory.StartNew(() => { IEnumerable<TabDependentTweetViewModel> tweets; using (NotifyStorage.NotifyManually("タイムラインの内容を取得しています...")) { tweets = this.CurrentForegroundTimeline.CoreViewModel.TweetsSource.ToArrayVolatile(); } var msg = new ConfirmationMessage( "このタブに含まれるすべてのツイートをUnfavoriteします。" + Environment.NewLine + "(対象ツイート: " + tweets.Count() + "件)" + Environment.NewLine + "よろしいですか?", "全てUnfavorite", System.Windows.MessageBoxImage.Warning, System.Windows.MessageBoxButton.OKCancel, "Confirm"); this.Parent.Messenger.Raise(msg); if (msg.Response.GetValueOrDefault()) tweets.ForEach(t => t.Unfavorite()); }); }
private void ReportForSpam() { if (!CanReportForSpam()) return; var conf = new ConfirmationMessage("ユーザー @" + this.Tweet.Status.User.ScreenName + " をスパム報告してもよろしいですか?" + Environment.NewLine + "(Krileに存在するすべてのアカウントでスパム報告を行います)", "スパム報告の確認", System.Windows.MessageBoxImage.Warning, System.Windows.MessageBoxButton.OKCancel, "Confirm"); this.Messenger.Raise(conf); if (conf.Response.GetValueOrDefault()) { AccountStorage.Accounts.ForEach(i => Task.Factory.StartNew(() => ApiHelper.ExecApi(() => i.ReportSpam(this.Tweet.Status.User.NumericId)))); TweetStorage.Remove(this.Tweet.Status.Id); NotifyStorage.Notify("R4Sしました: @" + this.Tweet.Status.User.ScreenName); Task.Factory.StartNew(() => TweetStorage.GetAll(t => t.Status.User.NumericId == this.Tweet.Status.User.NumericId) .ForEach(vm => TweetStorage.Remove(vm.Status.Id))); } }
public void R4S() { var cm = new ConfirmationMessage( "ユーザー @" + User.TwitterUser.ScreenName + " をスパム報告します。", "スパム報告", System.Windows.MessageBoxImage.Warning, System.Windows.MessageBoxButton.OKCancel, "Confirm"); if (this.Messenger.GetResponse(cm).Response.GetValueOrDefault()) { this.Messenger.Raise(new WindowActionMessage("WindowAction", WindowAction.Close)); Task.Factory.StartNew(() => { AccountStorage.Accounts.ForEach(i => ReportForSpam(i, User.TwitterUser)); NotifyStorage.Notify("@" + User.TwitterUser.ScreenName + " をスパム報告しました。"); }); } }
public override void DeleteMultipleItems () { var projects = new HashSet<SolutionEntityItem> (); var confirmMsg = new ConfirmationMessage () { ConfirmButton = AlertButton.Delete, AllowApplyToAll = CurrentNodes.Length > 1, }; foreach (ITreeNavigator node in CurrentNodes) { var folder = node.DataItem as ProjectFolder; var project = folder.Project; confirmMsg.Text = GettextCatalog.GetString ("Are you sure you want to permanently delete folder {0}?", folder.Path); if (!MessageService.Confirm (confirmMsg)) continue; var folderRelativePath = folder.Path.ToRelative (project.BaseDirectory); var files = project.Files.GetFilesInVirtualPath (folder.Path).ToList (); var folderPf = project.Files.GetFileWithVirtualPath (folderRelativePath); try { if (Directory.Exists (folder.Path)) // Indirect events will remove the files from the project FileService.DeleteDirectory (folder.Path); } catch (Exception ex) { MessageService.ShowError (GettextCatalog.GetString ("The folder {0} could not be deleted from disk: {1}", folder.Path, ex.Message)); } // even if we removed the directory successfully there may still be link files // so make sure we remove all the files foreach (var f in files) project.Files.Remove (f); // also remove the folder's own ProjectFile, if it exists if (folderPf != null) project.Files.Remove (folderPf); // If it's the last item in the parent folder, make sure we keep a reference to the parent // folder, so it is not deleted from the tree. var inParentFolder = project.Files.GetFilesInVirtualPath (folderRelativePath.ParentDirectory); if (!inParentFolder.Skip (1).Any()) { project.Files.Add (new ProjectFile (folder.Path.ParentDirectory) { Subtype = Subtype.Directory, }); } projects.Add (project); } IdeApp.ProjectOperations.Save (projects); }