private void OnCategorySelected(SelectZeroOrOne <Category> f) { if (SelectZeroOrOneModule.hasChanges(f)) { if (f.CurrentChoice.IsNone()) { var chooseUncategorized = FormMessage.ChooseCategoryUncategorized; var modeIsChoose = FormMessage.CategoryModeChooseExisting; var clearNew = FormMessage.NewNewCategoryName(TextBoxMessage.NewTypeText("")); var newLoseFocus = FormMessage.NewNewCategoryName(TextBoxMessage.LoseFocus); var trans = FormMessage.NewTransaction(new List <FormMessage> { modeIsChoose, chooseUncategorized, clearNew, newLoseFocus }); Process(trans); } else { // should not serialize guid? var categoryGuid = f.CurrentChoice.Value.CategoryId.Item; var chooseSomeCat = FormMessage.NewChooseCategory(categoryGuid); var modeIsChoose = FormMessage.CategoryModeChooseExisting; var trans = FormMessage.NewTransaction(new List <FormMessage> { modeIsChoose, chooseSomeCat }); Process(trans); } } }
private void OnStoresSelected(SelectMany <Store> f) { if (SelectManyModule.hasChanges(f)) { var msg = FormMessage.NewStoresSetAllAvailability(f.Selected); Process(msg); } }
private void OnPostponeSelected(int?d) { if (d is int days) { Process(FormMessage.NewPostponeSet(days)); } else { Process(FormMessage.PostponeClear); } }
protected void OnQuantityFocusOut() => Process(FormMessage.NewQuantity(TextBoxMessage.LoseFocus));
protected void OnQuantityChange(string s) => Process(FormMessage.NewQuantity(TextBoxMessage.NewTypeText(s)));
protected void OnNoteFocusOut() => Process(FormMessage.NewNote(TextBoxMessage.LoseFocus));
protected void OnNoteChange(string s) => Process(FormMessage.NewNote(TextBoxMessage.NewTypeText(s)));
protected void OnItemNameFocusOut(FocusEventArgs e) => Process(FormMessage.NewItemName(TextBoxMessage.LoseFocus));
protected void OnItemNameChange(ChangeEventArgs e) => Process(FormMessage.NewItemName(TextBoxMessage.NewTypeText((string)e.Value)));
private void Process(FormMessage msg) => OnItemFormMessage.InvokeAsync(msg);
protected async Task OnFormMessage(FormMessage message) { var pageMessage = PageMessage.NewItemEditFormMessage(message); var stateMessage = StateMessage.NewItemEditPageMessage(pageMessage); await StateService.UpdateAsync(stateMessage); }