/// <summary> /// 実行 /// </summary> /// <param name="message">メッセージ</param> protected override void InvokeAction(InteractionMessage message) { if (message is not PromptMessage prompt) { return; } var viewModel = new PromptViewModel { Title = prompt.Title, Description = prompt.Description, Text = prompt.Text, IsAllowEmpty = prompt.IsAllowEmpty, Validation = prompt.Validation, }; prompt.Response = null; var window = new PromptWindow { DataContext = viewModel, Owner = Window.GetWindow(this.AssociatedObject), }; if (window.ShowDialog() ?? false) { prompt.Response = viewModel.Text; } }
public async Task <PromptResult> Prompt(PromptConfig config, CancellationToken cancelToken = default) { var tcs = new TaskCompletionSource <PromptResult>(); var vm = new PromptViewModel { Title = config.Title, Message = config.Message, Value = config.CurrentValue ?? String.Empty, ValuePlaceholder = config.ValuePlaceholder ?? String.Empty, Keyboard = config.Keyboard, IsCancellable = config.IsCancellable, OkLabel = config.OkLabel ?? "OK", CancelLabel = config.CancelLabel ?? "Cancel" }; vm.Ok = PopAction(() => tcs.TrySetResult(new PromptResult(true, vm.Value.Trim()))); vm.Cancel = PopAction(() => tcs.TrySetResult(new PromptResult(true, vm.Value.Trim()))); await PopupNavigation.Instance.PushAsync(new PromptPage { BindingContext = vm }); return(await tcs.Task); }
public ActionResult Add() { var selectList = GetAllCategories(); PromptViewModel promptViewModel = new PromptViewModel() { CategoryList = selectList }; return(View("Edit", promptViewModel)); }
public ActionResult Edit(int?id) { if (id == null) { return(RedirectToAction("HttpError404", "Error")); } Prompt prompt = _prompt.GetPromptDetails(UserID, (int)id); if (prompt == null) { return(RedirectToAction("HttpError404", "Error")); } var selectList = GetAllCategories(); PromptViewModel promptViewModel = new PromptViewModel() { CategoryList = selectList, Prompt = prompt }; return(View(promptViewModel)); }