public async Task ExecuteSave(int index) { if (index <= 0 || index > SaveFileManager.FileCount) { return; } //上書き保存があり得るので確認を挟む。 //初セーブの場合は上書きにならないが、「次から上書きになるで」の意味で出しておく var indication = MessageIndication.ConfirmSettingFileSave(); var result = await MessageBoxWrapper.Instance.ShowAsync( indication.Title, string.Format(indication.Content, index), MessageBoxWrapper.MessageBoxStyle.OKCancel ); if (!result) { return; } _model.SaveCurrentSetting(index); //ファイルレベルの処理なので流石にスナックバーくらい出しておく(ロードとかインポート/エクスポートも同様) SnackbarWrapper.Enqueue(string.Format( LocalizedString.GetString("SettingFile_SaveCompleted"), index )); //ロードと違い、ダイアログは閉じず、代わりに更新時刻が変わった所を見に行く _ = Application.Current.Dispatcher.BeginInvoke(new Action(() => Refresh())); }
private async void OnDisableAutomationRequested() { var indication = MessageIndication.DisableAutomation(); var result = await MessageBoxWrapper.Instance.ShowAsync( indication.Title, indication.Content, MessageBoxWrapper.MessageBoxStyle.OKCancel ); if (result) { _model.IsAutomationEnabled.Value = false; } }
/// <summary> /// iFacialMocapのデータ受信をiOS機器に対してリクエストします。 /// 内部的には決め打ちのUDPメッセージを一発打つだけです。 /// </summary> /// <param name="ipAddress">IPv4でiOS機器の端末を指定したLAN内のIPアドレス。</param> public static async void SendIFacialMocapDataReceiveRequest(string ipAddress) { if (!IPAddress.TryParse(ipAddress, out var address)) { var indication = MessageIndication.InvalidIpAddress(); await MessageBoxWrapper.Instance.ShowAsync(indication.Title, indication.Content, MessageBoxWrapper.MessageBoxStyle.OK); return; } var data = Encoding.UTF8.GetBytes("iFacialMocap_sahuasouryya9218sauhuiayeta91555dy3719"); _udpClient.Send(data, data.Length, new IPEndPoint(address, 49983)); }
/// <summary> /// 確認ダイアログを出したうえで、個別カテゴリの設定をリセットします。 /// </summary> /// <param name="resetAction"></param> public static async void ResetSingleCategoryAsync(Action resetAction) { var indication = MessageIndication.ResetSingleCategoryConfirmation(); bool res = await MessageBoxWrapper.Instance.ShowAsync( indication.Title, indication.Content, MessageBoxWrapper.MessageBoxStyle.OKCancel ); if (res) { resetAction(); } }
private async Task <ProgressDialogController?> GuardSettingWindowIfNeeded() { if (SettingWindow.CurrentWindow is not SettingWindow settingWindow) { return(null); } var indication = MessageIndication.GuardSettingWindowDuringSaveLoad(); return(await settingWindow.ShowProgressAsync(indication.Title, indication.Content, settings : new MetroDialogSettings() { DialogResultOnCancel = MessageDialogResult.Negative, AnimateShow = true, AnimateHide = false, OwnerCanCloseWithDialog = true, })); }
private async void ShowMissingBlendShapeNotification() { var indication = MessageIndication.ExTrackerMissingBlendShapeNames(); var lines = MissingBlendShapeNames.Value.Split('\n').ToList(); if (lines.Count > 8) { //未定義ブレンドシェイプがあまりに多いとき、後ろを"…"で切る lines = lines.Take(8).ToList(); lines.Add("…"); } await MessageBoxWrapper.Instance.ShowAsync( indication.Title, indication.Content + string.Join("\n", lines), MessageBoxWrapper.MessageBoxStyle.OK ); }
public async Task ExecuteLoad(int index) { if (index < 0 || index > SaveFileManager.FileCount || !_model.CheckFileExist(index)) { return; } //NOTE: オートセーブのデータに関しても、ここを通るケースではスロットのファイルと同格に扱う事に注意 var indication = MessageIndication.ConfirmSettingFileLoad(); var result = await MessageBoxWrapper.Instance.ShowAsync( indication.Title, string.Format(indication.Content, index), MessageBoxWrapper.MessageBoxStyle.OKCancel ); if (!result) { return; } //NOTE: コケる事も考えられるんだけど判別がムズいんですよね… SnackbarWrapper.Enqueue(string.Format( LocalizedString.GetString("SettingFile_LoadCompleted"), index )); //NOTE: ロードが先だとVRoidのロード時にダイアログがうまく閉じないため、先に閉じる _actToClose(); _model.LoadSetting( index, LoadCharacterWhenSettingLoaded.Value, LoadNonCharacterWhenSettingLoaded.Value, false ); //NOTE: Loadでは必ず非nullのはず。ここで設定を覚えることで、次回以降もロード設定のチェックが残る if (_rootModel != null) { _rootModel.LoadCharacterWhenLoadInternalFile.Value = LoadCharacterWhenSettingLoaded.Value; _rootModel.LoadNonCharacterWhenLoadInternalFile.Value = LoadNonCharacterWhenSettingLoaded.Value; } }