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); }
//protected MyViewController(IntPtr handle) : base(handle) //{ // // Note: this .ctor should not contain any initialization logic. //} public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. View.BackgroundColor = UIColor.FromRGB(7, 69, 126); Title = "PatientMonitor - Feed Communication"; nfloat h = 31.0f; nfloat w = View.Bounds.Width; usernameField = new UITextField { Placeholder = "Username", BorderStyle = UITextBorderStyle.RoundedRect, Frame = new CGRect(10, 82, w - 20, h) }; View.AddSubview(usernameField); passwordField = new UITextField { SecureTextEntry = true, Placeholder = "Password", BorderStyle = UITextBorderStyle.RoundedRect, Frame = new CGRect(10, 122, w - 20, h) }; View.AddSubview(passwordField); var buttonWidth = (w / 2) - 20; buttonLogin = UIButton.FromType(UIButtonType.System); buttonLogin.Frame = new CGRect(10, 162, w - 20, 44); buttonLogin.SetTitle("Login", UIControlState.Normal); buttonLogin.SetTitleColor(UIColor.White, UIControlState.Normal); buttonLogin.BackgroundColor = colorBackgroundButtonLogin; buttonLogin.TouchUpInside += async(sender, e) => { //AppDelegate myAppDel = (UIApplication.SharedApplication.Delegate as DemoKLS.AppDelegate); //await myAppDel.Login(usernameField.Text, passwordField.Text); }; View.AddSubview(buttonLogin); buttonLoginAlice = UIButton.FromType(UIButtonType.System); buttonLoginAlice.Frame = new CGRect(10, 250, w - 20, 44); buttonLoginAlice.SetTitle("Login Dr. Gregory Casa", UIControlState.Normal); buttonLoginAlice.SetTitleColor(UIColor.White, UIControlState.Normal); buttonLoginAlice.BackgroundColor = colorBackgroundButtonLogin; buttonLoginAlice.TouchUpInside += async(sender, e) => { AppDelegate myAppDel = (UIApplication.SharedApplication.Delegate as AppDelegate); await myAppDel.LoginDrGregoryCasa(); }; View.AddSubview(buttonLoginAlice); buttonLoginBob = UIButton.FromType(UIButtonType.System); buttonLoginBob.Frame = new CGRect(10, 300, w - 20, 44); buttonLoginBob.SetTitle("Login Bob", UIControlState.Normal); buttonLoginBob.SetTitleColor(UIColor.White, UIControlState.Normal); buttonLoginBob.BackgroundColor = colorBackgroundButtonLogin; buttonLoginBob.TouchUpInside += async(sender, e) => { AppDelegate myAppDel = (UIApplication.SharedApplication.Delegate as AppDelegate); await myAppDel.LoginBob(); }; View.AddSubview(buttonLoginBob); //buttonLoginCharlie = UIButton.FromType(UIButtonType.System); //buttonLoginCharlie.Frame = new CGRect(10, 350, w - 20, 44); //buttonLoginCharlie.SetTitle("Login Charlie", UIControlState.Normal); //buttonLoginCharlie.SetTitleColor(UIColor.White, UIControlState.Normal); //buttonLoginCharlie.BackgroundColor = colorBackgroundButtonLogin; //buttonLoginCharlie.TouchUpInside += async (sender, e) => { // AppDelegate myAppDel = (UIApplication.SharedApplication.Delegate as DemoKLS.AppDelegate); // await myAppDel.LoginCharlie(); //}; //View.AddSubview(buttonLoginCharlie); buttonLoginAdmin = UIButton.FromType(UIButtonType.System); buttonLoginAdmin.Frame = new CGRect(10, 400, w - 20, 44); buttonLoginAdmin.SetTitle("Login Admin", UIControlState.Normal); buttonLoginAdmin.SetTitleColor(UIColor.White, UIControlState.Normal); buttonLoginAdmin.BackgroundColor = colorBackgroundButtonLogin; buttonLoginAdmin.TouchUpInside += async(sender, e) => { AppDelegate myAppDel = (UIApplication.SharedApplication.Delegate as AppDelegate); await myAppDel.LoginAdmin(); }; View.AddSubview(buttonLoginAdmin); }
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 } }); }