public LowHighArea(UIView mainView, AnalyzerViewController ViewController, sensorGroup analyzerSensors) { lowArea = new lowHighSensor(new CGRect(.028 * mainView.Bounds.Width, .45 * mainView.Bounds.Height, .465 * mainView.Bounds.Width, .202 * mainView.Bounds.Height), new CGRect(.028 * mainView.Bounds.Width, .652 * mainView.Bounds.Height, .465 * mainView.Bounds.Width, .25 * mainView.Bounds.Height), ViewController, analyzerSensors.viewList); lowArea.location = "low"; lowArea.undefinedText = Strings.Analyzer.LOWUNDEFINED; lowArea.Connection.Image = UIImage.FromBundle("ic_bluetooth_disconnected"); lowArea.LabelSubview.BackgroundColor = UIColor.Blue; lowArea.snapArea.BackgroundColor = UIColor.White; lowArea.snapArea.Alpha = 1f; lowArea.snapArea.UserInteractionEnabled = true; lowArea.snapArea.AccessibilityIdentifier = "low"; lowArea.snapArea.Layer.CornerRadius = 5; lowArea.LabelTop.AdjustsFontSizeToFitWidth = true; lowArea.LabelTop.Text = ""; lowArea.LabelTop.Layer.CornerRadius = 5; lowArea.LabelTop.ClipsToBounds = true; lowArea.LabelMiddle.AdjustsFontSizeToFitWidth = true; lowArea.LabelMiddle.Text = Util.Strings.Analyzer.LOWUNDEFINED; lowArea.LabelMiddle.TextAlignment = UITextAlignment.Right; lowArea.LabelBottom.AdjustsFontSizeToFitWidth = true; lowArea.LabelBottom.Text = ""; lowArea.LabelBottom.TextAlignment = UITextAlignment.Right; lowArea.LabelBottom.BackgroundColor = UIColor.Clear; lowArea.LabelSubview.AdjustsFontSizeToFitWidth = true; lowArea.LabelSubview.Text = ""; lowArea.LabelSubview.TextColor = UIColor.White; lowArea.LabelSubview.ClipsToBounds = true; lowArea.subviewTable.BackgroundColor = UIColor.Clear; lowArea.subviewTable.SeparatorStyle = UITableViewCellSeparatorStyle.None; lowArea.subviewTable.Hidden = true; lowArea.subviewTable.Source = null; lowArea.subviewHide.BackgroundColor = UIColor.Blue; lowArea.subviewHide.SetImage(null, UIControlState.Normal); lowArea.subviewHide.Hidden = true; lowArea.Connection.Image = UIImage.FromBundle("ic_bluetooth_connected"); lowArea.Connection.BackgroundColor = UIColor.Clear; lowArea.Connection.Hidden = true; lowArea.connectionColor.Layer.CornerRadius = 5; lowArea.connectionColor.Layer.BorderColor = UIColor.Black.CGColor; lowArea.connectionColor.Layer.BorderWidth = 1f; lowArea.connectionColor.Hidden = true; lowArea.subviewDivider.BackgroundColor = UIColor.Black; lowArea.headingDivider.Hidden = true; lowArea.headingDivider.BackgroundColor = UIColor.Black; lowArea.snapArea.AddSubview(lowArea.LabelTop); lowArea.snapArea.AddSubview(lowArea.LabelMiddle); lowArea.snapArea.AddSubview(lowArea.LabelBottom); lowArea.snapArea.AddSubview(lowArea.LabelSubview); lowArea.snapArea.AddSubview(lowArea.DeviceImage); lowArea.snapArea.AddSubview(lowArea.Connection); lowArea.snapArea.AddSubview(lowArea.subviewDivider); lowArea.snapArea.AddSubview(lowArea.headingDivider); lowArea.snapArea.AddSubview(lowArea.subviewHide); lowArea.snapArea.BringSubviewToFront(lowArea.headingDivider); lowArea.snapArea.AddSubview(lowArea.connectionColor); lowArea.snapArea.BringSubviewToFront(lowArea.Connection); lowArea.snapArea.AddSubview(lowArea.conDisButton); lowArea.snapArea.BringSubviewToFront(lowArea.conDisButton); lowArea.snapArea.BringSubviewToFront(lowArea.subviewDivider); highArea = new lowHighSensor(new CGRect(.507 * mainView.Bounds.Width, .45 * mainView.Bounds.Height, .465 * mainView.Bounds.Width, .202 * mainView.Bounds.Height), new CGRect(.507 * mainView.Bounds.Width, .652 * mainView.Bounds.Height, .465 * mainView.Bounds.Width, .25 * mainView.Bounds.Height), ViewController, analyzerSensors.viewList); highArea.location = "high"; highArea.undefinedText = Strings.Analyzer.HIGHUNDEFINED; highArea.Connection.Image = UIImage.FromBundle("ic_bluetooth_disconnected"); highArea.LabelSubview.BackgroundColor = UIColor.Red; highArea.snapArea.BackgroundColor = UIColor.White; highArea.snapArea.Alpha = 1f; highArea.snapArea.UserInteractionEnabled = true; highArea.snapArea.AccessibilityIdentifier = "high"; highArea.snapArea.Layer.CornerRadius = 5; highArea.LabelTop.AdjustsFontSizeToFitWidth = true; highArea.LabelTop.Text = ""; highArea.LabelTop.Layer.CornerRadius = 5; highArea.LabelTop.ClipsToBounds = true; highArea.LabelMiddle.AdjustsFontSizeToFitWidth = true; highArea.LabelMiddle.Text = Util.Strings.Analyzer.HIGHUNDEFINED; highArea.LabelMiddle.TextAlignment = UITextAlignment.Right; highArea.LabelBottom.AdjustsFontSizeToFitWidth = true; highArea.LabelBottom.Text = ""; highArea.LabelBottom.TextAlignment = UITextAlignment.Right; highArea.LabelSubview.AdjustsFontSizeToFitWidth = true; highArea.LabelSubview.Text = ""; highArea.LabelSubview.TextColor = UIColor.White; highArea.LabelSubview.ClipsToBounds = true; highArea.subviewTable.BackgroundColor = UIColor.Clear; highArea.subviewTable.SeparatorStyle = UITableViewCellSeparatorStyle.None; highArea.subviewTable.Hidden = true; highArea.subviewTable.Source = null; highArea.subviewHide.BackgroundColor = UIColor.Red; highArea.subviewHide.SetImage(null, UIControlState.Normal); highArea.subviewHide.Hidden = true; highArea.Connection.Image = UIImage.FromBundle("ic_bluetooth_connected"); highArea.Connection.Hidden = true; highArea.Connection.BackgroundColor = UIColor.Clear; highArea.connectionColor.Layer.CornerRadius = 5; highArea.connectionColor.Layer.BorderColor = UIColor.Black.CGColor; highArea.connectionColor.Layer.BorderWidth = 1f; highArea.connectionColor.Hidden = true; highArea.subviewDivider.BackgroundColor = UIColor.Black; highArea.headingDivider.Hidden = true; highArea.headingDivider.BackgroundColor = UIColor.Black; highArea.snapArea.AddSubview(highArea.LabelTop); highArea.snapArea.AddSubview(highArea.LabelMiddle); highArea.snapArea.AddSubview(highArea.LabelBottom); highArea.snapArea.AddSubview(highArea.LabelSubview); highArea.snapArea.AddSubview(highArea.DeviceImage); highArea.snapArea.AddSubview(highArea.Connection); highArea.snapArea.AddSubview(highArea.subviewDivider); highArea.snapArea.AddSubview(highArea.headingDivider); highArea.snapArea.AddSubview(highArea.subviewHide); highArea.snapArea.BringSubviewToFront(highArea.headingDivider); highArea.snapArea.AddSubview(highArea.connectionColor); highArea.snapArea.BringSubviewToFront(highArea.Connection); highArea.snapArea.AddSubview(highArea.conDisButton); highArea.snapArea.BringSubviewToFront(highArea.conDisButton); highArea.snapArea.BringSubviewToFront(highArea.subviewDivider); lowArea.hideLHUI(); highArea.hideLHUI(); }
public sensorGroup(UIView mainView, AnalyzerViewController ViewController) { ion = AppState.context; ////CREATE STATIC SENSOR LOCATIONS /// LEFT SIDE /// 4 3 /// 2 1 snapRect1 = new CGRect(.25 * mainView.Bounds.Width, .304 * mainView.Bounds.Height, .203 * mainView.Bounds.Width, .114 * mainView.Bounds.Height); snapRect2 = new CGRect(.024 * mainView.Bounds.Width, .304 * mainView.Bounds.Height, .203 * mainView.Bounds.Width, .114 * mainView.Bounds.Height); snapRect3 = new CGRect(.25 * mainView.Bounds.Width, .012 * mainView.Bounds.Height, .203 * mainView.Bounds.Width, .114 * mainView.Bounds.Height); snapRect4 = new CGRect(.024 * mainView.Bounds.Width, .012 * mainView.Bounds.Height, .203 * mainView.Bounds.Width, .114 * mainView.Bounds.Height); /// RIGHT SIDE /// 7 8 /// 5 6 snapRect5 = new CGRect(.546 * mainView.Bounds.Width, .304 * mainView.Bounds.Height, .203 * mainView.Bounds.Width, .114 * mainView.Bounds.Height); snapRect6 = new CGRect(.769 * mainView.Bounds.Width, .304 * mainView.Bounds.Height, .203 * mainView.Bounds.Width, .114 * mainView.Bounds.Height); snapRect7 = new CGRect(.546 * mainView.Bounds.Width, .012 * mainView.Bounds.Height, .203 * mainView.Bounds.Width, .114 * mainView.Bounds.Height); snapRect8 = new CGRect(.769 * mainView.Bounds.Width, .012 * mainView.Bounds.Height, .203 * mainView.Bounds.Width, .114 * mainView.Bounds.Height); ////CREATE CONSTANT POINT OF ORIGIN FOR EACH AREA /// LEFT SIDE snapPoint1 = new CGPoint(snapRect1.GetMidX(), snapRect1.GetMidY()); snapPoint2 = new CGPoint(snapRect2.GetMidX(), snapRect2.GetMidY()); snapPoint3 = new CGPoint(snapRect3.GetMidX(), snapRect3.GetMidY()); snapPoint4 = new CGPoint(snapRect4.GetMidX(), snapRect4.GetMidY()); ///RIGHT SIDE snapPoint5 = new CGPoint(snapRect5.GetMidX(), snapRect5.GetMidY()); snapPoint6 = new CGPoint(snapRect6.GetMidX(), snapRect6.GetMidY()); snapPoint7 = new CGPoint(snapRect7.GetMidX(), snapRect7.GetMidY()); snapPoint8 = new CGPoint(snapRect8.GetMidX(), snapRect8.GetMidY()); snapArea1 = new sensor(snapRect1, "1", mainView); viewList.Add(snapArea1); AddSensorGestures(snapArea1, mainView); snapArea2 = new sensor(snapRect2, "2", mainView); viewList.Add(snapArea2); AddSensorGestures(snapArea2, mainView); snapArea3 = new sensor(snapRect3, "3", mainView); viewList.Add(snapArea3); AddSensorGestures(snapArea3, mainView); snapArea4 = new sensor(snapRect4, "4", mainView); viewList.Add(snapArea4); AddSensorGestures(snapArea4, mainView); snapArea5 = new sensor(snapRect5, "5", mainView); viewList.Add(snapArea5); AddSensorGestures(snapArea5, mainView); snapArea6 = new sensor(snapRect6, "6", mainView); viewList.Add(snapArea6); AddSensorGestures(snapArea6, mainView); snapArea7 = new sensor(snapRect7, "7", mainView); viewList.Add(snapArea7); AddSensorGestures(snapArea7, mainView); snapArea8 = new sensor(snapRect8, "8", mainView); viewList.Add(snapArea8); AddSensorGestures(snapArea8, mainView); ///STORE POINT LOCATIONS AND INITIALIZE SENSOR ORDER locationList.Add(snapPoint1); locationList.Add(snapPoint2); locationList.Add(snapPoint3); locationList.Add(snapPoint4); locationList.Add(snapPoint5); locationList.Add(snapPoint6); locationList.Add(snapPoint7); locationList.Add(snapPoint8); }
// Overridden from UIViewController public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle("CarbonBackground")); viewAnalyzerContainer.Bounds = View.Bounds; viewAnalyzerContainer.BackgroundColor = UIColor.Clear; ion = AppState.context as IosION; blockerView = new UIView(viewAnalyzerContainer.Bounds); blockerView.Hidden = true; arvc = this; start = new manualEntry(); analyzerSensors = new sensorGroup(viewAnalyzerContainer, this); lowHighSensors = new LowHighArea(viewAnalyzerContainer, this, analyzerSensors); analyzerSensors.lowHighSensors = lowHighSensors; mentryView = new ManualView(viewAnalyzerContainer); mentryView.start = start; mentryView.analyzerSensors = analyzerSensors; mentryView.lowHighSensors = lowHighSensors; sactionView = new ActionView(viewAnalyzerContainer); sactionView.pactionButton.TouchUpInside += handleActionPopup; InitNavigationBar("ic_nav_analyzer", false); //webServices = ion.webServices; AutomaticallyAdjustsScrollViewInsets = false; backAction = () => { root.navigation.ToggleMenu(); }; //if(remoteMode){ // remoteTitle = new UILabel(new CGRect(0, 0, 480, 44)); // remoteTitle.BackgroundColor = UIColor.Clear; // remoteTitle.Lines = 2; // remoteTitle.Font = UIFont.BoldSystemFontOfSize(14f); // remoteTitle.ShadowColor = UIColor.FromWhiteAlpha(0.0f,.5f); // remoteTitle.TextAlignment = UITextAlignment.Center; // remoteTitle.TextColor = UIColor.Black; // remoteTitle.Text = Util.Strings.Analyzer.ANALYZERREMOTEVIEW; // this.NavigationItem.TitleView = remoteTitle; //} else { Title = Util.Strings.Analyzer.SELF; //} if (ion.currentAnalyzer.sensorList == null) { ion.currentAnalyzer.sensorList = new List <Sensor>(); } var screenshot = new UIButton(new CGRect(0, 0, 31, 30)); screenshot.TouchUpInside += (obj, args) => { TakeScreenshot(); }; screenshot.SetImage(UIImage.FromBundle("ic_camera"), UIControlState.Normal); dataRecord = new UIButton(new CGRect(0, 0, 35, 35)); dataRecord.BackgroundColor = UIColor.Clear; dataRecord.TouchDown += (sender, e) => { dataRecord.BackgroundColor = UIColor.LightGray; }; dataRecord.TouchUpOutside += (sender, e) => { dataRecord.BackgroundColor = UIColor.Black; }; dataRecord.TouchUpInside += (sender, e) => { recordDevices(); }; if (ion.dataLogManager.isRecording) { dataRecord.SetImage(UIImage.FromBundle("ic_stop"), UIControlState.Normal); } else { dataRecord.SetImage(UIImage.FromBundle("ic_record"), UIControlState.Normal); } var button = new UIBarButtonItem(dataRecord); var button2 = new UIBarButtonItem(screenshot); NavigationItem.RightBarButtonItems = new UIBarButtonItem[] { button2, button }; layoutAnalyzer(); if (UserInterfaceIdiomIsPhone) { expansion = new UIImageView(new CGRect(.46 * viewAnalyzerContainer.Bounds.Width, .023 * viewAnalyzerContainer.Bounds.Height, .044 * viewAnalyzerContainer.Bounds.Height, .044 * viewAnalyzerContainer.Bounds.Height)); compressor = new UIImageView(new CGRect(.46 * viewAnalyzerContainer.Bounds.Width, .365 * viewAnalyzerContainer.Bounds.Height, .044 * viewAnalyzerContainer.Bounds.Height, .044 * viewAnalyzerContainer.Bounds.Height)); } else { expansion = new UIImageView(new CGRect(.47 * View.Bounds.Width, .025 * View.Bounds.Height, .044 * View.Bounds.Height, .044 * View.Bounds.Height)); compressor = new UIImageView(new CGRect(.47 * View.Bounds.Width, .36 * View.Bounds.Height, .044 * View.Bounds.Height, .044 * View.Bounds.Height)); } compressor.Image = UIImage.FromBundle("ic_compressor"); expansion.Image = UIImage.FromBundle("ic_expansionchamber"); viewAnalyzerContainer.AddSubview(compressor); viewAnalyzerContainer.AddSubview(expansion); viewAnalyzerContainer.AddSubview(lowHighSensors.lowArea.snapArea); viewAnalyzerContainer.AddSubview(lowHighSensors.lowArea.subviewTable); viewAnalyzerContainer.AddSubview(lowHighSensors.highArea.snapArea); viewAnalyzerContainer.AddSubview(lowHighSensors.highArea.subviewTable); viewAnalyzerContainer.AddSubview(blockerView); viewAnalyzerContainer.AddSubview(mentryView.mView); viewAnalyzerContainer.AddSubview(sactionView.aView); //ion.onIonStateChanged += updateLogging; addSlotGestures(); }
public lowHighSensor(CGRect areaRect, CGRect tblRect, AnalyzerViewController ViewController, List <sensor> viewList, List <int> areaList = null) { sensorList = viewList; locationList = areaList; snapArea = new UIView(areaRect); this.areaRect = areaRect; cellHeight = 72; subviewTable = new UITableView(tblRect); subviewTable.Bounces = false; LabelTop = new UILabel(new CGRect(0, 0, .859 * areaRect.Width, .217 * areaRect.Height)); LabelMiddle = new UILabel(new CGRect(.214 * areaRect.Width, .217 * areaRect.Height, .686 * areaRect.Width, .347 * areaRect.Height)); LabelBottom = new UILabel(new CGRect(0, .565 * areaRect.Height, areaRect.Width, .217 * areaRect.Height)); LabelSubview = new UILabel(new CGRect(0, .8 * areaRect.Height, .8 * snapArea.Bounds.Width, .204 * areaRect.Height)); LabelSubview.ClipsToBounds = true; subviewHide = new UIButton(new CGRect(.791 * snapArea.Bounds.Width, .8 * areaRect.Height, .209 * snapArea.Bounds.Width, .203 * areaRect.Height)); subviewHide.ClipsToBounds = true; subviewDivider = new UIView(new CGRect(0, .8 * areaRect.Height, areaRect.Width, 2)); headingDivider = new UIView(new CGRect(.033 * areaRect.Width, .234 * areaRect.Height, .932 * areaRect.Width, 1)); connectionColor = new UIView(new CGRect(.838 * areaRect.Width, .017 * areaRect.Height, .14 * areaRect.Width, .217 * areaRect.Height)); connectionColor.BackgroundColor = UIColor.Red; Connection = new UIImageView(new CGRect(.838 * areaRect.Width, .017 * areaRect.Height, .14 * areaRect.Width, .217 * areaRect.Height)); Connection.BackgroundColor = UIColor.Clear; activityConnectStatus = new UIActivityIndicatorView(new CGRect(.838 * areaRect.Width, .017 * areaRect.Height, .14 * areaRect.Width, .217 * areaRect.Height)); activityConnectStatus.Hidden = true; conDisButton = new UIButton(new CGRect(.838 * areaRect.Width, .017 * areaRect.Height, .14 * areaRect.Width, .217 * areaRect.Height)); conDisButton.BackgroundColor = UIColor.Clear; DeviceImage = new UIImageView(new CGRect(0, .3 * areaRect.Height, .214 * areaRect.Width, .214 * areaRect.Width)); subviewTable.RegisterClassForCellReuse(typeof(maximumTableCell), "Maximum"); subviewTable.RegisterClassForCellReuse(typeof(minimumTableCell), "Minimum"); subviewTable.RegisterClassForCellReuse(typeof(holdTableCell), "Hold"); subviewTable.RegisterClassForCellReuse(typeof(altTableCell), "Alternate"); subviewTable.RegisterClassForCellReuse(typeof(RoCTableCell), "Rate"); subviewTable.RegisterClassForCellReuse(typeof(SHSCTableCell), "Superheat"); subviewTable.RegisterClassForCellReuse(typeof(PTTableCell), "Pressure"); subviewTable.RegisterClassForCellReuse(typeof(secondarySensorCell), "Linked"); maxReading = new UILabel(new CGRect(.2 * tblRect.Width, .5 * cellHeight, .79 * tblRect.Width, .5 * cellHeight)); minReading = new UILabel(new CGRect(.2 * tblRect.Width, .5 * cellHeight, .79 * tblRect.Width, .5 * cellHeight)); holdReading = new UILabel(new CGRect(.2 * tblRect.Width, .5 * cellHeight, .79 * tblRect.Width, .5 * cellHeight)); shReading = new UILabel(new CGRect(.5 * tblRect.Width, .5 * cellHeight, .5 * tblRect.Width, .5 * cellHeight)); shFluidType = new UILabel(new CGRect(0, .5 * cellHeight, .5 * tblRect.Width, .5 * cellHeight)); shFluidType.Layer.BorderColor = UIColor.Black.CGColor; shFluidType.Layer.BorderWidth = 1f; shFluidState = new UILabel(new CGRect(0, 0, 1.006 * tblRect.Width, .5 * cellHeight)); shFluidState.TextAlignment = UITextAlignment.Center; shFluidState.TextColor = UIColor.White; shFluidState.BackgroundColor = UIColor.Black; ptFluidState = new UILabel(new CGRect(0, 0, 1.006 * tblRect.Width, .5 * cellHeight)); ptFluidState.TextAlignment = UITextAlignment.Center; ptFluidState.TextColor = UIColor.White; ptFluidState.BackgroundColor = UIColor.Black; ptFluidState.Text = "PTDew"; changeFluid = new UIButton(new CGRect(0, .5 * cellHeight, tblRect.Width, .5 * cellHeight)); changeFluid.Layer.BorderColor = UIColor.Black.CGColor; changeFluid.Layer.BorderWidth = 1f; changeFluid.BackgroundColor = UIColor.Clear; ptReading = new UILabel(new CGRect(.5 * tblRect.Width, .5 * cellHeight, .5 * tblRect.Width, .5 * cellHeight)); ptFluidType = new UILabel(new CGRect(0, .5 * cellHeight, .5 * tblRect.Width, .5 * cellHeight)); changePTFluid = new UIButton(new CGRect(0, .5 * cellHeight, tblRect.Width, .5 * cellHeight)); changePTFluid.Layer.BorderColor = UIColor.Black.CGColor; changePTFluid.Layer.BorderWidth = 1f; changePTFluid.BackgroundColor = UIColor.Clear; altReading = new UILabel(new CGRect(0, .5 * cellHeight, .99 * tblRect.Width, .5 * cellHeight)); rocReading = new UILabel(new CGRect(.2 * tblRect.Width, 36, .79 * tblRect.Width, 36)); rocReading.AdjustsFontSizeToFitWidth = true; rocImage = new UIImageView(new CGRect(0, 36, 36, 36)); secondaryReading = new UILabel(new CGRect(0, .5 * cellHeight, tblRect.Width, .5 * cellHeight)); ion = AppState.context as IosION; __analyzerviewcontroller = ViewController; tUnit = Units.Temperature.FAHRENHEIT; pUnit = Units.Pressure.PSIG; maxType = "hold"; minType = "hold"; holdType = "hold"; isManual = false; isLinked = false; conDisButton.TouchUpInside += delegate { if (currentSensor != null) { if (activityConnectStatus != null) { activityConnectStatus.StopAnimating(); activityConnectStatus = null; } activityConnectStatus = new UIActivityIndicatorView(new CGRect(.867 * snapArea.Bounds.Width, .035 * snapArea.Bounds.Height, .103 * snapArea.Bounds.Width, .179 * snapArea.Bounds.Height)); snapArea.AddSubview(activityConnectStatus); if (currentSensor.device.isConnected) { connectionSpinner(1); } else { connectionSpinner(2); } } }; subviewHide.TouchUpInside += delegate { if (currentSensor.sensorProperties.Count > 0) { if (subviewTable.Hidden) { subviewHide.SetImage(UIImage.FromBundle("ic_arrow_downwhite"), UIControlState.Normal); subviewTable.Hidden = false; } else { subviewHide.SetImage(UIImage.FromBundle("ic_arrow_upwhite"), UIControlState.Normal); subviewTable.Hidden = true; } } }; changeFluid.TouchUpInside += openSHSC; changePTFluid.TouchUpInside += openPTC; ion.locationManager.onLocationChanged += OnLocationChanged; }