private void RenderView()
        {
            Title = "Kinvey Live Service - Doctor";
            View.BackgroundColor = UIColor.FromRGB(7, 69, 126);
            nfloat w           = View.Bounds.Width;
            var    buttonWidth = (w / 2) - 20;

            AppDelegate myAppDel   = (UIApplication.SharedApplication.Delegate as AppDelegate);
            var         titleLabel = new UILabel
            {
                Text          = "Bob's Device Reading",
                TextColor     = UIColor.White,
                Frame         = new CGRect(10, 80, w - 20, h),
                TextAlignment = UITextAlignment.Center
            };

            View.AddSubview(titleLabel);

            MessageView = new UILabel
            {
                Text          = "--",
                Frame         = new CGRect(10, 120, w - 20, 3 * h),
                TextColor     = UIColor.White,
                Font          = UIFont.FromName("Helvetica-Bold", 60f),
                TextAlignment = UITextAlignment.Center
            };

            View.AddSubview(MessageView);

            TimeView = new UITextField
            {
                Placeholder     = "Roundtrip Time",
                Frame           = new CGRect(10, 200, w - 20, h),
                BorderStyle     = UITextBorderStyle.RoundedRect,
                BackgroundColor = UIColor.White,
                TextColor       = UIColor.Black
            };

            View.AddSubview(TimeView);
            TimeView.Hidden = true;

            plotModel = new OxyPlot.PlotModel();
            //plotModel.Background = OxyColor.FromRgb(131, 195, 202);
            plotModel.Background = OxyColor.FromRgb(157, 194, 198);
            plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis {
                Position = OxyPlot.Axes.AxisPosition.Bottom
            });
            plotModel.Axes.Add(new OxyPlot.Axes.LinearAxis {
                Position = OxyPlot.Axes.AxisPosition.Left
            });

            OxyPlot.Xamarin.iOS.PlotView plotView = new OxyPlot.Xamarin.iOS.PlotView(new CGRect(10, 240, w - 20, 200));
            plotView.Model = plotModel;

            View.AddSubview(plotView);
            //UIButton buttonPublishDecrement;
            //buttonPublishDecrement = UIButton.FromType(UIButtonType.System);
            //buttonPublishDecrement.Frame = new CGRect(10, 280, buttonWidth, 44);
            //buttonPublishDecrement.SetTitle("Decrease", UIControlState.Normal);
            //buttonPublishDecrement.SetTitleColor(UIColor.Red, UIControlState.Normal);
            //buttonPublishDecrement.BackgroundColor = colorLightBlue;
            //buttonPublishDecrement.TouchUpInside += async (sender, e) =>
            //{
            //	await this.Publish(MedicalDeviceCommand.EnumCommand.DECREMENT);
            //	//PublishMessageView.Text = String.Empty;
            //};

            //View.AddSubview(buttonPublishDecrement);

            //UIButton buttonPublishIncrement;
            //buttonPublishIncrement = UIButton.FromType(UIButtonType.System);
            //buttonPublishIncrement.Frame = new CGRect(w - buttonWidth - 10, 280, buttonWidth, 44);
            //buttonPublishIncrement.SetTitle("Increase", UIControlState.Normal);
            //buttonPublishIncrement.SetTitleColor(UIColor.Green, UIControlState.Normal);
            //buttonPublishIncrement.BackgroundColor = colorLightBlue;
            ////buttonPublishIncrement.BackgroundColor = UIColor.Green;
            //buttonPublishIncrement.TouchUpInside += async (sender, e) =>
            //{
            //	await this.Publish(MedicalDeviceCommand.EnumCommand.INCREMENT);
            //	//PublishMessageView.Text = String.Empty;
            //};

            //View.AddSubview(buttonPublishIncrement);

            UIButton buttonLogout;

            buttonLogout       = UIButton.FromType(UIButtonType.System);
            buttonLogout.Frame = new CGRect(10, 460, w - 20, 44);
            buttonLogout.SetTitle("Logout", UIControlState.Normal);
            buttonLogout.SetTitleColor(UIColor.Black, UIControlState.Normal);
            buttonLogout.BackgroundColor = UIColor.Gray;

            var user = new UIViewController();

            user.View.BackgroundColor = UIColor.FromRGB(7, 69, 126);

            buttonLogout.TouchUpInside += async(sender, e) =>
            {
                await myAppDel.Logout();
            };

            View.AddSubview(buttonLogout);
        }
Esempio n. 2
0
        private void RenderView()
        {
            Title = "Kinvey Live Service - Patient";
            View.BackgroundColor = UIColor.FromRGB(7, 69, 126);
            nfloat w = View.Bounds.Width;

            AppDelegate myAppDel = (UIApplication.SharedApplication.Delegate as AppDelegate);

            var titleLabel = new UILabel
            {
                Text          = "My Device Reading",
                TextColor     = UIColor.White,
                TextAlignment = UITextAlignment.Center,
                Frame         = new CGRect(10, 80, w - 20, h)
            };

            View.AddSubview(titleLabel);

            MessageView = new UILabel
            {
                Frame         = new CGRect(10, 120, w - 20, 3 * h),
                Text          = this.settingValue.ToString(),
                TextColor     = UIColor.White,
                Font          = UIFont.FromName("Helvetica-Bold", 60f),
                TextAlignment = UITextAlignment.Center
            };

            View.AddSubview(MessageView);

            UIButton buttonLogout;

            buttonLogout       = UIButton.FromType(UIButtonType.System);
            buttonLogout.Frame = new CGRect(10, 322, w - 20, 44);
            buttonLogout.SetTitle("Logout", UIControlState.Normal);
            buttonLogout.SetTitleColor(UIColor.Black, UIControlState.Normal);
            buttonLogout.BackgroundColor = UIColor.Gray;

            var user = new UIViewController();

            user.View.BackgroundColor = colorDarkBlue;

            buttonLogout.TouchUpInside += async(sender, e) =>
            {
                await myAppDel.Logout();
            };

            View.AddSubview(buttonLogout);

            Task.Run(async() => {
                var random = new Random(12345);
                while (true)
                {
                    int delta    = random.Next() % 5;
                    int sign     = random.Next() % 2;
                    settingValue = sign == 0 ? settingValue + delta : settingValue - delta;
                    InvokeOnMainThread(() => this.ChangeText(settingValue.ToString()));
                    await this.PublishStatus(settingValue.ToString());
                    await Task.Delay(1000);                     // sleep for 5 seconds avoiding computer overcharge
                }
            });
        }