/// <summary> /// Process an item command /// </summary> /// <param name="itemCommand"></param> private async Task OnItemCommand(ItemCommand itemCommand) { if (itemCommand.Id == new Guid("0db8f80d-0ea8-4cbf-80ba-b37cab739391")) { var jsonEditorPage = new JsonEditorPage(Container); jsonEditorPage.ViewModel.ItemId = itemCommand.ItemId.ToString(); jsonEditorPage.ViewModel.PreLoad = true; jsonEditorPage.Disappearing += (disSender, disE) => { MessageService.Send(new WorldReadLocationSummaryRequest() { }); }; await Page.Navigation.PushModalAsync(jsonEditorPage); } else { var useRequest = new CoreUseItemRequest() { ItemId = itemCommand.ItemId, Use = itemCommand }; var result = await MessageService.SendRequestAsync <CoreUseItemResponse>(useRequest); if (!result.IsSuccess()) { throw new BeforeOurTimeException(result._responseMessage); } } }
/// <summary> /// Perform an admin command /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public async Task OnSelectedIndexChanged(object sender, EventArgs e) { try { if (Selected == "Edit Location") { var itemId = VMLocation.Item.Id; var jsonEditorPage = new JsonEditorPage(Container); jsonEditorPage.ViewModel.ItemId = itemId.ToString(); jsonEditorPage.ViewModel.PreLoad = true; jsonEditorPage.Disappearing += (disSender, disE) => { MessageService.Send(new WorldReadLocationSummaryRequest() { }); }; await Page.Navigation.PushModalAsync(jsonEditorPage); } else if (Selected == "Create Location") { await CreateFromCurrentLocation(); MessageService.Send(new WorldReadLocationSummaryRequest() { }); } else if (Selected == "Create Item") { await CreateGenericItem(); MessageService.Send(new WorldReadLocationSummaryRequest() { }); } Selected = null; } catch (Exception ex) { await Page.DisplayAlert("Error", ex.Message, "Ok"); } }