コード例 #1
0
        /// <summary>
        /// EVENT FUNCTION FOR ACTION POPUP FOR SINGLE SENSOR
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        void handleActionPopup(object sender, EventArgs e)
        {
            UIAlertController addDeviceSheet;

            addDeviceSheet = UIAlertController.Create(Util.Strings.Analyzer.DEVICEACTIONS, "", UIAlertControllerStyle.Alert);

            UIPopoverPresentationController presentationPopover = addDeviceSheet.PopoverPresentationController;

            if (presentationPopover != null)
            {
                presentationPopover.SourceView = this.View;
                presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Right;
            }
            if (sensorActions.pressedSensor.isManual.Equals(false))
            {
                addDeviceSheet.AddAction(UIAlertAction.Create(Util.Strings.Alarms.SELF, UIAlertActionStyle.Default, (action) => {
                    alarmRequestViewer(sensorActions);
                }));
            }
            addDeviceSheet.AddAction(UIAlertAction.Create(Util.Strings.RENAME, UIAlertActionStyle.Default, (action) => {
                renamePopup();
            }));
            addDeviceSheet.AddAction(UIAlertAction.Create(Util.Strings.Analyzer.REMOVESENSOR, UIAlertActionStyle.Default, (action) => {
                AnalyserUtilities.RemoveDevice(sensorActions, lowHighSensors, analyzerSensors, ion.currentAnalyzer.sensorList);
                blockerView.Hidden       = true;
                sactionView.aView.Hidden = true;
            }));

            addDeviceSheet.AddAction(UIAlertAction.Create(Util.Strings.CANCEL, UIAlertActionStyle.Cancel, (action) => { Console.WriteLine("Cancel Action"); blockerView.Hidden = true; }));
            this.View.Window.RootViewController.PresentViewController(addDeviceSheet, true, null);
        }
コード例 #2
0
        /// <summary>
        /// POPUP TO DETERMINE LOW/HIGH AREA ACTIONS
        /// </summary>
        /// <param name="pressedArea">LOCATION OF SENSOR</param>
        public void ShowPopup(UIView pressedArea, lowHighSensor lowHighArea, sensor associatedSensor)
        {
            UIAlertController addDeviceSheet;

            ///LOW/HIGH AREA IS ASSOCIATED WITH A SINGLE SENSOR ALREADY

            addDeviceSheet = UIAlertController.Create(Util.Strings.Analyzer.ADDFROM, "", UIAlertControllerStyle.Alert);

            if (lowHighArea.snapArea.AccessibilityIdentifier == "low" || lowHighArea.snapArea.AccessibilityIdentifier == "high")
            {
                addDeviceSheet.AddAction(UIAlertAction.Create(Util.Strings.Device.Manager.SELF, UIAlertActionStyle.Default, (action) => {
                    if ((lowHighArea.snapArea.AccessibilityIdentifier == "low" && ion.currentAnalyzer.IsSideFull(ESide.Low)) || (lowHighArea.snapArea.AccessibilityIdentifier == "high" && ion.currentAnalyzer.IsSideFull(ESide.High)))
                    {
                        showFullAlert();
                    }
                    else
                    {
                        Console.WriteLine("Low high pressed");
                        lhOnRequestViewer(lowHighArea);
                    }
                }));

                addDeviceSheet.AddAction(UIAlertAction.Create(Util.Strings.Analyzer.CREATEMANUAL, UIAlertActionStyle.Default, (action) => {
                    if ((lowHighArea.snapArea.AccessibilityIdentifier == "low" && ion.currentAnalyzer.IsSideFull(ESide.Low)) || (lowHighArea.snapArea.AccessibilityIdentifier == "high" && ion.currentAnalyzer.IsSideFull(ESide.High)))
                    {
                        showFullAlert();
                    }
                    else
                    {
                        //start = new manualEntry();
                        start.pressedView  = pressedArea;
                        start.topLabel     = lowHighArea.LabelTop;
                        start.middleLabel  = lowHighArea.LabelMiddle;
                        start.bottomLabel  = lowHighArea.LabelBottom;
                        start.subviewLabel = lowHighArea.LabelSubview;
                        mentryView.mView.AccessibilityIdentifier = "Pressure";
                        mentryView.setDoneAction();
                        mentryView.isManual     = true;
                        mentryView.mView.Hidden = false;
                    }
                }));
            }
            else
            {
                addDeviceSheet = UIAlertController.Create(lowHighArea.LabelTop.Text + " " + Util.Strings.ACTIONS, "", UIAlertControllerStyle.Alert);
                if (associatedSensor.currentSensor != null && !associatedSensor.currentSensor.device.isConnected)
                {
                    addDeviceSheet.AddAction(UIAlertAction.Create(Strings.Device.RECONNECT.FromResources(), UIAlertActionStyle.Default, (action) => {
                        lowHighSensors.lowArea.connectionSpinner(2);
                    }));
                }

                addDeviceSheet.AddAction(UIAlertAction.Create(Util.Strings.Analyzer.ADDSUBVIEW, UIAlertActionStyle.Default, (action) => {
                    AnalyserUtilities.subviewOptionChosen(lowHighArea);
                }));

                if (!lowHighArea.isManual)
                {
                    addDeviceSheet.AddAction(UIAlertAction.Create(Util.Strings.Alarms.SELF, UIAlertActionStyle.Default, (action) => {
                        AnalyserUtilities.alarmRequestViewer(associatedSensor);
                    }));
                }
                addDeviceSheet.AddAction(UIAlertAction.Create(Util.Strings.Analyzer.REMOVESENSOR, UIAlertActionStyle.Default, (action) => {
                    var attached = AnalyserUtilities.RemoveDevice(associatedSensor, lowHighSensors);
                    Console.WriteLine("attached was: " + attached);
                    if (attached == "low")
                    {
                        for (int i = 0; i < 4; i++)
                        {
                            analyzerSensors.viewList[i].topLabel.BackgroundColor = UIColor.White;
                            analyzerSensors.viewList[i].topLabel.TextColor       = UIColor.Gray;
                        }
                    }
                    else if (attached == "high")
                    {
                        for (int i = 4; i < 8; i++)
                        {
                            analyzerSensors.viewList[i].topLabel.BackgroundColor = UIColor.White;
                            analyzerSensors.viewList[i].topLabel.TextColor       = UIColor.Gray;
                        }
                    }
                }));

                if (associatedSensor.currentSensor != null && associatedSensor.currentSensor.device.isConnected)
                {
                    addDeviceSheet.AddAction(UIAlertAction.Create(Strings.Device.DISCONNECT.FromResources(), UIAlertActionStyle.Default, (action) => {
                        lowHighSensors.lowArea.connectionSpinner(1);
                    }));
                }

                addDeviceSheet.AddAction(UIAlertAction.Create(Util.Strings.RENAME, UIAlertActionStyle.Default, (action) => {
                    AnalyserUtilities.renamePopup(associatedSensor, lowHighArea);
                }));
            }

            addDeviceSheet.AddAction(UIAlertAction.Create(Util.Strings.CANCEL, UIAlertActionStyle.Cancel, (action) => {}));

            this.View.Window.RootViewController.PresentViewController(addDeviceSheet, true, null);
        }