Ejemplo n.º 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle("CarbonBackground"));
            InitNavigationBar("ic_nav_workbench", false);
            backAction = () => {
                root.navigation.ToggleMenu();
            };
            Title = Util.Strings.Remote.APPIONPORTAL;

            ion      = AppState.context as IosION;
            wc       = new WebClient();
            wc.Proxy = null;

            var button = new UIButton(new CGRect(0, 0, 40, 40));

            button.SetImage(UIImage.FromBundle("ic_settings"), UIControlState.Normal);
            button.BackgroundColor = UIColor.Clear;
            button.TouchUpInside  += flipAccountViews;
            settingsButton         = new UIBarButtonItem(button);

            var button2 = new UIButton(new CGRect(0, 0, 70, 30));

            button2.SetTitle("Register", UIControlState.Normal);
            button2.SetTitleColor(UIColor.Black, UIControlState.Normal);
            button2.BackgroundColor = UIColor.Clear;
            //button2.Layer.BorderWidth = 1f;
            button2.TouchDown      += (sender, e) => { button.BackgroundColor = UIColor.Blue; };
            button2.TouchUpOutside += (sender, e) => { button.BackgroundColor = UIColor.Clear; };
            button2.TouchUpInside  += (sender, e) => { button.BackgroundColor = UIColor.Clear; };
            button2.TouchUpInside  += (sender, e) => { userRegistrationSetup(); };
            register = new UIBarButtonItem(button2);

            setupInitialView();
        }
Ejemplo n.º 2
0
 public RemoteAccessTableSource(List <ConnectionData> accessItems, ObservableCollection <ConnectionData> selected)
 {
     tableItems   = accessItems;
     selectedUser = selected;
     ion          = AppState.context as IosION;
     tableItems.Sort((x, y) => y.isUserOnline.CompareTo(x.isUserOnline));
 }
Ejemplo n.º 3
0
        public AccessSettings(UIView parentView)
        {
            ion = AppState.context as IosION;

            settingsView = new UIView(new CGRect(0, 0, parentView.Bounds.Width, parentView.Bounds.Height));
            settingsView.BackgroundColor = UIColor.White;
            //settingsView.Hidden = true;
            selectedSessions = new ObservableCollection <int>();

            selectedSessions.CollectionChanged += checkForSelected;
            cellHeight = .07f * settingsView.Bounds.Height;

            uploadHeader = new UILabel(new CGRect(0, 0, settingsView.Bounds.Width, .1 * settingsView.Bounds.Height));
            uploadHeader.BackgroundColor = UIColor.Black;
            uploadHeader.TextAlignment   = UITextAlignment.Center;
            uploadHeader.Text            = "Session List";
            uploadHeader.TextColor       = UIColor.FromRGB(255, 215, 101);

            sessionTable = new UITableView(new CGRect(.05 * settingsView.Bounds.Width, .12 * settingsView.Bounds.Height, .9 * settingsView.Bounds.Width, .65 * settingsView.Bounds.Height));
            sessionTable.RegisterClassForCellReuse(typeof(SessionCell), "sessionCell");
            sessionTable.BackgroundColor    = UIColor.Clear;
            sessionTable.SeparatorStyle     = UITableViewCellSeparatorStyle.None;
            sessionTable.EstimatedRowHeight = 0;
            sessionTable.Layer.BorderWidth  = 1f;

            refreshSessions = new UIRefreshControl();
            refreshSessions.ValueChanged += (sender, e) => {
                if (!ion.dataLogManager.isRecording)
                {
                    ReloadAllSessions();
                }
            };

            sessionTable.InsertSubview(refreshSessions, 0);
            sessionTable.SendSubviewToBack(refreshSessions);

            sessionButton = new UIButton(new CGRect(.25 * settingsView.Bounds.Width, .85 * settingsView.Bounds.Height, .5 * settingsView.Bounds.Width, .1 * settingsView.Bounds.Height));
            sessionButton.SetTitle("Upload Session", UIControlState.Normal);
            sessionButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            sessionButton.Layer.BorderWidth  = 1f;
            sessionButton.Layer.CornerRadius = 5f;
            sessionButton.BackgroundColor    = UIColor.FromRGB(255, 215, 101);
            sessionButton.Enabled            = false;
            sessionButton.Alpha           = .6f;
            sessionButton.TouchDown      += (sender, e) => { sessionButton.BackgroundColor = UIColor.Blue; };
            sessionButton.TouchUpOutside += (sender, e) => { sessionButton.BackgroundColor = UIColor.FromRGB(255, 215, 101); };
            sessionButton.TouchUpInside  += startUpload;

            settingsView.AddSubview(sessionTable);
            settingsView.AddSubview(sessionButton);
            settingsView.AddSubview(uploadHeader);
            refreshSessions.SendActionForControlEvents(UIControlEvent.ValueChanged);
        }
        public void makeCellData(double cellWidth, double cellHeight, ConnectionData user)
        {
            ion = AppState.context as IosION;

            var currentlyViewing = NSUserDefaults.StandardUserDefaults.StringForKey("viewedUser");

            header = new UILabel(new CGRect(0, 0, .5 * cellWidth, .5 * cellHeight));
            header.TextAlignment             = UITextAlignment.Left;
            header.AdjustsFontSizeToFitWidth = true;

            deviceInfo      = new UILabel(new CGRect(0, .5 * cellHeight, .5 * cellWidth, .5 * cellHeight));
            deviceInfo.Font = UIFont.ItalicSystemFontOfSize(18f);
            deviceInfo.Text = user.deviceName;
            deviceInfo.AdjustsFontSizeToFitWidth = true;

            status = new UILabel(new CGRect(.5 * cellWidth, 0, .3 * cellWidth, cellHeight));
            status.TextAlignment             = UITextAlignment.Left;
            status.TextColor                 = UIColor.FromRGB(49, 111, 18);
            status.AdjustsFontSizeToFitWidth = true;

            header.Text = " " + user.displayName;

            if (Convert.ToInt32(KeychainAccess.ValueForKey("userID")) == user.id)
            {
                header.Text = " Your Account";
                if (ion is RemoteIosION && UIDevice.CurrentDevice.IdentifierForVendor.ToString() == user.deviceId)
                {
                    status.TextColor = UIColor.Red;
                    status.Text      = "Uploading";
                }
                else
                {
                    status.Text = "Viewable";
                }
            }
            else if (ion is RemoteIosION && !String.IsNullOrEmpty(currentlyViewing) && currentlyViewing == user.id.ToString())
            {
                status.Text     += "Viewing";
                status.TextColor = UIColor.Blue;
            }
            else
            {
                if (user.isUserOnline)
                {
                    status.Text += "Viewable";
                }
            }

            this.AddSubview(header);
            this.AddSubview(deviceInfo);
            this.AddSubview(status);
        }
Ejemplo n.º 5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle("CarbonBackground"));

            ion = AppState.context as IosION;

            ///////THIS BUTTON WILL BEGIN UPLOADING A USER'S LAYOUT AND THEN BE REPLACED BY THE SECOND BUTTON
            startButton = new UIButton(new CGRect(0, 0, 120, 30));
            startButton.SetTitle("Start Upload", UIControlState.Normal);
            startButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            startButton.BackgroundColor = UIColor.Clear;



            ///////THIS BUTTON WILL STOP UPLOADING A USER'S LAYOUT AND THEN BE REPLACED BY THE FIRST BUTTON
            stopButton = new UIButton(new CGRect(0, 0, 120, 30));
            stopButton.SetTitle("Stop Upload", UIControlState.Normal);
            stopButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            stopButton.BackgroundColor = UIColor.Clear;

            startButton.TouchDown      += (sender, e) => { startButton.BackgroundColor = UIColor.Blue; };
            startButton.TouchUpOutside += (sender, e) => { startButton.BackgroundColor = UIColor.Clear; };
            startButton.TouchUpInside  += (sender, e) => { startButton.BackgroundColor = UIColor.Clear; selectionView.remoteMenuButton.Enabled = false; };
            startButton.TouchUpInside  += (sender, e) => { startUploadStatus(); };

            stopButton.TouchDown      += (sender, e) => { stopButton.BackgroundColor = UIColor.Blue; };
            stopButton.TouchUpOutside += (sender, e) => { stopButton.BackgroundColor = UIColor.Clear; };
            stopButton.TouchUpInside  += (sender, e) => { stopButton.BackgroundColor = UIColor.Clear; selectionView.remoteMenuButton.Enabled = true; };
            stopButton.TouchUpInside  += (sender, e) => { stopUploadStatus(); };

            if (ion is RemoteIosION)
            {
                uploadButton = new UIBarButtonItem(stopButton);
            }
            else
            {
                uploadButton = new UIBarButtonItem(startButton);
            }

            this.NavigationItem.RightBarButtonItem = uploadButton;

            setupInitialView();
        }
Ejemplo n.º 6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle("CarbonBackground"));
            InitNavigationBar("ic_nav_workbench", false);
            backAction = () => {
                root.navigation.ToggleMenu();
            };
            ion = AppState.context as IosION;
            NavigationItem.Title = Strings.AccessManager.SELF.FromResources();

            var button = new UIButton(new CGRect(0, 0, 40, 40));

            button.SetImage(UIImage.FromBundle("ic_settings"), UIControlState.Normal);
            button.TouchUpInside += SetupAccessView;
            settingsButton        = new UIBarButtonItem(button);

            this.NavigationItem.RightBarButtonItem = settingsButton;

            loggedOutLabel = new UILabel(new CGRect(0, 0, View.Bounds.Width, View.Bounds.Height));
            loggedOutLabel.TextAlignment = UITextAlignment.Center;
            loggedOutLabel.Text          = "Must Log In To Use Manager";
            loggedOutLabel.Lines         = 0;
            loggedOutLabel.Hidden        = true;
            accessHolderView.Bounds      = View.Bounds;

            requestManager  = new AccessRequestManager(accessHolderView);
            settingsManager = new AccessSettings(accessHolderView);

            if (string.IsNullOrEmpty(KeychainAccess.ValueForKey("userID")))
            {
                requestManager.accessView.Hidden       = true;
                this.NavigationItem.RightBarButtonItem = null;
            }
            accessHolderView.AddSubview(requestManager.accessView);
            accessHolderView.AddSubview(settingsManager.settingsView);
            accessHolderView.AddSubview(loggedOutLabel);
        }
 public VibrateAlarmAlert(IAlarm alarm, IosION ion) : base(alarm)
 {
     this.ion = ion;
 }
Ejemplo n.º 8
0
        public AccessUsers(UIView parentView)
        {
            ion = AppState.context as IosION;

            accessView = new UIView(new CGRect(0, 0, parentView.Bounds.Width, parentView.Bounds.Height));
            accessView.BackgroundColor = UIColor.White;

            allowedHeader = new UILabel(new CGRect(.05 * parentView.Bounds.Width, 0, .9 * parentView.Bounds.Width, .05 * parentView.Bounds.Height));
            allowedHeader.AdjustsFontSizeToFitWidth = true;
            allowedHeader.Font            = UIFont.BoldSystemFontOfSize(20);
            allowedHeader.TextAlignment   = UITextAlignment.Center;
            allowedHeader.BackgroundColor = UIColor.Black;
            allowedHeader.TextColor       = UIColor.FromRGB(255, 215, 101);
            allowedHeader.Text            = "Following";

            viewingTable = new UITableView(new CGRect(.05 * parentView.Bounds.Width, .05 * parentView.Bounds.Height, .9 * parentView.Bounds.Width, .4 * parentView.Bounds.Height));
            viewingTable.Layer.BorderWidth = 1f;
            viewingTable.SeparatorStyle    = UITableViewCellSeparatorStyle.None;
            viewingTable.RegisterClassForCellReuse(typeof(ViewingUserCell), "viewingCell");

            grantedHeader      = new UILabel(new CGRect(.05 * parentView.Bounds.Width, .5 * parentView.Bounds.Height, .9 * parentView.Bounds.Width, .05 * parentView.Bounds.Height));
            grantedHeader.Font = UIFont.BoldSystemFontOfSize(20);
            grantedHeader.AdjustsFontSizeToFitWidth = true;
            grantedHeader.TextAlignment             = UITextAlignment.Center;
            grantedHeader.BackgroundColor           = UIColor.Black;
            grantedHeader.TextColor = UIColor.FromRGB(255, 215, 101);
            grantedHeader.Text      = "Followers";

            allowingTable = new UITableView(new CGRect(.05 * parentView.Bounds.Width, .55 * parentView.Bounds.Height, .9 * parentView.Bounds.Width, .4 * parentView.Bounds.Height));
            allowingTable.Layer.BorderWidth = 1f;
            allowingTable.SeparatorStyle    = UITableViewCellSeparatorStyle.None;
            allowingTable.RegisterClassForCellReuse(typeof(AllowingUserCell), "allowingCell");

            followingRefresh = new UIRefreshControl();
            followingRefresh.ValueChanged += (sender, e) => {
                getAllUserAccess(parentView);
            };

            followerRefresh = new UIRefreshControl();
            followerRefresh.ValueChanged += (sender, e) => {
                getAllUserAccess(parentView);
            };

            viewingTable.InsertSubview(followingRefresh, 0);
            viewingTable.SendSubviewToBack(followingRefresh);

            allowingTable.InsertSubview(followerRefresh, 0);
            allowingTable.SendSubviewToBack(followerRefresh);

            loadingRequests                  = new UIActivityIndicatorView(new CGRect(.05 * parentView.Bounds.Width, 0, .9 * parentView.Bounds.Width, .95 * parentView.Bounds.Height));
            loadingRequests.Alpha            = .8f;
            loadingRequests.BackgroundColor  = UIColor.Gray;
            loadingRequests.HidesWhenStopped = true;

            accessView.AddSubview(loadingRequests);
            accessView.AddSubview(allowedHeader);
            accessView.AddSubview(viewingTable);
            accessView.AddSubview(grantedHeader);
            accessView.AddSubview(allowingTable);
            accessView.BringSubviewToFront(loadingRequests);
            getAllUserAccess(parentView);
        }
Ejemplo n.º 9
0
        public remoteSelectionView(UIView parentView)
        {
            ion = AppState.context as IosION;

//      ion.webServices.timedOut += timeOutAlert;
            // Perform any additional setup after loading the view, typically from a nib.
            selectedUser = new ObservableCollection <ConnectionData>();
            selectedUser.CollectionChanged += checkForSelected;
            selectionView = new UIView(new CGRect(0, 0, parentView.Bounds.Width, parentView.Bounds.Height));
            selectionView.BackgroundColor = UIColor.White;

            var window = UIApplication.SharedApplication.KeyWindow;
            var rootVC = window.RootViewController as IONPrimaryScreenController;

            onlineLabel = new UILabel(new CGRect(0, 0, parentView.Bounds.Width, .08 * selectionView.Bounds.Height));
            onlineLabel.BackgroundColor           = UIColor.Black;
            onlineLabel.TextColor                 = UIColor.FromRGB(255, 215, 101);
            onlineLabel.Text                      = "Remote Viewing Access";
            onlineLabel.TextAlignment             = UITextAlignment.Center;
            onlineLabel.AdjustsFontSizeToFitWidth = true;

            onlineTable = new UITableView(new CGRect(.05 * parentView.Bounds.Width, .08 * selectionView.Bounds.Height, .9 * parentView.Bounds.Width, .78 * selectionView.Bounds.Height));
            onlineTable.SeparatorStyle     = UITableViewCellSeparatorStyle.None;
            onlineTable.Layer.CornerRadius = 5f;
            onlineTable.Layer.BorderWidth  = 1f;
            onlineTable.RegisterClassForCellReuse(typeof(RemoteAccessTableCell), "remoteAccessCell");

            reloadOnline = new UIRefreshControl();
            reloadOnline.ValueChanged += (sender, e) => {
                GetAccessList();
            };
            onlineTable.InsertSubview(reloadOnline, 0);
            onlineTable.SendSubviewToBack(reloadOnline);

            remoteMenuButton = new UIButton(new CGRect(.3 * selectionView.Bounds.Width, .87 * selectionView.Bounds.Height, .4 * selectionView.Bounds.Width, .1 * selectionView.Bounds.Height));
            remoteMenuButton.BackgroundColor = UIColor.FromRGB(255, 215, 101);
            remoteMenuButton.SetTitle("Remote Mode", UIControlState.Normal);
            remoteMenuButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            remoteMenuButton.Enabled            = false;
            remoteMenuButton.Alpha              = .6f;
            remoteMenuButton.Layer.CornerRadius = 5f;
            remoteMenuButton.Layer.BorderWidth  = 1f;
            remoteMenuButton.TouchDown         += (sender, e) => { remoteMenuButton.BackgroundColor = UIColor.Blue; };
            remoteMenuButton.TouchUpOutside    += (sender, e) => { remoteMenuButton.BackgroundColor = UIColor.FromRGB(255, 215, 101); };
            remoteMenuButton.TouchUpInside     += async(sender, e) => {
                remoteMenuButton.BackgroundColor = UIColor.FromRGB(255, 215, 101);
                var checkSource = onlineTable.Source as RemoteAccessTableSource;

/*
 *                              if(ion.webServices.uploading && checkSource.selectedUser[0].deviceID == UIDevice.CurrentDevice.IdentifierForVendor.ToString()){
 *                                      checkSource.selectedUser.Clear();
 *                                      var alert = UIAlertController.Create ("Unable to View", "You cannot view your current layout while uploading from the same device", UIAlertControllerStyle.Alert);
 *                                      alert.AddAction (UIAlertAction.Create ("Ok", UIAlertActionStyle.Cancel, null));
 *                                      rootVC.PresentViewController (alert, animated: true, completionHandler: null);
 *                              } else {
 *                                      await Task.Delay(TimeSpan.FromMilliseconds(1));
 *                                      var viewing = NSUserDefaults.StandardUserDefaults.StringForKey("viewedUser");
 *                                      //var viewingLayout = NSUserDefaults.StandardUserDefaults.StringForKey("viewedLayout");
 *
 *                                      if(!string.IsNullOrEmpty(viewing)){
 *                                        ///TURN OFF ANY LOCATION POLLING TO ALLOW FOR REMOTE LOCATION BEING USED
 *          if (ion.settings._location.allowsGps) {
 *                              ion.locationManager.StopAutomaticLocationPolling();
 *                            }
 *
 *                                              remoteMenuButton.Hidden = true;
 *                                              fullMenuButton.Hidden = false;
 *                                              onlineTable.UserInteractionEnabled = false;
 * //						ion.webServices.remoteViewing = true;
 *
 *                                              ///CHANGE THE APP MENU AND DEVICE MANAGER TO REFLECT REMOTE VIEWING OPTIONS
 *          var rion = new RemoteIosION(ion.portal);
 *          if (!await rion.InitAsync()) {
 *            // todo [email protected]: do an actual error dialog here
 *            throw new Exception("Failed to initialize remote ion");
 *          }
 *                                              AppState.context = rion;
 *                      rootVC.setRemoteMenu();
 * //						ion.webServices.downloading = true;
 *                                              ///START THE LAYOUT DOWNLOADING PROCESS
 *                                              startDownloading();
 *                                              onlineTable.ReloadData();
 * //						ion.webServices.timedOut += timeOutAlert;
 *              } else {
 *                                              var alert = UIAlertController.Create ("Unable to View", "User is not available. Please try again.", UIAlertControllerStyle.Alert);
 *                                              alert.AddAction (UIAlertAction.Create ("Ok", UIAlertActionStyle.Cancel, null));
 *                                              rootVC.PresentViewController (alert, animated: true, completionHandler: null);
 *                                      }
 *                              }
 */
            };

            fullMenuButton = new UIButton(new CGRect(.3 * selectionView.Bounds.Width, .87 * selectionView.Bounds.Height, .4 * selectionView.Bounds.Width, .1 * selectionView.Bounds.Height));
            fullMenuButton.Layer.CornerRadius = 5f;
            fullMenuButton.Layer.BorderWidth  = 1f;
            fullMenuButton.BackgroundColor    = UIColor.FromRGB(255, 215, 101);
            fullMenuButton.SetTitle("Local Mode", UIControlState.Normal);
            fullMenuButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            fullMenuButton.Hidden          = true;
            fullMenuButton.TouchDown      += (sender, e) => { fullMenuButton.BackgroundColor = UIColor.Blue; };
            fullMenuButton.TouchUpOutside += (sender, e) => { fullMenuButton.BackgroundColor = UIColor.FromRGB(255, 215, 101); };
            fullMenuButton.TouchUpInside  += async(sender, e) => {
                fullMenuButton.BackgroundColor = UIColor.FromRGB(255, 215, 101);

                ///TURN BACK ON ANY LOCATION POLLING THE LOCAL DEVICE WAS USING
                if (ion.settings._location.allowsGps)
                {
                    ion.locationManager.StartAutomaticLocationPolling();
                }

                fullMenuButton.Hidden              = true;
                remoteMenuButton.Hidden            = false;
                onlineTable.UserInteractionEnabled = true;
                // todo [email protected]: ensure that these features are not needed.

/*
 *                              ion.webServices.remoteViewing = false;
 *                              ion.webServices.downloading = false;
 *                              ion.webServices.paused = null;
 */
                await Task.Delay(TimeSpan.FromMilliseconds(1));

                NSUserDefaults.StandardUserDefaults.SetString("", "viewedUser");
                NSUserDefaults.StandardUserDefaults.SetString("", "viewedLayout");
                selectedUser.Clear();
                onlineTable.ReloadData();

                ///SET THE APP MENU AND DEVICE MANAGER BACK TO THE LOCAL DEVICE'S SETTINGS
                var lion = new LocalIosION(ion.portal);
                if (!await lion.InitAsync())
                {
                    // todo [email protected]: do an actual error dialog here
                    throw new Exception("Failed to initialize local ion");
                }
                AppState.context = lion;
                rootVC.setMainMenu();
                // todo [email protected]: this is a note for andy: we need to implement timeouts and the passive service maintainer
//				ion.webServices.timedOut -= timeOutAlert;
            };

            loadingUsers                  = new UIActivityIndicatorView(new CGRect(0, 0, parentView.Bounds.Width, parentView.Bounds.Height));
            loadingUsers.Alpha            = .8f;
            loadingUsers.BackgroundColor  = UIColor.Gray;
            loadingUsers.HidesWhenStopped = true;

            selectionView.AddSubview(onlineLabel);
            selectionView.AddSubview(remoteMenuButton);
            selectionView.AddSubview(fullMenuButton);
            selectionView.AddSubview(onlineTable);
            selectionView.AddSubview(loadingUsers);
            selectionView.BringSubviewToFront(loadingUsers);
            GetAccessList();
        }
        // 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 AccessRequestManager(UIView parentView)
        {
            ion = AppState.context as IosION;

            var viewTap = new UITapGestureRecognizer(() => {
                submitCodeField.ResignFirstResponder();
            });

            viewTap.CancelsTouchesInView = false;
            accessView = new UIView(new CGRect(0, 0, parentView.Bounds.Width, parentView.Bounds.Height));
            accessView.BackgroundColor = UIColor.White;
            accessView.AddGestureRecognizer(viewTap);

            submitLabel      = new UILabel(new CGRect(.05 * accessView.Bounds.Width, 0, .9 * accessView.Bounds.Width, .07 * accessView.Bounds.Height));
            submitLabel.Text = "Enter Access Code";
            submitLabel.AdjustsFontSizeToFitWidth = true;
            submitLabel.TextAlignment             = UITextAlignment.Center;

            submitCodeField = new UITextField(new CGRect(.05 * accessView.Bounds.Width, .07 * accessView.Bounds.Height, .9 * accessView.Bounds.Width, .1 * accessView.Bounds.Height));
            submitCodeField.Layer.CornerRadius = 5f;
            submitCodeField.Layer.BorderWidth  = 1f;
            submitCodeField.TextAlignment      = UITextAlignment.Center;
            submitCodeField.ShouldReturn      += (textField) => {
                textField.ResignFirstResponder();
                return(true);
            };
            submitCodeField.AutocorrectionType = UITextAutocorrectionType.No;

            submitButton = new UIButton(new CGRect(.05 * accessView.Bounds.Width, .175 * accessView.Bounds.Height, .9 * accessView.Bounds.Width, .1 * accessView.Bounds.Height));
            submitButton.SetTitle("Submit", UIControlState.Normal);
            submitButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            submitButton.Layer.CornerRadius = 5f;
            submitButton.Layer.BorderWidth  = 1f;
            submitButton.BackgroundColor    = UIColor.FromRGB(255, 215, 101);
            submitButton.TouchDown         += (sender, e) => { submitButton.BackgroundColor = UIColor.Blue; };
            submitButton.TouchUpInside     += (sender, e) => { submitButton.BackgroundColor = UIColor.FromRGB(255, 215, 101); };
            submitButton.TouchUpOutside    += (sender, e) => { submitButton.BackgroundColor = UIColor.FromRGB(255, 215, 101); };
            submitButton.TouchUpInside     += submitCode;

            requestLabel                           = new UILabel(new CGRect(.2 * accessView.Bounds.Width, .27 * accessView.Bounds.Height, .6 * accessView.Bounds.Width, .08 * accessView.Bounds.Height));
            requestLabel.Text                      = "Access Requests";
            requestLabel.TextAlignment             = UITextAlignment.Center;
            requestLabel.AdjustsFontSizeToFitWidth = true;

            refreshButton = new UIButton(new CGRect(.9 * accessView.Bounds.Width - requestLabel.Bounds.Height, .275 * accessView.Bounds.Height, requestLabel.Bounds.Height, .9 * requestLabel.Bounds.Height));
            refreshButton.SetImage(UIImage.FromBundle("ic_refresh"), UIControlState.Normal);
            refreshButton.TouchUpInside += getAllRequests;

            pendingTable = new UITableView(new CGRect(.05 * accessView.Bounds.Width, .35 * accessView.Bounds.Height, .9 * accessView.Bounds.Width, .5 * accessView.Bounds.Height));
            pendingTable.BackgroundColor    = UIColor.Clear;
            pendingTable.Layer.CornerRadius = 5f;
            pendingTable.Layer.BorderWidth  = 1f;
            pendingTable.SeparatorStyle     = UITableViewCellSeparatorStyle.None;
            pendingTable.RegisterClassForCellReuse(typeof(AccessRequestTableCell), "accessCell");
            pendingTable.AllowsSelection = true;

            requestButton = new UIButton(new CGRect(.05 * accessView.Bounds.Width, .86 * accessView.Bounds.Height, .9 * accessView.Bounds.Width, .1 * accessView.Bounds.Height));
            requestButton.SetTitle("Generate Access Code", UIControlState.Normal);
            requestButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            requestButton.BackgroundColor    = UIColor.FromRGB(255, 215, 101);
            requestButton.Layer.CornerRadius = 5f;
            requestButton.Layer.BorderWidth  = 1f;
            requestButton.TouchUpInside     += GenerateAccessCode;

            loadingRequests                  = new UIActivityIndicatorView(new CGRect(.05 * accessView.Bounds.Width, .35 * accessView.Bounds.Height, .9 * accessView.Bounds.Width, .5 * accessView.Bounds.Height));
            loadingRequests.Alpha            = .8f;
            loadingRequests.BackgroundColor  = UIColor.Gray;
            loadingRequests.HidesWhenStopped = true;

            accessView.AddSubview(submitLabel);
            accessView.AddSubview(submitCodeField);
            accessView.AddSubview(submitButton);
            accessView.AddSubview(requestLabel);
            accessView.AddSubview(refreshButton);
            accessView.AddSubview(pendingTable);
            accessView.AddSubview(loadingRequests);
            accessView.AddSubview(requestButton);
            accessView.BringSubviewToFront(loadingRequests);
            getAllRequests(this, null);
        }
Ejemplo n.º 12
0
        public RemoteUserProfileView(UIView parentView)
        {
            ion = AppState.context as IosION;

            string[] splitName;
            if (ion.portal.isLoggedIn)
            {
                splitName = ion.portal.user.displayName.Split(' ');
            }
            else
            {
                splitName = new[] { "", "" };
            }

            var viewTap = new UITapGestureRecognizer(() => {
                profileView.EndEditing(true);
            });

            profileView = new UIView(new CGRect(0, 0, parentView.Bounds.Width, parentView.Bounds.Height));
            profileView.BackgroundColor = UIColor.White;
            profileView.Hidden          = true;
            profileView.AddGestureRecognizer(viewTap);

            profileScroll             = new UIScrollView(new CGRect(0, 0, parentView.Bounds.Width, parentView.Bounds.Height));
            profileScroll.ContentSize = new CGSize(parentView.Bounds.Width, 1.4 * parentView.Bounds.Height);

            // todo [email protected]: this needs to be localized

            settingsHeader               = new UILabel(new CGRect(0, 0, profileView.Bounds.Width, .08 * profileView.Bounds.Height));
            settingsHeader.Text          = "User Profile";
            settingsHeader.TextAlignment = UITextAlignment.Center;
            settingsHeader.Font          = UIFont.BoldSystemFontOfSize(20f);

            emailLabel                           = new UILabel(new CGRect(.05 * profileView.Bounds.Width, .08 * profileView.Bounds.Height, .9 * profileView.Bounds.Width, .05 * profileView.Bounds.Height));
            emailLabel.Text                      = "Email: " + ion.portal.user.email;
            emailLabel.TextAlignment             = UITextAlignment.Left;
            emailLabel.AdjustsFontSizeToFitWidth = true;
            emailLabel.Font                      = UIFont.BoldSystemFontOfSize(20f);

            firstNameLabel                           = new UILabel(new CGRect(.05 * profileView.Bounds.Width, .14 * profileView.Bounds.Height, .9 * profileView.Bounds.Width, .09 * profileView.Bounds.Height));
            firstNameLabel.Text                      = "Display Name";
            firstNameLabel.TextAlignment             = UITextAlignment.Left;
            firstNameLabel.AdjustsFontSizeToFitWidth = true;

            firstNameField                        = new UITextField(new CGRect(.05 * profileView.Bounds.Width, .23 * profileView.Bounds.Height, .6 * profileView.Bounds.Width, .09 * profileView.Bounds.Height));
            firstNameField.Placeholder            = "First Name";
            firstNameField.Layer.BorderWidth      = 1f;
            firstNameField.AutocorrectionType     = UITextAutocorrectionType.No;
            firstNameField.AutocapitalizationType = UITextAutocapitalizationType.None;
            firstNameField.TextAlignment          = UITextAlignment.Center;
            firstNameField.Text                   = splitName[0];

            lastNameField                        = new UITextField(new CGRect(.05 * profileView.Bounds.Width, .32 * profileView.Bounds.Height, .6 * profileView.Bounds.Width, .09 * profileView.Bounds.Height));
            lastNameField.Placeholder            = "Last Name";
            lastNameField.Layer.BorderWidth      = 1f;
            lastNameField.AutocorrectionType     = UITextAutocorrectionType.No;
            lastNameField.AutocapitalizationType = UITextAutocapitalizationType.None;
            lastNameField.TextAlignment          = UITextAlignment.Center;
            lastNameField.Text                   = splitName[1];

            changeNameButton = new UIButton(new CGRect(.67 * profileView.Bounds.Width, .33 * profileView.Bounds.Height, .3 * profileView.Bounds.Width, .07 * profileView.Bounds.Height));
            changeNameButton.SetTitle("Update", UIControlState.Normal);
            changeNameButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            changeNameButton.Layer.CornerRadius = 5f;
            changeNameButton.Layer.BorderWidth  = 1f;
            changeNameButton.BackgroundColor    = UIColor.FromRGB(255, 215, 101);
            changeNameButton.TouchDown         += (sender, e) => { changeNameButton.BackgroundColor = UIColor.Blue; };
            changeNameButton.TouchUpOutside    += (sender, e) => { changeNameButton.BackgroundColor = UIColor.FromRGB(255, 215, 101); };

            passwordLabel = new UILabel(new CGRect(.05 * profileView.Bounds.Width, .41 * profileView.Bounds.Height, .9 * profileView.Bounds.Width, .05 * profileView.Bounds.Height));
            passwordLabel.TextAlignment   = UITextAlignment.Left;
            passwordLabel.Text            = "Password";
            passwordLabel.BackgroundColor = UIColor.White;

            passwordField                        = new UITextField(new CGRect(.05 * profileView.Bounds.Width, .46 * profileView.Bounds.Height, .6 * profileView.Bounds.Width, .09 * profileView.Bounds.Height));
            passwordField.Placeholder            = "Password";
            passwordField.Layer.BorderWidth      = 1f;
            passwordField.SecureTextEntry        = true;
            passwordField.AutocorrectionType     = UITextAutocorrectionType.No;
            passwordField.AutocapitalizationType = UITextAutocapitalizationType.None;
            passwordField.TextAlignment          = UITextAlignment.Center;

            confirmPasswordField                        = new UITextField(new CGRect(.05 * profileView.Bounds.Width, .55 * profileView.Bounds.Height, .6 * profileView.Bounds.Width, .09 * profileView.Bounds.Height));
            confirmPasswordField.Placeholder            = "Confirm Password";
            confirmPasswordField.Layer.BorderWidth      = 1f;
            confirmPasswordField.SecureTextEntry        = true;
            confirmPasswordField.AutocorrectionType     = UITextAutocorrectionType.No;
            confirmPasswordField.AutocapitalizationType = UITextAutocapitalizationType.None;
            confirmPasswordField.TextAlignment          = UITextAlignment.Center;

            changePassButton = new UIButton(new CGRect(.67 * profileView.Bounds.Width, .56 * profileView.Bounds.Height, .3 * profileView.Bounds.Width, .07 * profileView.Bounds.Height));
            changePassButton.SetTitle("Update", UIControlState.Normal);
            changePassButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            changePassButton.Layer.CornerRadius = 5f;
            changePassButton.Layer.BorderWidth  = 1f;
            changePassButton.BackgroundColor    = UIColor.FromRGB(255, 215, 101);
            changePassButton.TouchDown         += (sender, e) => { changePassButton.BackgroundColor = UIColor.Blue; };
            changePassButton.TouchUpOutside    += (sender, e) => { changePassButton.BackgroundColor = UIColor.FromRGB(255, 215, 101); };

            updatingLabel      = new UILabel(new CGRect(.05 * profileView.Bounds.Width, .63 * profileView.Bounds.Height, .95 * profileView.Bounds.Width, .1 * profileView.Bounds.Height));
            updatingLabel.Text = "Updating password. Please Wait.";
            updatingLabel.AdjustsFontSizeToFitWidth = true;
            updatingLabel.Hidden = true;

            logoutButton = new UIButton(new CGRect(.25 * profileView.Bounds.Width, .7 * profileView.Bounds.Height, .5 * profileView.Bounds.Width, .09 * profileView.Bounds.Height));
            logoutButton.SetTitle("Log Out", UIControlState.Normal);
            logoutButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            logoutButton.Layer.BorderWidth = 1f;
            logoutButton.BackgroundColor   = UIColor.FromRGB(255, 215, 101);

            changePassButton.TouchUpInside += UpdatePassword;
            changeNameButton.TouchUpInside += UpdateName;

            profileScroll.AddSubview(settingsHeader);
            profileScroll.AddSubview(firstNameLabel);
            profileScroll.AddSubview(firstNameField);
            profileScroll.AddSubview(lastNameField);
            profileScroll.AddSubview(changeNameButton);
            profileScroll.AddSubview(emailLabel);
            profileScroll.AddSubview(passwordLabel);
            profileScroll.AddSubview(passwordField);
            profileScroll.AddSubview(confirmPasswordField);
            profileScroll.AddSubview(changePassButton);
            profileScroll.AddSubview(updatingLabel);
            profileScroll.AddSubview(logoutButton);

            profileView.AddSubview(profileScroll);
        }
 public IosLocationManager(IosION ion)
 {
     this.ion          = ion;
     lastKnownLocation = new IosLocation();
 }
Ejemplo n.º 14
0
 public PTTableCell(IntPtr handle)
 {
     ion = AppState.context as IosION;
 }
Ejemplo n.º 15
0
 public SoundAlarmAlert(IAlarm alarm, IosION ion) : base(alarm)
 {
     this.ion = ion;
 }