コード例 #1
0
        /// <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();
            }
        }
コード例 #2
0
 /// <summary>
 ///     Raises the login changed event.
 /// </summary>
 protected override void OnLoginChanged()
 {
     base.OnLoginChanged();
     ChangeMenuCommand.ChangeCanExecute();
     ChangeCheckListCommand.ChangeCanExecute();
 }