Exemplo n.º 1
0
        /// <summary>
        ///     Executes the change check list command.
        /// </summary>
        /// <returns>The change check list command.</returns>
        private async Task ExecuteChangeCheckListCommand()
        {
            if (IsBusy)
            {
                return;
            }
            IsBusy = true;
            ChangeCheckListCommand.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.DownloadChecklists();

                    if (res.IsSuccess)
                    {
                        if (!pendingCheckListToUpload)
                        {
                            object isMenu = false;
                            isBackNavigation = false;
                            await Page.NavigateToWithSelectedObject(PageEnum.MenuChecklist, true, isMenu);
                        }
                        else
                        {
                            IsBusy = false;
                            Page.DismissPopup();
                            await
                            Page.ShowAlert(string.Empty,
                                           HACCPUtil.GetResourceString(
                                               "CannotchangetheChecklistasrecordsarependingtobeuploadedTouploadtherecordsselectUploadRecordsundertheWirelessTasksmenu"));
                        }
                    }
                    else
                    {
                        IsBusy = false;
                        Page.DismissPopup();
                        await Page.ShowAlert(string.Empty, 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 check list. Exception: {0}", ex);
            }
            finally
            {
                IsBusy = false;
                Page.DismissPopup();
                ChangeCheckListCommand.ChangeCanExecute();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 ///     Raises the login changed event.
 /// </summary>
 protected override void OnLoginChanged()
 {
     base.OnLoginChanged();
     ChangeMenuCommand.ChangeCanExecute();
     ChangeCheckListCommand.ChangeCanExecute();
 }