public ThesisViewModel(NavigationService navigationService, Thesis thesis, string pageTitle = "Edycja pracy dyplomowej") : this(thesis, pageTitle) { _navigationService = navigationService; DeleteThesis = new ActionCommand(() => Delete()); SaveThesis = new ActionCommand(() => Save()); NavigateBackCommand = new NavigateCommand <ThesesViewModel>(_navigationService, () => new ThesesViewModel(_navigationService)); ShowThesisLiteratureCommand = new NavigateCommand <LiteraturesViewModel>(_navigationService, () => new LiteraturesViewModel(_navigationService, Thesis.Literatures, $"Literatura dla {Thesis.Topic}")); ChangeBackMenuCommand = new ChangeMenuCommand <MenuViewModel>(_navigationService, () => new MenuViewModel(_navigationService)); }
/// <summary> /// Executes the change menu command. /// </summary> /// <returns>The change menu command.</returns> private async Task ExecuteChangeMenuCommand() { if (IsBusy) { return; } IsBusy = true; ChangeMenuCommand.ChangeCanExecute(); Page.ShowProgressIndicator(); try { if (haccpService.IsConnected() == false) { IsBusy = false; Page.DismissPopup(); Page.DisplayAlertMessage(HACCPUtil.GetResourceString("EnableNetworkConnection"), HACCPUtil.GetResourceString( "YourequireanactiveInternetconnectiontoperformsomefunctionsWerecommendthatyouenableWiFiforthispurposeDatachargesmayapplyifWiFiisnotenabled")); return; } if (HaccpAppSettings.SharedInstance.SiteSettings.SiteId > 0) { var res = await haccpService.DownloadMenus(); if (res.IsSuccess) { var menuLists = (IList <Menu>)res.Results; if (menuLists.Count > 0) { if (!pendingTemperatureRecordsToUpload) { object isMenu = true; isBackNavigation = false; await Page.NavigateToWithSelectedObject(PageEnum.MenuChecklist, true, isMenu); } else { IsBusy = false; Page.DismissPopup(); await Page.ShowAlert(string.Empty, HACCPUtil.GetResourceString( "CannotchangetheMenuasrecordsarependingtobeuploadedTouploadtherecordsselectUploadRecordsundertheWirelessTasksmenu")); } } } else { IsBusy = false; Page.DismissPopup(); await Page.ShowAlert("", res.Message); } } else { IsBusy = false; Page.DismissPopup(); await Page.ShowAlert(HACCPUtil.GetResourceString("NoSiteInformationFound"), HACCPUtil.GetResourceString( "NositeinformationsfoundPleasetapUpdateSiteandSettingsintheWirelessTasksmenu")); } } catch (Exception ex) { Debug.WriteLine("Ooops! Something went wrong while select menu. Exception: {0}", ex); } finally { IsBusy = false; Page.DismissPopup(); ChangeMenuCommand.ChangeCanExecute(); } }
/// <summary> /// Raises the login changed event. /// </summary> protected override void OnLoginChanged() { base.OnLoginChanged(); ChangeMenuCommand.ChangeCanExecute(); ChangeCheckListCommand.ChangeCanExecute(); }