Esempio n. 1
0
        //edited
        private void SetDismissAllButton()
        {
            ExceptionUtility.Try(() =>
            {
                if (this.HasAccessLevelToDelete())
                {
                    if (this.NavigationItem != null)
                    {
                        this.NavigationItem.RightBarButtonItem = new UIBarButtonItem(StringLiterals.DismissAll, UIBarButtonItemStyle.Plain, (o, e) =>
                        {
                            if (this.NavigationController != null)
                            {
                                //  this.NavigationController.PopViewController(false);

                                ExceptionUtility.Try(() =>
                                {
                                    string title = StringLiterals.Alert;
                                    AlertUtility.ShowConfirmationAlert(title, StringLiterals.DismissAllAlertsConfirmationMessage(), (b) =>
                                    {
                                        if (b)
                                        {
                                            DismissAlertsConfirmed();
                                        }
                                    }, StringLiterals.YesButtonText);
                                });
                            }
                        });
                    }
                }
            });
        }
Esempio n. 2
0
        private void WaterSelectedStations(IEnumerable <PumpViewModel> pumps, int durationMinutes)
        {
            ExceptionUtility.Try(() =>
            {
                IEnumerable <string> stationNames, stationNumbers;
                this.GetSelectedStationsList(out stationNames, out stationNumbers);

                AlertUtility.ShowConfirmationAlert(StringLiterals.StartStationConfirmationTitle, StringLiterals.FormatStartStationConfirmationMessage(stationNames, stationNumbers), (b) =>
                {
                    if (b)
                    {
                        this.WaterSelectedStationsConfirmed(pumps, durationMinutes);
                    }
                }, okButtonText: StringLiterals.StartButtonText);
            });
        }
Esempio n. 3
0
        private void TestSelectedStations()
        {
            ExceptionUtility.Try(() =>
            {
                IEnumerable <string> stationNames, stationNumbers;
                this.GetSelectedStationsList(out stationNames, out stationNumbers);
                //var selectedStationIds = this.Device.Stations.Where((s) => s.Selected).Select((s) => s.Id);

                AlertUtility.ShowConfirmationAlert(StringLiterals.TestStationConfirmationTitle, StringLiterals.FormatTestStationConfirmationMessage(stationNames, stationNumbers), (b) =>
                {
                    if (b)
                    {
                        this.TestSelectedStationsConfirmed();
                    }
                }, okButtonText: StringLiterals.TestButtonText);
            });
        }
Esempio n. 4
0
 private void PrevButtonClicked()
 {
     ExceptionUtility.Try(() =>
     {
         LogUtility.LogMessage("User clicked PREV button (footer).");
         string deviceId = this.Device?.Id;
         if (!String.IsNullOrEmpty(deviceId))
         {
             AlertUtility.ShowConfirmationAlert(this._prevFeature.ProgressText, _prevFeature.PromptText, (b) =>
             {
                 if (b)
                 {
                     this.PrevConfirmed();
                 }
             }, okButtonText: _prevFeature.PromptConfirm, cancelButtonText: _prevFeature.PromptCancel);
         }
     });
 }
Esempio n. 5
0
 private void StopStartProgram(ProgramViewModel program, bool start)
 {
     ExceptionUtility.Try(() =>
     {
         string title = start ? StringLiterals.StartStationConfirmationTitle : StringLiterals.StopProgramConfirmationTitle;
         AlertUtility.ShowConfirmationAlert(title, StringLiterals.FormatStartStopProgramConfirmationMessage(start, program.Name, program.Id), (b) =>
         {
             if (b)
             {
                 StopStartProgramConfirmed(program, start);
             }
             else
             {
                 var cell = this._tableViewController.GetCell(program) as ProgramListTableViewCell;
                 if (cell != null)
                 {
                     program.Starting = false;
                     cell.LoadCellValues(program);
                 }
             }
         }, okButtonText: start?StringLiterals.Start: StringLiterals.Stop);
     });
 }
 private void StartButton_TouchUpInside(object sender, EventArgs e)
 {
     ExceptionUtility.Try(() =>
     {
         string title = _startPivot ? StringLiterals.StartStationConfirmationTitle : StringLiterals.StopProgramConfirmationTitle;
         AlertUtility.ShowConfirmationAlert(title, StringLiterals.FormatStartStopProgramConfirmationMessage(_startPivot, _programStart.Name, _programStart.Id), (b) =>
         {
             if (b)
             {
                 StopStartProgramConfirmed(_programStart, _startPivot);
             }
             else
             {
                 var cell = this.GetCell(_programStart) as ProgramListTableViewCell;
                 if (cell != null)
                 {
                     _programStart.Starting = false;
                     cell.LoadCellValues(_programStart);
                 }
             }
         }, okButtonText: _startPivot?StringLiterals.Start: StringLiterals.Stop);
     });
 }
Esempio n. 7
0
        //edited
        private void DismissAlertsConfirmed()
        {
            ExceptionUtility.Try(() =>
            {
                if (this.HasAccessLevelToDelete())
                {
                    if (String.IsNullOrEmpty(_searchBoxView.Text))
                    {
                        //var activeAlertIds = this.GetActiveAlertIds();
                        var activeAlerts = GetActiveAlert();
                        //check all the active alers have correct access with device
                        var deletingAlertsIds = CheckAlertDeletePermission(activeAlerts);

                        if (deletingAlertsIds.Count < activeAlerts.Count())
                        {
                            AlertUtility.ShowConfirmationAlert(StringLiterals.Alert, StringLiterals.ActiveAlertsNotAccessForDissmiss(), (b) =>
                            {
                                if (b)
                                {
                                    ServiceContainer.AlertService.DismissGlobalAlerts(deletingAlertsIds, onReconnect: () => { DismissAlertsConfirmed(); }).ContinueWith((r) =>
                                    {
                                        MainThreadUtility.InvokeOnMain(() =>
                                        {
                                            ProgressUtility.Dismiss();
                                        });
                                    });
                                }
                            }, StringLiterals.Dismiss);
                        }
                        else
                        {
                            ServiceContainer.AlertService.DismissGlobalAlerts(deletingAlertsIds, onReconnect: () => { DismissAlertsConfirmed(); }).ContinueWith((r) =>
                            {
                                MainThreadUtility.InvokeOnMain(() =>
                                {
                                    ProgressUtility.Dismiss();
                                });
                            });
                        }
                    }
                    else
                    {
                        //var activeAlertIds = this.GetActiveAlertIds();
                        var activeAlerts = GetActiveAlertsFromSearchList();
                        //check all the active alers have correct access with device
                        var deletingAlertsIds = CheckAlertDeletePermission(activeAlerts);

                        if (deletingAlertsIds.Count < activeAlerts.Count())
                        {
                            AlertUtility.ShowConfirmationAlert(StringLiterals.Alert, StringLiterals.ActiveAlertsNotAccessForDissmiss(), (b) =>
                            {
                                if (b)
                                {
                                    ServiceContainer.AlertService.DismissGlobalAlerts(deletingAlertsIds, onReconnect: () => { DismissAlertsConfirmed(); }).ContinueWith((r) =>
                                    {
                                        MainThreadUtility.InvokeOnMain(() =>
                                        {
                                            ProgressUtility.Dismiss();
                                        });
                                    });
                                }
                            }, StringLiterals.Dismiss);
                        }
                        else
                        {
                            ServiceContainer.AlertService.DismissGlobalAlerts(deletingAlertsIds, onReconnect: () => { DismissAlertsConfirmed(); }).ContinueWith((r) =>
                            {
                                MainThreadUtility.InvokeOnMain(() =>
                                {
                                    ProgressUtility.Dismiss();
                                });
                            });
                        }
                    }
                }
            });
        }