Section CreateButtonSection(float labelHeight, float containerWidth) { Section buttonSection = new Section(); GlassButton button = new GlassButton(new RectangleF(0, 0, containerWidth, labelHeight)); button.SetTitleColor(UIColor.FromRGBA(255, 255, 0, 255), UIControlState.Normal); button.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; button.SetTitle("Create Dataset", UIControlState.Normal); button.TouchUpInside += (o, e) => { string name = _name.Summary(); if (string.IsNullOrEmpty(name)) { //show an alert if data is not filled new UIAlertView(string.Empty, "Enter a name", null, "OK", null).Show(); } else { // navigate to next screen MXTouchContainer.Navigate("Dashboard/CreateData/" + name); } }; UIViewElement imageElement = new UIViewElement(string.Empty, button, true); imageElement.Flags = UIViewElement.CellFlags.DisableSelection | UIViewElement.CellFlags.Transparent; buttonSection.Add(imageElement); return(buttonSection); }
private bool ConstructUI() { // check if UI has already been built if (!_uiContructed) { Title = "Welcome!"; UIImageView imgBackground = new UIImageView(new RectangleF(0, 0, 320, 480)); imgBackground.Image = UIImage.FromFile("images/Wallpaper.png"); this.Add(imgBackground); var loc = new PointF(10, 20); var size = new SizeF(300, 44); var rect = new RectangleF(loc, size); GlassButton b = new GlassButton(rect); b.SetTitleColor(UIColor.Black, UIControlState.Normal); b.NormalColor = UIColor.FromRGB(0x62, 0x63, 0x70); b.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; b.SetTitle("Next Screen", UIControlState.Normal); b.TouchUpInside += (o, e) => { MXTouchContainer.Navigate("Dashboard"); }; this.Add(b); // UI construction completed _uiContructed = true; } return(_uiContructed); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow(UIScreen.MainScreen.Bounds); dvc = new DialogViewController( new RootElement("Root") { new Section("Main") { (button = new GlassButton(new RectangleF(0, 0, window.Bounds.Width - 20, 60))), (upper = new StringElement("this should become uppercased")), (lower = new StringElement("THIS SHOULD BECOME LOWERCASED")), } } ); button.SetTitle("Test", UIControlState.Normal); button.Tapped += (obj) => { button.Enabled = false; Test(); }; window.RootViewController = dvc; window.MakeKeyAndVisible(); return(true); }
private GlassButton GetGlassButton(float buttonYposition) { var buttonWidth = 300f; var center = (View.Frame.Width / 2) - (buttonWidth / 2); var frame = new RectangleF(center, buttonYposition, 300f, 50f); var glassBtn = new GlassButton(frame); glassBtn.SetTitle("Use", UIControlState.Normal); glassBtn.TouchDown += AddProgressIndicator; glassBtn.TouchUpInside += HandleLoginButtonTouchUpInside; return(glassBtn); }
public static GlassButton CreateGlassButton(string buttonTitle, UIColor color, float width, float height, ButtonClickDelegate touchUpInside) { GlassButton button = new GlassButton(new RectangleF(0, 0, width, height)); button.NormalColor = color; button.HighlightedColor = UIColor.LightGray; button.SetTitleColor(UIColor.FromRGBA(255, 255, 255, 255), UIControlState.Normal); button.SetTitleColor(UIColor.FromRGBA(0, 0, 0, 255), UIControlState.Highlighted); button.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; button.SetTitle(buttonTitle, UIControlState.Normal); button.TouchUpInside += (s, e) => { if (touchUpInside != null) touchUpInside(s, e); }; return button; }
UIView CreateTextView(UITextField textField, string placeholderText, string text, RectangleF rectF, GetLocationActions locActions) { UIView uiView = new UIView(rectF); uiView.MultipleTouchEnabled = true; textField.Frame = new RectangleF(20, 0, this.View.Bounds.Width - 110, 30); textField.Font = font12; textField.Placeholder = placeholderText; textField.Text = text; textField.BorderStyle = UITextBorderStyle.RoundedRect; textField.Enabled = true; uiView.AddSubview(textField); GlassButton gbLoc = new GlassButton(new RectangleF(textField.Bounds.Width + 20 + 5, 0, 80, 30)); if (locActions != GetLocationActions.None) { gbLoc.Font = font10; gbLoc.NormalColor = UIColor.Brown; gbLoc.SetTitle("Use Location", UIControlState.Normal); gbLoc.Enabled = true; gbLoc.Tapped += delegate { textField.Enabled = false; if (locActions == GetLocationActions.UpdateTraffic) { gbBlocked.Enabled = false; gbHeavy.Enabled = false; gbNormal.Enabled = false; gbLow.Enabled = false; } else if (locActions == GetLocationActions.SetOrigin) { gbViewTraffic.Enabled = false; } else if (locActions == GetLocationActions.SetDestination) { gbViewTraffic.Enabled = false; } GetLocation(locActions, textField); }; uiView.AddSubview(gbLoc); } return(uiView); }
UIView CreateHeaderView(Dictionary <string, RectangleF> dicRect, int iViewHeight) { UIView uiView = new UIView(new RectangleF(0, 0, this.View.Bounds.Width, iViewHeight)); uiView.MultipleTouchEnabled = true; gbBlocked = new GlassButton(dicRect["blocked"]); gbBlocked.Font = font12; gbBlocked.SetTitle("Blocked", UIControlState.Normal); gbBlocked.NormalColor = UIColor.Red; gbBlocked.Enabled = true; gbBlocked.Tapped += delegate { CheckChannel(TrafficUpdates.TrafficMessage.Blocked); }; uiView.AddSubview(gbBlocked); gbHeavy = new GlassButton(dicRect["heavy"]); gbHeavy.Font = font12; gbHeavy.SetTitle("Heavy", UIControlState.Normal); gbHeavy.Enabled = true; gbHeavy.NormalColor = UIColor.Orange; gbHeavy.Tapped += delegate { CheckChannel(TrafficUpdates.TrafficMessage.Heavy); }; uiView.AddSubview(gbHeavy); gbNormal = new GlassButton(dicRect["normal"]); gbNormal.Font = font12; gbNormal.NormalColor = UIColor.FromRGB(0, 255, 0); gbNormal.SetTitle("Normal", UIControlState.Normal); gbNormal.Enabled = true; gbNormal.Tapped += delegate { CheckChannel(TrafficUpdates.TrafficMessage.Normal); }; uiView.AddSubview(gbNormal); gbLow = new GlassButton(dicRect["low"]); gbLow.Font = font12; gbLow.NormalColor = UIColor.Purple; gbLow.SetTitle("Low", UIControlState.Normal); gbLow.Enabled = true; gbLow.Tapped += delegate { CheckChannel(TrafficUpdates.TrafficMessage.Low); }; uiView.AddSubview(gbLow); return(uiView); }
public static GlassButton CreateGlassButton(string buttonTitle, UIColor color, float width, float height) { GlassButton button = new GlassButton(new RectangleF(0, 0, width, height)); button.NormalColor = color; button.HighlightedColor = UIColor.LightGray; button.SetTitleColor(UIColor.FromRGBA(255, 255, 255, 255), UIControlState.Normal); button.SetTitleColor(UIColor.FromRGBA(0, 0, 0, 255), UIControlState.Highlighted); button.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; button.SetTitle(buttonTitle, UIControlState.Normal); //TODO: Find a away to pass in an TouchUpInside delegate instead of a Uri //button.TouchUpInside += (sender, e) => { }; return button; }
public Button(string title, Action handler) { // Setup the button //var button = new UIButton(UIButtonType.RoundedRect); var button = new GlassButton(); button.SetTitle(title, UIControlState.Normal); View = button; // Attach an event handler and forward the event button.TouchUpInside += (sender, e) => handler(); // Setup the layout parameters LayoutParameters = new LayoutParameters(AutoSize.FillParent, AutoSize.WrapContent); LayoutParameters.MaxWidth = 160; }
UIView CreateButtonView(RectangleF rectF) { UIView uiView = new UIView(rectF); uiView.MultipleTouchEnabled = true; gbViewTraffic = new GlassButton(new RectangleF((this.View.Bounds.Width - 100) / 2, 0, 100, 35)); gbViewTraffic.Font = font12; gbViewTraffic.NormalColor = UIColor.Blue; gbViewTraffic.SetTitle("View Traffic", UIControlState.Normal); gbViewTraffic.Enabled = true; gbViewTraffic.Tapped += delegate { new TrafficViewDialogViewController(tu, tfOrigin.Text, tfDestination.Text); }; uiView.AddSubview(gbViewTraffic); return(uiView); }
// Create view public override void ViewDidLoad() { base.ViewDidLoad(); image = UIImage.FromFile("image.jpg"); imageView = new GPUImageView(new RectangleF(0, 0, 480, 320)); imageView.ContentMode = UIViewContentMode.ScaleToFill; View = imageView; // Trick to display the image initially // TODO: Have the right size applySepiaFilter(0f); UIButton button = new GlassButton(new RectangleF(0, 0, 96, 32)); button.SetTitle("Sepia!", UIControlState.Normal); button.TouchUpInside += (object sender, EventArgs e) => { applySepiaFilter(0.9f); }; View.AddSubview(button); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. this.SetupPicker(); //this.SignInButton.IconImage = Theme.Login; //this.SignUpButton.IconImage = Theme.Register; var b = new GlassButton(new RectangleF(20, 250, 280, 50)) { Font = UIFont.BoldSystemFontOfSize(20), NormalColor = UIColor.Red, HighlightedColor = UIColor.Gray }; b.SetTitle("Send Money", UIControlState.Normal); View.AddSubview(b); // var gradient = new CAGradientLayer(); // gradient.Colors = new MonoTouch.CoreGraphics.CGColor[] // { // UIColor.FromRGB (115, 181, 216).CGColor, // UIColor.FromRGB (35, 101, 136).CGColor // }; // gradient.Locations = new NSNumber[] // { // .5f, // 1f // }; // // gradient.Frame = View.Layer.Bounds; // View.Layer.AddSublayer(gradient); // Perform any additional setup after loading the view, typically from a nib. }
UIView CreateHeaderView(Dictionary <string, RectangleF> dicRect, int iViewHeight) { UIView uiView = new UIView(new RectangleF(0, 0, this.View.Bounds.Width, iViewHeight)); uiView.MultipleTouchEnabled = true; //subscribe GlassButton gbSubs = new GlassButton(dicRect["subscribe"]); gbSubs.Font = font13; gbSubs.SetTitle("Subscribe", UIControlState.Normal); gbSubs.Enabled = true; gbSubs.Tapped += delegate { Subscribe(); }; uiView.AddSubview(gbSubs); //subscribe GlassButton gbSubsConnect = new GlassButton(dicRect["subscribeconncallback"]); gbSubsConnect.Font = font13; gbSubsConnect.SetTitle("Subscribe - Connect Callback", UIControlState.Normal); gbSubsConnect.Enabled = true; gbSubsConnect.Tapped += delegate { SubscribeConnectCallback(); }; uiView.AddSubview(gbSubsConnect); //publish GlassButton gbPublish = new GlassButton(dicRect["publish"]); gbPublish.Font = font13; gbPublish.SetTitle("Publish", UIControlState.Normal); gbPublish.Enabled = true; gbPublish.Tapped += delegate { Publish(); }; uiView.AddSubview(gbPublish); //presence GlassButton gbPresence = new GlassButton(dicRect["presence"]); gbPresence.Font = font13; gbPresence.SetTitle("Presence", UIControlState.Normal); gbPresence.Enabled = true; gbPresence.Tapped += delegate { Presence(); }; uiView.AddSubview(gbPresence); //Detailed History GlassButton gbDetailedHis = new GlassButton(dicRect["detailedhis"]); gbDetailedHis.Font = font13; gbDetailedHis.SetTitle("Detailed History", UIControlState.Normal); gbDetailedHis.Enabled = true; gbDetailedHis.Tapped += delegate { DetailedHistory(); }; uiView.AddSubview(gbDetailedHis); //Here Now GlassButton gbHereNow = new GlassButton(dicRect["herenow"]); gbHereNow.Font = font13; gbHereNow.SetTitle("Here Now", UIControlState.Normal); gbHereNow.Enabled = true; gbHereNow.Tapped += delegate { HereNow(); }; uiView.AddSubview(gbHereNow); //Time GlassButton gbTime = new GlassButton(dicRect["time"]); gbTime.Font = font13; gbTime.SetTitle("Time", UIControlState.Normal); gbTime.Enabled = true; gbTime.Tapped += delegate { GetTime(); }; uiView.AddSubview(gbTime); //Unsubscribe GlassButton gbUnsub = new GlassButton(dicRect["unsub"]); gbUnsub.Font = font13; gbUnsub.SetTitle("Unsubscribe", UIControlState.Normal); gbUnsub.Enabled = true; gbUnsub.Tapped += delegate { Unsub(); }; uiView.AddSubview(gbUnsub); //Unsubscribe-Presence GlassButton gbUnsubPres = new GlassButton(dicRect["unsubpres"]); gbUnsubPres.Font = font13; gbUnsubPres.SetTitle("Unsubscribe-Presence", UIControlState.Normal); gbUnsubPres.Enabled = true; gbUnsubPres.Tapped += delegate { UnsubPresence(); }; uiView.AddSubview(gbUnsubPres); return(uiView); }
public UIViewController GetFormService(RootElement rElement) { //if (DetailViewController.QuestionsView != null) //{ // DetailViewController.Title = ""; // DetailViewController.QuestionsView.Clear(); //} var bounds = UIScreen.MainScreen.Bounds; // show the loading overlay on the UI thread using the correct orientation sizing loadingOverlay = new LoadingOverlay(bounds); mvc = (DialogViewController)((UINavigationController)SplitViewController.ViewControllers[0]).TopViewController; mvc.Add(loadingOverlay); var dds = new DynaPadService.DynaPadService(); var dfElemet = (DynaFormRootElement)rElement; string origJson = dds.GetFormQuestions(dfElemet.FormID, dfElemet.PatientID, dfElemet.ApptID, dfElemet.IsDoctorForm); JsonHandler.OriginalFormJsonString = origJson; SelectedAppointment.SelectedQForm = JsonConvert.DeserializeObject <QForm>(origJson); var rootFormSections = new RootElement(SelectedAppointment.SelectedQForm.FormName); var sectionFormSections = new Section(); bool IsDoctorForm = dfElemet.IsDoctorForm; if (IsDoctorForm) { /* * TODO: make presets password protected (maybe not, since for doctors only?)! (maybe component: Passcode) */ var FormPresetNames = dds.GetAnswerPresets(SelectedAppointment.ApptFormId, null, SelectedAppointment.ApptPatientId, true, SelectedAppointment.ApptLocationId); var formPresetSection = new DynaSection("Form Preset Answers"); formPresetSection.Enabled = true; var formPresetGroup = new RadioGroup("FormPresetAnswers", SelectedAppointment.SelectedQForm.FormSelectedTemplateId); var formPresetsRoot = new DynaRootElement("Preset Answers", formPresetGroup); formPresetsRoot.IsPreset = true; foreach (string[] arrPreset in FormPresetNames) { var radioPreset = new MyRadioElement(arrPreset[1], "FormPresetAnswers"); radioPreset.OnSelected += delegate(object sender, EventArgs e) { string presetJson = arrPreset[2]; JsonHandler.OriginalFormJsonString = presetJson; SelectedAppointment.SelectedQForm = JsonConvert.DeserializeObject <QForm>(presetJson); LoadSectionView(SelectedAppointment.SelectedQForm.FormSections[0].SectionId, SelectedAppointment.SelectedQForm.FormSections[0].SectionName, SelectedAppointment.SelectedQForm.FormSections[0], IsDoctorForm); }; formPresetSection.Add(radioPreset); } var btnNewFormPreset = new GlassButton(new RectangleF(0, 0, (float)View.Frame.Width, 50)); btnNewFormPreset.Font = UIFont.BoldSystemFontOfSize(17); btnNewFormPreset.SetTitleColor(UIColor.Black, UIControlState.Normal); btnNewFormPreset.NormalColor = UIColor.FromRGB(224, 238, 240); btnNewFormPreset.SetTitle("Save New Form Preset", UIControlState.Normal); btnNewFormPreset.TouchUpInside += (sender, e) => { /* * TODO: popup to enter preset name (DONE?) */ //Create Alert var SavePresetPrompt = UIAlertController.Create("New Form Preset", "Necesito name", UIAlertControllerStyle.Alert); SavePresetPrompt.AddTextField((field) => { field.Placeholder = "Preset Name"; }); //Add Actions SavePresetPrompt.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, action => SavePreset(SavePresetPrompt.TextFields[0].Text))); SavePresetPrompt.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null)); //Present Alert PresentViewController(SavePresetPrompt, true, null); }; formPresetSection.Add(btnNewFormPreset); formPresetsRoot.Add(formPresetSection); formPresetsRoot.Enabled = true; sectionFormSections.Add(formPresetsRoot); } foreach (FormSection fSection in SelectedAppointment.SelectedQForm.FormSections) { sectionFormSections.Add(new StringElement(fSection.SectionName, delegate { LoadSectionView(fSection.SectionId, fSection.SectionName, fSection, IsDoctorForm); })); } sectionFormSections.Add(new StringElement("Finalize", delegate { LoadSectionView("Finalize", "Finalize", null, IsDoctorForm); })); rootFormSections.Add(sectionFormSections); var formDVC = new DialogViewController(rootFormSections, true); // TODO pull to refresh: (problamatic scrolling with it) //formDVC.RefreshRequested += delegate //{ // formDVC.ReloadComplete(); //}; if (!IsDoctorForm) { messageLabel = new UILabel(); formDVC.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIImage.FromBundle("Lock"), UIBarButtonItemStyle.Bordered, delegate(object sender, EventArgs e) { //Create Alert var BackPrompt = UIAlertController.Create("Exit Form", "Administrative use only. Please enter password to continue or tap Cancel", UIAlertControllerStyle.Alert); BackPrompt.AddTextField((field) => { field.SecureTextEntry = true; field.Placeholder = "Password"; }); BackPrompt.Add(messageLabel); BackPrompt.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, action => PopBack(BackPrompt.TextFields[0].Text))); BackPrompt.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, null)); //Present Alert PresentViewController(BackPrompt, true, null); }); //formDVC.NavigationItem.LeftBarButtonItem.Title = "Back"; } loadingOverlay.Hide(); return(formDVC); }
private bool ConstructUI() { // check if UI has already been built if (!_uiContructed) { Title = "Dashboard"; UIImageView imgBackground = new UIImageView(new RectangleF(0, 0, 320, 480)); imgBackground.Image = UIImage.FromFile("images/Wallpaper.png"); this.Add(imgBackground); float yLoc = 0; float labelHeight = 44; var loc = new PointF(10, 75); var size = new SizeF(300, labelHeight); var viewRect = new RectangleF(loc, size); UIView statsView = new UIView(viewRect); statsView.BackgroundColor = UIColor.Clear; var labelSize = new SizeF(150, labelHeight); var rect = new RectangleF(new PointF(0, yLoc), labelSize); var userIdLabel = new UILabel(rect); userIdLabel.Text = "DataSet GUID:"; userIdLabel.Layer.BorderColor = new CGColor(1.0f, 0.0f, 0.0f, 1.0f); userIdLabel.Layer.CornerRadius = 15f; userIdLabel.BackgroundColor = UIColor.FromWhiteAlpha(0.5f, 0.5f); var labelRect = new RectangleF(); var labelStart = labelSize.Width - 20; labelRect.Width = size.Width - labelStart; labelRect.Height = labelHeight; labelRect.Location = new PointF(labelStart, yLoc); _userIdValueLabel = new UILabel(labelRect); _userIdValueLabel.BackgroundColor = UIColor.FromWhiteAlpha(0.5f, 0.5f); _userIdValueLabel.Layer.CornerRadius = 15f; _userIdValueLabel.Text = Model != null ? Model.Name : "NULL"; statsView.Add(userIdLabel); statsView.Add(_userIdValueLabel); this.Add(statsView); //float buttonStart = labelRect.Y + labelHeight + 10; loc = new PointF(10, 20); size = new SizeF(300, 44); rect = new RectangleF(loc, size); GlassButton b = new GlassButton(rect); b.SetTitleColor(UIColor.FromRGBA(255, 255, 0, 255), UIControlState.Normal); b.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; b.SetTitle("Delete Data", UIControlState.Normal); b.TouchUpInside += (o, e) => { string s = !string.IsNullOrEmpty(s) ? Model.Name : s = "NoData"; MXTouchContainer.Navigate("WelcomeScreen/Data/" + s); }; this.Add(b); var button = new UIBarButtonItem(UIBarButtonSystemItem.Refresh); button.Clicked += delegate(object sender, EventArgs e) { MXTouchContainer.Navigate("WelcomeScreen"); }; NavigationItem.SetRightBarButtonItem(button, true); // UI construction completed _uiContructed = true; } return(_uiContructed); }