public VideoCell(NSString cellId) : base(UITableViewCellStyle.Default, cellId) { SelectionStyle = UITableViewCellSelectionStyle.None; heading = new UILabel (); heading.TextColor = UIColor.White; heading.Font = UIFont.FromName ("Helvetica-Bold", 14f); heading.BackgroundColor = UIColor.Clear; heading.Lines = 2; category = new UILabel (); category.TextColor = UIColor.Red; category.Font = UIFont.FromName ("Helvetica", 12f); category.BackgroundColor = UIColor.Clear; image = new UIImageView (); image.ContentMode = UIViewContentMode.ScaleAspectFill; image.ClipsToBounds = true; play = new UIImageView (); headingView = new UIView (); headingView.BackgroundColor = UIColor.FromRGBA (0, 0, 0, 120); headingView.AddSubviews (new UIView[] { play, heading, category }); ContentView.Add (image); ContentView.Add (headingView); }
public override void LoadView() { base.LoadView(); this.View.Layer.BackgroundColor = ColorScheme.Clouds.CGColor; SearchButton = new UIButton(); holderView = new UIView(this.View.Frame); SearchTableView = new UITableView(new CGRect(), UITableViewStyle.Grouped); scrollView = new UIScrollView(this.View.Frame); SearchCityLabel = new UILabel { TextAlignment = UITextAlignment.Center }; SearchCityLabel.AttributedText = new NSAttributedString(String.Format("Search {0} for:", Location.SiteName), Constants.LabelAttributes); ads = new ADBannerView(); SearchButton.Layer.BackgroundColor = ColorScheme.MidnightBlue.CGColor; SearchButton.Layer.CornerRadius = 10; SearchButton.ClipsToBounds = true; SearchButton.SetAttributedTitle(new NSAttributedString("Search", Constants.ButtonAttributes), UIControlState.Normal); SearchTableView.Layer.BackgroundColor = ColorScheme.Clouds.CGColor; holderView.AddSubviews(new UIView[] { SearchButton, SearchCityLabel, SearchTableView, ads }); scrollView.AddSubview(holderView); this.View.AddSubview(scrollView); AddLayoutConstraints(); saveButton = new UIBarButtonItem( UIImage.FromFile("save.png"), UIBarButtonItemStyle.Plain, SaveButtonClicked); NavigationItem.RightBarButtonItem = saveButton; }
public UICustomProgressView() { currentProgressLabel = new UILabel(); currentProgressLabel.Text = "10000000"; ofProgressLabel = new UILabel(); ofProgressLabel.Text = "of"; totalProgressLabel = new UILabel(); totalProgressLabel.Text = "10000000"; progressNoContainer = new UIView(); progressNoContainer.BackgroundColor = UIColor.Yellow; progressNoContainer.Layer.BorderColor = UIColor.Red.CGColor; progressNoContainer.Layer.BorderWidth = 2f; progressNoContainer.AddSubviews(new UIView[] { currentProgressLabel, ofProgressLabel, totalProgressLabel }); progressNoContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); progressNoContainer.AddConstraints(new[] { currentProgressLabel.AtTopOf(progressNoContainer), currentProgressLabel.WithSameCenterX(progressNoContainer).Minus(25), currentProgressLabel.Height().EqualTo(30), ofProgressLabel.WithSameTop(currentProgressLabel), ofProgressLabel.ToRightOf(currentProgressLabel).Plus(5), ofProgressLabel.WithSameHeight(currentProgressLabel), totalProgressLabel.WithSameBottom(ofProgressLabel), totalProgressLabel.ToRightOf(ofProgressLabel).Plus(5), totalProgressLabel.WithSameHeight(ofProgressLabel) }); AddSubviews(new[] { progressNoContainer }); this.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints(); this.AddConstraints(new[] { progressNoContainer.WithSameCenterY(this), progressNoContainer.WithSameRight(this).Minus(10), progressNoContainer.Width().EqualTo(100), progressNoContainer.Height().EqualTo(30) }); }
//CUSTOM CELL public UIView UIViewFactory() { UIView uiview_xibless = new UIView(); uiview_xibless.Frame = new RectangleF(0,0,768,44); UIButton btnDelete; UILabel lblName; UILabel lblDate; btnDelete = UIButton.FromType(UIButtonType.Custom); btnDelete.Frame = new RectangleF(7,8,103,27); //UIControlState = Normal -> default system state for iOS element //UIControlState = Highlighted -> Highlighted state of a control. // A control enters this state when a touch enters and exits // during tracking and when there is a touch up event. btnDelete.SetTitleColor(UIColor.Blue,UIControlState.Normal); btnDelete.SetTitleColor(UIColor.Red,UIControlState.Highlighted); btnDelete.SetTitle("Delete", UIControlState.Normal); btnDelete.TouchUpInside += (object sender, EventArgs e) => { }; lblName = new UILabel(new RectangleF(140,11,489,21)); lblDate = new UILabel(new RectangleF(583,11,165,21)); lblName.Text = "Name"; lblDate.Text = DateTime.Now.ToString(); UIView [] views = { btnDelete, lblName, lblDate }; uiview_xibless.AddSubviews(views); return uiview_xibless; }
public override void LoadView() { base.LoadView(); this.View.Layer.BackgroundColor = ColorScheme.Clouds.CGColor; closeIcon = new UIImageView(UIImage.FromBundle("Delete-50.png")); CurrentImage = new UIImageView(); scrollview = new UIScrollView(this.View.Frame); holderView = new UIView(this.View.Frame); holderView.AddSubviews(new UIView[]{closeIcon, CurrentImage}); scrollview.AddSubview(holderView); this.View.AddSubview(scrollview); AddLayoutConstraints(); this.View.BackgroundColor = ColorScheme.Clouds; scrollview.BackgroundColor = ColorScheme.Clouds; scrollview.BackgroundColor.ColorWithAlpha(0.7f); CurrentImage.ContentMode = UIViewContentMode.ScaleAspectFit; closeIcon.UserInteractionEnabled = true; }
public override void LoadView() { _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _activityIndicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge) { BackgroundColor = UIColor.FromWhiteAlpha(0, .6f), TranslatesAutoresizingMaskIntoConstraints = false }; View = new UIView(); View.AddSubviews(_myMapView, _activityIndicator); _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor).Active = true; _myMapView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true; _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active = true; _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor).Active = true; _activityIndicator.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor).Active = true; _activityIndicator.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active = true; _activityIndicator.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor).Active = true; _activityIndicator.HeightAnchor.ConstraintEqualTo(40).Active = true; }
public void InitSubviews () { var image = UIImage.FromFile ("profile-stats-bg.png"); profileDetailsView = new UIView (); profileDetailsView.BackgroundColor = UIColor.FromPatternImage (image); profileDetailsView.Frame = new CGRect (profileDetailsView.Frame.Location, image.Size); workoutButton = Buttons.ProfileButton ("Workouts", "stats-workout.png"); cardioButton = Buttons.ProfileButton ("Cardio", "stats-cardio.png"); journalButton = Buttons.ProfileButton ("Journal", "stats-journal.png"); cardioButton.ImageEdgeInsets = new UIEdgeInsets (0, 19, 3, 0); cardioButton.TitleEdgeInsets = new UIEdgeInsets (0, 34, 3, 0); journalButton.ImageEdgeInsets = new UIEdgeInsets (0, 9, 3, 0); journalButton.TitleEdgeInsets = new UIEdgeInsets (0, 22, 3, 0); profileIcon = new UIImageView (UIImage.FromFile ("picture.png")); profileIcon.Center = new PointF (58, 55); profileDetailsView.AddSubviews (profileIcon, workoutButton, cardioButton, journalButton); InitLabels (); ProfileTableViewController = new ProfileController (); var tableFooterImageView = new UIImageView (FitpulseTheme.SharedTheme.TableFooterBackground); ProfileTableViewController.TableView.TableFooterView = tableFooterImageView; ProfileTableViewController.TableView.ReloadData (); Add (ProfileTableViewController.View); Add (profileDetailsView); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; UIToolbar toolbar = new UIToolbar(); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; toolbar.Items = new[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem("Change sublayer renderer", UIBarButtonItemStyle.Plain, ChangeSublayerRendererButton_TouchUpInside), new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) }; // Add the views. View.AddSubviews(_myMapView, toolbar); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), }); }
public override void LoadView() { // Create views View = new UIView { BackgroundColor = ApplicationTheme.BackgroundColor }; _homeLocationSearchBar = new UISearchBar { TranslatesAutoresizingMaskIntoConstraints = false, Placeholder = "LocationSearchBarPlaceholder".Localize(), BackgroundImage = new UIImage(), ShowsCancelButton = true, Text = AppSettings.CurrentSettings.HomeLocation, TintColor = ApplicationTheme.ActionBackgroundColor }; _autosuggestionsTableView = new UITableView { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColor.Clear }; // Add views View.AddSubviews(_homeLocationSearchBar, _autosuggestionsTableView); // Lay out views NSLayoutConstraint.ActivateConstraints(new[] { _homeLocationSearchBar.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _homeLocationSearchBar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _homeLocationSearchBar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _autosuggestionsTableView.TopAnchor.ConstraintEqualTo(_homeLocationSearchBar.BottomAnchor), _autosuggestionsTableView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _autosuggestionsTableView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _autosuggestionsTableView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor) }); }
public override void LoadView() { // Create the views. View = new UIView(); _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; UILabel helpLabel = new UILabel { Text = "Tap to show a callout.", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.FromWhiteAlpha(0, .6f), TextColor = UIColor.White, Lines = 1, TranslatesAutoresizingMaskIntoConstraints = false }; // Add the views. View.AddSubviews(_myMapView, helpLabel); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), helpLabel.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), helpLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), helpLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), helpLabel.HeightAnchor.ConstraintEqualTo(40) }); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; // Enable tap-for-callout pattern on results. _myMapView.GeoViewTapped += MyMapView_GeoViewTapped; _addressSearchBar = new UISearchBar(); _addressSearchBar.TranslatesAutoresizingMaskIntoConstraints = false; _addressSearchBar.UserInteractionEnabled = false; _addressSearchBar.ShowsSearchResultsButton = true; _addressSearchBar.ListButtonClicked += AddressSearch_ListButtonClicked; _addressSearchBar.SearchButtonClicked += AddressSearchBar_Clicked; // Add the views. View.AddSubviews(_myMapView, _addressSearchBar); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _addressSearchBar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _addressSearchBar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _addressSearchBar.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor), _myMapView.TopAnchor.ConstraintEqualTo(_addressSearchBar.BottomAnchor) }); }
public override void LoadView() { // Create the views. View = new UIView() { BackgroundColor = UIColor.White }; _mySceneView = new SceneView(); _mySceneView.TranslatesAutoresizingMaskIntoConstraints = false; UILabel helpLabel = new UILabel { Text = "Tap to find the elevation for a point.", BackgroundColor = UIColor.FromWhiteAlpha(0f, .6f), TextColor = UIColor.White, TextAlignment = UITextAlignment.Center, TranslatesAutoresizingMaskIntoConstraints = false }; // Add the views. View.AddSubviews(_mySceneView, helpLabel); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _mySceneView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _mySceneView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor), _mySceneView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _mySceneView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), helpLabel.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), helpLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), helpLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), helpLabel.HeightAnchor.ConstraintEqualTo(40) }); }
public override void LoadView() { // Create the views. View = new UIView(); _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _segmentButton = new UISegmentedControl("Sketch", "Edit", "Undo", "Redo", "Done", "Clear") { BackgroundColor = UIColor.FromWhiteAlpha(0, .7f), TintColor = UIColor.White, TranslatesAutoresizingMaskIntoConstraints = false }; _segmentButton.ValueChanged += SegmentButtonClicked; // Clean up borders of segmented control - avoid corner pixels. _segmentButton.ClipsToBounds = true; _segmentButton.Layer.CornerRadius = 5; // Add the views. View.AddSubviews(_myMapView, _segmentButton); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new [] { _myMapView.TopAnchor.ConstraintEqualTo(View.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor), _segmentButton.LeadingAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.LeadingAnchor), _segmentButton.TrailingAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.TrailingAnchor), _segmentButton.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor, 8) }); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; UIToolbar toolbar = new UIToolbar(); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; toolbar.Items = new[] { new UIBarButtonItem("Reset", UIBarButtonItemStyle.Plain, OnResetButtonClicked), new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem("Apply expression", UIBarButtonItemStyle.Plain, OnApplyExpressionClicked) }; // Add the views. View.AddSubviews(_myMapView, toolbar); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), }); }
public override void LoadView() { // Create the views. View = new UIView(); _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _styleChoiceButton = new UISegmentedControl("Default", "Contrast stretch") { BackgroundColor = UIColor.FromWhiteAlpha(0, .7f), TintColor = UIColor.White, Enabled = false, TranslatesAutoresizingMaskIntoConstraints = false, SelectedSegment = 0, // Clean up borders of segmented control - avoid corner pixels. ClipsToBounds = true, Layer = { CornerRadius = 5 } }; // Add the views. View.AddSubviews(_myMapView, _styleChoiceButton); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor), _styleChoiceButton.LeadingAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.LeadingAnchor), _styleChoiceButton.TrailingAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.TrailingAnchor), _styleChoiceButton.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor, 8) }); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; UIView formContainer = new UIView(); formContainer.TranslatesAutoresizingMaskIntoConstraints = false; formContainer.BackgroundColor = UIColor.White; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _inputParameter1 = new UITextField(); _inputParameter1.TranslatesAutoresizingMaskIntoConstraints = false; _inputParameter1.BorderStyle = UITextBorderStyle.RoundedRect; _inputParameter1.ShouldReturn += textField => { textField.ResignFirstResponder(); return(true); }; _inputParameter2 = new UITextField(); _inputParameter2.TranslatesAutoresizingMaskIntoConstraints = false; _inputParameter2.BorderStyle = UITextBorderStyle.RoundedRect; _inputParameter2.ShouldReturn += textField => { textField.ResignFirstResponder(); return(true); }; _labelParameter1 = new UILabel(); _labelParameter1.TextAlignment = UITextAlignment.Right; _labelParameter1.TranslatesAutoresizingMaskIntoConstraints = false; _labelParameter2 = new UILabel(); _labelParameter2.TextAlignment = UITextAlignment.Right; _labelParameter2.TranslatesAutoresizingMaskIntoConstraints = false; _updateRendererButton = new UIButton(); _updateRendererButton.TouchUpInside += UpdateRendererButton_Clicked; _updateRendererButton.SetTitle("Update renderer", UIControlState.Normal); _updateRendererButton.SetTitleColor(View.TintColor, UIControlState.Normal); _updateRendererButton.TranslatesAutoresizingMaskIntoConstraints = false; _rendererTypes = new UISegmentedControl("Min/Max", "% Clip", "Std. Deviation"); _rendererTypes.ValueChanged += rendererTypes_ValueChanged; _rendererTypes.SelectedSegment = 0; _rendererTypes.TintColor = View.TintColor; _rendererTypes.TranslatesAutoresizingMaskIntoConstraints = false; // Call a function to configure the labels appropriately rendererTypes_ValueChanged(_rendererTypes, null); // Add the views. View.AddSubviews(_myMapView, formContainer, _rendererTypes, _inputParameter1, _inputParameter2, _labelParameter1, _labelParameter2, _updateRendererButton); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _rendererTypes.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor, 8), _rendererTypes.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor, 8), _rendererTypes.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor, -8), _inputParameter1.TopAnchor.ConstraintEqualTo(_rendererTypes.BottomAnchor, 8), _inputParameter1.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor, -8), _inputParameter1.WidthAnchor.ConstraintEqualTo(72), _inputParameter2.TopAnchor.ConstraintEqualTo(_inputParameter1.BottomAnchor, 8), _inputParameter2.TrailingAnchor.ConstraintEqualTo(_inputParameter1.TrailingAnchor), _inputParameter2.WidthAnchor.ConstraintEqualTo(_inputParameter1.WidthAnchor), _updateRendererButton.TopAnchor.ConstraintEqualTo(_inputParameter2.BottomAnchor, 8), _updateRendererButton.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor), _updateRendererButton.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor), _labelParameter1.TopAnchor.ConstraintEqualTo(_inputParameter1.TopAnchor), _labelParameter1.LeadingAnchor.ConstraintEqualTo(_rendererTypes.LeadingAnchor), _labelParameter1.TrailingAnchor.ConstraintEqualTo(_inputParameter1.LeadingAnchor, -8), _labelParameter1.BottomAnchor.ConstraintEqualTo(_inputParameter1.BottomAnchor), _labelParameter2.TopAnchor.ConstraintEqualTo(_inputParameter2.TopAnchor), _labelParameter2.BottomAnchor.ConstraintEqualTo(_inputParameter2.BottomAnchor), _labelParameter2.LeadingAnchor.ConstraintEqualTo(_labelParameter1.LeadingAnchor), _labelParameter2.TrailingAnchor.ConstraintEqualTo(_labelParameter1.TrailingAnchor), formContainer.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), formContainer.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), formContainer.BottomAnchor.ConstraintEqualTo(_updateRendererButton.BottomAnchor, 8), formContainer.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.TopAnchor.ConstraintEqualTo(formContainer.BottomAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor) }); }
private RootElement CreateRootElement() { var captionLabel = UIHelper.CreateLabel( "cross copy", true, 32, 32, UITextAlignment.Center, UIColor.Black ); UILabel subcaptionLabel = UIHelper.CreateLabel( WELCOME_LABEL_TEXT, false, 14, 85, UITextAlignment.Center, lightTextColor ); subcaptionLabel.Tag = 3; captionLabel.Frame = new Rectangle(0, 10, 320, 40); subcaptionLabel.Frame = new Rectangle(20, 55, 280, 100); UIView header = new UIView(new Rectangle(0, 0, 300, 145)); header.AddSubviews(captionLabel, subcaptionLabel); var root = new RootElement("Secrets") { new Section(header), (secretsSection = new Section("Secrets")), new Section() { (secretEntry = new AdvancedEntryElement("Secret", "enter new phrase", "", null)) } }; secretsSection.AddAll(from s in AppDelegate.HistoryData.Secrets select(Element) CreateImageButtonStringElement(s)); secretEntry.AutocapitalizationType = UITextAutocapitalizationType.None; secretEntry.ShouldReturn += delegate { if (String.IsNullOrEmpty(secretEntry.Value)) { return(false); } var newSecret = new Secret(secretEntry.Value); AppDelegate.HistoryData.Secrets.Add(newSecret); if (root.Count == 2) { root.Insert(1, secretsSection); } secretsSection.Insert( secretsSection.Elements.Count, UITableViewRowAnimation.Fade, CreateImageButtonStringElement(newSecret) ); secretEntry.Value = ""; secretEntry.ResignFirstResponder(false); DisplaySecretDetail(newSecret); return(true); }; secretEntry.ReturnKeyType = UIReturnKeyType.Go; if (secretsSection.Count == 0) { secretEntry.BecomeFirstResponder(true); root.RemoveAt(1); } return(root); }
void InitSubviews() { _productImage = new UIImageView(new RectangleF(5, 5, 231, 200)); AddSubviews(_productImage); // _statusView = new UIView(new RectangleF(0, 0, 241, 71)); // _titleLabel = new UILabel(new RectangleF(15, 0, 210, 22)) { TextColor = Consts.ColorDark, Font = UIFont.FromName(Consts.FontNameBold, 16), TextAlignment = UITextAlignment.Center, Lines = 0, LineBreakMode = UILineBreakMode.WordWrap }; // _lineView = new UIView(new CGRect(90, 0, 60, 2)) { BackgroundColor = Consts.ColorDivider }; _descriptionLabel = new UILabel(new RectangleF(15, 45, 210, 22)) { Font = UIFont.FromName(Consts.FontNameCursive, 12), TextColor = Consts.ColorDarkLight, Lines = 0, LineBreakMode = UILineBreakMode.WordWrap }; _statusView.AddSubviews(_titleLabel, _descriptionLabel, _lineView); Add(_statusView); // _listPriceLable = new UILabel(new RectangleF(8, 10, 50, 30)) { TextColor = Consts.ColorDarkLight, Font = UIFont.FromName(Consts.FontNameRegular, 16), TextAlignment = UITextAlignment.Center }; // _salePriceLable = new UILabel(new RectangleF(58, 10, 50, 30)) { TextColor = Consts.ColorDark, Font = UIFont.FromName(Consts.FontNameBold, 20), TextAlignment = UITextAlignment.Center }; // _cartButton = new UIButton(new RectangleF(200, 8, 25, 25)); _cartButton.TouchDown += TouchCart; _cartButton.SetImage(UIImage.FromFile("cart-black"), UIControlState.Normal); _actionsView = new UIView(new RectangleF(0, 20, 241, 40)); _actionsView.AddSubviews(_listPriceLable, _salePriceLable, _cartButton); // nfloat r, g, b, a; Consts.ColorMain.GetRGBA(out r, out g, out b, out a); Layer.BorderColor = UIColor.FromRGBA(r, g, b, new nfloat(0.1)).CGColor; Layer.BorderWidth = 1; // Add(_actionsView); }
public override UITableViewCell GetCell (UITableView tableView, Foundation.NSIndexPath indexPath) { Console.WriteLine (DateTime.Now.ToString ()); if (tableView.Frame.X != 600) { switch (indexPath.Section) { case 0: { UITableViewCell cell = new UITableViewCell (UITableViewCellStyle.Subtitle, null); cell.TextLabel.Text = _AList [indexPath.Row]; cell.DetailTextLabel.Text = _AList [indexPath.Row]; switch (indexPath.Row) { case 0: { cell.Accessory = UITableViewCellAccessory.None; break; } case 1: { cell.Accessory = UITableViewCellAccessory.Checkmark; break; } case 2: { cell.Accessory = UITableViewCellAccessory.DetailButton; break; } case 3: { cell.Accessory = UITableViewCellAccessory.DetailDisclosureButton; break; } case 4: { cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; break; } } return cell; } case 1: { UITableViewCell cell = new UITableViewCell (UITableViewCellStyle.Value1, null); cell.TextLabel.Text = _AList [indexPath.Row].ToLower (); cell.DetailTextLabel.Text = _AList [indexPath.Row].ToLower (); return cell; } case 2: { UITableViewCell cell = new UITableViewCell (UITableViewCellStyle.Value2, null); cell.TextLabel.Text = _numList [indexPath.Row]; cell.DetailTextLabel.Text = _numList [indexPath.Row]; return cell; } case 3: default: { UITableViewCell cell = new UITableViewCell (UITableViewCellStyle.Default, null); cell.TextLabel.Text = _miList [indexPath.Row]; cell.ImageView.Image = new UIImage ("1_130124110644_3.png"); return cell; } } } else { switch (indexPath.Section) { case 0: { UITableViewCell cell = new UITableViewCell (UITableViewCellStyle.Subtitle, null); cell.TextLabel.Text = _AList [indexPath.Row]; cell.DetailTextLabel.Text = _AList [indexPath.Row]; switch (indexPath.Row) { case 0: { //cell.Accessory = UITableViewCellAccessory.None; UISwitch sw = new UISwitch (new CoreGraphics.CGRect (0, 0, 50, 20)); sw.Selected = true; sw.ValueChanged += this.Sw_ValueChange; //sw.AddTarget(Sw_ValueChange); cell.AccessoryView = sw; break; } case 1: { //cell.Accessory = UITableViewCellAccessory.Checkmark; UIView vi=new UIView(new CoreGraphics.CGRect(0,0,350,50)); UIImageView imgv = new UIImageView (new CoreGraphics.CGRect(0, 0, 100, 50)); imgv.Image=new UIImage("1_130124110644_3.png"); UILabel lbl = new UILabel (new CoreGraphics.CGRect (110, 0, 100, 30)); lbl.BackgroundColor = UIColor.Gray; lbl.Text="My Label"; UIButton btn = new UIButton (UIButtonType.System); btn.Frame = new CoreGraphics.CGRect (220, 0, 40, 30); btn.SetTitle ("OK", UIControlState.Normal); btn.TouchUpInside += CellBtn_TouchUpInside; vi.AddSubviews (imgv, lbl, btn); cell.AccessoryView = vi; break; } } return cell; } case 1: { UITableViewCell cell = new UITableViewCell (UITableViewCellStyle.Value1, null); cell.TextLabel.Text = _AList [indexPath.Row].ToLower (); cell.DetailTextLabel.Text = _AList [indexPath.Row].ToLower (); return cell; } case 2: { UITableViewCell cell = new UITableViewCell (UITableViewCellStyle.Value2, null); cell.TextLabel.Text = _numList [indexPath.Row]; cell.DetailTextLabel.Text = _numList [indexPath.Row]; return cell; } case 3: default: { UITableViewCell cell = new UITableViewCell (UITableViewCellStyle.Default, null); cell.TextLabel.Text = _miList [indexPath.Row]; cell.ImageView.Image = new UIImage ("1_130124110644_3.png"); return cell; } } } }
/// <summary> /// <para>Constrains the layout of subviews according to equations and /// inequalities specified in <paramref name="constraints"/>. Issue /// multiple constraints per call using the && operator.</para> /// <para>e.g. button.Frame.Left >= text.Frame.Right + 22 && /// button.Frame.Width == View.Frame.Width * 0.42f</para> /// </summary> /// <param name="view">The superview laying out the referenced subviews.</param> /// <param name="constraints">Constraint equations and inequalities.</param> /// <param name="views">Views to which we want to add constraints</param> public static NSLayoutConstraint[] ConstrainLayout(this UIView view, Expression <Func <bool> > constraints, params UIView[] views) { view.AddSubviews(views); return(ConstrainLayout(view, constraints, UILayoutPriority.Required)); }
private void EnsureViews () { if (containerView != null) return; var navController = controller.NavigationController; if (navController == null) return; containerView = new UIView () { ClipsToBounds = true, }; menuView = new UIView ().Apply (Style.NavMenu.Background); menuButtons = new[] { // (recentButton = new UIButton ()), (logButton = new UIButton ()), (settingsButton = new UIButton ()), (feedbackButton = new UIButton ()), (signOutButton = new UIButton ()), }; // recentButton.SetTitle ("NavMenuRecent".Tr (), UIControlState.Normal); logButton.SetTitle ("NavMenuLog".Tr (), UIControlState.Normal); settingsButton.SetTitle ("NavMenuSettings".Tr (), UIControlState.Normal); feedbackButton.SetTitle ("NavMenuFeedback".Tr (), UIControlState.Normal); signOutButton.SetTitle ("NavMenuSignOut".Tr (), UIControlState.Normal); foreach (var menuButton in menuButtons) { var isActive = (menuButton == recentButton && controller is RecentViewController) || (menuButton == logButton && controller is LogViewController); if (isActive) { menuButton.Apply (Style.NavMenu.HighlightedItem); } else { menuButton.Apply (Style.NavMenu.NormalItem); } menuButton.TouchUpInside += OnMenuButtonTouchUpInside; } separators = new UIView[menuButtons.Length - 1]; for (var i = 0; i < separators.Length; i++) { separators [i] = new UIView ().Apply (Style.NavMenu.Separator); } menuView.AddSubviews (separators); menuView.AddSubviews (menuButtons); containerView.AddSubview (menuView); // Layout items: var offsetY = 15f; var sepIdx = 0; foreach (var menuButton in menuButtons) { menuButton.SizeToFit (); var frame = menuButton.Frame; frame.Width = navController.View.Frame.Width; frame.Y = offsetY; menuButton.Frame = frame; offsetY += frame.Height; // Position separator if (sepIdx < separators.Length) { var separator = separators [sepIdx]; var rightMargin = menuButton.ContentEdgeInsets.Right; separator.Frame = new RectangleF ( x: rightMargin, y: offsetY, width: navController.View.Frame.Width - rightMargin, height: 1f ); sepIdx += 1; offsetY += separator.Frame.Height; } } offsetY += 15f; containerView.Frame = new RectangleF ( x: 0, y: navController.NavigationBar.Frame.Bottom, width: navController.View.Frame.Width, height: offsetY ); menuView.Frame = new RectangleF ( x: 0, y: -containerView.Frame.Height, width: containerView.Frame.Width, height: containerView.Frame.Height ); return; }
UITableViewCell CellContentFactoryImplementationForPerson2() { UITableViewCell cc = new UITableViewCell(); UIView uiview_xibless = new UIView(); uiview_xibless.Frame = new RectangleF(0, 0, 750, 44); UIButton btnDelete; UILabel lblName; UILabel lblDate; btnDelete = UIButton.FromType(UIButtonType.Custom); btnDelete.Frame = new RectangleF(30, 8, 100, 27); lblName = new UILabel(new RectangleF(150, 8 + 3, 350, 21)); lblDate = new UILabel(new RectangleF(500, 8 + 3, 150, 21)); //UIControlState = Normal -> default system state for iOS element //UIControlState = Highlighted -> Highlighted state of a control. // A control enters this state when a touch enters and exits // during tracking and when there is a touch up event. btnDelete.SetTitleColor(UIColor.Green, UIControlState.Normal); btnDelete.SetTitleColor(UIColor.Orange, UIControlState.Highlighted); btnDelete.SetTitle("Delete", UIControlState.Normal); btnDelete.TouchUpInside += (object sender, EventArgs e) => { }; lblName.Text = "Name"; lblDate.Text = DateTime.Now.ToString(); UIView[] views = { btnDelete, lblName, lblDate }; uiview_xibless.AddSubviews(views); UIView content_view = uiview_xibless; // wrap UIView cc.Bounds = content_view.Bounds; cc.AddSubview(content_view); return cc; }
public void DrawOpeningPage() { try { DateClass dt = new DateClass(); int iColNo = 0; int iSectionId = 0; bool bYes; bool bNo; bool bNA; string sId = m_sPassedId; float iVert = 0f; float iSectionHdrRowHeight = 40f; float iQuestionHdrRowHeight = 20f; float iQuestionRowHeight = 30f; float iQuestionRowVert = 0f; float iTotalHeight = 0f; float iHeightToAdd = iQuestionRowHeight; float iHeightToAdd2 = iHeightToAdd; bool bDisableRow = false; bool bFullyCommitted = false; bool bHideComplete = true; bool[] bHideSections = new bool[1]; UIView[] arrItems = new UIView[5]; UIView[] arrItems2 = new UIView[6]; UIView[] arrItems3 = new UIView[5]; UIView[] arrItems4 = new UIView[6]; UIView[] arrItems6 = new UIView[11]; UIView[] arrItems7 = new UIView[7]; UIView[] arrItems14 = new UIView[8]; UIScrollView layout = new UIScrollView(); layout.Frame = new RectangleF(0f,35f,1000f,620f); layout.Tag = 2; clsTabletDB.ITPDocumentSection ITPSection = new clsTabletDB.ITPDocumentSection(); //Get all the sections and place a table layout for each one DataSet arrITPSections = ITPSection.GetLocalITPSections(sId); if (arrITPSections.Tables.Count > 0) { int iRows = arrITPSections.Tables[0].Rows.Count; m_iSections = iRows; m_iQuestionSections = iRows; Array.Resize<bool>(ref bHideSections, iRows); for (int i = 0; i < iRows; i++) { bHideSections[i] = false; //Add in a view for each section. UIView SectionRow = new UIView(); iSectionId = iSectionTagId * (i+1); SectionRow.Tag = iSectionId; SectionRow.Frame = new RectangleF(0f,iVert,1000f,iSectionHdrRowHeight); layout.AddSubview(SectionRow); //Add in the section title and buttons for each section header UILabel hfSection = new UILabel(); iColNo = arrITPSections.Tables[0].Columns["SectionId"].Ordinal; hfSection.Text = arrITPSections.Tables[0].Rows[i].ItemArray[iColNo].ToString(); hfSection.Tag = iSectionDBIdTagId * (i+1); hfSection.Hidden = true; SectionRow.AddSubview(hfSection); iUtils.CreateFormGridItem Section = new iUtils.CreateFormGridItem(); UIView SectionVw = new UIView(); iColNo = arrITPSections.Tables[0].Columns["Name"].Ordinal; Section.SetDimensions(0f,0f, 300f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); Section.SetLabelText(arrITPSections.Tables[0].Rows[i].ItemArray[iColNo].ToString()); Section.SetBorderWidth(0.0f); Section.SetFontName("Verdana-Bold"); Section.SetTextColour("White"); Section.SetFontSize(12f); Section.SetCellColour("DarkSlateGrey"); Section.SetTag(iSectionDescTagId * (i+1)); SectionVw = Section.GetLabelCell(); arrItems[0] = SectionVw; bool bAnyCommitted = ITPSection.ProjectSectionRFUAnyPwrIdCommitted(m_sPassedId); if(bAnyCommitted) { bFullyCommitted = true; bHideComplete = false; } else { bFullyCommitted = false; bHideComplete = true; } iUtils.CreateFormGridItem SectionCompleteLabel = new iUtils.CreateFormGridItem(); UIView SectionCompleteLabelVw = new UIView(); SectionCompleteLabel.SetDimensions(300f,0f, 250f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); if(bFullyCommitted) { SectionCompleteLabel.SetLabelText("COMMITTED"); } else { SectionCompleteLabel.SetLabelText("COMPLETED"); } SectionCompleteLabel.SetBorderWidth(0.0f); SectionCompleteLabel.SetFontName("Verdana-Bold"); SectionCompleteLabel.SetTextColour("Bright Yellow"); SectionCompleteLabel.SetFontSize(14f); SectionCompleteLabel.SetCellColour("DarkSlateGrey"); SectionCompleteLabel.SetTag(iSectionCompleteLabelTagId * (i+1)); SectionCompleteLabel.SetHidden(bHideComplete); SectionCompleteLabelVw = SectionCompleteLabel.GetLabelCell(); arrItems[1] = SectionCompleteLabelVw; iUtils.CreateFormGridItem btnSave = new iUtils.CreateFormGridItem(); UIView btnSaveVw = new UIView(); btnSave.SetDimensions(550f,0f, 150f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnSave.SetLabelText("Save Section"); btnSave.SetBorderWidth(0.0f); btnSave.SetFontName("Verdana"); btnSave.SetFontSize(12f); btnSave.SetTag(iSaveSectionBtnTagId * (i+1)); btnSave.SetCellColour("DarkSlateGrey"); btnSaveVw = btnSave.GetButtonCell(); UIButton btnSaveButton = new UIButton(); btnSaveButton = btnSave.GetButton(); btnSaveButton.TouchUpInside += (sender,e) => {SaveThisSection(sender, e);}; arrItems[2] = btnSaveVw; iUtils.CreateFormGridItem btnExpand = new iUtils.CreateFormGridItem(); UIView btnExpandVw = new UIView(); btnExpand.SetDimensions(700f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnExpand.SetLabelText("+"); btnExpand.SetBorderWidth(0.0f); btnExpand.SetFontName("Verdana"); btnExpand.SetFontSize(12f); btnExpand.SetTag(iExpandSectionBtnTagId * (i+1)); btnExpand.SetCellColour("DarkSlateGrey"); btnExpandVw = btnExpand.GetButtonCell(); UIButton btnExpandButton = new UIButton(); btnExpandButton = btnExpand.GetButton(); btnExpandButton.Enabled = false; btnExpandButton.TouchUpInside += (sender,e) => {ExpandSection(sender, e);}; arrItems[3] = btnExpandVw; iUtils.CreateFormGridItem btnContract = new iUtils.CreateFormGridItem(); UIView btnContractVw = new UIView(); btnContract.SetDimensions(750f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnContract.SetLabelText("-"); btnContract.SetBorderWidth(0.0f); btnContract.SetFontName("Verdana"); btnContract.SetFontSize(12f); btnContract.SetTag(iContractSectionBtnTagId * (i+1)); btnContract.SetCellColour("DarkSlateGrey"); btnContractVw = btnContract.GetButtonCell(); UIButton btnContractButton = new UIButton(); btnContractButton = btnContract.GetButton(); btnContractButton.TouchUpInside += (sender,e) => {ContractSection(sender, e);}; arrItems[4] = btnContractVw; SectionRow.AddSubviews(arrItems); iVert += iSectionHdrRowHeight; //Now add a new view to this view to hold another view containing all the questions for this section UIView QuestionsTableRow = new UIView(); float iQuestionRowVertTop = iVert; QuestionsTableRow.Frame = new RectangleF(0f,iQuestionRowVertTop,1000f,iQuestionHdrRowHeight); iSectionId = iContainerSectionTagId * (i+1); QuestionsTableRow.Tag = iSectionId; layout.AddSubview(QuestionsTableRow); //Get all the questions in this section and place a row for each one iColNo = arrITPSections.Tables[0].Columns["SectionId"].Ordinal; int iDBSectionId = Convert.ToInt32( arrITPSections.Tables[0].Rows[i].ItemArray[iColNo]); iColNo = arrITPSections.Tables[0].Columns["QuestionType"].Ordinal; int iQuestionTypes = Convert.ToInt32(arrITPSections.Tables[0].Rows[i].ItemArray[iColNo]); DataSet arrITPSectionQuestions = ITPSection.GetLocalITPSectionQuestions(sId, iDBSectionId); if (arrITPSectionQuestions.Tables.Count > 0) { int iQuestionRows = arrITPSectionQuestions.Tables[0].Rows.Count; //Put in the header row iUtils.CreateFormGridItem lblQuestionHdr = new iUtils.CreateFormGridItem(); UIView lblQuestionHdrVw = new UIView(); lblQuestionHdr.SetDimensions(0f,0f, 400f, iQuestionHdrRowHeight, 4f, 1f, 4f, 1f); lblQuestionHdr.SetLabelText("Question"); lblQuestionHdr.SetBorderWidth(0.0f); lblQuestionHdr.SetFontName("Verdana-Bold"); lblQuestionHdr.SetTextAlignment("Centre"); lblQuestionHdr.SetFontSize(12f); lblQuestionHdr.SetCellColour("Pale Yellow"); lblQuestionHdr.SetTag(iQuestionHdrTagId * (i+1)); lblQuestionHdrVw = lblQuestionHdr.GetLabelCell(); arrItems2[0] = lblQuestionHdrVw; iUtils.CreateFormGridItem lblAnswerHdr = new iUtils.CreateFormGridItem(); UIView lblAnswerHdrVw = new UIView(); lblAnswerHdr.SetDimensions(400f,0f, 200f, iQuestionHdrRowHeight, 4f, 1f, 4f, 1f); lblAnswerHdr.SetLabelText("Answer"); lblAnswerHdr.SetBorderWidth(0.0f); lblAnswerHdr.SetFontName("Verdana-Bold"); lblAnswerHdr.SetTextAlignment("Centre"); lblAnswerHdr.SetFontSize(12f); lblAnswerHdr.SetCellColour("Pale Yellow"); lblAnswerHdr.SetTag(iAnswerHdrTagId * (i+1)); lblAnswerHdrVw = lblAnswerHdr.GetLabelCell(); arrItems2[1] = lblAnswerHdrVw; iUtils.CreateFormGridItem lblCommentsHdr = new iUtils.CreateFormGridItem(); UIView lblCommentsHdrVw = new UIView(); lblCommentsHdr.SetDimensions(600f,0f, 200f, iQuestionHdrRowHeight, 4f, 1f, 4f, 1f); lblCommentsHdr.SetLabelText("Comments"); lblCommentsHdr.SetBorderWidth(0.0f); lblCommentsHdr.SetFontName("Verdana-Bold"); lblCommentsHdr.SetTextAlignment("Centre"); lblCommentsHdr.SetFontSize(12f); lblCommentsHdr.SetCellColour("Pale Yellow"); lblCommentsHdr.SetTag(iCommentsHdrTagId * (i+1)); lblCommentsHdrVw = lblCommentsHdr.GetLabelCell(); arrItems2[2] = lblCommentsHdrVw; layout.AddSubview(QuestionsTableRow); float iSectionQuestionsHeight = iQuestionHdrRowHeight; UILabel hfSectionHeight = new UILabel(); hfSectionHeight.Tag = iSectionHeightTagId * (i+1); hfSectionHeight.Hidden = true; arrItems2[3] = hfSectionHeight; UILabel hfSectionRows = new UILabel(); hfSectionRows.Tag = iSectionRowsTagId * (i+1); hfSectionRows.Hidden = true; hfSectionRows.Text = iQuestionRows.ToString(); arrItems2[4] = hfSectionRows; UILabel hfSectionStatus = new UILabel(); hfSectionStatus.Tag = iSectionStatusTagId * (i+1); hfSectionStatus.Hidden = true; hfSectionStatus.Text = "0"; arrItems2[5] = hfSectionStatus; QuestionsTableRow.AddSubviews(arrItems2); iVert += iQuestionHdrRowHeight; iQuestionRowVert = iQuestionHdrRowHeight; bool bSectionFullyCompleted = true; for (int j = 0; j < iQuestionRows; j++) { UILabel hfRowStatus = new UILabel(); hfRowStatus.Text = "0"; hfRowStatus.Tag = (ihfRowStatusTagId + (j+1)) * (i+1); hfRowStatus.Hidden = true; arrItems3[0] = hfRowStatus; iColNo = arrITPSectionQuestions.Tables[0].Columns["AutoId"].Ordinal; string sAutoId = arrITPSectionQuestions.Tables[0].Rows[j].ItemArray[iColNo].ToString(); iColNo = arrITPSectionQuestions.Tables[0].Columns["Question"].Ordinal; string sQuestion = arrITPSectionQuestions.Tables[0].Rows[j].ItemArray[iColNo].ToString(); UILabel hfAutoId = new UILabel(); hfAutoId.Text = sAutoId; hfAutoId.Tag = (ihfAutoRowTagId + (j+1)) * (i+1); hfAutoId.Hidden = true; arrItems3[1] = hfAutoId; //Put in the question iUtils.CreateFormGridItem rowQuestion = new iUtils.CreateFormGridItem(); UIView rowQuestionVw = new UIView(); rowQuestion.SetLabelWrap(1); //This means the text will be wrapped in the label rowQuestion.SetDimensions(0f,iQuestionRowVert, 400f, iQuestionRowHeight, 2f, 2.5f, 2f, 2.5f); rowQuestion.SetLabelText(sQuestion); rowQuestion.SetBorderWidth(0.0f); rowQuestion.SetFontName("Verdana"); rowQuestion.SetFontSize(12f); rowQuestion.SetTag((iQuestionRowTagId + (j+1)) * (i+1)); if (j % 2 == 0) { rowQuestion.SetCellColour("Pale Blue"); } else { rowQuestion.SetCellColour("Sky Blue"); } rowQuestionVw = rowQuestion.GetLabelCell(); iHeightToAdd = rowQuestion.GetCellHeight(); //Put in the answer iColNo = arrITPSectionQuestions.Tables[0].Columns["Yes"].Ordinal; bYes = Convert.ToBoolean(arrITPSectionQuestions.Tables[0].Rows[j].ItemArray[iColNo]); iColNo = arrITPSectionQuestions.Tables[0].Columns["No"].Ordinal; bNo = Convert.ToBoolean(arrITPSectionQuestions.Tables[0].Rows[j].ItemArray[iColNo]); iColNo = arrITPSectionQuestions.Tables[0].Columns["NA"].Ordinal; bNA = Convert.ToBoolean(arrITPSectionQuestions.Tables[0].Rows[j].ItemArray[iColNo]); iUtils.CreateFormGridItem radGrp = new iUtils.CreateFormGridItem(); UIView radGrpVw = new UIView(); radGrp.SetDimensions(400f,iQuestionRowVert, 200f, iQuestionRowHeight, 2f, 2.5f, 2f, 2.5f); radGrp.SetFontName("Verdana"); radGrp.SetFontSize(12f); radGrp.SetTag((iAnswerGroupTagId + (j+1)) * (i+1)); if (j % 2 == 0) { radGrp.SetCellColour("Pale Blue"); } else { radGrp.SetCellColour("Sky Blue"); } radGrpVw = radGrp.GetRadioButtonCell(); UISegmentedControl radGrpRadio = new UISegmentedControl(); radGrpRadio = radGrp.GetRadioGroup(); radGrpRadio.TouchUpInside += (sender,e) => {SetRowRadioChanged(sender, e);}; radGrpRadio.ValueChanged += (sender,e) => {SetRowRadioChanged(sender, e);}; QuestionsBitMask mask = (QuestionsBitMask)iQuestionTypes; int iPos = 0; bool bQuestionSet = false; if ((mask & QuestionsBitMask.Yes) == QuestionsBitMask.Yes) { radGrpRadio.InsertSegment("Yes", iPos,false); if(bYes) { radGrpRadio.SelectedSegment = iPos; bQuestionSet= true; } iPos++; } if ((mask & QuestionsBitMask.No) == QuestionsBitMask.No) { radGrpRadio.InsertSegment("No", iPos,false); if(bNo) { radGrpRadio.SelectedSegment = iPos; bQuestionSet= true; } iPos++; } if ((mask & QuestionsBitMask.NA) == QuestionsBitMask.NA) { radGrpRadio.InsertSegment("N/A", iPos,false); if(bNA) { radGrpRadio.SelectedSegment = iPos; bQuestionSet= true; } } if(bQuestionSet) { radGrpRadio.Enabled = false; } else { bSectionFullyCompleted = false; } //Put in the comments iUtils.CreateFormGridItem rowComments = new iUtils.CreateFormGridItem(); UIView rowCommentsVw = new UIView(); iColNo = arrITPSectionQuestions.Tables[0].Columns["Comments"].Ordinal; rowComments.SetLabelWrap(1); //This means the text will be wrapped in the label rowComments.SetDimensions(600f,iQuestionRowVert, 200f, iQuestionRowHeight, 2f, 2.5f, 2f, 2.5f); rowComments.SetLabelText(arrITPSectionQuestions.Tables[0].Rows[j].ItemArray[iColNo].ToString()); rowComments.SetBorderWidth(0.0f); rowComments.SetFontName("Verdana"); rowComments.SetFontSize(12f); rowComments.SetTag((iCommentsTagId + (j+1)) * (i+1)); // if (j % 2 == 0) { rowComments.SetCellColour("Pale Blue"); } else { rowComments.SetCellColour("Sky Blue"); } rowCommentsVw = rowComments.GetTextCell(); iHeightToAdd2 = rowComments.GetCellHeight(); UITextView rowCommentsTextVw = new UITextView(); rowCommentsTextVw = rowComments.GetTextView(); rowCommentsTextVw.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 11);}; rowCommentsTextVw.Changed += (sender,e) => {SetRowEditTextChanged(sender, e);}; if(bQuestionSet) { rowCommentsTextVw.Editable = false; } if(iHeightToAdd2 > iHeightToAdd) { rowQuestion.SetDimensions(0f,iQuestionRowVert, 400f, iHeightToAdd2, 2f, 2.5f, 2f, 2.5f); rowQuestion.ResetCellViewDimensions(rowQuestionVw); radGrp.SetDimensions(400f,iQuestionRowVert, 200f, iHeightToAdd2, 2f, 2.5f, 2f, 2.5f); radGrp.ResetCellViewDimensions(radGrpVw); } else { radGrp.SetDimensions(400f,iQuestionRowVert, 200f, iHeightToAdd, 2f, 2.5f, 2f, 2.5f); radGrp.ResetCellViewDimensions(radGrpVw); rowComments.SetDimensions(600f,iQuestionRowVert, 200f, iHeightToAdd, 2f, 2.5f, 2f, 2.5f); rowComments.ResetCellViewDimensions(rowCommentsVw); rowComments.ResetCellTextViewDimensions(rowCommentsTextVw); } arrItems3[2] = rowQuestionVw; arrItems3[3] = radGrpVw; arrItems3[4] = rowCommentsVw; QuestionsTableRow.AddSubviews(arrItems3); iSectionQuestionsHeight += iHeightToAdd; iQuestionRowVert += iHeightToAdd; iVert += iHeightToAdd; } //Now resize the UIView that is effectively the container for the questions for this section //And also store this height in a hidden field for use in the contract and expand functions QuestionsTableRow.Frame = new RectangleF(0f,iQuestionRowVertTop,1000f,iSectionQuestionsHeight); hfSectionHeight.Text = iSectionQuestionsHeight.ToString(); if(bSectionFullyCompleted) { bHideSections[i] = true; } } } } //******************************************************************************************// // SECTION 10 (BATTERIES) // //******************************************************************************************// //Get all the PwrId's for this project from ITPSection10 DataSet arrITPSection10PwrIds = ITPSection.GetLocalITPSection10PwrIds(sId, 6); if (arrITPSection10PwrIds.Tables.Count > 0) { int ii = arrITPSections.Tables[0].Rows.Count; m_iSections++; //Add an extra one for the batteries section m_iBatterySectionCounter = ii; int iPwrIdRows = arrITPSection10PwrIds.Tables[0].Rows.Count; //Add in the section title and buttons for each section header UIView Section10Row = new UIView(); float iSection10RowVertTop = iVert; Section10Row.Frame = new RectangleF(0f,iSection10RowVertTop,1000f,iSectionHdrRowHeight); iSectionId = iSectionTagId * (ii+1); Section10Row.Tag = iSectionId; layout.AddSubview(Section10Row); UILabel hfSection10 = new UILabel(); hfSection10.Text = "10"; hfSection10.Tag = iSectionDBIdTagId * (ii+1); hfSection10.Hidden = true; Section10Row.AddSubview(hfSection10); iUtils.CreateFormGridItem Section10 = new iUtils.CreateFormGridItem(); UIView Section10Vw = new UIView(); Section10.SetDimensions(0f,0f, 300f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); Section10.SetLabelText("BATTERIES"); Section10.SetBorderWidth(0.0f); Section10.SetFontName("Verdana-Bold"); Section10.SetTextColour("White"); Section10.SetFontSize(12f); Section10.SetCellColour("DarkSlateGrey"); Section10.SetTag(iSectionDescTagId * (ii+1)); Section10Vw = Section10.GetLabelCell(); arrItems4[0] = Section10Vw; if(RFUFullyCommitted()) { bFullyCommitted = true; bHideComplete = false; } else { if(BatteryFullyCommitted()) { bFullyCommitted = true; bHideComplete = false; } else { bFullyCommitted = false; if(BatteryFullyComplete()) { bHideComplete = false; } else { bHideComplete = true; } } } iUtils.CreateFormGridItem SectionCompleteLabel = new iUtils.CreateFormGridItem(); UIView SectionCompleteLabelVw = new UIView(); SectionCompleteLabel.SetDimensions(300f,0f, 150f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); if(bFullyCommitted) { SectionCompleteLabel.SetLabelText("COMMITTED"); } else { SectionCompleteLabel.SetLabelText("COMPLETED"); } SectionCompleteLabel.SetBorderWidth(0.0f); SectionCompleteLabel.SetFontName("Verdana-Bold"); SectionCompleteLabel.SetTextColour("Bright Yellow"); SectionCompleteLabel.SetFontSize(14f); SectionCompleteLabel.SetCellColour("DarkSlateGrey"); SectionCompleteLabel.SetTag(iSectionCompleteLabelTagId * (ii+1)); SectionCompleteLabel.SetHidden(bHideComplete); SectionCompleteLabelVw = SectionCompleteLabel.GetLabelCell(); arrItems4[1] = SectionCompleteLabelVw; iUtils.CreateFormGridItem btnSave10 = new iUtils.CreateFormGridItem(); UIView btnSave10Vw = new UIView(); btnSave10.SetDimensions(450f,0f, 350f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnSave10.SetLabelText("Open Battery Details Screen"); btnSave10.SetBorderWidth(0.0f); btnSave10.SetFontName("Verdana"); btnSave10.SetFontSize(12f); btnSave10.SetTag(iSaveSectionBtnTagId * (ii+1)); btnSave10.SetCellColour("DarkSlateGrey"); btnSave10Vw = btnSave10.GetButtonCell(); UIButton btnSave10Button = new UIButton(); btnSave10Button = btnSave10.GetButton(); btnSave10Button.TouchUpInside += (sender,e) => {OpenBatteries(sender, e);}; arrItems4[2] = btnSave10Vw; UILabel hfSectionHeight = new UILabel(); hfSectionHeight.Tag = iSectionHeightTagId * (ii+1); hfSectionHeight.Hidden = true; hfSectionHeight.Text = "0"; arrItems4[3] = hfSectionHeight; UILabel hfSectionRows = new UILabel(); hfSectionRows.Tag = iSectionRowsTagId * (ii+1); hfSectionRows.Hidden = true; hfSectionRows.Text = iPwrIdRows.ToString(); arrItems4[4] = hfSectionRows; UILabel hfSectionStatus = new UILabel(); hfSectionStatus.Tag = iSectionStatusTagId * (ii+1); hfSectionStatus.Hidden = true; hfSectionStatus.Text = "0"; arrItems4[5] = hfSectionStatus; Section10Row.AddSubviews(arrItems4); iVert += iSectionHdrRowHeight; //Now add a new view to this view to hold another view containing all the pwrid info for this section 10 UIView PwrIdTableRow = new UIView(); PwrIdTableRow.Frame = new RectangleF(0f,iVert,1000f,0f); iSectionId = iContainerSectionTagId * (ii+1); PwrIdTableRow.Tag = iSectionId; layout.AddSubview(PwrIdTableRow); } //******************************************************************************************// // SECTION 10 (EQUIPMENT) // //******************************************************************************************// //Get all the PwrId's for this project from ITPSection10 DataSet arrITPSectionEquipmentPwrIds = ITPSection.GetLocalITPSectionEquipmentPwrIds(sId); if (arrITPSectionEquipmentPwrIds.Tables.Count > 0) { int iii = m_iSections; m_iSections++; //Add an extra one for the equipment section m_iEquipmentSectionCounter = iii; int iPwrIdRows = arrITPSectionEquipmentPwrIds.Tables[0].Rows.Count; //Add in the section title and buttons for each section header UIView SectionEquipmentRow = new UIView(); float iSectionEquipmentRowVertTop = iVert; SectionEquipmentRow.Frame = new RectangleF(0f,iSectionEquipmentRowVertTop,1000f,iSectionHdrRowHeight); iSectionId = iSectionTagId * (iii+1); SectionEquipmentRow.Tag = iSectionId; layout.AddSubview(SectionEquipmentRow); UILabel hfSectionEquipment = new UILabel(); hfSectionEquipment.Text = "10"; hfSectionEquipment.Tag = iSectionDBIdTagId * (iii+1); hfSectionEquipment.Hidden = true; SectionEquipmentRow.AddSubview(hfSectionEquipment); iUtils.CreateFormGridItem SectionEquipment = new iUtils.CreateFormGridItem(); UIView SectionEquipmentVw = new UIView(); SectionEquipment.SetDimensions(0f,0f, 300f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); SectionEquipment.SetLabelText("POWER CONVERSION EQUIPMENT"); SectionEquipment.SetBorderWidth(0.0f); SectionEquipment.SetFontName("Verdana-Bold"); SectionEquipment.SetTextColour("White"); SectionEquipment.SetFontSize(12f); SectionEquipment.SetCellColour("DarkSlateGrey"); SectionEquipment.SetTag(iSectionDescTagId * (iii+1)); SectionEquipmentVw = SectionEquipment.GetLabelCell(); arrItems4[0] = SectionEquipmentVw; if(RFUFullyCommitted()) { bFullyCommitted = true; bHideComplete = false; } else { if(PowerConversionFullyCommitted()) { bFullyCommitted = true; bHideComplete = false; } else { bFullyCommitted = false; if(PowerConversionFullyComplete()) { bHideComplete = false; } else { bHideComplete = true; } } } iUtils.CreateFormGridItem SectionCompleteLabel = new iUtils.CreateFormGridItem(); UIView SectionCompleteLabelVw = new UIView(); SectionCompleteLabel.SetDimensions(300f,0f, 150f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); if(bFullyCommitted) { SectionCompleteLabel.SetLabelText("COMMITTED"); } else { SectionCompleteLabel.SetLabelText("COMPLETED"); } SectionCompleteLabel.SetBorderWidth(0.0f); SectionCompleteLabel.SetFontName("Verdana-Bold"); SectionCompleteLabel.SetTextColour("Bright Yellow"); SectionCompleteLabel.SetFontSize(14f); SectionCompleteLabel.SetCellColour("DarkSlateGrey"); SectionCompleteLabel.SetTag(iSectionCompleteLabelTagId * (iii+1)); SectionCompleteLabel.SetHidden(bHideComplete); SectionCompleteLabelVw = SectionCompleteLabel.GetLabelCell(); arrItems4[1] = SectionCompleteLabelVw; iUtils.CreateFormGridItem btnSaveEquipment = new iUtils.CreateFormGridItem(); UIView btnSaveEquipmentVw = new UIView(); btnSaveEquipment.SetDimensions(450f,0f, 350f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnSaveEquipment.SetLabelText("Open Power Conversion Equipment Screen"); btnSaveEquipment.SetBorderWidth(0.0f); btnSaveEquipment.SetFontName("Verdana"); btnSaveEquipment.SetFontSize(12f); btnSaveEquipment.SetTag(iSaveSectionBtnTagId * (iii+1)); btnSaveEquipment.SetCellColour("DarkSlateGrey"); btnSaveEquipmentVw = btnSaveEquipment.GetButtonCell(); UIButton btnSaveEquipmentButton = new UIButton(); btnSaveEquipmentButton = btnSaveEquipment.GetButton(); btnSaveEquipmentButton.TouchUpInside += (sender,e) => {OpenPowerConversion(sender, e);}; arrItems4[2] = btnSaveEquipmentVw; UILabel hfSectionEquipmentHeight = new UILabel(); hfSectionEquipmentHeight.Tag = iSectionHeightTagId * (iii+1); hfSectionEquipmentHeight.Hidden = true; hfSectionEquipmentHeight.Text = "0"; arrItems4[3] = hfSectionEquipmentHeight; UILabel hfSectionEquipmentRows = new UILabel(); hfSectionEquipmentRows.Tag = iSectionRowsTagId * (iii+1); hfSectionEquipmentRows.Hidden = true; hfSectionEquipmentRows.Text = iPwrIdRows.ToString(); arrItems4[4] = hfSectionEquipmentRows; UILabel hfSectionEquipmentStatus = new UILabel(); hfSectionEquipmentStatus.Tag = iSectionStatusTagId * (iii+1); hfSectionEquipmentStatus.Hidden = true; hfSectionEquipmentStatus.Text = "0"; arrItems4[5] = hfSectionEquipmentStatus; SectionEquipmentRow.AddSubviews(arrItems4); iVert += iSectionHdrRowHeight; //Now add a new view to this view to hold another view containing all the pwrid info for this section 10 UIView PwrIdTableRow = new UIView(); PwrIdTableRow.Frame = new RectangleF(0f,iVert,1000f,0f); iSectionId = iContainerSectionTagId * (iii+1); PwrIdTableRow.Tag = iSectionId; layout.AddSubview(PwrIdTableRow); } //******************************************************************************************// // SECTION RFU // //******************************************************************************************// //Get all the PwrId's for this project from ITPRFU DataSet arrITPRFUs = ITPSection.GetLocalITPRFUPwrIds(sId); if (arrITPRFUs.Tables.Count > 0) { float iRFURowVert = 0.0f; float iSectionRFUHeight = 0.0f; float iRFURowVertTop = iVert; float iRFURowInnerTop = 0.0f; int ii = m_iSections; m_iSections++; //Add an extra one for the RFU section m_iRFUSectionCounter = ii; //Here ii and m_iSections are different by 1. If we add more sections after this it will be different later on int iPwrIdRowsRFU = arrITPRFUs.Tables[0].Rows.Count; //Add in the section title and buttons for each section header UIView SectionRFURow = new UIView(); float iSection10RowVertTop = iVert; SectionRFURow.Frame = new RectangleF(0f,iSection10RowVertTop,1000f,iSectionHdrRowHeight); iSectionId = iSectionTagId * (ii+1); SectionRFURow.Tag = iSectionId; layout.AddSubview(SectionRFURow); UILabel hfSectionRFU = new UILabel(); hfSectionRFU.Text = "RFU"; hfSectionRFU.Tag = iSectionDBIdTagId * (ii+1); hfSectionRFU.Hidden = true; SectionRFURow.AddSubview(hfSectionRFU); iUtils.CreateFormGridItem SectionRFU = new iUtils.CreateFormGridItem(); UIView SectionRFUVw = new UIView(); SectionRFU.SetDimensions(0f,0f, 300f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); SectionRFU.SetLabelText("READY FOR USE (RFU)"); SectionRFU.SetBorderWidth(0.0f); SectionRFU.SetFontName("Verdana-Bold"); SectionRFU.SetTextColour("White"); SectionRFU.SetFontSize(12f); SectionRFU.SetCellColour("DarkSlateGrey"); SectionRFU.SetTag(iSectionDescTagId * (ii+1)); SectionRFUVw = SectionRFU.GetLabelCell(); arrItems14[0] = SectionRFUVw; if(RFUFullyCommitted()) { bFullyCommitted = false; } else { bFullyCommitted = true; } iUtils.CreateFormGridItem SectionCompleteLabel = new iUtils.CreateFormGridItem(); UIView SectionCompleteLabelVw = new UIView(); SectionCompleteLabel.SetDimensions(300f,0f, 250f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); SectionCompleteLabel.SetLabelText("COMMITTED"); SectionCompleteLabel.SetBorderWidth(0.0f); SectionCompleteLabel.SetFontName("Verdana-Bold"); SectionCompleteLabel.SetTextColour("Bright Yellow"); SectionCompleteLabel.SetFontSize(14f); SectionCompleteLabel.SetCellColour("DarkSlateGrey"); SectionCompleteLabel.SetTag(iSectionCompleteLabelTagId * (ii+1)); SectionCompleteLabel.SetHidden(bFullyCommitted); SectionCompleteLabelVw = SectionCompleteLabel.GetLabelCell(); arrItems14[1] = SectionCompleteLabelVw; iUtils.CreateFormGridItem btnSaveRFU = new iUtils.CreateFormGridItem(); UIView btnSaveRFUVw = new UIView(); btnSaveRFU.SetDimensions(550f,0f, 150f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnSaveRFU.SetLabelText("Save Section"); btnSaveRFU.SetBorderWidth(0.0f); btnSaveRFU.SetFontName("Verdana"); btnSaveRFU.SetFontSize(12f); btnSaveRFU.SetTag(iSaveSectionBtnTagId * (ii+1)); btnSaveRFU.SetCellColour("DarkSlateGrey"); btnSaveRFUVw = btnSaveRFU.GetButtonCell(); UIButton btnSaveRFUButton = new UIButton(); btnSaveRFUButton = btnSaveRFU.GetButton(); btnSaveRFUButton.TouchUpInside += (sender,e) => {SaveThisSection(sender, e);}; btnSaveRFUButton.Hidden = true; arrItems14[2] = btnSaveRFUVw; iUtils.CreateFormGridItem btnExpandRFU = new iUtils.CreateFormGridItem(); UIView btnExpandRFUVw = new UIView(); btnExpandRFU.SetDimensions(700f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnExpandRFU.SetLabelText("+"); btnExpandRFU.SetBorderWidth(0.0f); btnExpandRFU.SetFontName("Verdana"); btnExpandRFU.SetFontSize(12f); btnExpandRFU.SetTag(iExpandSectionBtnTagId * (ii+1)); btnExpandRFU.SetCellColour("DarkSlateGrey"); btnExpandRFUVw = btnExpandRFU.GetButtonCell(); UIButton btnExpandRFUButton = new UIButton(); btnExpandRFUButton = btnExpandRFU.GetButton(); btnExpandRFUButton.Enabled = false; btnExpandRFUButton.TouchUpInside += (sender,e) => {ExpandSection(sender, e);}; arrItems14[3] = btnExpandRFUVw; iUtils.CreateFormGridItem btnContractRFU = new iUtils.CreateFormGridItem(); UIView btnContractRFUVw = new UIView(); btnContractRFU.SetDimensions(750f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnContractRFU.SetLabelText("-"); btnContractRFU.SetBorderWidth(0.0f); btnContractRFU.SetFontName("Verdana"); btnContractRFU.SetFontSize(12f); btnContractRFU.SetTag(iContractSectionBtnTagId * (ii+1)); btnContractRFU.SetCellColour("DarkSlateGrey"); btnContractRFUVw = btnContractRFU.GetButtonCell(); UIButton btnContractRFUButton = new UIButton(); btnContractRFUButton = btnContractRFU.GetButton(); btnContractRFUButton.TouchUpInside += (sender,e) => {ContractSection(sender, e);}; arrItems14[4] = btnContractRFUVw; UILabel hfSectionHeight = new UILabel(); hfSectionHeight.Tag = iSectionHeightTagId * (ii+1); hfSectionHeight.Hidden = true; hfSectionHeight.Text = "0"; arrItems14[5] = hfSectionHeight; UILabel hfSectionRows = new UILabel(); hfSectionRows.Tag = iSectionRowsTagId * (ii+1); hfSectionRows.Hidden = true; hfSectionRows.Text = iPwrIdRowsRFU.ToString(); arrItems14[6] = hfSectionRows; UILabel hfSectionStatus = new UILabel(); hfSectionStatus.Tag = iSectionStatusTagId * (ii+1); hfSectionStatus.Hidden = true; hfSectionStatus.Text = "0"; arrItems14[7] = hfSectionStatus; SectionRFURow.AddSubviews(arrItems14); iVert += iSectionHdrRowHeight; iRFURowVertTop += iSectionHdrRowHeight; //Now add a new view to this view to hold another view containing all the pwrid info for this RFU section UIView RFUTableRow = new UIView(); RFUTableRow.Frame = new RectangleF(0f,iRFURowVertTop,1000f,iSectionHdrRowHeight); iSectionId = iContainerSectionTagId * (ii+1); RFUTableRow.Tag = iSectionId; layout.AddSubview(RFUTableRow); //Put in the header UIView vwPwrHdrInternalRowId = new UIView(); vwPwrHdrInternalRowId.Frame = new RectangleF(0f,iRFURowVert,1000f,iSectionHdrRowHeight); //This will be resized later on iUtils.CreateFormGridItem rowPwrIdHdrLbl = new iUtils.CreateFormGridItem(); UIView rowPwrIdHdrLblVw = new UIView(); rowPwrIdHdrLbl.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowPwrIdHdrLbl.SetDimensions(0f,iRFURowVert, 100f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowPwrIdHdrLbl.SetLabelText("Power Id"); rowPwrIdHdrLbl.SetTextAlignment("centre"); rowPwrIdHdrLbl.SetBorderWidth(0.0f); rowPwrIdHdrLbl.SetFontName("Verdana-Bold"); rowPwrIdHdrLbl.SetFontSize(14f); rowPwrIdHdrLbl.SetTag((iRFUPwrIdHdrLabelTagId) * (ii+1)); rowPwrIdHdrLbl.SetCellColour("Pale Yellow"); rowPwrIdHdrLblVw = rowPwrIdHdrLbl.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems7[0] = rowPwrIdHdrLblVw; iUtils.CreateFormGridItem rowDesignLoadHdrLbl = new iUtils.CreateFormGridItem(); UIView rowDesignLoadHdrLblVw = new UIView(); rowDesignLoadHdrLbl.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowDesignLoadHdrLbl.SetDimensions(100f,iRFURowVert, 100f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowDesignLoadHdrLbl.SetLabelText("Design Load"); rowDesignLoadHdrLbl.SetTextAlignment("centre"); rowDesignLoadHdrLbl.SetBorderWidth(0.0f); rowDesignLoadHdrLbl.SetFontName("Verdana-Bold"); rowDesignLoadHdrLbl.SetFontSize(14f); rowDesignLoadHdrLbl.SetTag((iRFUDesignLoadHdrLabelTagId) * (ii+1)); rowDesignLoadHdrLbl.SetCellColour("Pale Yellow"); rowDesignLoadHdrLblVw = rowDesignLoadHdrLbl.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems7[1] = rowDesignLoadHdrLblVw; iUtils.CreateFormGridItem rowCutoverLoadHdrLbl = new iUtils.CreateFormGridItem(); UIView rowCutoverLoadHdrLblVw = new UIView(); rowCutoverLoadHdrLbl.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowCutoverLoadHdrLbl.SetDimensions(200f,iRFURowVert, 100f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowCutoverLoadHdrLbl.SetLabelText("Cutover Load"); rowCutoverLoadHdrLbl.SetTextAlignment("centre"); rowCutoverLoadHdrLbl.SetBorderWidth(0.0f); rowCutoverLoadHdrLbl.SetFontName("Verdana-Bold"); rowCutoverLoadHdrLbl.SetFontSize(14f); rowCutoverLoadHdrLbl.SetTag((iRFUCutoverLoadHdrLabelTagId) * (ii+1)); rowCutoverLoadHdrLbl.SetCellColour("Pale Yellow"); rowCutoverLoadHdrLblVw = rowCutoverLoadHdrLbl.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems7[2] = rowCutoverLoadHdrLblVw; iUtils.CreateFormGridItem rowCutoverDateHdrLbl = new iUtils.CreateFormGridItem(); UIView rowCutoverDateHdrLblVw = new UIView(); rowCutoverDateHdrLbl.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowCutoverDateHdrLbl.SetDimensions(300f,iRFURowVert, 100f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowCutoverDateHdrLbl.SetLabelText("Cutover Date"); rowCutoverDateHdrLbl.SetTextAlignment("centre"); rowCutoverDateHdrLbl.SetBorderWidth(0.0f); rowCutoverDateHdrLbl.SetFontName("Verdana-Bold"); rowCutoverDateHdrLbl.SetFontSize(14f); rowCutoverDateHdrLbl.SetTag((iRFUCutoverDateHdrLabelTagId) * (ii+1)); rowCutoverDateHdrLbl.SetCellColour("Pale Yellow"); rowCutoverDateHdrLblVw = rowCutoverDateHdrLbl.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems7[3] = rowCutoverDateHdrLblVw; iUtils.CreateFormGridItem rowDecommissionedHdrLbl = new iUtils.CreateFormGridItem(); UIView rowDecommissionedHdrLblVw = new UIView(); rowDecommissionedHdrLbl.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowDecommissionedHdrLbl.SetDimensions(400f,iRFURowVert, 150f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowDecommissionedHdrLbl.SetLabelText("Decommissioned"); rowDecommissionedHdrLbl.SetTextAlignment("centre"); rowDecommissionedHdrLbl.SetBorderWidth(0.0f); rowDecommissionedHdrLbl.SetFontName("Verdana-Bold"); rowDecommissionedHdrLbl.SetFontSize(14f); rowDecommissionedHdrLbl.SetTag((iRFUDecommissionedHdrLabelTagId) * (ii+1)); rowDecommissionedHdrLbl.SetCellColour("Pale Yellow"); rowDecommissionedHdrLblVw = rowDecommissionedHdrLbl.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems7[4] = rowDecommissionedHdrLblVw; iUtils.CreateFormGridItem rowCommissionedHdrLbl = new iUtils.CreateFormGridItem(); UIView rowCommissionedHdrLblVw = new UIView(); rowCommissionedHdrLbl.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowCommissionedHdrLbl.SetDimensions(550f,iRFURowVert, 150f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowCommissionedHdrLbl.SetLabelText("Commissioned"); rowCommissionedHdrLbl.SetTextAlignment("centre"); rowCommissionedHdrLbl.SetBorderWidth(0.0f); rowCommissionedHdrLbl.SetFontName("Verdana-Bold"); rowCommissionedHdrLbl.SetFontSize(14f); rowCommissionedHdrLbl.SetTag((iRFUCommissionedHdrLabelTagId) * (ii+1)); rowCommissionedHdrLbl.SetCellColour("Pale Yellow"); rowCommissionedHdrLblVw = rowCommissionedHdrLbl.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems7[5] = rowCommissionedHdrLblVw; iUtils.CreateFormGridItem rowSaveRFUHdrLbl = new iUtils.CreateFormGridItem(); UIView rowSaveRFUHdrLblVw = new UIView(); rowSaveRFUHdrLbl.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowSaveRFUHdrLbl.SetDimensions(700f,iRFURowVert, 130f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowSaveRFUHdrLbl.SetLabelText("Commit RFU"); rowSaveRFUHdrLbl.SetTextAlignment("centre"); rowSaveRFUHdrLbl.SetBorderWidth(0.0f); rowSaveRFUHdrLbl.SetFontName("Verdana-Bold"); rowSaveRFUHdrLbl.SetFontSize(14f); rowSaveRFUHdrLbl.SetTag((iRFUSaveRFUHdrLabelTagId) * (ii+1)); rowSaveRFUHdrLbl.SetCellColour("Pale Yellow"); rowSaveRFUHdrLblVw = rowSaveRFUHdrLbl.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems7[6] = rowSaveRFUHdrLblVw; //Now add the row details into the view vwPwrHdrInternalRowId.AddSubviews(arrItems7); iSectionRFUHeight += iHeightToAdd; iRFURowVert += iHeightToAdd; iVert += iHeightToAdd; vwPwrHdrInternalRowId.Frame = new RectangleF(0f, iRFURowInnerTop, 1000f, iRFURowVert); RFUTableRow.AddSubview(vwPwrHdrInternalRowId); iRFURowInnerTop += iRFURowVert; iRFURowVert = 0f; for (var j = 0; j < iPwrIdRowsRFU; j++) { UIView vwPwrInternalRowId = new UIView(); vwPwrInternalRowId.Frame = new RectangleF(0f,iRFURowVert,1000f,200f); //This will be resized later on vwPwrInternalRowId.Tag = (iPwrIdSectionTagId + (j+1)) * (ii+1); iColNo = arrITPRFUs.Tables[0].Columns["PwrId"].Ordinal; string sPwrId = arrITPRFUs.Tables[0].Rows[j].ItemArray[iColNo].ToString(); iColNo = arrITPRFUs.Tables[0].Columns["CutoverLoad"].Ordinal; string sCutoverLoad = arrITPRFUs.Tables[0].Rows[j].ItemArray[iColNo].ToString(); iColNo = arrITPRFUs.Tables[0].Columns["CutoverDate"].Ordinal; string sCutoverDate = arrITPRFUs.Tables[0].Rows[j].ItemArray[iColNo].ToString(); iColNo = arrITPRFUs.Tables[0].Columns["Decommission"].Ordinal; int iDecommission = Convert.ToInt32(arrITPRFUs.Tables[0].Rows[j].ItemArray[iColNo]); iColNo = arrITPRFUs.Tables[0].Columns["Commission"].Ordinal; int iCommission = Convert.ToInt32(arrITPRFUs.Tables[0].Rows[j].ItemArray[iColNo]); bDisableRow = RFUPwrIdCommitted(sPwrId); UILabel hfRowRFUStatus = new UILabel(); hfRowRFUStatus.Text = "0"; hfRowRFUStatus.Tag = (ihfRowRFUStatusTagId + (j+1)) * (ii+1); hfRowRFUStatus.Hidden = true; arrItems6[0] = hfRowRFUStatus; //Put in the PwrId Label iUtils.CreateFormGridItem rowPwrIdLabel = new iUtils.CreateFormGridItem(); UIView rowPwrIdLabelVw = new UIView(); rowPwrIdLabel.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowPwrIdLabel.SetDimensions(0f,iRFURowVert, 100f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowPwrIdLabel.SetLabelText(sPwrId); rowPwrIdLabel.SetBorderWidth(0.0f); rowPwrIdLabel.SetFontName("Verdana"); rowPwrIdLabel.SetFontSize(14f); rowPwrIdLabel.SetTag((iRFUPwrIdRowLabelTagId + (j+1)) * (ii+1)); if (j % 2 == 0) { rowPwrIdLabel.SetCellColour("Pale Blue"); } else { rowPwrIdLabel.SetCellColour("Sky Blue"); } rowPwrIdLabelVw = rowPwrIdLabel.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems6[1] = rowPwrIdLabelVw; //Put in the PwrId Label iUtils.CreateFormGridItem rowDesignLoadLabel = new iUtils.CreateFormGridItem(); UIView rowDesignLoadLabelVw = new UIView(); iColNo = arrITPRFUs.Tables[0].Columns["DesignLoad"].Ordinal; string sDesignLoad = arrITPRFUs.Tables[0].Rows[j].ItemArray[iColNo].ToString(); rowDesignLoadLabel.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowDesignLoadLabel.SetDimensions(100f,iRFURowVert, 100f, iSectionHdrRowHeight, 20f, 2.5f, 20f, 2.5f); rowDesignLoadLabel.SetLabelText(sDesignLoad); rowDesignLoadLabel.SetTextAlignment("right"); rowDesignLoadLabel.SetBorderWidth(0.0f); rowDesignLoadLabel.SetFontName("Verdana"); rowDesignLoadLabel.SetFontSize(14f); rowDesignLoadLabel.SetTag((iRFUDesignLoadRowLabelTagId + (j+1)) * (ii+1)); if (j % 2 == 0) { rowDesignLoadLabel.SetCellColour("Pale Blue"); } else { rowDesignLoadLabel.SetCellColour("Sky Blue"); } rowDesignLoadLabelVw = rowDesignLoadLabel.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems6[2] = rowDesignLoadLabelVw; iUtils.CreateFormGridItem txtCutoverLoad = new iUtils.CreateFormGridItem(); UIView txtCutoverLoadVw = new UIView(); txtCutoverLoad.SetDimensions(200f,iRFURowVert, 100f, iSectionHdrRowHeight, 15f, 2.5f, 15f, 2.5f); txtCutoverLoad.SetLabelText(sCutoverLoad); txtCutoverLoad.SetTextAlignment("right"); txtCutoverLoad.SetBorderWidth(0.0f); txtCutoverLoad.SetFontName("Verdana"); txtCutoverLoad.SetFontSize(14f); txtCutoverLoad.SetTag((iRFUCutoverLoadRowLabelTagId + (j+1)) * (ii+1)); if (j % 2 == 0) { txtCutoverLoad.SetCellColour("Pale Blue"); } else { txtCutoverLoad.SetCellColour("Sky Blue"); } txtCutoverLoadVw = txtCutoverLoad.GetTextFieldCell(); UITextField txtCutoverLoadView = txtCutoverLoad.GetTextFieldView(); txtCutoverLoadView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtCutoverLoadView.ReturnKeyType = UIReturnKeyType.Next; txtCutoverLoadView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 9);}; txtCutoverLoadView.ShouldEndEditing += (sender) => { return ValidateCutoverLoad(sender, 0);}; txtCutoverLoadView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 9);}; if(bDisableRow) { txtCutoverLoadView.Enabled = false; } arrItems6[3] = txtCutoverLoadVw; UILabel hfCurrentCutoverLoad = new UILabel(); hfCurrentCutoverLoad.Text = sCutoverLoad; hfCurrentCutoverLoad.Tag = (ihfCutoverLoadRowLabelTagId + (j + 1)) * (ii + 1); hfCurrentCutoverLoad.Hidden = true; arrItems6 [4] = hfCurrentCutoverLoad; iUtils.CreateFormGridItem txtCutoverDate = new iUtils.CreateFormGridItem(); UIView txtCutoverDateVw = new UIView(); txtCutoverDate.SetDimensions(300f,iRFURowVert, 100f, iSectionHdrRowHeight, 8f, 2.5f, 8f, 2.5f); if (sCutoverDate == "" || sCutoverDate == "0") { sCutoverDate = "01/01/1900"; } DateTime dtCutover = Convert.ToDateTime(sCutoverDate); string sCutoverDisplay = dt.Get_Date_String(dtCutover, "dd/mm/yy"); txtCutoverDate.SetLabelText(sCutoverDisplay); txtCutoverDate.SetTextAlignment("right"); txtCutoverDate.SetBorderWidth(0.0f); txtCutoverDate.SetFontName("Verdana"); txtCutoverDate.SetFontSize(14f); txtCutoverDate.SetTag((iRFUCutoverDateRowLabelTagId + (j+1)) * (ii+1)); if (j % 2 == 0) { txtCutoverDate.SetCellColour("Pale Blue"); } else { txtCutoverDate.SetCellColour("Sky Blue"); } txtCutoverDateVw = txtCutoverDate.GetTextFieldCell(); UITextField txtCutoverDateView = txtCutoverDate.GetTextFieldView(); txtCutoverDateView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtCutoverDateView.ReturnKeyType = UIReturnKeyType.Next; txtCutoverDateView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 10);}; txtCutoverDateView.ShouldEndEditing += (sender) => { return ValidateCutoverDate(sender, 0);}; txtCutoverDateView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 10);}; if(bDisableRow) { txtCutoverDateView.Enabled = false; } arrItems6[5] = txtCutoverDateVw; UILabel hfCurrentCutoverDate = new UILabel(); hfCurrentCutoverDate.Text = sCutoverDisplay; hfCurrentCutoverDate.Tag = (ihfCutoverDateRowLabelTagId + (j + 1)) * (ii + 1); hfCurrentCutoverDate.Hidden = true; arrItems6[6] = hfCurrentCutoverDate; iUtils.CreateFormGridItem chkDecommission = new iUtils.CreateFormGridItem(); UIView chkDecommissionVw = new UIView(); chkDecommission.SetDimensions(400f,iRFURowVert, 150f, iSectionHdrRowHeight, 30f, 2.5f, 30f, 2.5f); bool bDecommission = false; if (iDecommission > 0) { bDecommission = true; } chkDecommission.SetCheckboxOnOff(bDecommission); chkDecommission.SetBorderWidth(0.0f); chkDecommission.SetSwitchType(2); chkDecommission.SetTag((iRFUDecommissionRowCheckTagId + (j+1)) * (ii+1)); if (j % 2 == 0) { chkDecommission.SetCellColour("Pale Blue"); } else { chkDecommission.SetCellColour("Sky Blue"); } chkDecommissionVw = chkDecommission.GetCheckboxCell(); UISwitch chkDecommissionCheck = chkDecommission.GetCheckbox(); chkDecommissionCheck.ValueChanged += (sender,e) => {CheckboxChanged(sender, e, 1);}; if(bDisableRow) { chkDecommissionCheck.Enabled = false; } arrItems6[7] = chkDecommissionVw; iUtils.CreateFormGridItem chkCommission = new iUtils.CreateFormGridItem(); UIView chkCommissionVw = new UIView(); chkCommission.SetDimensions(550f,iRFURowVert, 150f, iSectionHdrRowHeight, 30f, 2.5f, 30f, 2.5f); bool bCommission = false; if (iCommission > 0) { bCommission = true; } chkCommission.SetCheckboxOnOff(bCommission); chkCommission.SetBorderWidth(0.0f); chkCommission.SetSwitchType(2); chkCommission.SetTag((iRFUCommissionRowCheckTagId + (j+1)) * (ii+1)); if (j % 2 == 0) { chkCommission.SetCellColour("Pale Blue"); } else { chkCommission.SetCellColour("Sky Blue"); } chkCommissionVw = chkCommission.GetCheckboxCell(); UISwitch chkCommissionCheck = chkCommission.GetCheckbox(); chkCommissionCheck.ValueChanged += (sender,e) => {CheckboxChanged(sender, e, 2);}; if(bDisableRow) { chkCommissionCheck.Enabled = false; } arrItems6[8] = chkCommissionVw; iUtils.CreateFormGridItem btnRFU = new iUtils.CreateFormGridItem(); UIView btnRFUVw = new UIView(); btnRFU.SetDimensions(700f,iRFURowVert, 130f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); if(bDisableRow) { btnRFU.SetLabelText("Committed"); } else { btnRFU.SetLabelText("Commit RFU"); } btnRFU.SetBorderWidth(0.0f); btnRFU.SetFontName("Verdana"); btnRFU.SetFontSize(14f); btnRFU.SetTag((iRFUButtonSaveTagId + (j+1)) * (ii+1)); if (j % 2 == 0) { btnRFU.SetCellColour("Pale Blue"); } else { btnRFU.SetCellColour("Sky Blue"); } btnRFUVw = btnRFU.GetButtonCell(); UIButton btnRFUButton = new UIButton(); btnRFUButton = btnRFU.GetButton(); btnRFUButton.TouchUpInside += (sender,e) => {CommitRFU(sender, e);}; if(bDisableRow) { btnRFUButton.Enabled = false; } arrItems6[9] = btnRFUVw; iColNo = arrITPRFUs.Tables[0].Columns["BatteryCapacity"].Ordinal; string sBatteryCapacity = arrITPRFUs.Tables[0].Rows[j].ItemArray[iColNo].ToString(); UILabel hfRFUBatteryCapacity = new UILabel(); hfRFUBatteryCapacity.Text = sBatteryCapacity; hfRFUBatteryCapacity.Tag = (ihfRowRFUBatteryCapacityTagId + (j+1)) * (ii+1); hfRFUBatteryCapacity.Hidden = true; arrItems6[10] = hfRFUBatteryCapacity; //Now add the row details into the view vwPwrInternalRowId.AddSubviews(arrItems6); iSectionRFUHeight += iHeightToAdd; iRFURowVert += iHeightToAdd; iVert += iHeightToAdd; vwPwrInternalRowId.Frame = new RectangleF(0f, iRFURowInnerTop, 1000f, iRFURowVert); RFUTableRow.AddSubview(vwPwrInternalRowId); iRFURowInnerTop += iRFURowVert; iRFURowVert = 0f; } //Now resize the UIView that is effectively the container for the RFU info for this section //And also store this height in a hidden field for use in the contract and expand functions RFUTableRow.Frame = new RectangleF(0f,iRFURowVertTop,1000f,iSectionRFUHeight); hfSectionHeight.Text = iSectionRFUHeight.ToString(); } iTotalHeight = iVert + 380f; SizeF layoutSize = new SizeF(1000f, iTotalHeight); layout.ContentSize = layoutSize; UILabel hfScrollContentHeight = new UILabel(); hfScrollContentHeight.Text = iTotalHeight.ToString(); hfScrollContentHeight.Tag = 3; hfScrollContentHeight.Hidden = true; layout.AddSubview(hfScrollContentHeight); View.AddSubview(layout); //Now determine what is to be contrated by default for(int iiii=0;iiii< m_iQuestionSections; iiii++) { if(bHideSections[iiii]) { UIButton btnContract = (UIButton)View.ViewWithTag (iContractSectionBtnTagId * (iiii+1)); ContractSection(btnContract, null); //Also display the completed item UILabel lblComplete = (UILabel)View.ViewWithTag(iSectionCompleteLabelTagId * (iiii+1)); lblComplete.Hidden = false; } } } catch (Exception except) { string sTest = except.Message.ToString(); iUtils.AlertBox alert = new iUtils.AlertBox(); alert.CreateErrorAlertDialog(sTest); } }
private void ShowAboutView() { var captionLabel = UIHelper.CreateLabel ( "about", true, 32, 32, UITextAlignment.Center, UIColor.Black ); captionLabel.Frame = new Rectangle (0, 10, 320, 40); UIView header = new UIView (new Rectangle (0, 0, 300, 40)); header.AddSubviews (captionLabel); var closeButton = new StyledStringElement ("Close"); closeButton.BackgroundColor = UIColor.LightGray; closeButton.Alignment = UITextAlignment.Center; closeButton.Tapped += delegate { navigation.DismissModalViewControllerAnimated(true); }; var root = new RootElement ("About") { new Section (header), new Section(UIHelper.CreateHtmlView("About.html", 290f, 300f)), new Section() { closeButton } }; root.UnevenRows = true; var dvc = new StyledDialogViewController (root, null, backgroundColor) { Autorotate = true, }; navigation.PresentModalViewController(dvc, true); }
public override void LoadView() { // Create and add the container views. View = new UIView() { BackgroundColor = UIColor.White }; UIScrollView scrollView = new UIScrollView(); scrollView.TranslatesAutoresizingMaskIntoConstraints = false; View.AddSubviews(scrollView); scrollView.TopAnchor.ConstraintEqualTo(View.TopAnchor).Active = true; scrollView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active = true; scrollView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor).Active = true; scrollView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true; UIStackView formContainer = new UIStackView(); formContainer.TranslatesAutoresizingMaskIntoConstraints = false; formContainer.Spacing = 8; formContainer.LayoutMarginsRelativeArrangement = true; formContainer.Alignment = UIStackViewAlignment.Fill; formContainer.LayoutMargins = new UIEdgeInsets(8, 8, 8, 8); formContainer.Axis = UILayoutConstraintAxis.Vertical; formContainer.WidthAnchor.ConstraintEqualTo(300).Active = true; // Create and add each row. UILabel analysisLabel = new UILabel(); analysisLabel.TranslatesAutoresizingMaskIntoConstraints = false; analysisLabel.Text = "Analysis overlay"; _analysisVisibilitySwitch = new UISwitch(); _analysisVisibilitySwitch.On = _viewshed.IsVisible; _analysisVisibilitySwitch.TranslatesAutoresizingMaskIntoConstraints = false; formContainer.AddArrangedSubview(getRowStackView(new UIView[] { analysisLabel, _analysisVisibilitySwitch })); UILabel frustumLabel = new UILabel(); frustumLabel.TranslatesAutoresizingMaskIntoConstraints = false; frustumLabel.Text = "Frustum"; _frustumVisibilitySwitch = new UISwitch(); _frustumVisibilitySwitch.On = _viewshed.IsFrustumOutlineVisible; _frustumVisibilitySwitch.TranslatesAutoresizingMaskIntoConstraints = false; formContainer.AddArrangedSubview(getRowStackView(new UIView[] { frustumLabel, _frustumVisibilitySwitch })); UILabel headingLabel = new UILabel(); headingLabel.TranslatesAutoresizingMaskIntoConstraints = false; headingLabel.Text = "Heading"; _headingSlider = new UISlider { MinValue = 0, MaxValue = 360, Value = (float)_viewshed.Heading }; _headingSlider.TranslatesAutoresizingMaskIntoConstraints = false; formContainer.AddArrangedSubview(getRowStackView(new UIView[] { headingLabel, _headingSlider })); UILabel pitchLabel = new UILabel(); pitchLabel.TranslatesAutoresizingMaskIntoConstraints = false; pitchLabel.Text = "Pitch"; _pitchSlider = new UISlider { MinValue = 0, MaxValue = 180, Value = (float)_viewshed.Pitch }; _pitchSlider.TranslatesAutoresizingMaskIntoConstraints = false; formContainer.AddArrangedSubview(getRowStackView(new UIView[] { pitchLabel, _pitchSlider })); UILabel horizontalLabel = new UILabel(); horizontalLabel.TranslatesAutoresizingMaskIntoConstraints = false; horizontalLabel.Text = "Horizontal"; _horizontalAngleSlider = new UISlider { MinValue = 1, MaxValue = 120, Value = (float)_viewshed.HorizontalAngle }; _horizontalAngleSlider.TranslatesAutoresizingMaskIntoConstraints = false; formContainer.AddArrangedSubview(getRowStackView(new UIView[] { horizontalLabel, _horizontalAngleSlider })); UILabel verticalLabel = new UILabel(); verticalLabel.TranslatesAutoresizingMaskIntoConstraints = false; verticalLabel.Text = "Vertical"; _verticalAngleSlider = new UISlider { MinValue = 1, MaxValue = 120, Value = (float)_viewshed.VerticalAngle }; _verticalAngleSlider.TranslatesAutoresizingMaskIntoConstraints = false; formContainer.AddArrangedSubview(getRowStackView(new UIView[] { verticalLabel, _verticalAngleSlider })); UILabel minLabel = new UILabel(); minLabel.TranslatesAutoresizingMaskIntoConstraints = false; minLabel.Text = "Min"; _minimumDistanceSlider = new UISlider { MinValue = 11, MaxValue = 8999, Value = (float)_viewshed.MinDistance }; _minimumDistanceSlider.TranslatesAutoresizingMaskIntoConstraints = false; formContainer.AddArrangedSubview(getRowStackView(new UIView[] { minLabel, _minimumDistanceSlider })); UILabel maxLabel = new UILabel(); maxLabel.TranslatesAutoresizingMaskIntoConstraints = false; maxLabel.Text = "Max"; _maximumDistanceSlider = new UISlider { MinValue = 0, MaxValue = 9999, Value = (float)_viewshed.MaxDistance }; _maximumDistanceSlider.TranslatesAutoresizingMaskIntoConstraints = false; formContainer.AddArrangedSubview(getRowStackView(new UIView[] { maxLabel, _maximumDistanceSlider })); // Lay out container and scroll view. scrollView.AddSubview(formContainer); formContainer.TopAnchor.ConstraintEqualTo(scrollView.TopAnchor).Active = true; formContainer.LeadingAnchor.ConstraintEqualTo(scrollView.LeadingAnchor).Active = true; formContainer.TrailingAnchor.ConstraintEqualTo(scrollView.TrailingAnchor).Active = true; formContainer.BottomAnchor.ConstraintEqualTo(scrollView.BottomAnchor).Active = true; }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _layerList = new UITableView(); _layerList.TranslatesAutoresizingMaskIntoConstraints = false; _layerList.RowHeight = 40; UILabel helpLabel = new UILabel { Text = "Select layers for display.", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.FromWhiteAlpha(0, .6f), TextColor = UIColor.White, Lines = 1, TranslatesAutoresizingMaskIntoConstraints = false }; // Add the views. View.AddSubviews(_myMapView, _layerList, helpLabel); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { helpLabel.LeadingAnchor.ConstraintEqualTo(_myMapView.LeadingAnchor), helpLabel.TrailingAnchor.ConstraintEqualTo(_myMapView.TrailingAnchor), helpLabel.TopAnchor.ConstraintEqualTo(_myMapView.TopAnchor), helpLabel.HeightAnchor.ConstraintEqualTo(40), }); _portraitConstraints = new[] { _layerList.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _layerList.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _layerList.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _layerList.HeightAnchor.ConstraintEqualTo(_layerList.RowHeight * 4), _myMapView.TopAnchor.ConstraintEqualTo(_layerList.BottomAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor) }; _landscapeConstraints = new[] { _layerList.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _layerList.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _layerList.BottomAnchor.ConstraintEqualTo(View.BottomAnchor), _layerList.TrailingAnchor.ConstraintEqualTo(View.CenterXAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(_layerList.TrailingAnchor), _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor) }; SetLayoutOrientation(); }
public override void LoadView() { // Create the views. View = new UIView() { BackgroundColor = UIColor.White }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _openSwitch = new UISwitch() { Enabled = false }; _openSwitch.On = true; _closedSwitch = new UISwitch() { Enabled = false }; _closedSwitch.On = true; _openLabel = new UILabel(); _closedLabel = new UILabel(); UIStackView openRow = new UIStackView(new UIView[] { _openSwitch, _openLabel }) { TranslatesAutoresizingMaskIntoConstraints = false, LayoutMarginsRelativeArrangement = true, LayoutMargins = new UIEdgeInsets(5, 5, 5, 5), Spacing = 8, Axis = UILayoutConstraintAxis.Horizontal, Distribution = UIStackViewDistribution.Fill }; UIStackView closedRow = new UIStackView(new UIView[] { _closedSwitch, _closedLabel }) { TranslatesAutoresizingMaskIntoConstraints = false, LayoutMarginsRelativeArrangement = true, LayoutMargins = new UIEdgeInsets(5, 5, 5, 5), Spacing = 8, Axis = UILayoutConstraintAxis.Horizontal, Distribution = UIStackViewDistribution.Fill }; _scaleLabel = new UILabel { Text = "Current map scale: 1:", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.FromWhiteAlpha(0, .6f), TextColor = UIColor.White, Lines = 1, TranslatesAutoresizingMaskIntoConstraints = false }; // Add the views. View.AddSubviews(_myMapView, openRow, closedRow, _scaleLabel); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(openRow.TopAnchor), openRow.BottomAnchor.ConstraintEqualTo(closedRow.TopAnchor), openRow.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), openRow.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), closedRow.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), closedRow.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), closedRow.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _scaleLabel.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _scaleLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _scaleLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _scaleLabel.HeightAnchor.ConstraintEqualTo(40) }); }
public override void LoadView() { // Create the views. View = new UIView() { BackgroundColor = UIColor.White }; UIScrollView scrollView = new UIScrollView(); scrollView.TranslatesAutoresizingMaskIntoConstraints = false; View.AddSubviews(scrollView); scrollView.TopAnchor.ConstraintEqualTo(View.TopAnchor).Active = true; scrollView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active = true; scrollView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor).Active = true; scrollView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true; UIStackView formContainer = new UIStackView(); formContainer.TranslatesAutoresizingMaskIntoConstraints = false; formContainer.Spacing = 8; formContainer.LayoutMarginsRelativeArrangement = true; formContainer.Alignment = UIStackViewAlignment.Fill; formContainer.LayoutMargins = new UIEdgeInsets(8, 8, 8, 8); formContainer.Axis = UILayoutConstraintAxis.Vertical; formContainer.WidthAnchor.ConstraintEqualTo(320).Active = true; // Form controls here. UILabel slopeTypesLabel = new UILabel(); slopeTypesLabel.TranslatesAutoresizingMaskIntoConstraints = false; slopeTypesLabel.Text = "Slope type:"; formContainer.AddArrangedSubview(slopeTypesLabel); _slopeTypesPicker = new UISegmentedControl(Enum.GetNames(typeof(SlopeType))); _slopeTypesPicker.TranslatesAutoresizingMaskIntoConstraints = false; _slopeTypesPicker.SelectedSegment = 0; formContainer.AddArrangedSubview(_slopeTypesPicker); UILabel colorRampsLabel = new UILabel(); colorRampsLabel.TranslatesAutoresizingMaskIntoConstraints = false; colorRampsLabel.Text = "Color ramp:"; formContainer.AddArrangedSubview(colorRampsLabel); _colorRampsPicker = new UISegmentedControl(Enum.GetNames(typeof(PresetColorRampType))); _colorRampsPicker.TranslatesAutoresizingMaskIntoConstraints = false; _colorRampsPicker.SelectedSegment = 0; formContainer.AddArrangedSubview(_colorRampsPicker); UILabel altitudeLabel = new UILabel(); altitudeLabel.TranslatesAutoresizingMaskIntoConstraints = false; altitudeLabel.Text = "Altitude:"; formContainer.AddArrangedSubview(altitudeLabel); _altitudeSlider = new UISlider(); _altitudeSlider.TranslatesAutoresizingMaskIntoConstraints = false; _altitudeSlider.MinValue = 0; _altitudeSlider.MaxValue = 90; _altitudeSlider.Value = 45; formContainer.AddArrangedSubview(_altitudeSlider); UILabel azimuthLabel = new UILabel(); azimuthLabel.TranslatesAutoresizingMaskIntoConstraints = false; azimuthLabel.Text = "Azimuth:"; formContainer.AddArrangedSubview(azimuthLabel); _azimuthSlider = new UISlider(); _azimuthSlider.TranslatesAutoresizingMaskIntoConstraints = false; _azimuthSlider.MinValue = 0; _azimuthSlider.MaxValue = 360; _azimuthSlider.Value = 180; formContainer.AddArrangedSubview(_azimuthSlider); // Add the views. scrollView.AddSubview(formContainer); // Put the apply button in the top-right part of the popover. NavigationItem.RightBarButtonItem = new UIBarButtonItem("Apply", UIBarButtonItemStyle.Plain, UpdateRendererButton_Clicked); // Lay out the views. formContainer.TopAnchor.ConstraintEqualTo(scrollView.TopAnchor).Active = true; formContainer.LeadingAnchor.ConstraintEqualTo(scrollView.LeadingAnchor).Active = true; formContainer.TrailingAnchor.ConstraintEqualTo(scrollView.TrailingAnchor).Active = true; formContainer.BottomAnchor.ConstraintEqualTo(scrollView.BottomAnchor).Active = true; // Disable horizontal scrolling. formContainer.WidthAnchor.ConstraintEqualTo(scrollView.WidthAnchor).Active = true; }
void InitializeComponents () { lblNameAndVersion = new UILabel (new CGRect (58, 31, 204, 21)); lblNameAndVersion.Text = RedLaserInfo.SdkVersion; lblNameAndVersion.TextAlignment = UITextAlignment.Center; firstTimeView = new UIView (new CGRect (0, 61, View.Bounds.Width, View.Bounds.Height - 105)); var lblText = new UILabel (new CGRect (18, 0, 285, 273)); lblText.Text = "RLSample is a sample app that demonstrates the basic features of the RedLaser SDK.\n\n" + "The Sample button below will scan a single barcode\n\n" + "After checking out this sample, you should go read the SDK documentation."; lblText.Lines = 0; lblText.LineBreakMode = UILineBreakMode.WordWrap; lblText.TextAlignment = UITextAlignment.Center; string statusString; RedLaserStatus status = RedLaserInfo.CheckReadyStatus (); switch (status) { case RedLaserStatus.BadLicense: statusString = "Bad License"; break; case RedLaserStatus.EvalModeReady: statusString = "Eval Mode Ready"; break; case RedLaserStatus.LicensedModeReady: statusString = "Licensed Mode Ready"; break; case RedLaserStatus.MissingOSLibraries: statusString = "Missing OS Libs"; break; case RedLaserStatus.NoCamera: statusString = "No Camera"; break; case RedLaserStatus.NoKeychainAccess: statusString = "No Key Access"; break; case RedLaserStatus.ScanLimitReached: statusString = "Scan Limit Reached"; break; default: statusString = "Unknown"; break; } lblAppInfo = new UILabel (new CGRect (20, firstTimeView.Frame.Height - 70, 280, 70)); lblAppInfo.Text = string.Format ("Version: {0}\nLicense Status: {1}", RedLaserInfo.SdkVersion, statusString); lblAppInfo.Lines = 0; lblAppInfo.LineBreakMode = UILineBreakMode.WordWrap; lblAppInfo.TextAlignment = UITextAlignment.Center; firstTimeView.AddSubviews (new [] { lblText, lblAppInfo }); firstTimeView.BackgroundColor = UIColor.Gray; btnScan = new UIBarButtonItem ("Sample", UIBarButtonItemStyle.Plain, ScanButtonPressed); toolBar = new UIToolbar (new CGRect(0, View.Frame.Height - 44, View.Frame.Width, 44)); toolBar.Items = new [] { new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace), btnScan, new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace) }; View.AddSubviews (new [] { lblNameAndVersion, firstTimeView, toolBar }); if (!UIImagePickerController.IsSourceTypeAvailable (UIImagePickerControllerSourceType.Camera)) { btnScan.Enabled = false; new UIAlertView ("Hey!! Listen!!", "It seems that you don't have any camera available to test RedLaser...", null, "Awww... Ok =(", null).Show (); } }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; _generateButton = new UIBarButtonItem("Generate", UIBarButtonItemStyle.Plain, GenerateButton_Clicked); _generateButton.Enabled = false; _syncButton = new UIBarButtonItem("Synchronize", UIBarButtonItemStyle.Plain, SyncButton_Click); _syncButton.Enabled = false; UIToolbar toolbar = new UIToolbar(); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; toolbar.Items = new[] { _generateButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _syncButton }; _helpLabel = new UILabel { Text = "1. Tap 'Generate'.", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.FromWhiteAlpha(0, .6f), TextColor = UIColor.White, Lines = 1, TranslatesAutoresizingMaskIntoConstraints = false }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _progressBar = new UIProgressView(); _progressBar.TranslatesAutoresizingMaskIntoConstraints = false; _progressBar.Hidden = true; // Add the views. View.AddSubviews(_myMapView, _helpLabel, _progressBar, toolbar); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new [] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _helpLabel.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _helpLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _helpLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _helpLabel.HeightAnchor.ConstraintEqualTo(40), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _progressBar.TopAnchor.ConstraintEqualTo(_helpLabel.BottomAnchor), _progressBar.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor), _progressBar.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor), _progressBar.HeightAnchor.ConstraintEqualTo(8) }); }
public UIView BuildBatteryHeader(int iRowNo, ref float iHeightToAdd) { iHeightToAdd = 0.0f; UIView hdrRow = new UIView(); float iHdrVert = 0.0f; float iRowHeight = 20f; UIView[] arrItems = new UIView[6]; UIView[] arrItems2 = new UIView[9]; iUtils.CreateFormGridItem lblBankNo = new iUtils.CreateFormGridItem(); UIView lblBankNoVw = new UIView(); lblBankNo.SetDimensions(0f,iHdrVert, 200f, iRowHeight, 2f, 2f, 2f, 2f); lblBankNo.SetLabelText("Bank No."); lblBankNo.SetBorderWidth(1.0f); lblBankNo.SetFontName("Verdana"); lblBankNo.SetFontSize(12f); lblBankNo.SetTag(iBankNoLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblBankNo.SetCellColour("Pale Yellow"); } else { lblBankNo.SetCellColour("Pale Orange"); } lblBankNoVw = lblBankNo.GetLabelCell(); arrItems[0] = lblBankNoVw; iUtils.CreateFormGridItem lblMake = new iUtils.CreateFormGridItem(); UIView lblMakeVw = new UIView(); lblMake.SetDimensions(199f,iHdrVert, 200f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblMake.SetLabelText("Make"); lblMake.SetBorderWidth(1.0f); lblMake.SetFontName("Verdana"); lblMake.SetFontSize(12f); lblMake.SetTag(iMakeLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblMake.SetCellColour("Pale Yellow"); } else { lblMake.SetCellColour("Pale Orange"); } lblMakeVw = lblMake.GetLabelCell(); arrItems[1] = lblMakeVw; iUtils.CreateFormGridItem lblModel = new iUtils.CreateFormGridItem(); UIView lblModelVw = new UIView(); lblModel.SetDimensions(398f,iHdrVert, 300f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblModel.SetLabelText("Model"); lblModel.SetBorderWidth(1.0f); lblModel.SetFontName("Verdana"); lblModel.SetFontSize(12f); lblModel.SetTag(iModelLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblModel.SetCellColour("Pale Yellow"); } else { lblModel.SetCellColour("Pale Orange"); } lblModelVw = lblModel.GetLabelCell(); arrItems[2] = lblModelVw; iUtils.CreateFormGridItem lblDOM = new iUtils.CreateFormGridItem(); UIView lblDOMVw = new UIView(); lblDOM.SetDimensions(697f,iHdrVert, 80f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblDOM.SetLabelText("DOM"); lblDOM.SetBorderWidth(1.0f); lblDOM.SetFontName("Verdana"); lblDOM.SetFontSize(12f); lblDOM.SetTag(iDOMLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblDOM.SetCellColour("Pale Yellow"); } else { lblDOM.SetCellColour("Pale Orange"); } lblDOMVw = lblDOM.GetLabelCell(); arrItems[3] = lblDOMVw; iUtils.CreateFormGridItem lblFuse = new iUtils.CreateFormGridItem(); UIView lblFuseVw = new UIView(); lblFuse.SetDimensions(776f,iHdrVert, 100f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblFuse.SetLabelText("Fuse"); lblFuse.SetBorderWidth(1.0f); lblFuse.SetFontName("Verdana"); lblFuse.SetFontSize(12f); lblFuse.SetTag(iFuseCBLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblFuse.SetCellColour("Pale Yellow"); } else { lblFuse.SetCellColour("Pale Orange"); } lblFuseVw = lblFuse.GetLabelCell(); arrItems[4] = lblFuseVw; iUtils.CreateFormGridItem lblRating = new iUtils.CreateFormGridItem(); UIView lblRatingVw = new UIView(); lblRating.SetDimensions(875f,iHdrVert, 125f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblRating.SetLabelText("Ratings"); lblRating.SetBorderWidth(1.0f); lblRating.SetFontName("Verdana"); lblRating.SetFontSize(12f); lblRating.SetTag(iRatingLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblRating.SetCellColour("Pale Yellow"); } else { lblRating.SetCellColour("Pale Orange"); } lblRatingVw = lblRating.GetLabelCell(); arrItems[5] = lblRatingVw; hdrRow.AddSubviews(arrItems); iHeightToAdd += iRowHeight - 1; //This is because of the 1 pixel overlap of the border (not required on the last one) iHdrVert += iRowHeight - 1; //This is because of the 1 pixel overlap of the border (not required on the last one) //Now put in the 2nd header row of labels iUtils.CreateFormGridItem lblFloor = new iUtils.CreateFormGridItem(); UIView lblFloorVw = new UIView(); lblFloor.SetDimensions(0f,iHdrVert, 51f, iRowHeight, 2f, 2f, 2f, 2f); lblFloor.SetLabelText("Floor"); lblFloor.SetBorderWidth(1.0f); lblFloor.SetFontName("Verdana"); lblFloor.SetFontSize(12f); lblFloor.SetTag(iFloorLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblFloor.SetCellColour("Pale Yellow"); } else { lblFloor.SetCellColour("Pale Orange"); } lblFloorVw = lblFloor.GetLabelCell(); arrItems2[0] = lblFloorVw; iUtils.CreateFormGridItem lblSuite = new iUtils.CreateFormGridItem(); UIView lblSuiteVw = new UIView(); lblSuite.SetDimensions(50f,iHdrVert, 51f, iRowHeight, 2f, 2f, 2f, 2f); lblSuite.SetLabelText("Suite"); lblSuite.SetBorderWidth(1.0f); lblSuite.SetFontName("Verdana"); lblSuite.SetFontSize(12f); lblSuite.SetTag(iSuiteLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblSuite.SetCellColour("Pale Yellow"); } else { lblSuite.SetCellColour("Pale Orange"); } lblSuiteVw = lblSuite.GetLabelCell(); arrItems2[1] = lblSuiteVw; iUtils.CreateFormGridItem lblRack = new iUtils.CreateFormGridItem(); UIView lblRackVw = new UIView(); lblRack.SetDimensions(100f,iHdrVert, 41f, iRowHeight, 2f, 2f, 2f, 2f); lblRack.SetLabelText("Rack"); lblRack.SetBorderWidth(1.0f); lblRack.SetFontName("Verdana"); lblRack.SetFontSize(12f); lblRack.SetTag(iRackLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblRack.SetCellColour("Pale Yellow"); } else { lblRack.SetCellColour("Pale Orange"); } lblRackVw = lblRack.GetLabelCell(); arrItems2[2] = lblRackVw; iUtils.CreateFormGridItem lblSubrack = new iUtils.CreateFormGridItem(); UIView lblSubrackVw = new UIView(); lblSubrack.SetDimensions(140f,iHdrVert, 60f, iRowHeight, 2f, 2f, 2f, 2f); lblSubrack.SetLabelText("Subrack"); lblSubrack.SetBorderWidth(1.0f); lblSubrack.SetFontName("Verdana"); lblSubrack.SetFontSize(12f); lblSubrack.SetTag(iSubrackLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblSubrack.SetCellColour("Pale Yellow"); } else { lblSubrack.SetCellColour("Pale Orange"); } lblSubrackVw = lblSubrack.GetLabelCell(); arrItems2[3] = lblSubrackVw; iUtils.CreateFormGridItem lblEquipType = new iUtils.CreateFormGridItem(); UIView lblEquipTypeVw = new UIView(); lblEquipType.SetDimensions(199f,iHdrVert, 200f, iRowHeight, 2f, 2f, 2f, 2f); lblEquipType.SetLabelText("EquipType"); lblEquipType.SetBorderWidth(1.0f); lblEquipType.SetFontName("Verdana"); lblEquipType.SetFontSize(12f); lblEquipType.SetTag(iEquipTypeLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblEquipType.SetCellColour("Pale Yellow"); } else { lblEquipType.SetCellColour("Pale Orange"); } lblEquipTypeVw = lblEquipType.GetLabelCell(); arrItems2[4] = lblEquipTypeVw; iUtils.CreateFormGridItem lblSerialNo = new iUtils.CreateFormGridItem(); UIView lblSerialNoVw = new UIView(); lblSerialNo.SetDimensions(398f,iHdrVert, 300f, iRowHeight, 2f, 2f, 2f, 2f); lblSerialNo.SetLabelText("SerialNo"); lblSerialNo.SetBorderWidth(1.0f); lblSerialNo.SetFontName("Verdana"); lblSerialNo.SetFontSize(12f); lblSerialNo.SetTag(iSerialNoLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblSerialNo.SetCellColour("Pale Yellow"); } else { lblSerialNo.SetCellColour("Pale Orange"); } lblSerialNoVw = lblSerialNo.GetLabelCell(); arrItems2[5] = lblSerialNoVw; iUtils.CreateFormGridItem lblLinkTest = new iUtils.CreateFormGridItem(); UIView lblLinkTestVw = new UIView(); lblLinkTest.SetDimensions(697f,iHdrVert, 80f, iRowHeight, 2f, 2f, 2f, 2f); lblLinkTest.SetLabelText("LinkTest"); lblLinkTest.SetBorderWidth(1.0f); lblLinkTest.SetFontName("Verdana"); lblLinkTest.SetFontSize(12f); lblLinkTest.SetTag(iLinkTestLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblLinkTest.SetCellColour("Pale Yellow"); } else { lblLinkTest.SetCellColour("Pale Orange"); } lblLinkTestVw = lblLinkTest.GetLabelCell(); arrItems2[6] = lblLinkTestVw; iUtils.CreateFormGridItem lbl20MinTest = new iUtils.CreateFormGridItem(); UIView lbl20MinTestVw = new UIView(); lbl20MinTest.SetDimensions(776f,iHdrVert, 100f, iRowHeight, 2f, 2f, 2f, 2f); lbl20MinTest.SetLabelText("20MinTest"); lbl20MinTest.SetBorderWidth(1.0f); lbl20MinTest.SetFontName("Verdana"); lbl20MinTest.SetFontSize(12f); lbl20MinTest.SetTag(i20MinTestLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lbl20MinTest.SetCellColour("Pale Yellow"); } else { lbl20MinTest.SetCellColour("Pale Orange"); } lbl20MinTestVw = lbl20MinTest.GetLabelCell(); arrItems2[7] = lbl20MinTestVw; iUtils.CreateFormGridItem lblDeleteLabel = new iUtils.CreateFormGridItem(); UIView lblDeleteLabelVw = new UIView(); lblDeleteLabel.SetDimensions(875f,iHdrVert, 125f, iRowHeight, 2f, 2f, 2f, 2f); lblDeleteLabel.SetLabelText("Delete"); lblDeleteLabel.SetBorderWidth(1.0f); lblDeleteLabel.SetFontName("Verdana"); lblDeleteLabel.SetFontSize(12f); lblDeleteLabel.SetTag(iDeleteLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblDeleteLabel.SetCellColour("Pale Yellow"); } else { lblDeleteLabel.SetCellColour("Pale Orange"); } lblDeleteLabelVw = lblDeleteLabel.GetLabelCell(); arrItems2[8] = lblDeleteLabelVw; hdrRow.AddSubviews(arrItems2); iHeightToAdd += iRowHeight; iHdrVert += iRowHeight; return hdrRow; }
private void MakeUI() { CreateAlertWindow (); // Needs these parameters if (CRSAlertView.AlertWindow == null || Title == null || Actions == null || Actions.Length == 0) { throw new ModelNotImplementedException(); } // Build Main View Alpha = 0f; BackgroundColor = UIColor.Black.ColorWithAlpha (0.5f); Frame = CRSAlertView.AlertWindow.Bounds; // Build Container nfloat imageWidth = 40f; nfloat buttonWidth = (CRSAlertView.AlertWindow.Frame.Width - 2 * pad) / Actions.Length; nfloat buttonHeight = 60f; _alertContainer = new UIView { Frame = new CGRect (pad, 0, CRSAlertView.AlertWindow.Frame.Width - 2 * pad, pad), BackgroundColor = Background, Alpha = 0f }; _alertContainer.Layer.CornerRadius = 10.0f; _alertContainer.Layer.MasksToBounds = true; _image = new UIImageView { Frame = new CGRect (_alertContainer.Frame.Width/2 - imageWidth/2 - 20 , pad, Image != null ? imageWidth : 0, Image != null ? imageWidth : 0), BackgroundColor = UIColor.Clear, TintColor = TitleTextColor, Image = Image ?? new UIImage(), ContentMode = UIViewContentMode.ScaleAspectFit }; _title = new UILabel { Frame = new CGRect( _alertContainer.Frame.Width/2 - imageWidth/2 + 20 , pad, Image != null ? imageWidth : 0, Image != null ? imageWidth : 0), Text = Title, TextColor = TitleTextColor, Font = TitleFont, Lines = 1, AdjustsFontSizeToFitWidth = true, MinimumScaleFactor = 0.5f, TextAlignment = UITextAlignment.Center }; _message = new UILabel { Frame = new CGRect( pad/2, _title.Frame.Bottom + 10, _alertContainer.Frame.Width - pad , 20.0f), Text = Message, TextColor = MessageTextColor, Font = MessageFont, Lines = 0, TextAlignment = UITextAlignment.Center }; _message.SizeToFit (); _message.Center = new CGPoint (_title.Center.X -20 , _message.Center.Y); if (Input != null) { _inputImage = new UIImageView { Frame = new CGRect(pad/2, _message.Frame.Bottom + pad/2, Input.Image != null ? 20 : 0, Input.Image != null ? 20 : 0), Image = Input.Image ?? new UIImage(), TintColor = Input.TintColor != null ? Input.TintColor : Tint }; var startX = Input.Image != null ? pad / 2 + 30 : pad / 2; _inputTextField = new UITextField { Frame = new CGRect(startX, _message.Frame.Bottom + pad/2, _alertContainer.Frame.Width - _inputImage.Frame.Right - 20, 30), BackgroundColor = UIColor.White, Placeholder = Input.Placeholder != null ? Input.Placeholder : "", Text = Input.Text != null ? Input.Text : "", TextColor = InputTextColor, Font = InputFont, BorderStyle = UITextBorderStyle.None, Alpha = 0f, Delegate = new InputSource(), ReturnKeyType = UIReturnKeyType.Done, KeyboardAppearance = UIKeyboardAppearance.Dark }; _inputTextField.Layer.SublayerTransform = CATransform3D.MakeTranslation (5.0f, 0.0f, 0.0f); _inputLabel = new UILabel { Frame = new CGRect(startX, _message.Frame.Bottom + pad/2, _alertContainer.Frame.Width - _inputImage.Frame.Right + 20, 30), TextColor = Input.TintColor != null ? Input.TintColor : Tint, Text = Input.Placeholder != null ? Input.Placeholder : "", Alpha = 0, Font = InputFont }; _inputButton = new UIButton { BackgroundColor = UIColor.Clear }; _inputButton.TouchUpInside += (sender, e) => { ShowInputTextField(); }; _alertContainer.AddSubviews (new UIView[] { _inputImage, _inputLabel, _inputButton, _inputTextField }); if (Input.OpenAutomatically) { _inputButton.Hidden = true; _inputTextField.Alpha = 1f; _inputImage.Center = new CGPoint (_inputImage.Center.X, _inputTextField.Center.Y); } else { _inputLabel.SizeToFit (); _inputLabel.Alpha = 1f; nfloat width = _inputImage.Frame.Width + 10 + _inputLabel.Frame.Width; _inputImage.Frame = new CGRect (_alertContainer.Frame.Width / 2 - width / 2, _inputImage.Frame.Top, _inputImage.Frame.Width, _inputImage.Frame.Height); _inputLabel.Frame = new CGRect (_inputImage.Frame.Right + 10, _inputLabel.Frame.Top, _inputLabel.Frame.Width, _inputLabel.Frame.Height); _inputImage.Center = new CGPoint (_inputImage.Center.X, _inputLabel.Center.Y); _inputButton.Frame = new CGRect (_inputImage.Frame.Left, _inputLabel.Frame.Top, width, 44); _inputButton.Center = new CGPoint (_inputButton.Center.X, _inputLabel.Center.Y); } } _bottomSeparator = new UIView { Frame = new CGRect(0, Input == null ? _message.Frame.Bottom + pad : _inputLabel.Frame.Bottom + pad, _alertContainer.Frame.Width, 1), BackgroundColor = SeparatorColor }; _alertContainer.AddSubviews (new UIView[] { _image, _title, _message, _bottomSeparator }); for (int i = 0; i < Actions.Length; i++) { CRSAlertAction action = Actions [i]; var btn = new UIButton { Frame = new CGRect(buttonWidth*i, _bottomSeparator.Frame.Bottom, buttonWidth, buttonHeight), BackgroundColor = ButtonBackground, Font = action.Highlighted ? AlertButtonHighlightedFont : AlertButtonNormalFont }; btn.ContentMode = UIViewContentMode.ScaleAspectFit; btn.SetTitle (string.IsNullOrEmpty (action.Text) ? "" : action.Text, UIControlState.Normal); btn.Tag = i; btn.TouchDown += (sender, e) => { btn.BackgroundColor = ButtonHighlighted; }; btn.TouchUpOutside += (sender, e) => { btn.BackgroundColor = ButtonBackground; }; btn.TouchUpInside += (sender, e) => { DidSelectAction((int)btn.Tag); }; btn.SetTitleColor (action.Highlighted ? (action.TintColor ?? Tint) : TitleTextColor, UIControlState.Normal); _alertContainer.Add (btn); if (i < Actions.Length - 1) { var s = new UIView { Frame = new CGRect(btn.Frame.Right - 1, btn.Frame.Top, 1, buttonHeight), BackgroundColor = SeparatorColor }; _alertContainer.Add (s); } } nfloat alertEnd = (_alertContainer.Subviews[_alertContainer.Subviews.Length - 1] as UIView).Frame.Bottom; _alertContainer.Frame = new CGRect (_alertContainer.Frame.Left, _alertContainer.Frame.Top, _alertContainer.Frame.Width, alertEnd); _alertContainer.Center = new CGPoint (CRSAlertView.AlertWindow.Frame.Width / 2, CRSAlertView.AlertWindow.Frame.Height / 2); Add (_alertContainer); }
public UIView BuildBatteryStringRowDetails(int iSectionCounterId, int iRowNo, int iStringRow, string sPwrId, int iAutoId, int iMaximoAssetId, string sBankNo, string sBankPlane, string sMake, string sModel, string sSPN, string sDOM, string sFuseOrCB, string sRatingAmps, string sFloor, string sSuite, string sRack, string sSubRack, string sEquipType, string sSerialNo, int iLinkTestStatus, int i20MinTest, bool bNewRow, bool bReadOnly, ref float iHeightToAdd) { DateClass dt = new DateClass(); iHeightToAdd = 0.0f; UIView hdrRow = new UIView(); float iHdrVert = 0.0f; float iRowHeight = 40f; UIView[] arrItems = new UIView[20]; UIView[] arrItems2 = new UIView[16]; UIView[] arrItems3 = new UIView[4]; UILabel hfSectionCounter = new UILabel(); hfSectionCounter.Text = iSectionCounterId.ToString(); hfSectionCounter.Tag = iStringRowSectionCounterTagId * (iRowNo + 1) + (iStringRow + 1); hfSectionCounter.Hidden = true; arrItems [0] = hfSectionCounter; UILabel hfPwrId = new UILabel(); hfPwrId.Text = sPwrId; hfPwrId.Tag = iStringRowPwrIdTagId * (iRowNo + 1) + (iStringRow + 1); hfPwrId.Hidden = true; arrItems [1] = hfPwrId; UILabel hfRowStatus = new UILabel(); if (bNewRow) { hfRowStatus.Text = "2"; //2 means new } else { hfRowStatus.Text = "0"; } hfRowStatus.Tag = iStringRowStatusTagId * (iRowNo + 1) + (iStringRow + 1); hfRowStatus.Hidden = true; arrItems [2] = hfRowStatus; UILabel hfAutoId = new UILabel(); hfAutoId.Text = iAutoId.ToString(); hfAutoId.Tag = iStringRowAutoIdTagId * (iRowNo + 1) + (iStringRow + 1); hfAutoId.Hidden = true; arrItems [3] = hfAutoId; UILabel hfMaximoAssetId = new UILabel(); hfMaximoAssetId.Text = iMaximoAssetId.ToString(); hfMaximoAssetId.Tag = iStringRowMaximoAssetIdTagId * (iRowNo + 1) + (iStringRow + 1); hfMaximoAssetId.Hidden = true; arrItems [4] = hfMaximoAssetId; iUtils.CreateFormGridItem lblBankNo = new iUtils.CreateFormGridItem(); UIView lblBankNoVw = new UIView(); lblBankNo.SetDimensions(0f, iHdrVert, 100f, iRowHeight, 2f, 2f, 2f, 2f); lblBankNo.SetLabelText(sBankNo); lblBankNo.SetBorderWidth(0.0f); lblBankNo.SetFontName("Verdana"); lblBankNo.SetFontSize(12f); lblBankNo.SetTag(iBankNoTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { lblBankNo.SetCellColour("Pale Yellow"); } else { lblBankNo.SetCellColour("Pale Orange"); } lblBankNoVw = lblBankNo.GetTextFieldCell(); UITextField txtBankNoView = lblBankNo.GetTextFieldView(); txtBankNoView.AutocorrectionType = UITextAutocorrectionType.No; txtBankNoView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtBankNoView.ReturnKeyType = UIReturnKeyType.Next; txtBankNoView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 1);}; txtBankNoView.ShouldEndEditing += (sender) => { return ValidateBankNo(sender, 1, 0);}; txtBankNoView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 1);}; if(bReadOnly) { txtBankNoView.Enabled = false; } arrItems [5] = lblBankNoVw; UILabel hfCurrentBankNo = new UILabel(); hfCurrentBankNo.Text = sBankNo; hfCurrentBankNo.Tag = iBankNoHiddenTagId * (iRowNo + 1) + (iStringRow + 1); hfCurrentBankNo.Hidden = true; arrItems [6] = hfCurrentBankNo; iUtils.CreateFormGridItem btnBankNoSearch = new iUtils.CreateFormGridItem(); UIView btnBankNoSearchVw = new UIView(); btnBankNoSearch.SetDimensions(100f, iHdrVert, 60f, iRowHeight, 8f, 4f, 8f, 4f); btnBankNoSearch.SetLabelText("..."); btnBankNoSearch.SetBorderWidth(0.0f); btnBankNoSearch.SetFontName("Verdana"); btnBankNoSearch.SetFontSize(12f); btnBankNoSearch.SetTag(iBankNoSearchTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { btnBankNoSearch.SetCellColour("Pale Yellow"); } else { btnBankNoSearch.SetCellColour("Pale Orange"); } btnBankNoSearchVw = btnBankNoSearch.GetButtonCell(); UIButton btnBankNoSearchButton = new UIButton(); btnBankNoSearchButton = btnBankNoSearch.GetButton(); btnBankNoSearchButton.TouchUpInside += (sender,e) => { OpenBankNoList(sender, e);}; if(bReadOnly) { btnBankNoSearchButton.Enabled = false; } arrItems [7] = btnBankNoSearchVw; iUtils.CreateFormGridItem lblBankPlane = new iUtils.CreateFormGridItem(); UIView lblBankPlaneVw = new UIView(); lblBankPlane.SetDimensions(160f, iHdrVert, 40f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblBankPlane.SetLabelText(sBankPlane); lblBankPlane.SetBorderWidth(0.0f); lblBankPlane.SetFontName("Verdana"); lblBankPlane.SetFontSize(12f); lblBankPlane.SetTag(iBankPlaneTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { lblBankPlane.SetCellColour("Pale Yellow"); } else { lblBankPlane.SetCellColour("Pale Orange"); } lblBankPlaneVw = lblBankPlane.GetLabelCell(); arrItems [8] = lblBankPlaneVw; iUtils.CreateFormGridItem lblBankMake = new iUtils.CreateFormGridItem(); UIView lblBankMakeVw = new UIView(); lblBankMake.SetDimensions(199f, iHdrVert, 140f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblBankMake.SetLabelText(sMake); lblBankMake.SetBorderWidth(0.0f); lblBankMake.SetFontName("Verdana"); lblBankMake.SetFontSize(12f); lblBankMake.SetTag(iBankMakeTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { lblBankMake.SetCellColour("Pale Yellow"); } else { lblBankMake.SetCellColour("Pale Orange"); } lblBankMakeVw = lblBankMake.GetLabelCell(); arrItems [9] = lblBankMakeVw; iUtils.CreateFormGridItem btnMakeSearch = new iUtils.CreateFormGridItem(); UIView btnMakeSearchVw = new UIView(); btnMakeSearch.SetDimensions(339f, iHdrVert, 60f, iRowHeight, 8f, 4f, 8f, 4f); btnMakeSearch.SetLabelText("..."); btnMakeSearch.SetBorderWidth(0.0f); btnMakeSearch.SetFontName("Verdana"); btnMakeSearch.SetFontSize(12f); btnMakeSearch.SetTag(iBankMakeSearchTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { btnMakeSearch.SetCellColour("Pale Yellow"); } else { btnMakeSearch.SetCellColour("Pale Orange"); } btnMakeSearchVw = btnMakeSearch.GetButtonCell(); UIButton btnMakeSearchButton = new UIButton(); btnMakeSearchButton = btnMakeSearch.GetButton(); btnMakeSearchButton.TouchUpInside += (sender,e) => { OpenMakeList(sender, e);}; if(bReadOnly) { btnMakeSearchButton.Enabled = false; } arrItems [10] = btnMakeSearchVw; iUtils.CreateFormGridItem lblBankModel = new iUtils.CreateFormGridItem(); UIView lblBankModelVw = new UIView(); lblBankModel.SetDimensions(398f, iHdrVert, 240f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblBankModel.SetLabelText(sModel); lblBankModel.SetBorderWidth(0.0f); lblBankModel.SetFontName("Verdana"); lblBankModel.SetFontSize(12f); lblBankModel.SetTag(iBankModelTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { lblBankModel.SetCellColour("Pale Yellow"); } else { lblBankModel.SetCellColour("Pale Orange"); } lblBankModelVw = lblBankModel.GetLabelCell(); arrItems [11] = lblBankModelVw; UILabel hfSPN = new UILabel(); hfSPN.Text = sSPN; hfSPN.Tag = iSPNHiddenTagId * (iRowNo + 1) + (iStringRow + 1); hfSPN.Hidden = true; arrItems [12] = hfSPN; iUtils.CreateFormGridItem btnModelSearch = new iUtils.CreateFormGridItem(); UIView btnModelSearchVw = new UIView(); btnModelSearch.SetDimensions(638f, iHdrVert, 60f, iRowHeight, 8f, 4f, 8f, 4f); btnModelSearch.SetLabelText("..."); btnModelSearch.SetBorderWidth(0.0f); btnModelSearch.SetFontName("Verdana"); btnModelSearch.SetFontSize(12f); btnModelSearch.SetTag(iBankModelSearchTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { btnModelSearch.SetCellColour("Pale Yellow"); } else { btnModelSearch.SetCellColour("Pale Orange"); } btnModelSearchVw = btnModelSearch.GetButtonCell(); UIButton btnModelSearchButton = new UIButton(); btnModelSearchButton = btnModelSearch.GetButton(); btnModelSearchButton.TouchUpInside += (sender,e) => { OpenModelList(sender, e);}; if(bReadOnly) { btnModelSearchButton.Enabled = false; } arrItems [13] = btnModelSearchVw; iUtils.CreateFormGridItem txtDOM = new iUtils.CreateFormGridItem(); UIView txtDOMVw = new UIView(); txtDOM.SetDimensions(697f, iHdrVert, 80f, iRowHeight, 2f, 2f, 2f, 2f); if (sDOM == "0") { sDOM = "01/01/1900"; } string sDOMDisplay; if(sDOM == "") { sDOMDisplay = sDOM; } else { DateTime dtDOM = Convert.ToDateTime(sDOM); sDOMDisplay = dt.Get_Date_String(dtDOM, "dd/mm/yy"); } txtDOM.SetLabelText(sDOMDisplay); txtDOM.SetBorderWidth(0.0f); txtDOM.SetFontName("Verdana"); txtDOM.SetFontSize(12f); txtDOM.SetTag(iBankDOMTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { txtDOM.SetCellColour("Pale Yellow"); } else { txtDOM.SetCellColour("Pale Orange"); } txtDOMVw = txtDOM.GetTextFieldCell(); UITextField txtDOMTextView = txtDOM.GetTextFieldView(); txtDOMTextView.AutocorrectionType = UITextAutocorrectionType.No; txtDOMTextView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtDOMTextView.ReturnKeyType = UIReturnKeyType.Next; txtDOMTextView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 2);}; txtDOMTextView.ShouldEndEditing += (sender) => { return ValidateDOM(sender, 0);}; txtDOMTextView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 2);}; if(bReadOnly) { txtDOMTextView.Enabled = false; } arrItems[14] = txtDOMVw; UILabel hfCurrentDOM = new UILabel(); hfCurrentDOM.Text = sDOMDisplay; hfCurrentDOM.Tag = iHiddenDOMTagId * (iRowNo + 1) + (iStringRow + 1); hfCurrentDOM.Hidden = true; arrItems[15] = hfCurrentDOM; iUtils.CreateFormGridItem lblBankFuseOrCB = new iUtils.CreateFormGridItem(); UIView lblBankFuseOrCBVw = new UIView(); lblBankFuseOrCB.SetDimensions(776f, iHdrVert, 50f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblBankFuseOrCB.SetLabelText(sFuseOrCB); lblBankFuseOrCB.SetBorderWidth(0.0f); lblBankFuseOrCB.SetFontName("Verdana"); lblBankFuseOrCB.SetFontSize(12f); lblBankFuseOrCB.SetTag(iBankFuseOrCBTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { lblBankFuseOrCB.SetCellColour("Pale Yellow"); } else { lblBankFuseOrCB.SetCellColour("Pale Orange"); } lblBankFuseOrCBVw = lblBankFuseOrCB.GetLabelCell(); arrItems[16] = lblBankFuseOrCBVw; iUtils.CreateFormGridItem btnFuseOrCBSearch = new iUtils.CreateFormGridItem(); UIView btnFuseOrCBSearchVw = new UIView(); btnFuseOrCBSearch.SetDimensions(826f, iHdrVert, 50f, iRowHeight, 3f, 4f, 3f, 4f); btnFuseOrCBSearch.SetLabelText("..."); btnFuseOrCBSearch.SetBorderWidth(0.0f); btnFuseOrCBSearch.SetFontName("Verdana"); btnFuseOrCBSearch.SetFontSize(12f); btnFuseOrCBSearch.SetTag(iBankFuseOrCBSearchTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { btnFuseOrCBSearch.SetCellColour("Pale Yellow"); } else { btnFuseOrCBSearch.SetCellColour("Pale Orange"); } btnFuseOrCBSearchVw = btnFuseOrCBSearch.GetButtonCell(); UIButton btnFuseOrCBSearchButton = new UIButton(); btnFuseOrCBSearchButton = btnFuseOrCBSearch.GetButton(); btnFuseOrCBSearchButton.TouchUpInside += (sender,e) => { OpenFuseOrCBList(sender, e);}; if(bReadOnly) { btnFuseOrCBSearchButton.Enabled = false; } arrItems[17] = btnFuseOrCBSearchVw; iUtils.CreateFormGridItem txtRating = new iUtils.CreateFormGridItem(); UIView txtRatingVw = new UIView(); txtRating.SetDimensions(876f, iHdrVert, 125f, iRowHeight, 2f, 2f, 2f, 2f); txtRating.SetLabelText(sRatingAmps); txtRating.SetBorderWidth(0.0f); txtRating.SetFontName("Verdana"); txtRating.SetFontSize(12f); txtRating.SetTag(iBankRatingTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { txtRating.SetCellColour("Pale Yellow"); } else { txtRating.SetCellColour("Pale Orange"); } txtRatingVw = txtRating.GetTextFieldCell(); UITextField txtRatingTextView = txtRating.GetTextFieldView(); txtRatingTextView.AutocorrectionType = UITextAutocorrectionType.No; txtRatingTextView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtRatingTextView.ReturnKeyType = UIReturnKeyType.Next; txtRatingTextView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 3);}; txtRatingTextView.ShouldEndEditing += (sender) => { return ValidateRating(sender, 0);}; txtRatingTextView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 3);}; if(bReadOnly) { txtRatingTextView.Enabled = false; } arrItems[18] = txtRatingVw; UILabel hfCurrentRating = new UILabel(); hfCurrentRating.Text = sRatingAmps; hfCurrentRating.Tag = iHiddenRatingTagId * (iRowNo + 1) + (iStringRow + 1); hfCurrentRating.Hidden = true; arrItems[19] = hfCurrentRating; hdrRow.AddSubviews(arrItems); iHeightToAdd += iRowHeight; iHdrVert += iRowHeight; //***************************************************************// // 2nd Row // //***************************************************************// iUtils.CreateFormGridItem lblFloor = new iUtils.CreateFormGridItem(); UIView lblFloorVw = new UIView(); lblFloor.SetDimensions(0f, iHdrVert, 50f, iRowHeight, 2f, 2f, 2f, 2f); lblFloor.SetLabelText(sFloor); lblFloor.SetBorderWidth(0.0f); lblFloor.SetFontName("Verdana"); lblFloor.SetFontSize(12f); lblFloor.SetTag(iFloorTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { lblFloor.SetCellColour("Pale Yellow"); } else { lblFloor.SetCellColour("Pale Orange"); } lblFloorVw = lblFloor.GetTextFieldCell(); UITextField txtFloorView = lblFloor.GetTextFieldView(); txtFloorView.AutocorrectionType = UITextAutocorrectionType.No; txtFloorView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtFloorView.ReturnKeyType = UIReturnKeyType.Next; txtFloorView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 4);}; txtFloorView.ShouldEndEditing += (sender) => { return ValidateFloor(sender, 0);}; txtFloorView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 4);}; if(bReadOnly) { txtFloorView.Enabled = false; } arrItems2 [0] = lblFloorVw; UILabel hfCurrentFloor = new UILabel(); hfCurrentFloor.Text = sFloor; hfCurrentFloor.Tag = iFloorHiddenTagId * (iRowNo + 1) + (iStringRow + 1); hfCurrentFloor.Hidden = true; arrItems2 [1] = hfCurrentFloor; iUtils.CreateFormGridItem lblSuite = new iUtils.CreateFormGridItem(); UIView lblSuiteVw = new UIView(); lblSuite.SetDimensions(50f, iHdrVert, 50f, iRowHeight, 2f, 2f, 2f, 2f); lblSuite.SetLabelText(sSuite); lblSuite.SetBorderWidth(0.0f); lblSuite.SetFontName("Verdana"); lblSuite.SetFontSize(12f); lblSuite.SetTag(iSuiteTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { lblSuite.SetCellColour("Pale Yellow"); } else { lblSuite.SetCellColour("Pale Orange"); } lblSuiteVw = lblSuite.GetTextFieldCell(); UITextField txtSuiteView = lblSuite.GetTextFieldView(); txtSuiteView.AutocorrectionType = UITextAutocorrectionType.No; txtSuiteView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtSuiteView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 5);}; txtSuiteView.ReturnKeyType = UIReturnKeyType.Next; txtSuiteView.ShouldEndEditing += (sender) => { return ValidateSuite(sender, 0);}; txtSuiteView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 5);}; if(bReadOnly) { txtSuiteView.Enabled = false; } arrItems2 [2] = lblSuiteVw; UILabel hfCurrentSuite = new UILabel(); hfCurrentSuite.Text = sSuite; hfCurrentSuite.Tag = iSuiteHiddenTagId * (iRowNo + 1) + (iStringRow + 1); hfCurrentSuite.Hidden = true; arrItems2 [3] = hfCurrentSuite; iUtils.CreateFormGridItem lblRack = new iUtils.CreateFormGridItem(); UIView lblRackVw = new UIView(); lblRack.SetDimensions(100f, iHdrVert, 50f, iRowHeight, 2f, 2f, 2f, 2f); lblRack.SetLabelText(sRack); lblRack.SetBorderWidth(0.0f); lblRack.SetFontName("Verdana"); lblRack.SetFontSize(12f); lblRack.SetTag(iRackTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { lblRack.SetCellColour("Pale Yellow"); } else { lblRack.SetCellColour("Pale Orange"); } lblRackVw = lblRack.GetTextFieldCell(); UITextField txtRackView = lblRack.GetTextFieldView(); txtRackView.AutocorrectionType = UITextAutocorrectionType.No; txtRackView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtRackView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 6);}; txtRackView.ReturnKeyType = UIReturnKeyType.Next; txtRackView.ShouldEndEditing += (sender) => { return ValidateRack(sender, 0);}; txtRackView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 6);}; if(bReadOnly) { txtRackView.Enabled = false; } arrItems2 [4] = lblRackVw; UILabel hfCurrentRack = new UILabel(); hfCurrentRack.Text = sRack; hfCurrentRack.Tag = iRackHiddenTagId * (iRowNo + 1) + (iStringRow + 1); hfCurrentRack.Hidden = true; arrItems2 [5] = hfCurrentRack; iUtils.CreateFormGridItem lblSubRack = new iUtils.CreateFormGridItem(); UIView lblSubRackVw = new UIView(); lblSubRack.SetDimensions(150f, iHdrVert, 50f, iRowHeight, 2f, 2f, 2f, 2f); lblSubRack.SetLabelText(sSubRack); lblSubRack.SetBorderWidth(0.0f); lblSubRack.SetFontName("Verdana"); lblSubRack.SetFontSize(12f); lblSubRack.SetTag(iSubRackTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { lblSubRack.SetCellColour("Pale Yellow"); } else { lblSubRack.SetCellColour("Pale Orange"); } lblSubRackVw = lblSubRack.GetTextFieldCell(); UITextField txtSubRackView = lblSubRack.GetTextFieldView(); txtSubRackView.AutocorrectionType = UITextAutocorrectionType.No; txtSubRackView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtSubRackView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 7);}; txtSubRackView.ReturnKeyType = UIReturnKeyType.Next; txtSubRackView.ShouldEndEditing += (sender) => { return ValidateSubRack(sender, 0);}; txtSubRackView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 7);}; if(bReadOnly) { txtSubRackView.Enabled = false; } arrItems2 [6] = lblSubRackVw; UILabel hfCurrentSubRack = new UILabel(); hfCurrentSubRack.Text = sSubRack; hfCurrentSubRack.Tag = iSubRackHiddenTagId * (iRowNo + 1) + (iStringRow + 1); hfCurrentSubRack.Hidden = true; arrItems2 [7] = hfCurrentSubRack; iUtils.CreateFormGridItem radEquipType = new iUtils.CreateFormGridItem(); UIView radEquipTypeVw = new UIView(); radEquipType.SetDimensions(199f, iHdrVert, 200f, iRowHeight * 2, 8f, iRowHeight / 2f, 8f, iRowHeight / 2f); radEquipType.SetFontName("Verdana"); radEquipType.SetFontSize(12f); radEquipType.SetTag(iEquipTypeTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { radEquipType.SetCellColour("Pale Yellow"); } else { radEquipType.SetCellColour("Pale Orange"); } radEquipTypeVw = radEquipType.GetRadioButtonCell(); UISegmentedControl radEquipTypeRadio = new UISegmentedControl(); radEquipTypeRadio = radEquipType.GetRadioGroup(); radEquipTypeRadio.ValueChanged += (sender,e) => { SetStringEquipTypeChanged(sender, e);}; radEquipTypeRadio.InsertSegment("New", 0, false); radEquipTypeRadio.InsertSegment("Used", 1, false); if (sEquipType == "N") { radEquipTypeRadio.SelectedSegment = 0; } else { radEquipTypeRadio.SelectedSegment = 1; } if (bNewRow || iMaximoAssetId < 0) { radEquipTypeRadio.Enabled = true; } else { radEquipTypeRadio.Enabled = false; } if(bReadOnly) { radEquipTypeRadio.Enabled = false; } arrItems2 [8] = radEquipTypeVw; iUtils.CreateFormGridItem lblSerialNo = new iUtils.CreateFormGridItem(); UIView lblSerialNoVw = new UIView(); lblSerialNo.SetDimensions(398f, iHdrVert, 300f, iRowHeight * 2f, 2f, iRowHeight / 2f, 2f, iRowHeight / 2f); lblSerialNo.SetLabelText(sSerialNo); lblSerialNo.SetBorderWidth(0.0f); lblSerialNo.SetFontName("Verdana"); lblSerialNo.SetFontSize(12f); lblSerialNo.SetTag(iSerialNoTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { lblSerialNo.SetCellColour("Pale Yellow"); } else { lblSerialNo.SetCellColour("Pale Orange"); } lblSerialNoVw = lblSerialNo.GetTextFieldCell(); UITextField txtSerialNoView = lblSerialNo.GetTextFieldView(); txtSerialNoView.AutocorrectionType = UITextAutocorrectionType.No; txtSerialNoView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtSerialNoView.ReturnKeyType = UIReturnKeyType.Next; txtSerialNoView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 8);}; txtSerialNoView.ShouldEndEditing += (sender) => { return ValidateSerialNo(sender, 0);}; txtSerialNoView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 8);}; if(bReadOnly) { txtSerialNoView.Enabled = false; } arrItems2 [9] = lblSerialNoVw; UILabel hfCurrentSerialNo = new UILabel(); hfCurrentSerialNo.Text = sSerialNo; hfCurrentSerialNo.Tag = iHiddenSerialNoTagId * (iRowNo + 1) + (iStringRow + 1); hfCurrentSerialNo.Hidden = true; arrItems2 [10] = hfCurrentSerialNo; iUtils.CreateFormGridItem btnLinkTest = new iUtils.CreateFormGridItem(); UIView btnLinkTestVw = new UIView(); btnLinkTest.SetDimensions(697f, iHdrVert, 80f, iRowHeight * 2f, 8f, iRowHeight / 2f, 8f, iRowHeight / 2f); btnLinkTest.SetLabelText("Link Test"); btnLinkTest.SetBorderWidth(0.0f); btnLinkTest.SetFontName("Verdana"); btnLinkTest.SetFontSize(12f); btnLinkTest.SetTag(iLinkTestBtnTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { btnLinkTest.SetCellColour("Pale Yellow"); } else { btnLinkTest.SetCellColour("Pale Orange"); } btnLinkTestVw = btnLinkTest.GetButtonCell(); UIButton btnLinkTestButton = new UIButton(); btnLinkTestButton = btnLinkTest.GetButton(); btnLinkTestButton.TouchUpInside += (sender,e) => { OpenLinkTest(sender, e);}; if(bReadOnly) { btnLinkTestButton.Enabled = false; } arrItems2 [11] = btnLinkTestVw; UILabel hfLinkTestStatus = new UILabel(); hfLinkTestStatus.Text = iLinkTestStatus.ToString(); hfLinkTestStatus.Tag = iLinkTestHiddenTagId * (iRowNo + 1) + (iStringRow + 1); hfLinkTestStatus.Hidden = true; arrItems2 [12] = hfLinkTestStatus; iUtils.CreateFormGridItem btn20MinTest = new iUtils.CreateFormGridItem(); UIView btn20MinTestVw = new UIView(); btn20MinTest.SetDimensions(776f, iHdrVert, 100f, iRowHeight * 2f, 8f, iRowHeight / 2f, 8f, iRowHeight / 2f); btn20MinTest.SetLabelText("20Min Test"); btn20MinTest.SetBorderWidth(0.0f); btn20MinTest.SetFontName("Verdana"); btn20MinTest.SetFontSize(12f); btn20MinTest.SetTag(i20MinTestBtnTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { btn20MinTest.SetCellColour("Pale Yellow"); } else { btn20MinTest.SetCellColour("Pale Orange"); } btn20MinTestVw = btn20MinTest.GetButtonCell(); UIButton btn20MinTestButton = new UIButton(); btn20MinTestButton = btn20MinTest.GetButton(); btn20MinTestButton.TouchUpInside += (sender,e) => { Open20MinTest(sender, e);}; if(bReadOnly) { btn20MinTestButton.Enabled = false; } arrItems2 [13] = btn20MinTestVw; UILabel hf20MinTestStatus = new UILabel(); hf20MinTestStatus.Text = i20MinTest.ToString(); hf20MinTestStatus.Tag = i20MinTestHiddenTagId * (iRowNo + 1) + (iStringRow + 1); hf20MinTestStatus.Hidden = true; arrItems2 [14] = hf20MinTestStatus; iUtils.CreateFormGridItem btnDelete = new iUtils.CreateFormGridItem(); UIView btnDeleteVw = new UIView(); btnDelete.SetDimensions(875f, iHdrVert, 125f, iRowHeight * 2f, 8f, iRowHeight / 2f, 8f, iRowHeight / 2f); btnDelete.SetLabelText("Delete"); btnDelete.SetBorderWidth(0.0f); btnDelete.SetFontName("Verdana"); btnDelete.SetFontSize(12f); btnDelete.SetTag(iDeleteBatteryStringBtnTagId * (iRowNo + 1) + (iStringRow + 1)); if (iRowNo % 2 == 0) { btnDelete.SetCellColour("Pale Yellow"); } else { btnDelete.SetCellColour("Pale Orange"); } btnDeleteVw = btnDelete.GetButtonCell(); UIButton btnDeleteButton = new UIButton(); btnDeleteButton = btnDelete.GetButton(); btnDeleteButton.TouchUpInside += (sender,e) => { DeleteBatteryString(sender, e);}; if (iMaximoAssetId > 0) { btnDeleteButton.Enabled = false; } if(bReadOnly) { btnDeleteButton.Enabled = false; } arrItems2[15] = btnDeleteVw; hdrRow.AddSubviews(arrItems2); iHeightToAdd += iRowHeight; iHdrVert += iRowHeight; //***************************************************************// // 3rd Row // //***************************************************************// iUtils.CreateFormGridItem btnFloorSearch = new iUtils.CreateFormGridItem(); UIView btnFloorSearchVw = new UIView(); btnFloorSearch.SetDimensions(0f,iHdrVert, 50f, iRowHeight, 8f, 4f, 8f, 4f); btnFloorSearch.SetLabelText("..."); btnFloorSearch.SetBorderWidth(0.0f); btnFloorSearch.SetFontName("Verdana"); btnFloorSearch.SetFontSize(12f); btnFloorSearch.SetTag(iFloorSearchTagId * (iRowNo+1) + (iStringRow+1)); if (iRowNo % 2 == 0) { btnFloorSearch.SetCellColour("Pale Yellow"); } else { btnFloorSearch.SetCellColour("Pale Orange"); } btnFloorSearchVw = btnFloorSearch.GetButtonCell(); UIButton btnFloorSearchButton = new UIButton(); btnFloorSearchButton = btnFloorSearch.GetButton(); btnFloorSearchButton.TouchUpInside += (sender,e) => {OpenSearchView(sender, e, 1);}; if(bReadOnly) { btnFloorSearchButton.Enabled = false; } arrItems3[0] = btnFloorSearchVw; iUtils.CreateFormGridItem btnSuiteSearch = new iUtils.CreateFormGridItem(); UIView btnSuiteSearchVw = new UIView(); btnSuiteSearch.SetDimensions(50f,iHdrVert, 50f, iRowHeight, 8f, 4f, 8f, 4f); btnSuiteSearch.SetLabelText("..."); btnSuiteSearch.SetBorderWidth(0.0f); btnSuiteSearch.SetFontName("Verdana"); btnSuiteSearch.SetFontSize(12f); btnSuiteSearch.SetTag(iSuiteSearchTagId * (iRowNo+1) + (iStringRow+1)); if (iRowNo % 2 == 0) { btnSuiteSearch.SetCellColour("Pale Yellow"); } else { btnSuiteSearch.SetCellColour("Pale Orange"); } btnSuiteSearchVw = btnSuiteSearch.GetButtonCell(); UIButton btnSuiteSearchButton = new UIButton(); btnSuiteSearchButton = btnSuiteSearch.GetButton(); btnSuiteSearchButton.TouchUpInside += (sender,e) => {OpenSearchView(sender, e, 2);}; if(bReadOnly) { btnSuiteSearchButton.Enabled = false; } arrItems3[1] = btnSuiteSearchVw; iUtils.CreateFormGridItem btnRackSearch = new iUtils.CreateFormGridItem(); UIView btnRackSearchVw = new UIView(); btnRackSearch.SetDimensions(100f,iHdrVert, 50f, iRowHeight, 8f, 4f, 8f, 4f); btnRackSearch.SetLabelText("..."); btnRackSearch.SetBorderWidth(0.0f); btnRackSearch.SetFontName("Verdana"); btnRackSearch.SetFontSize(12f); btnRackSearch.SetTag(iRackSearchTagId * (iRowNo+1) + (iStringRow+1)); if (iRowNo % 2 == 0) { btnRackSearch.SetCellColour("Pale Yellow"); } else { btnRackSearch.SetCellColour("Pale Orange"); } btnRackSearchVw = btnRackSearch.GetButtonCell(); UIButton btnRackSearchButton = new UIButton(); btnRackSearchButton = btnRackSearch.GetButton(); btnRackSearchButton.TouchUpInside += (sender,e) => {OpenSearchView(sender, e, 3);}; if(bReadOnly) { btnRackSearchButton.Enabled = false; } arrItems3[2] = btnRackSearchVw; iUtils.CreateFormGridItem btnSubRackSearch = new iUtils.CreateFormGridItem(); UIView btnSubRackSearchVw = new UIView(); btnSubRackSearch.SetDimensions(150f,iHdrVert, 50f, iRowHeight, 8f, 4f, 8f, 4f); btnSubRackSearch.SetLabelText("..."); btnSubRackSearch.SetBorderWidth(0.0f); btnSubRackSearch.SetFontName("Verdana"); btnSubRackSearch.SetFontSize(12f); btnSubRackSearch.SetTag(iSubRackSearchTagId * (iRowNo+1) + (iStringRow+1)); if (iRowNo % 2 == 0) { btnSubRackSearch.SetCellColour("Pale Yellow"); } else { btnSubRackSearch.SetCellColour("Pale Orange"); } btnSubRackSearchVw = btnSubRackSearch.GetButtonCell(); UIButton btnSubRackSearchButton = new UIButton(); btnSubRackSearchButton = btnSubRackSearch.GetButton(); btnSubRackSearchButton.TouchUpInside += (sender,e) => {OpenSearchView(sender, e, 4);}; if(bReadOnly) { btnSubRackSearchButton.Enabled = false; } arrItems3[3] = btnSubRackSearchVw; hdrRow.AddSubviews(arrItems3); iHeightToAdd += iRowHeight; iHdrVert += iRowHeight; //Now draw a 1 pixel horizontal line UIView vwHorizLine = new UIView(); vwHorizLine.Frame = new RectangleF(0f,iHdrVert, 1000f, 1f); vwHorizLine.BackgroundColor = UIColor.FromRGBA(0,0,0,255); iHeightToAdd += 1f; iHdrVert += 1f; hdrRow.AddSubview(vwHorizLine); return hdrRow; }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add); _doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done); _saveButton = new UIBarButtonItem(); _saveButton.Title = "Save"; _resetButton = new UIBarButtonItem(); _resetButton.Title = "Reset"; _toolbar = new UIToolbar(); _toolbar.TranslatesAutoresizingMaskIntoConstraints = false; _toolbar.Items = new[] { _addButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _saveButton, _resetButton }; _helpLabel = new UILabel { Text = "Press the '+' button to start.", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.FromWhiteAlpha(0, .6f), TextColor = UIColor.White, Lines = 1, TranslatesAutoresizingMaskIntoConstraints = false }; // Add the views. View.AddSubviews(_myMapView, _toolbar, _helpLabel); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(_toolbar.TopAnchor), _toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), _toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _helpLabel.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _helpLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _helpLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _helpLabel.HeightAnchor.ConstraintEqualTo(25) }); }
public static UIView ToUIView(this Stage stage) { var view = new UIView () { }; stage.NaviveViews ["Stage"] = view; view.AddSubviews (stage.Content.Select (x => (UIView)(stage.NaviveViews[x.Name] = x.ToUIView ())).ToArray()); stage.SetState (stage.InitialState, view); return view; }
private void EnsureViews () { if (containerView != null) { return; } var navController = controller.NavigationController; if (navController == null) { return; } containerView = new UIView () { ClipsToBounds = true, }; menuView = new UIView ().Apply (Style.NavMenu.Background); menuButtons = new[] { (dayButton = new UIButton ()), (weekButton = new UIButton ()), (yearButton = new UIButton ()), }; dayButton.SetTitle ("ReportsMenuWeek".Tr (), UIControlState.Normal); weekButton.SetTitle ("ReportsMenuMonth".Tr (), UIControlState.Normal); yearButton.SetTitle ("ReportsMenuYear".Tr (), UIControlState.Normal); foreach (var menuButton in menuButtons) { var isActive = (menuButton == dayButton && controller.ZoomLevel == ZoomLevel.Week) || (menuButton == weekButton && controller.ZoomLevel == ZoomLevel.Month) || (menuButton == yearButton && controller.ZoomLevel == ZoomLevel.Year); if (isActive) { menuButton.Apply (Style.NavMenu.HighlightedItem); } else { menuButton.Apply (Style.NavMenu.NormalItem); } menuButton.TouchUpInside += OnMenuButtonTouchUpInside; } separators = new UIView[menuButtons.Length - 1]; for (var i = 0; i < separators.Length; i++) { separators [i] = new UIView ().Apply (Style.NavMenu.Separator); } menuView.AddSubviews (separators); menuView.AddSubviews (menuButtons); containerView.AddSubview (menuView); // Layout items: nfloat offsetY = 15f; var sepIdx = 0; foreach (var menuButton in menuButtons) { menuButton.SizeToFit (); var frame = menuButton.Frame; frame.Width = navController.View.Frame.Width; frame.Y = offsetY; menuButton.Frame = frame; offsetY += frame.Height; // Position separator if (sepIdx < separators.Length) { var separator = separators [sepIdx]; var rightMargin = menuButton.ContentEdgeInsets.Right; separator.Frame = new CGRect ( x: rightMargin, y: offsetY, width: navController.View.Frame.Width - rightMargin, height: 1f ); sepIdx += 1; offsetY += separator.Frame.Height; } } offsetY += 15f; containerView.Frame = new CGRect ( x: 0, y: navController.NavigationBar.Frame.Bottom, width: navController.View.Frame.Width, height: offsetY ); menuView.Frame = new CGRect ( x: 0, y: -containerView.Frame.Height, width: containerView.Frame.Width, height: containerView.Frame.Height ); return; }
void initialize(UIViewController controller) { var nav = controller as UINavigationController; if (nav == null && controller.NavigationController != null) nav = controller.NavigationController; if (nav != null) { navBar = nav.NavigationBar; navController = nav; } var nc = NSNotificationCenter.DefaultCenter; observers.Add (nc.AddObserver (UIDevice.OrientationDidChangeNotification, OrientationDidChange)); rootView = new UIView (controller.View.Bounds); rootView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; controllerView = controller.View; controllerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; if (controllerView.Superview != null) controllerView.RemoveFromSuperview (); rootView.AddSubview (controllerView); var statusBarHeight = GetStatusBarHeight (); baseView = new UIView (new RectangleF (0, 0, controller.View.Bounds.Width, BAR_HEIGHT + statusBarHeight)); labelText = new UILabel (new RectangleF (0, statusBarHeight, baseView.Frame.Width - BUTTON_WIDTH, BAR_HEIGHT)); labelText.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; labelText.Font = UIFont.SystemFontOfSize (UIFont.SmallSystemFontSize); labelText.TextAlignment = UITextAlignment.Center; labelText.UserInteractionEnabled = true; labelText.Text = lblText; buttonClose = new UIButton (UIButtonType.Custom); buttonClose.Frame = new RectangleF (labelText.Frame.Right, statusBarHeight, BUTTON_WIDTH, BUTTON_WIDTH); buttonClose.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin; baseView.AddSubviews (labelText, buttonClose); //baseView.Frame = new RectangleF (baseView.Frame.X, baseView.Frame.Y, baseView.Frame.Width, 0f); controller.View = rootView; controller.View.AddSubview (baseView); controller.View.BringSubviewToFront (baseView); if (navController != null && navBar != null) { navBar.ClipsToBounds = false; navController.View.ClipsToBounds = false; navController.View.AddSubview (baseView); navController.View.BringSubviewToFront (baseView); } else rootView.AddSubview (baseView); AttachedToController = controller; buttonClose.TouchUpInside += delegate { var evt = OnClosedRefererOverlay; if (evt != null) evt(); }; tapGestureLabel = new UITapGestureRecognizer (async g => { await OpenRefererAppLink(RefererLink); }); labelText.AddGestureRecognizer (tapGestureLabel); UpdateColors (); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; _staticMapView = new MapView(); _staticMapView.TranslatesAutoresizingMaskIntoConstraints = false; _dynamicMapView = new MapView(); _dynamicMapView.TranslatesAutoresizingMaskIntoConstraints = false; _stackView = new UIStackView(new UIView[] { _staticMapView, _dynamicMapView }); _stackView.TranslatesAutoresizingMaskIntoConstraints = false; _stackView.Distribution = UIStackViewDistribution.FillEqually; UIToolbar toolbar = new UIToolbar(); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; toolbar.Items = new[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem("Zoom", UIBarButtonItemStyle.Plain, OnZoomClick), new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) }; UILabel staticLabel = new UILabel { Text = "Static", BackgroundColor = UIColor.FromWhiteAlpha(0f, .6f), TextColor = UIColor.White, TextAlignment = UITextAlignment.Center, TranslatesAutoresizingMaskIntoConstraints = false }; UILabel dynamicLabel = new UILabel() { Text = "Dynamic", BackgroundColor = UIColor.FromWhiteAlpha(0f, .6f), TextColor = UIColor.White, TextAlignment = UITextAlignment.Center, TranslatesAutoresizingMaskIntoConstraints = false }; // Add the views. View.AddSubviews(_stackView, toolbar, staticLabel, dynamicLabel); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _stackView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _stackView.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), _stackView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _stackView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), staticLabel.TopAnchor.ConstraintEqualTo(_staticMapView.TopAnchor), staticLabel.HeightAnchor.ConstraintEqualTo(40), staticLabel.LeadingAnchor.ConstraintEqualTo(_staticMapView.LeadingAnchor), staticLabel.TrailingAnchor.ConstraintEqualTo(_staticMapView.TrailingAnchor), dynamicLabel.TopAnchor.ConstraintEqualTo(_dynamicMapView.TopAnchor), dynamicLabel.HeightAnchor.ConstraintEqualTo(40), dynamicLabel.LeadingAnchor.ConstraintEqualTo(_dynamicMapView.LeadingAnchor), dynamicLabel.TrailingAnchor.ConstraintEqualTo(_dynamicMapView.TrailingAnchor) }); }
public UIView BuildEquipmentHeader(int iRowNo, ref float iHeightToAdd) { iHeightToAdd = 0.0f; UIView hdrRow = new UIView(); float iHdrVert = 0.0f; float iRowHeight = 20f; UIView[] arrItems = new UIView[3]; UIView[] arrItems2 = new UIView[10]; //Now put in the 2nd header row of labels iUtils.CreateFormGridItem lblFloor = new iUtils.CreateFormGridItem(); UIView lblFloorVw = new UIView(); lblFloor.SetDimensions(0f,iHdrVert, 51f, iRowHeight, 2f, 2f, 2f, 2f); lblFloor.SetLabelText("Floor"); lblFloor.SetBorderWidth(1.0f); lblFloor.SetFontName("Verdana"); lblFloor.SetFontSize(12f); lblFloor.SetTag(iFloorEquipLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblFloor.SetCellColour("Pale Yellow"); } else { lblFloor.SetCellColour("Pale Orange"); } lblFloorVw = lblFloor.GetLabelCell(); arrItems2[0] = lblFloorVw; iUtils.CreateFormGridItem lblSuite = new iUtils.CreateFormGridItem(); UIView lblSuiteVw = new UIView(); lblSuite.SetDimensions(50f,iHdrVert, 51f, iRowHeight, 2f, 2f, 2f, 2f); lblSuite.SetLabelText("Suite"); lblSuite.SetBorderWidth(1.0f); lblSuite.SetFontName("Verdana"); lblSuite.SetFontSize(12f); lblSuite.SetTag(iSuiteEquipLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblSuite.SetCellColour("Pale Yellow"); } else { lblSuite.SetCellColour("Pale Orange"); } lblSuiteVw = lblSuite.GetLabelCell(); arrItems2[1] = lblSuiteVw; iUtils.CreateFormGridItem lblRack = new iUtils.CreateFormGridItem(); UIView lblRackVw = new UIView(); lblRack.SetDimensions(100f,iHdrVert, 41f, iRowHeight, 2f, 2f, 2f, 2f); lblRack.SetLabelText("Rack"); lblRack.SetBorderWidth(1.0f); lblRack.SetFontName("Verdana"); lblRack.SetFontSize(12f); lblRack.SetTag(iRackEquipLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblRack.SetCellColour("Pale Yellow"); } else { lblRack.SetCellColour("Pale Orange"); } lblRackVw = lblRack.GetLabelCell(); arrItems2[2] = lblRackVw; iUtils.CreateFormGridItem lblSubrack = new iUtils.CreateFormGridItem(); UIView lblSubrackVw = new UIView(); lblSubrack.SetDimensions(140f,iHdrVert, 61f, iRowHeight, 2f, 2f, 2f, 2f); lblSubrack.SetLabelText("Subrack"); lblSubrack.SetBorderWidth(1.0f); lblSubrack.SetFontName("Verdana"); lblSubrack.SetFontSize(12f); lblSubrack.SetTag(iSubrackEquipLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblSubrack.SetCellColour("Pale Yellow"); } else { lblSubrack.SetCellColour("Pale Orange"); } lblSubrackVw = lblSubrack.GetLabelCell(); arrItems2[3] = lblSubrackVw; iUtils.CreateFormGridItem lblPosition = new iUtils.CreateFormGridItem(); UIView lblPositionVw = new UIView(); lblPosition.SetDimensions(200f,iHdrVert, 51f, iRowHeight, 2f, 2f, 2f, 2f); lblPosition.SetLabelText("Posn"); lblPosition.SetBorderWidth(1.0f); lblPosition.SetFontName("Verdana"); lblPosition.SetFontSize(12f); lblPosition.SetTag(iPositionEquipLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblPosition.SetCellColour("Pale Yellow"); } else { lblPosition.SetCellColour("Pale Orange"); } lblPositionVw = lblPosition.GetLabelCell(); arrItems2[4] = lblPositionVw; iUtils.CreateFormGridItem lblString = new iUtils.CreateFormGridItem(); UIView lblStringVw = new UIView(); lblString.SetDimensions(250f,iHdrVert, 51f, iRowHeight, 2f, 2f, 2f, 2f); lblString.SetLabelText("String"); lblString.SetBorderWidth(1.0f); lblString.SetFontName("Verdana"); lblString.SetFontSize(12f); lblString.SetTag(iStringEquipLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblString.SetCellColour("Pale Yellow"); } else { lblString.SetCellColour("Pale Orange"); } lblStringVw = lblString.GetLabelCell(); arrItems2[5] = lblStringVw; iUtils.CreateFormGridItem lblEquipType = new iUtils.CreateFormGridItem(); UIView lblEquipTypeVw = new UIView(); lblEquipType.SetDimensions(300f,iHdrVert, 201f, iRowHeight, 2f, 2f, 2f, 2f); lblEquipType.SetLabelText("EquipType"); lblEquipType.SetBorderWidth(1.0f); lblEquipType.SetFontName("Verdana"); lblEquipType.SetFontSize(12f); lblEquipType.SetTag(iEquipTypeEquipLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblEquipType.SetCellColour("Pale Yellow"); } else { lblEquipType.SetCellColour("Pale Orange"); } lblEquipTypeVw = lblEquipType.GetLabelCell(); arrItems2[6] = lblEquipTypeVw; iUtils.CreateFormGridItem lblDOM = new iUtils.CreateFormGridItem(); UIView lblDOMVw = new UIView(); lblDOM.SetDimensions(500f,iHdrVert, 81f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblDOM.SetLabelText("DOM"); lblDOM.SetBorderWidth(1.0f); lblDOM.SetFontName("Verdana"); lblDOM.SetFontSize(12f); lblDOM.SetTag(iDOMEquipLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblDOM.SetCellColour("Pale Yellow"); } else { lblDOM.SetCellColour("Pale Orange"); } lblDOMVw = lblDOM.GetLabelCell(); arrItems2[7] = lblDOMVw; iUtils.CreateFormGridItem lblSerialNo = new iUtils.CreateFormGridItem(); UIView lblSerialNoVw = new UIView(); lblSerialNo.SetDimensions(580f,iHdrVert, 301f, iRowHeight, 2f, 2f, 2f, 2f); lblSerialNo.SetLabelText("SerialNo"); lblSerialNo.SetBorderWidth(1.0f); lblSerialNo.SetFontName("Verdana"); lblSerialNo.SetFontSize(12f); lblSerialNo.SetTag(iSerialNoEquipLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblSerialNo.SetCellColour("Pale Yellow"); } else { lblSerialNo.SetCellColour("Pale Orange"); } lblSerialNoVw = lblSerialNo.GetLabelCell(); arrItems2[8] = lblSerialNoVw; iUtils.CreateFormGridItem lblDeleteLabel = new iUtils.CreateFormGridItem(); UIView lblDeleteLabelVw = new UIView(); lblDeleteLabel.SetDimensions(880f,iHdrVert, 120f, iRowHeight, 2f, 2f, 2f, 2f); lblDeleteLabel.SetLabelText("Delete"); lblDeleteLabel.SetBorderWidth(1.0f); lblDeleteLabel.SetFontName("Verdana"); lblDeleteLabel.SetFontSize(12f); lblDeleteLabel.SetTag(iDeleteEquipLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblDeleteLabel.SetCellColour("Pale Yellow"); } else { lblDeleteLabel.SetCellColour("Pale Orange"); } lblDeleteLabelVw = lblDeleteLabel.GetLabelCell(); arrItems2[9] = lblDeleteLabelVw; hdrRow.AddSubviews(arrItems2); iHeightToAdd += iRowHeight - 1; //This is because of the 1 pixel overlap of the border (not required on the last one) iHdrVert += iRowHeight - 1; //This is because of the 1 pixel overlap of the border (not required on the last one) iUtils.CreateFormGridItem lblMake = new iUtils.CreateFormGridItem(); UIView lblMakeVw = new UIView(); lblMake.SetDimensions(0f,iHdrVert, 401f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblMake.SetLabelText("Make"); lblMake.SetBorderWidth(1.0f); lblMake.SetFontName("Verdana"); lblMake.SetFontSize(12f); lblMake.SetTag(iMakeEquipLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblMake.SetCellColour("Pale Yellow"); } else { lblMake.SetCellColour("Pale Orange"); } lblMakeVw = lblMake.GetLabelCell(); arrItems[0] = lblMakeVw; iUtils.CreateFormGridItem lblModel = new iUtils.CreateFormGridItem(); UIView lblModelVw = new UIView(); lblModel.SetDimensions(400f,iHdrVert, 501f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblModel.SetLabelText("Model"); lblModel.SetBorderWidth(1.0f); lblModel.SetFontName("Verdana"); lblModel.SetFontSize(12f); lblModel.SetTag(iModelEquipLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblModel.SetCellColour("Pale Yellow"); } else { lblModel.SetCellColour("Pale Orange"); } lblModelVw = lblModel.GetLabelCell(); arrItems[1] = lblModelVw; iUtils.CreateFormGridItem lblBlank1 = new iUtils.CreateFormGridItem(); UIView lblBlank1Vw = new UIView(); lblBlank1.SetDimensions(900f,iHdrVert, 100f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblBlank1.SetLabelText("Asset Id"); lblBlank1.SetBorderWidth(1.0f); lblBlank1.SetFontName("Verdana"); lblBlank1.SetFontSize(12f); lblBlank1.SetTag(iBlank1EquipLabelTagId * (iRowNo+1)); if (iRowNo % 2 == 0) { lblBlank1.SetCellColour("Pale Yellow"); } else { lblBlank1.SetCellColour("Pale Orange"); } lblBlank1Vw = lblBlank1.GetLabelCell(); arrItems[2] = lblBlank1Vw; hdrRow.AddSubviews(arrItems); iHeightToAdd += iRowHeight; iHdrVert += iRowHeight; return hdrRow; }
public override void LoadView() { // Create the views. View = new UIView() { BackgroundColor = ApplicationTheme.BackgroundColor }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; UIToolbar toolbar = new UIToolbar { TranslatesAutoresizingMaskIntoConstraints = false }; _connectivityImage = new UIImageView(new CoreGraphics.CGRect(0, 0, 25, 25)); _attachmentImage = new UIImageView(new CoreGraphics.CGRect(0, 0, 25, 25)); UILabel connectivityLabel = new UILabel() { Text = "Connectivity" }; UILabel attachmentLabel = new UILabel() { Text = "Attachment" }; toolbar.Items = new[] { new UIBarButtonItem { CustomView = _attachmentImage }, new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace) { Width = 8 }, new UIBarButtonItem { CustomView = attachmentLabel }, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem { CustomView = _connectivityImage }, new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace) { Width = 8 }, new UIBarButtonItem { CustomView = connectivityLabel }, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), }; // Add the views. View.AddSubviews(_myMapView, toolbar); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), toolbar.TopAnchor.ConstraintEqualTo(_myMapView.BottomAnchor), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor) }); }
public void DrawOpeningPage() { try { int iColNo = 0; int iSectionId = 0; string sId = m_sPassedId; float iVert = 0f; float iPwrIdRowVertInner = 0f; float iSectionHdrRowHeight = 40f; float iQuestionRowHeight = 30f; float iTotalHeight = 0f; float iHeightToAdd = iQuestionRowHeight; bool bHideComplete = true; bool bHideSectionComplete = true; bool bFullyCommitted = false; bool bRFUPwrIdCommitted = false; UIView[] arrItems4 = new UIView[8]; UIView[] arrItems5 = new UIView[8]; //Get some static data for dropdowns only once so we don't reprocess unecessarily clsTabletDB.ITPInventory ITPInventory = new clsTabletDB.ITPInventory(); string[] sRackMakes = ITPInventory.GetRackMakes(); m_sRackMakes = sRackMakes; string[] sSubRackMakes = ITPInventory.GetSubRackMakes(); m_sSubRackMakes = sSubRackMakes; string[] sPositionMakes = ITPInventory.GetPositionMakes(); m_sPositionMakes = sPositionMakes; string[] sSolarStringMakes = ITPInventory.GetSolarStringMakes(); m_sSolarStringMakes = sSolarStringMakes; UIScrollView layout = new UIScrollView(); layout.Frame = new RectangleF(0f,35f,1000f,620f); layout.Tag = 2; clsTabletDB.ITPDocumentSection ITPSection = new clsTabletDB.ITPDocumentSection(); //******************************************************************************************// // SECTION 10 (EQUIPMENT) // //******************************************************************************************// //Get all the PwrId's for this project from ITPSection10 DataSet arrITPSectionEquipmentPwrIds = ITPSection.GetLocalITPSectionEquipmentPwrIds(sId); if (arrITPSectionEquipmentPwrIds.Tables.Count > 0) { int iii = m_iSections; m_iSections++; //Add an extra one for the batteries section m_iEquipmentSectionCounter = iii; int iPwrIdRows = arrITPSectionEquipmentPwrIds.Tables[0].Rows.Count; //Add in the section title and buttons for each section header UIView SectionEquipmentRow = new UIView(); float iSectionEquipmentRowVertTop = iVert; SectionEquipmentRow.Frame = new RectangleF(0f,iSectionEquipmentRowVertTop,1000f,iSectionHdrRowHeight); iSectionId = iSectionTagId * (iii+1); SectionEquipmentRow.Tag = iSectionId; layout.AddSubview(SectionEquipmentRow); UILabel hfSectionEquipment = new UILabel(); hfSectionEquipment.Text = "10"; hfSectionEquipment.Tag = iSectionDBIdTagId * (iii+1); hfSectionEquipment.Hidden = true; SectionEquipmentRow.AddSubview(hfSectionEquipment); iUtils.CreateFormGridItem SectionEquipment = new iUtils.CreateFormGridItem(); UIView SectionEquipmentVw = new UIView(); SectionEquipment.SetDimensions(0f,0f, 400f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); SectionEquipment.SetLabelText("POWER CONVERSION"); SectionEquipment.SetBorderWidth(0.0f); SectionEquipment.SetFontName("Verdana-Bold"); SectionEquipment.SetTextColour("White"); SectionEquipment.SetFontSize(12f); SectionEquipment.SetCellColour("DarkSlateGrey"); SectionEquipment.SetTag(iSectionDescTagId * (iii+1)); SectionEquipmentVw = SectionEquipment.GetLabelCell(); arrItems4[0] = SectionEquipmentVw; if(PowerConversionFullyCommitted()) { bFullyCommitted = true; bHideComplete = false; } else { bFullyCommitted = false; if(PowerConversionFullyComplete()) { bHideComplete = false; } else { bHideComplete = true; } } iUtils.CreateFormGridItem SectionCompleteLabel = new iUtils.CreateFormGridItem(); UIView SectionCompleteLabelVw = new UIView(); SectionCompleteLabel.SetDimensions(400f,0f, 150f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); if(bFullyCommitted) { SectionCompleteLabel.SetLabelText("COMMITTED"); } else { SectionCompleteLabel.SetLabelText("COMPLETED"); } SectionCompleteLabel.SetBorderWidth(0.0f); SectionCompleteLabel.SetFontName("Verdana-Bold"); SectionCompleteLabel.SetTextColour("Bright Yellow"); SectionCompleteLabel.SetFontSize(12f); SectionCompleteLabel.SetCellColour("DarkSlateGrey"); SectionCompleteLabel.SetTag(iSectionCompleteLabelTagId * (iii+1)); SectionCompleteLabel.SetHidden(bHideComplete); SectionCompleteLabelVw = SectionCompleteLabel.GetLabelCell(); arrItems4[1] = SectionCompleteLabelVw; iUtils.CreateFormGridItem btnSaveEquipment = new iUtils.CreateFormGridItem(); UIView btnSaveEquipmentVw = new UIView(); btnSaveEquipment.SetDimensions(550f,0f, 150f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnSaveEquipment.SetLabelText("Save Section"); btnSaveEquipment.SetBorderWidth(0.0f); btnSaveEquipment.SetFontName("Verdana"); btnSaveEquipment.SetFontSize(12f); btnSaveEquipment.SetHidden(true); btnSaveEquipment.SetTag(iSaveSectionBtnTagId * (iii+1)); btnSaveEquipment.SetCellColour("DarkSlateGrey"); btnSaveEquipmentVw = btnSaveEquipment.GetButtonCell(); UIButton btnSaveEquipmentButton = new UIButton(); btnSaveEquipmentButton = btnSaveEquipment.GetButton(); btnSaveEquipmentButton.TouchUpInside += (sender,e) => {SaveThisSection(sender, e);}; arrItems4[2] = btnSaveEquipmentVw; iUtils.CreateFormGridItem btnExpandEquipment = new iUtils.CreateFormGridItem(); UIView btnExpandEquipmentVw = new UIView(); btnExpandEquipment.SetDimensions(700f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnExpandEquipment.SetLabelText("+"); btnExpandEquipment.SetBorderWidth(0.0f); btnExpandEquipment.SetFontName("Verdana"); btnExpandEquipment.SetFontSize(12f); btnExpandEquipment.SetTag(iExpandSectionBtnTagId * (iii+1)); btnExpandEquipment.SetCellColour("DarkSlateGrey"); btnExpandEquipmentVw = btnExpandEquipment.GetButtonCell(); UIButton btnExpandEquipmentButton = new UIButton(); btnExpandEquipmentButton = btnExpandEquipment.GetButton(); btnExpandEquipmentButton.Enabled = false; btnExpandEquipmentButton.TouchUpInside += (sender,e) => {ExpandSection(sender, e);}; arrItems4[3] = btnExpandEquipmentVw; iUtils.CreateFormGridItem btnContractEquipment = new iUtils.CreateFormGridItem(); UIView btnContractEquipmentVw = new UIView(); btnContractEquipment.SetDimensions(750f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnContractEquipment.SetLabelText("-"); btnContractEquipment.SetBorderWidth(0.0f); btnContractEquipment.SetFontName("Verdana"); btnContractEquipment.SetFontSize(12f); btnContractEquipment.SetTag(iContractSectionBtnTagId * (iii+1)); btnContractEquipment.SetCellColour("DarkSlateGrey"); btnContractEquipmentVw = btnContractEquipment.GetButtonCell(); UIButton btnContractEquipmentButton = new UIButton(); btnContractEquipmentButton = btnContractEquipment.GetButton(); btnContractEquipmentButton.TouchUpInside += (sender,e) => {ContractSection(sender, e);}; arrItems4[4] = btnContractEquipmentVw; UILabel hfSectionEquipmentHeight = new UILabel(); hfSectionEquipmentHeight.Tag = iSectionHeightTagId * (iii+1); hfSectionEquipmentHeight.Hidden = true; hfSectionEquipmentHeight.Text = "0"; arrItems4[5] = hfSectionEquipmentHeight; UILabel hfSectionEquipmentRows = new UILabel(); hfSectionEquipmentRows.Tag = iSectionRowsTagId * (iii+1); hfSectionEquipmentRows.Hidden = true; hfSectionEquipmentRows.Text = iPwrIdRows.ToString(); arrItems4[6] = hfSectionEquipmentRows; UILabel hfSectionEquipmentStatus = new UILabel(); hfSectionEquipmentStatus.Tag = iSectionStatusTagId * (iii+1); hfSectionEquipmentStatus.Hidden = true; hfSectionEquipmentStatus.Text = "0"; arrItems4[7] = hfSectionEquipmentStatus; SectionEquipmentRow.AddSubviews(arrItems4); iVert += iSectionHdrRowHeight; //Now add a new view to this view to hold another view containing all the pwrid info for this section 10 UIView PwrIdTableRow = new UIView(); PwrIdTableRow.Frame = new RectangleF(0f,iVert,1000f,iSectionHdrRowHeight); iSectionId = iContainerSectionTagId * (iii+1); PwrIdTableRow.Tag = iSectionId; layout.AddSubview(PwrIdTableRow); float iPwrIdRowVert = 0.0f; float iSectionPwrIdHeight = 0.0f; float iPwrIdRowVertTop = iVert; float iPwrIdRowInnerTop = 0.0f; float iPwrIdRowInnerTop2 = 0.0f; m_iEquipmentPwrIds = iPwrIdRows; for (int jj = 0; jj < iPwrIdRows; jj++) { iPwrIdRowInnerTop2 = 0.0f; UIView vwPwrInternalRowId = new UIView(); vwPwrInternalRowId.Frame = new RectangleF(0f,iPwrIdRowVert,1000f,200f); //This will be resized later on vwPwrInternalRowId.Tag = (iPwrIdSectionTagId + (jj+1)) * (iii+1); UILabel hfRow10Status = new UILabel(); hfRow10Status.Text = "0"; hfRow10Status.Tag = (ihfRow10StatusTagId + (jj+1)) * (iii+1); hfRow10Status.Hidden = true; arrItems5[0] = hfRow10Status; //Put in the PwrId Label iUtils.CreateFormGridItem rowPwrIdLabel = new iUtils.CreateFormGridItem(); UIView rowPwrIdLabelVw = new UIView(); iColNo = arrITPSectionEquipmentPwrIds.Tables[0].Columns["PwrId"].Ordinal; string sPwrId = arrITPSectionEquipmentPwrIds.Tables[0].Rows[jj].ItemArray[iColNo].ToString(); rowPwrIdLabel.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowPwrIdLabel.SetDimensions(0f,iPwrIdRowVert, 200f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowPwrIdLabel.SetLabelText(sPwrId); rowPwrIdLabel.SetBorderWidth(0.0f); rowPwrIdLabel.SetFontName("Verdana-Bold"); rowPwrIdLabel.SetFontSize(18f); rowPwrIdLabel.SetTag((iPwrIdRowLabelTagId + (jj+1)) * (iii+1)); if (jj % 2 == 0) { rowPwrIdLabel.SetCellColour("Pale Yellow"); } else { rowPwrIdLabel.SetCellColour("Pale Orange"); } rowPwrIdLabelVw = rowPwrIdLabel.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems5[1] = rowPwrIdLabelVw; bRFUPwrIdCommitted = RFUPwrIdCommitted(sPwrId); iUtils.CreateFormGridItem btnNewEquipment = new iUtils.CreateFormGridItem(); UIView btnNewEquipmentVw = new UIView(); btnNewEquipment.SetDimensions(200f,iPwrIdRowVert, 200f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnNewEquipment.SetLabelText("New Item"); btnNewEquipment.SetBorderWidth(0.0f); btnNewEquipment.SetFontName("Verdana"); btnNewEquipment.SetFontSize(12f); btnNewEquipment.SetTag((iPwrIdNewBtnTagId + (jj+1)) * (iii+1)); if (jj % 2 == 0) { btnNewEquipment.SetCellColour("Pale Yellow"); } else { btnNewEquipment.SetCellColour("Pale Orange"); } btnNewEquipmentVw = btnNewEquipment.GetButtonCell(); UIButton btnNewEquipmentButton = new UIButton(); btnNewEquipmentButton = btnNewEquipment.GetButton(); btnNewEquipmentButton.TouchUpInside += (sender,e) => {AddNewEquipment(sender, e);}; if(bRFUPwrIdCommitted) { btnNewEquipmentButton.Enabled = false; } arrItems5[2] = btnNewEquipmentVw; if(PowerConversionPwrIdComplete(sPwrId)) { bHideSectionComplete = false; } else { bHideSectionComplete = true; } iUtils.CreateFormGridItem PwrIdCompleteLabel = new iUtils.CreateFormGridItem(); UIView PwrIdCompleteLabelVw = new UIView(); PwrIdCompleteLabel.SetDimensions(400f,0f, 150f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); if(bRFUPwrIdCommitted) { PwrIdCompleteLabel.SetLabelText("COMMITTED"); bHideSectionComplete = false; } else { PwrIdCompleteLabel.SetLabelText("COMPLETED"); } PwrIdCompleteLabel.SetBorderWidth(0.0f); PwrIdCompleteLabel.SetFontName("Verdana-Bold"); PwrIdCompleteLabel.SetTextColour("Royal Blue"); PwrIdCompleteLabel.SetFontSize(14f); if (jj % 2 == 0) { PwrIdCompleteLabel.SetCellColour("Pale Yellow"); } else { PwrIdCompleteLabel.SetCellColour("Pale Orange"); } PwrIdCompleteLabel.SetTag((iPwrIdSectionCompleteLabelTagId + (jj+1)) * (iii+1)); PwrIdCompleteLabel.SetHidden(bHideSectionComplete); PwrIdCompleteLabelVw = PwrIdCompleteLabel.GetLabelCell(); arrItems5[3] = PwrIdCompleteLabelVw; iUtils.CreateFormGridItem rowPwrIdBlank = new iUtils.CreateFormGridItem(); UIView rowPwrIdBlankVw = new UIView(); rowPwrIdBlank.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowPwrIdBlank.SetDimensions(550f,iPwrIdRowVert, 350f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowPwrIdBlank.SetLabelText(""); rowPwrIdBlank.SetBorderWidth(0.0f); rowPwrIdBlank.SetFontName("Verdana"); rowPwrIdBlank.SetFontSize(12f); rowPwrIdBlank.SetTag((iPwrIdRowLabelTagId + (jj+1)) * (iii+1)); if (jj % 2 == 0) { rowPwrIdBlank.SetCellColour("Pale Yellow"); } else { rowPwrIdBlank.SetCellColour("Pale Orange"); } rowPwrIdBlankVw = rowPwrIdBlank.GetLabelCell(); arrItems5[4] = rowPwrIdBlankVw; iUtils.CreateFormGridItem btnExpandPwrId = new iUtils.CreateFormGridItem(); UIView btnExpandPwrIdVw = new UIView(); btnExpandPwrId.SetDimensions(900f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnExpandPwrId.SetLabelText("+"); btnExpandPwrId.SetBorderWidth(0.0f); btnExpandPwrId.SetFontName("Verdana"); btnExpandPwrId.SetFontSize(12f); btnExpandPwrId.SetTag((iPwrIdExpandTagId + (jj+1)) * (iii+1)); if (jj % 2 == 0) { btnExpandPwrId.SetCellColour("Pale Yellow"); } else { btnExpandPwrId.SetCellColour("Pale Orange"); } btnExpandPwrIdVw = btnExpandPwrId.GetButtonCell(); UIButton btnExpandPwrIdButton = new UIButton(); btnExpandPwrIdButton = btnExpandPwrId.GetButton(); btnExpandPwrIdButton.Enabled = false; btnExpandPwrIdButton.TouchUpInside += (sender,e) => {ExpandPwrId(sender, e, 2);}; arrItems5[5] = btnExpandPwrIdVw; iUtils.CreateFormGridItem btnContractPwrId = new iUtils.CreateFormGridItem(); UIView btnContractPwrIdVw = new UIView(); btnContractPwrId.SetDimensions(950f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnContractPwrId.SetLabelText("-"); btnContractPwrId.SetBorderWidth(0.0f); btnContractPwrId.SetFontName("Verdana"); btnContractPwrId.SetFontSize(12f); btnContractPwrId.SetTag((iPwrIdContractTagId + (jj+1)) * (iii+1)); if (jj % 2 == 0) { btnContractPwrId.SetCellColour("Pale Yellow"); } else { btnContractPwrId.SetCellColour("Pale Orange"); } btnContractPwrIdVw = btnContractPwrId.GetButtonCell(); UIButton btnContractPwrIdButton = new UIButton(); btnContractPwrIdButton = btnContractPwrId.GetButton(); btnContractPwrIdButton.TouchUpInside += (sender,e) => {ContractPwrId(sender, e, 2);}; arrItems5[6] = btnContractPwrIdVw; UILabel hfPwrIdSectionHeight = new UILabel(); hfPwrIdSectionHeight.Tag = (iPwrIdHeightTagId + (jj+1)) * (iii+1); hfPwrIdSectionHeight.Hidden = true; hfPwrIdSectionHeight.Text = "0"; arrItems5[7] = hfPwrIdSectionHeight; iHeightToAdd = iSectionHdrRowHeight; //Now add the row details into the view vwPwrInternalRowId.AddSubviews(arrItems5); iSectionPwrIdHeight += iHeightToAdd; iPwrIdRowVert += iHeightToAdd; iVert += iHeightToAdd; iPwrIdRowInnerTop2 += iHeightToAdd; iPwrIdRowVertInner = 0f; UIView vwPwrInternalRowIdInnner = new UIView(); vwPwrInternalRowIdInnner.Tag = (iPwrIdSectionInnerTagId + (jj+1)) * (iii+1); vwPwrInternalRowIdInnner.Frame = new RectangleF(0f,iPwrIdRowVertInner,1000f,200f); //This will be resized later on // vwPwrInternalRowIdInnner.Hidden = true; UIView PwrIdHdr = BuildEquipmentHeader(jj, ref iHeightToAdd); PwrIdHdr.Frame = new RectangleF(0f, iPwrIdRowVertInner, 1000f, iHeightToAdd); vwPwrInternalRowIdInnner.AddSubview(PwrIdHdr); vwPwrInternalRowId.AddSubview(vwPwrInternalRowIdInnner); iSectionPwrIdHeight += iHeightToAdd; iPwrIdRowVert += iHeightToAdd; iPwrIdRowVertInner += iHeightToAdd; iVert += iHeightToAdd; //Now for each PwrId get the details for each string DataSet arrITPSection10PwrIdItems = ITPSection.GetLocalITPSection10PwrIdEquipmentDetails(sId, sPwrId); if (arrITPSection10PwrIdItems.Tables.Count > 0) { int iPwrIdItemRows = arrITPSection10PwrIdItems.Tables[0].Rows.Count; //Add the rows to a hidden field so we know how many rows are in each PwrId battery block UILabel hfPwrIdStringRows = new UILabel(); hfPwrIdStringRows.Text = iPwrIdItemRows.ToString(); hfPwrIdStringRows.Tag = (ihfPwrIdStringRowsTagId + (jj+1)) * (iii+1); hfPwrIdStringRows.Hidden = true; vwPwrInternalRowIdInnner.AddSubview(hfPwrIdStringRows); for (var kk = 0; kk < iPwrIdItemRows; kk++) { iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["AutoId"].Ordinal; int iAutoId = Convert.ToInt32(arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo]); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["BankNo"].Ordinal; string sBankNo = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Make"].Ordinal; string sMake = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Model"].Ordinal; string sModel = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["SPN"].Ordinal; string sSPN = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["DOM"].Ordinal; string sDOM = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Floor"].Ordinal; string sFloor = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Suite"].Ordinal; string sSuite = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Rack"].Ordinal; string sRack = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["SubRack"].Ordinal; string sSubRack = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Position"].Ordinal; string sPosition = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Equipment_Condition"].Ordinal; string sEquipType = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["SerialBatch"].Ordinal; string sSerialNo = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["tblMaximoPSA_ID"].Ordinal; string sMaximoPSAId = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["tblMaximoTransfer_Eqnum"].Ordinal; string sMaximoTransferId = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); if(sMaximoPSAId == "" || sMaximoPSAId == "0") { sMaximoPSAId = "-1"; } if(sMaximoTransferId == "" || sMaximoTransferId == "0") { sMaximoTransferId = "-1"; } int iMaximoPSAId = Convert.ToInt32(sMaximoPSAId); int iMaximoTransferId = Convert.ToInt32(sMaximoTransferId); int iMaximoAssetId = -1; if(iMaximoPSAId > 0) { iMaximoAssetId = iMaximoPSAId; } else if(iMaximoTransferId > 0 || sMaximoTransferId == "0000000000") { iMaximoAssetId = iMaximoTransferId; } else { iMaximoAssetId = -1; } iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Equipment_Type"].Ordinal; int iEquipmentType = Convert.ToInt32(arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo]); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Duplicate"].Ordinal; int iDuplicate = Convert.ToInt32(arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo]); //Add in the row UIView EquipmentItemRow = BuildEquipmentItemRowDetails(iii, jj, kk, sPwrId, iAutoId, iMaximoAssetId, sBankNo, sMake, sModel, sSPN, sDOM, sFloor, sSuite, sRack, sSubRack, sPosition, sEquipType, sSerialNo, iEquipmentType, iDuplicate, false, bRFUPwrIdCommitted,ref iHeightToAdd); EquipmentItemRow.Frame = new RectangleF(0f, iPwrIdRowVertInner, 1000f, iHeightToAdd); EquipmentItemRow.Tag = iEquipmentFullRowTagId * (jj + 1) + (kk + 1); vwPwrInternalRowIdInnner.AddSubview(EquipmentItemRow); m_iEquipmentRowHeight = iHeightToAdd; iSectionPwrIdHeight += iHeightToAdd; iPwrIdRowVert += iHeightToAdd; iPwrIdRowVertInner += iHeightToAdd; iVert += iHeightToAdd; } hfPwrIdSectionHeight.Text = iPwrIdRowVertInner.ToString(); vwPwrInternalRowIdInnner.Frame = new RectangleF(0f, iPwrIdRowInnerTop2, 1000f, iPwrIdRowVertInner); vwPwrInternalRowId.Frame = new RectangleF(0f, iPwrIdRowInnerTop, 1000f, iPwrIdRowVert); PwrIdTableRow.AddSubview(vwPwrInternalRowId); iPwrIdRowInnerTop += iPwrIdRowVert; //iPwrIdRowInnerTop2 += iPwrIdRowVertInner; iPwrIdRowVert = 0f; } } //Now resize the UIView that is effectively the container for the battery info for this section //And also store this height in a hidden field for use in the contract and expand functions PwrIdTableRow.Frame = new RectangleF(0f,iPwrIdRowVertTop,1000f,iSectionPwrIdHeight); hfSectionEquipmentHeight.Text = iSectionPwrIdHeight.ToString(); } iTotalHeight = iVert + 280f; SizeF layoutSize = new SizeF(1000f, iTotalHeight); layout.ContentSize = layoutSize; UILabel hfScrollContentHeight = new UILabel(); hfScrollContentHeight.Text = iTotalHeight.ToString(); hfScrollContentHeight.Tag = 3; hfScrollContentHeight.Hidden = true; layout.AddSubview(hfScrollContentHeight); View.AddSubview(layout); //Contract all the power conversion PwrIds for(int iiii=0;iiii< m_iEquipmentPwrIds; iiii++) { UIButton btnContract = (UIButton)View.ViewWithTag ((iPwrIdContractTagId + (iiii+1)) * (m_iEquipmentSectionCounter+1)); ContractPwrId(btnContract, null, 2); } } catch (Exception except) { string sTest = except.Message.ToString(); iUtils.AlertBox alert = new iUtils.AlertBox (); alert.CreateErrorAlertDialog (sTest); } }
private RootElement CreateRootElement() { var captionLabel = UIHelper.CreateLabel ( "cross copy", true, 32, 32, UITextAlignment.Center, UIColor.Black ); UILabel subcaptionLabel = UIHelper.CreateLabel ( WELCOME_LABEL_TEXT, false, 14, 85, UITextAlignment.Center, lightTextColor ); subcaptionLabel.Tag = 3; captionLabel.Frame = new Rectangle (0, 10, 320, 40); subcaptionLabel.Frame = new Rectangle (20, 55, 280, 100); UIView header = new UIView (new Rectangle (0, 0, 300, 145)); header.AddSubviews (captionLabel, subcaptionLabel); var root = new RootElement ("Secrets") { new Section (header), (secretsSection = new Section ("Secrets")), new Section () { (secretEntry = new AdvancedEntryElement ("Secret", "enter new phrase", "", null)) } }; secretsSection.AddAll (from s in AppDelegate.HistoryData.Secrets select (Element)CreateImageButtonStringElement (s)); secretEntry.AutocapitalizationType = UITextAutocapitalizationType.None; secretEntry.ShouldReturn += delegate { if (String.IsNullOrEmpty (secretEntry.Value)) return false; var newSecret = new Secret (secretEntry.Value); AppDelegate.HistoryData.Secrets.Add (newSecret); if (root.Count == 2) root.Insert (1, secretsSection); secretsSection.Insert ( secretsSection.Elements.Count, UITableViewRowAnimation.Fade, CreateImageButtonStringElement (newSecret) ); secretEntry.Value = ""; secretEntry.ResignFirstResponder (false); DisplaySecretDetail (newSecret); return true; }; secretEntry.ReturnKeyType = UIReturnKeyType.Go; if (secretsSection.Count == 0) { secretEntry.BecomeFirstResponder (true); root.RemoveAt (1); } return root; }
public UIView BuildEquipmentItemRowDetails(int iSectionCounterId, int iPwrIdRowNo, int iEquipRowNo, string sPwrId, int iAutoId, int iMaximoAssetId, string sStringNo, string sMake, string sModel, string sSPN, string sDOM, string sFloor, string sSuite,string sRack, string sSubRack, string sPosition, string sEquipType, string sSerialNo, int iEquipmentType, int iDuplicate, bool bNewRow, bool bReadOnly, ref float iHeightToAdd) { DateClass dt = new DateClass(); iHeightToAdd = 0.0f; UIView hdrRow = new UIView(); float iHdrVert = 0.0f; float iRowHeight = 40f; UIView[] arrItems = new UIView[8]; UIView[] arrItems2 = new UIView[18]; UIView[] arrItems3 = new UIView[6]; UIView[] arrItems4 = new UIView[7]; UIView vwBlank = new UIView(); UILabel hfSectionCounter = new UILabel(); hfSectionCounter.Text = iSectionCounterId.ToString(); hfSectionCounter.Tag = iEquipmentRowSectionCounterTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfSectionCounter.Hidden = true; arrItems4[0] = hfSectionCounter; UILabel hfPwrId = new UILabel(); hfPwrId.Text = sPwrId; hfPwrId.Tag = iEquipmentRowPwrIdTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfPwrId.Hidden = true; arrItems4[1] = hfPwrId; UILabel hfRowStatus = new UILabel(); if (bNewRow) { hfRowStatus.Text = "2"; //2 means new } else { hfRowStatus.Text = "0"; } hfRowStatus.Tag = iEquipmentRowStatusTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfRowStatus.Hidden = true; arrItems4[2] = hfRowStatus; UILabel hfAutoId = new UILabel(); hfAutoId.Text = iAutoId.ToString(); hfAutoId.Tag = iEquipmentRowAutoIdTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfAutoId.Hidden = true; arrItems4[3] = hfAutoId; UILabel hfMaximoAssetId = new UILabel(); hfMaximoAssetId.Text = iMaximoAssetId.ToString(); hfMaximoAssetId.Tag = iEquipmentRowMaximoAssetIdTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfMaximoAssetId.Hidden = true; arrItems4[4] = hfMaximoAssetId; UILabel hfEquipmentTypeId = new UILabel(); hfEquipmentTypeId.Text = iEquipmentType.ToString(); hfEquipmentTypeId.Tag = iEquipmentTypeTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfEquipmentTypeId.Hidden = true; arrItems4[5] = hfEquipmentTypeId; UILabel hfDuplicateId = new UILabel(); hfDuplicateId.Text = iDuplicate.ToString(); hfDuplicateId.Tag = iDuplicateTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfDuplicateId.Hidden = true; arrItems4[6] = hfDuplicateId; hdrRow.AddSubviews(arrItems4); //***************************************************************// // 1st Row // //***************************************************************// iUtils.CreateFormGridItem lblFloor = new iUtils.CreateFormGridItem(); UIView lblFloorVw = new UIView(); lblFloor.SetDimensions(0f, iHdrVert, 50f, iRowHeight, 2f, 2f, 2f, 2f); lblFloor.SetLabelText(sFloor); lblFloor.SetBorderWidth(0.0f); lblFloor.SetFontName("Verdana"); lblFloor.SetFontSize(12f); lblFloor.SetTag(iEquipmentFloorTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { lblFloor.SetCellColour("Pale Yellow"); } else { lblFloor.SetCellColour("Pale Orange"); } lblFloorVw = lblFloor.GetTextFieldCell(); UITextField txtFloorView = lblFloor.GetTextFieldView(); txtFloorView.AutocorrectionType = UITextAutocorrectionType.No; txtFloorView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtFloorView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 1);}; txtFloorView.ReturnKeyType = UIReturnKeyType.Next; txtFloorView.ShouldEndEditing += (sender) => { return ValidateFloor(sender, 0);}; txtFloorView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 1);}; if(bReadOnly) { txtFloorView.Enabled = false; } arrItems2 [0] = lblFloorVw; UILabel hfCurrentFloor = new UILabel(); hfCurrentFloor.Text = sFloor; hfCurrentFloor.Tag = iEquipmentFloorHiddenTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfCurrentFloor.Hidden = true; arrItems2 [1] = hfCurrentFloor; iUtils.CreateFormGridItem lblSuite = new iUtils.CreateFormGridItem(); UIView lblSuiteVw = new UIView(); lblSuite.SetDimensions(50f, iHdrVert, 50f, iRowHeight, 2f, 2f, 2f, 2f); lblSuite.SetLabelText(sSuite); lblSuite.SetBorderWidth(0.0f); lblSuite.SetFontName("Verdana"); lblSuite.SetFontSize(12f); lblSuite.SetTag(iEquipmentSuiteTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { lblSuite.SetCellColour("Pale Yellow"); } else { lblSuite.SetCellColour("Pale Orange"); } lblSuiteVw = lblSuite.GetTextFieldCell(); UITextField txtSuiteView = lblSuite.GetTextFieldView(); txtSuiteView.AutocorrectionType = UITextAutocorrectionType.No; txtSuiteView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtSuiteView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 2);}; txtSuiteView.ReturnKeyType = UIReturnKeyType.Next; txtSuiteView.ShouldEndEditing += (sender) => { return ValidateSuite(sender, 0);}; txtSuiteView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 2);}; if(bReadOnly) { txtSuiteView.Enabled = false; } arrItems2 [2] = lblSuiteVw; UILabel hfCurrentSuite = new UILabel(); hfCurrentSuite.Text = sSuite; hfCurrentSuite.Tag = iEquipmentSuiteHiddenTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfCurrentSuite.Hidden = true; arrItems2 [3] = hfCurrentSuite; iUtils.CreateFormGridItem lblRack = new iUtils.CreateFormGridItem(); UIView lblRackVw = new UIView(); lblRack.SetDimensions(100f, iHdrVert, 50f, iRowHeight, 2f, 2f, 2f, 2f); lblRack.SetLabelText(sRack); lblRack.SetBorderWidth(0.0f); lblRack.SetFontName("Verdana"); lblRack.SetFontSize(12f); lblRack.SetTag(iEquipmentRackTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { lblRack.SetCellColour("Pale Yellow"); } else { lblRack.SetCellColour("Pale Orange"); } lblRackVw = lblRack.GetTextFieldCell(); UITextField txtRackView = lblRack.GetTextFieldView(); txtRackView.AutocorrectionType = UITextAutocorrectionType.No; txtRackView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtRackView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 3);}; txtRackView.ReturnKeyType = UIReturnKeyType.Next; txtRackView.ShouldEndEditing += (sender) => { return ValidateRack(sender, 0);}; txtRackView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 3);}; if(bReadOnly) { txtRackView.Enabled = false; } arrItems2 [4] = lblRackVw; UILabel hfCurrentRack = new UILabel(); hfCurrentRack.Text = sRack; hfCurrentRack.Tag = iEquipmentRackHiddenTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfCurrentRack.Hidden = true; arrItems2 [5] = hfCurrentRack; if(iEquipmentType > 3) { iUtils.CreateFormGridItem lblSubRack = new iUtils.CreateFormGridItem(); UIView lblSubRackVw = new UIView(); lblSubRack.SetDimensions(140f, iHdrVert, 60f, iRowHeight, 2f, 2f, 2f, 2f); lblSubRack.SetLabelText(sSubRack); lblSubRack.SetBorderWidth(0.0f); lblSubRack.SetFontName("Verdana"); lblSubRack.SetFontSize(12f); lblSubRack.SetTag(iEquipmentSubRackTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { lblSubRack.SetCellColour("Pale Yellow"); } else { lblSubRack.SetCellColour("Pale Orange"); } lblSubRackVw = lblSubRack.GetTextFieldCell(); UITextField txtSubRackView = lblSubRack.GetTextFieldView(); txtSubRackView.AutocorrectionType = UITextAutocorrectionType.No; txtSubRackView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtSubRackView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 4);}; txtSubRackView.ReturnKeyType = UIReturnKeyType.Next; txtSubRackView.ShouldEndEditing += (sender) => { return ValidateSubRack(sender, 0);}; txtSubRackView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 4);}; if(bReadOnly) { txtSubRackView.Enabled = false; } arrItems2 [6] = lblSubRackVw; UILabel hfCurrentSubRack = new UILabel(); hfCurrentSubRack.Text = sSubRack; hfCurrentSubRack.Tag = iEquipmentSubRackHiddenTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfCurrentSubRack.Hidden = true; arrItems2 [7] = hfCurrentSubRack; } else { iUtils.CreateFormGridItem lblSubRack = new iUtils.CreateFormGridItem(); UIView lblSubRackVw = new UIView(); lblSubRack.SetDimensions(140f, iHdrVert, 60f, iRowHeight, 2f, 2f, 2f, 2f); lblSubRack.SetBorderWidth(0.0f); if (iPwrIdRowNo % 2 == 0) { lblSubRack.SetCellColour("Pale Yellow"); } else { lblSubRack.SetCellColour("Pale Orange"); } lblSubRackVw = lblSubRack.GetLabelCell(); arrItems2 [6] = lblSubRackVw; arrItems2 [7] = vwBlank; } if(iEquipmentType > 4) { iUtils.CreateFormGridItem lblPosition = new iUtils.CreateFormGridItem(); UIView lblPositionVw = new UIView(); lblPosition.SetDimensions(200f, iHdrVert, 50f, iRowHeight, 2f, 2f, 2f, 2f); lblPosition.SetLabelText(sPosition); lblPosition.SetBorderWidth(0.0f); lblPosition.SetFontName("Verdana"); lblPosition.SetFontSize(12f); lblPosition.SetTag(iEquipmentPositionTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { lblPosition.SetCellColour("Pale Yellow"); } else { lblPosition.SetCellColour("Pale Orange"); } lblPositionVw = lblPosition.GetTextFieldCell(); UITextField txtPositionView = lblPosition.GetTextFieldView(); txtPositionView.AutocorrectionType = UITextAutocorrectionType.No; txtPositionView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtPositionView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 5);}; txtPositionView.ReturnKeyType = UIReturnKeyType.Next; txtPositionView.ShouldEndEditing += (sender) => { return ValidatePosition(sender, 0);}; txtPositionView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 5);}; if(bReadOnly) { txtPositionView.Enabled = false; } arrItems2 [8] = lblPositionVw; UILabel hfCurrentPosition = new UILabel(); hfCurrentPosition.Text = sPosition; hfCurrentPosition.Tag = iEquipmentPositionHiddenTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfCurrentPosition.Hidden = true; arrItems2 [9] = hfCurrentPosition; } else { iUtils.CreateFormGridItem lblPosition = new iUtils.CreateFormGridItem(); UIView lblPositionVw = new UIView(); lblPosition.SetDimensions(200f, iHdrVert, 50f, iRowHeight, 2f, 2f, 2f, 2f); lblPosition.SetBorderWidth(0.0f); if (iPwrIdRowNo % 2 == 0) { lblPosition.SetCellColour("Pale Yellow"); } else { lblPosition.SetCellColour("Pale Orange"); } lblPositionVw = lblPosition.GetLabelCell(); arrItems2 [8] = lblPositionVw; arrItems2 [9] = vwBlank; } if(iEquipmentType > 5) { iUtils.CreateFormGridItem lblString = new iUtils.CreateFormGridItem(); UIView lblStringVw = new UIView(); lblString.SetDimensions(250f, iHdrVert, 50f, iRowHeight, 2f, 2f, 2f, 2f); lblString.SetLabelText(sStringNo); lblString.SetBorderWidth(0.0f); lblString.SetFontName("Verdana"); lblString.SetFontSize(12f); lblString.SetTag(iEquipmentStringTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { lblString.SetCellColour("Pale Yellow"); } else { lblString.SetCellColour("Pale Orange"); } lblStringVw = lblString.GetTextFieldCell(); UITextField txtStringView = lblString.GetTextFieldView(); txtStringView.AutocorrectionType = UITextAutocorrectionType.No; txtStringView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtStringView.ReturnKeyType = UIReturnKeyType.Next; txtStringView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 6);}; txtStringView.ShouldEndEditing += (sender) => { return ValidateBankNo(sender, 2, 0);}; txtStringView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 6);}; if(bReadOnly) { txtStringView.Enabled = false; } arrItems2 [10] = lblStringVw; UILabel hfCurrentString = new UILabel(); hfCurrentString.Text = sStringNo; hfCurrentString.Tag = iEquipmentStringHiddenTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfCurrentString.Hidden = true; arrItems2 [11] = hfCurrentString; } else { iUtils.CreateFormGridItem lblString = new iUtils.CreateFormGridItem(); UIView lblStringVw = new UIView(); lblString.SetDimensions(250f, iHdrVert, 50f, iRowHeight, 2f, 2f, 2f, 2f); lblString.SetBorderWidth(0.0f); if (iPwrIdRowNo % 2 == 0) { lblString.SetCellColour("Pale Yellow"); } else { lblString.SetCellColour("Pale Orange"); } lblStringVw = lblString.GetLabelCell(); arrItems2 [10] = lblStringVw; arrItems2 [11] = vwBlank; } iUtils.CreateFormGridItem radEquipType = new iUtils.CreateFormGridItem(); UIView radEquipTypeVw = new UIView(); radEquipType.SetDimensions(300f, iHdrVert, 200f, iRowHeight * 2, 8f, iRowHeight / 2f, 8f, iRowHeight / 2f); radEquipType.SetFontName("Verdana"); radEquipType.SetFontSize(12f); radEquipType.SetTag(iEquipmentEquipTypeTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { radEquipType.SetCellColour("Pale Yellow"); } else { radEquipType.SetCellColour("Pale Orange"); } radEquipTypeVw = radEquipType.GetRadioButtonCell(); UISegmentedControl radEquipTypeRadio = new UISegmentedControl(); radEquipTypeRadio = radEquipType.GetRadioGroup(); radEquipTypeRadio.ValueChanged += (sender,e) => { SetStringEquipTypeChanged(sender, e);}; radEquipTypeRadio.InsertSegment("New", 0, false); radEquipTypeRadio.InsertSegment("Used", 1, false); if (sEquipType == "N") { radEquipTypeRadio.SelectedSegment = 0; } else { radEquipTypeRadio.SelectedSegment = 1; } if (bNewRow || iDuplicate < 0) { radEquipTypeRadio.Enabled = true; } else { radEquipTypeRadio.Enabled = false; } if(bReadOnly) { radEquipTypeRadio.Enabled = false; } arrItems2 [12] = radEquipTypeVw; iUtils.CreateFormGridItem txtDOM = new iUtils.CreateFormGridItem(); UIView txtDOMVw = new UIView(); txtDOM.SetDimensions(500f, iHdrVert, 80f, iRowHeight * 2, 2f, iRowHeight / 2f, 2f, iRowHeight / 2f); if (sDOM == "0") { sDOM = "01/01/1900"; } string sDOMDisplay; if(sDOM == "") { sDOMDisplay = sDOM; } else { DateTime dtDOM = Convert.ToDateTime(sDOM); sDOMDisplay = dt.Get_Date_String(dtDOM, "dd/mm/yy"); } txtDOM.SetLabelText(sDOMDisplay); txtDOM.SetBorderWidth(0.0f); txtDOM.SetFontName("Verdana"); txtDOM.SetFontSize(12f); txtDOM.SetTag(iEquipmentDOMTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { txtDOM.SetCellColour("Pale Yellow"); } else { txtDOM.SetCellColour("Pale Orange"); } txtDOMVw = txtDOM.GetTextFieldCell(); UITextField txtDOMTextView = txtDOM.GetTextFieldView(); txtDOMTextView.AutocorrectionType = UITextAutocorrectionType.No; txtDOMTextView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtDOMTextView.ReturnKeyType = UIReturnKeyType.Next; txtDOMTextView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 7);}; txtDOMTextView.ShouldEndEditing += (sender) => { return ValidateDOM(sender, 0);}; txtDOMTextView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 7);}; if(bReadOnly) { txtDOMTextView.Enabled = false; } arrItems2 [13] = txtDOMVw; UILabel hfCurrentDOM = new UILabel(); hfCurrentDOM.Text = sDOMDisplay; hfCurrentDOM.Tag = iEquipmentDOMHiddenTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfCurrentDOM.Hidden = true; arrItems2 [14] = hfCurrentDOM; iUtils.CreateFormGridItem lblSerialNo = new iUtils.CreateFormGridItem(); UIView lblSerialNoVw = new UIView(); lblSerialNo.SetDimensions(580f, iHdrVert, 300f, iRowHeight * 2f, 2f, iRowHeight / 2f, 2f, iRowHeight / 2f); lblSerialNo.SetLabelText(sSerialNo); lblSerialNo.SetBorderWidth(0.0f); lblSerialNo.SetFontName("Verdana"); lblSerialNo.SetFontSize(12f); lblSerialNo.SetTag(iEquipmentSerialNoTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { lblSerialNo.SetCellColour("Pale Yellow"); } else { lblSerialNo.SetCellColour("Pale Orange"); } lblSerialNoVw = lblSerialNo.GetTextFieldCell(); UITextField txtSerialNoView = lblSerialNo.GetTextFieldView(); txtSerialNoView.AutocorrectionType = UITextAutocorrectionType.No; txtSerialNoView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtSerialNoView.ReturnKeyType = UIReturnKeyType.Next; txtSerialNoView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 8);}; txtSerialNoView.ShouldEndEditing += (sender) => { return ValidateSerialNo(sender, 0);}; txtSerialNoView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 8);}; if(bReadOnly) { txtSerialNoView.Enabled = false; } arrItems2 [15] = lblSerialNoVw; UILabel hfCurrentSerialNo = new UILabel(); hfCurrentSerialNo.Text = sSerialNo; hfCurrentSerialNo.Tag = iEquipmentSerialNoHiddenTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfCurrentSerialNo.Hidden = true; arrItems2 [16] = hfCurrentSerialNo; iUtils.CreateFormGridItem btnDelete = new iUtils.CreateFormGridItem(); UIView btnDeleteVw = new UIView(); btnDelete.SetDimensions(880f, iHdrVert, 120f, iRowHeight * 2f, 8f, iRowHeight / 2f, 8f, iRowHeight / 2f); btnDelete.SetLabelText("Delete"); btnDelete.SetBorderWidth(0.0f); btnDelete.SetFontName("Verdana"); btnDelete.SetFontSize(12f); btnDelete.SetTag(iEquipmentDeleteBtnTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { btnDelete.SetCellColour("Pale Yellow"); } else { btnDelete.SetCellColour("Pale Orange"); } btnDeleteVw = btnDelete.GetButtonCell(); UIButton btnDeleteButton = new UIButton(); btnDeleteButton = btnDelete.GetButton(); btnDeleteButton.TouchUpInside += (sender,e) => { DeleteEquipmentRow(sender, e);}; if (iMaximoAssetId >= 0) { btnDeleteButton.Enabled = false; } if(bReadOnly) { btnDeleteButton.Enabled = false; } arrItems2[17] = btnDeleteVw; hdrRow.AddSubviews(arrItems2); iHeightToAdd += iRowHeight; iHdrVert += iRowHeight; //***************************************************************// // 2nd Row // //***************************************************************// iUtils.CreateFormGridItem btnFloorSearch = new iUtils.CreateFormGridItem(); UIView btnFloorSearchVw = new UIView(); btnFloorSearch.SetDimensions(0f,iHdrVert, 50f, iRowHeight, 8f, 4f, 8f, 4f); btnFloorSearch.SetLabelText("..."); btnFloorSearch.SetBorderWidth(0.0f); btnFloorSearch.SetFontName("Verdana"); btnFloorSearch.SetFontSize(12f); btnFloorSearch.SetTag(iEquipmentFloorSearchTagId * (iPwrIdRowNo+1) + (iEquipRowNo+1)); if (iPwrIdRowNo % 2 == 0) { btnFloorSearch.SetCellColour("Pale Yellow"); } else { btnFloorSearch.SetCellColour("Pale Orange"); } btnFloorSearchVw = btnFloorSearch.GetButtonCell(); UIButton btnFloorSearchButton = new UIButton(); btnFloorSearchButton = btnFloorSearch.GetButton(); btnFloorSearchButton.TouchUpInside += (sender,e) => {OpenSearchView(sender, e, 1);}; if(bReadOnly) { btnFloorSearchButton.Enabled = false; } arrItems3[0] = btnFloorSearchVw; iUtils.CreateFormGridItem btnSuiteSearch = new iUtils.CreateFormGridItem(); UIView btnSuiteSearchVw = new UIView(); btnSuiteSearch.SetDimensions(50f,iHdrVert, 50f, iRowHeight, 8f, 4f, 8f, 4f); btnSuiteSearch.SetLabelText("..."); btnSuiteSearch.SetBorderWidth(0.0f); btnSuiteSearch.SetFontName("Verdana"); btnSuiteSearch.SetFontSize(12f); btnSuiteSearch.SetTag(iEquipmentSuiteSearchTagId * (iPwrIdRowNo+1) + (iEquipRowNo+1)); if (iPwrIdRowNo % 2 == 0) { btnSuiteSearch.SetCellColour("Pale Yellow"); } else { btnSuiteSearch.SetCellColour("Pale Orange"); } btnSuiteSearchVw = btnSuiteSearch.GetButtonCell(); UIButton btnSuiteSearchButton = new UIButton(); btnSuiteSearchButton = btnSuiteSearch.GetButton(); btnSuiteSearchButton.TouchUpInside += (sender,e) => {OpenSearchView(sender, e, 2);}; if(bReadOnly) { btnSuiteSearchButton.Enabled = false; } arrItems3[1] = btnSuiteSearchVw; iUtils.CreateFormGridItem btnRackSearch = new iUtils.CreateFormGridItem(); UIView btnRackSearchVw = new UIView(); btnRackSearch.SetDimensions(100f,iHdrVert, 40f, iRowHeight, 3f, 4f, 3f, 4f); btnRackSearch.SetLabelText("..."); btnRackSearch.SetBorderWidth(0.0f); btnRackSearch.SetFontName("Verdana"); btnRackSearch.SetFontSize(12f); btnRackSearch.SetTag(iEquipmentRackSearchTagId * (iPwrIdRowNo+1) + (iEquipRowNo+1)); if (iPwrIdRowNo % 2 == 0) { btnRackSearch.SetCellColour("Pale Yellow"); } else { btnRackSearch.SetCellColour("Pale Orange"); } btnRackSearchVw = btnRackSearch.GetButtonCell(); UIButton btnRackSearchButton = new UIButton(); btnRackSearchButton = btnRackSearch.GetButton(); btnRackSearchButton.TouchUpInside += (sender,e) => {OpenSearchView(sender, e, 3);}; if(bReadOnly) { btnRackSearchButton.Enabled = false; } arrItems3[2] = btnRackSearchVw; if(iEquipmentType > 3) { iUtils.CreateFormGridItem btnSubRackSearch = new iUtils.CreateFormGridItem(); UIView btnSubRackSearchVw = new UIView(); btnSubRackSearch.SetDimensions(140f,iHdrVert, 60f, iRowHeight, 13f, 4f, 13f, 4f); btnSubRackSearch.SetLabelText("..."); btnSubRackSearch.SetBorderWidth(0.0f); btnSubRackSearch.SetFontName("Verdana"); btnSubRackSearch.SetFontSize(12f); btnSubRackSearch.SetTag(iEquipmentSubRackSearchTagId * (iPwrIdRowNo+1) + (iEquipRowNo+1)); if (iPwrIdRowNo % 2 == 0) { btnSubRackSearch.SetCellColour("Pale Yellow"); } else { btnSubRackSearch.SetCellColour("Pale Orange"); } btnSubRackSearchVw = btnSubRackSearch.GetButtonCell(); UIButton btnSubRackSearchButton = new UIButton(); btnSubRackSearchButton = btnSubRackSearch.GetButton(); btnSubRackSearchButton.TouchUpInside += (sender,e) => {OpenSearchView(sender, e, 4);}; if(bReadOnly) { btnSubRackSearchButton.Enabled = false; } arrItems3[3] = btnSubRackSearchVw; } else { iUtils.CreateFormGridItem btnSubRackSearch = new iUtils.CreateFormGridItem(); UIView btnSubRackSearchVw = new UIView(); btnSubRackSearch.SetDimensions(140f,iHdrVert, 60f, iRowHeight, 13f, 4f, 13f, 4f); btnSubRackSearch.SetBorderWidth(0.0f); btnSubRackSearch.SetTag(iEquipmentSubRackSearchTagId * (iPwrIdRowNo+1) + (iEquipRowNo+1)); if (iPwrIdRowNo % 2 == 0) { btnSubRackSearch.SetCellColour("Pale Yellow"); } else { btnSubRackSearch.SetCellColour("Pale Orange"); } btnSubRackSearchVw = btnSubRackSearch.GetLabelCell(); arrItems3[3] = btnSubRackSearchVw; } if(iEquipmentType > 4) { iUtils.CreateFormGridItem btnPositionSearch = new iUtils.CreateFormGridItem(); UIView btnPositionSearchVw = new UIView(); btnPositionSearch.SetDimensions(200f,iHdrVert, 50f, iRowHeight, 8f, 4f, 8f, 4f); btnPositionSearch.SetLabelText("..."); btnPositionSearch.SetBorderWidth(0.0f); btnPositionSearch.SetFontName("Verdana"); btnPositionSearch.SetFontSize(12f); btnPositionSearch.SetTag(iEquipmentPositionSearchTagId * (iPwrIdRowNo+1) + (iEquipRowNo+1)); if (iPwrIdRowNo % 2 == 0) { btnPositionSearch.SetCellColour("Pale Yellow"); } else { btnPositionSearch.SetCellColour("Pale Orange"); } btnPositionSearchVw = btnPositionSearch.GetButtonCell(); UIButton btnPositionSearchButton = new UIButton(); btnPositionSearchButton = btnPositionSearch.GetButton(); btnPositionSearchButton.TouchUpInside += (sender,e) => {OpenSearchView(sender, e, 5);}; if(bReadOnly) { btnPositionSearchButton.Enabled = false; } arrItems3[4] = btnPositionSearchVw; } else { iUtils.CreateFormGridItem btnPositionSearch = new iUtils.CreateFormGridItem(); UIView btnPositionSearchVw = new UIView(); btnPositionSearch.SetDimensions(200f,iHdrVert, 50f, iRowHeight, 8f, 4f, 8f, 4f); btnPositionSearch.SetBorderWidth(0.0f); btnPositionSearch.SetTag(iEquipmentSubRackSearchTagId * (iPwrIdRowNo+1) + (iEquipRowNo+1)); if (iPwrIdRowNo % 2 == 0) { btnPositionSearch.SetCellColour("Pale Yellow"); } else { btnPositionSearch.SetCellColour("Pale Orange"); } btnPositionSearchVw = btnPositionSearch.GetLabelCell(); arrItems3[4] = btnPositionSearchVw; } if(iEquipmentType > 5) { iUtils.CreateFormGridItem btnStringSearch = new iUtils.CreateFormGridItem(); UIView btnStringSearchVw = new UIView(); btnStringSearch.SetDimensions(250f,iHdrVert, 50f, iRowHeight, 8f, 4f, 8f, 4f); btnStringSearch.SetLabelText("..."); btnStringSearch.SetBorderWidth(0.0f); btnStringSearch.SetFontName("Verdana"); btnStringSearch.SetFontSize(12f); btnStringSearch.SetTag(iEquipmentStringSearchTagId * (iPwrIdRowNo+1) + (iEquipRowNo+1)); if (iPwrIdRowNo % 2 == 0) { btnStringSearch.SetCellColour("Pale Yellow"); } else { btnStringSearch.SetCellColour("Pale Orange"); } btnStringSearchVw = btnStringSearch.GetButtonCell(); UIButton btnStringSearchButton = new UIButton(); btnStringSearchButton = btnStringSearch.GetButton(); btnStringSearchButton.TouchUpInside += (sender,e) => {OpenSearchView(sender, e, 7);}; if(bReadOnly) { btnStringSearchButton.Enabled = false; } arrItems3[5] = btnStringSearchVw; } else { iUtils.CreateFormGridItem btnStringSearch = new iUtils.CreateFormGridItem(); UIView btnStringSearchVw = new UIView(); btnStringSearch.SetDimensions(250f,iHdrVert, 50f, iRowHeight, 8f, 4f, 8f, 4f); btnStringSearch.SetBorderWidth(0.0f); btnStringSearch.SetTag(iEquipmentSubRackSearchTagId * (iPwrIdRowNo+1) + (iEquipRowNo+1)); if (iPwrIdRowNo % 2 == 0) { btnStringSearch.SetCellColour("Pale Yellow"); } else { btnStringSearch.SetCellColour("Pale Orange"); } btnStringSearchVw = btnStringSearch.GetLabelCell(); arrItems3[5] = btnStringSearchVw; } hdrRow.AddSubviews(arrItems3); iHeightToAdd += iRowHeight; iHdrVert += iRowHeight; //***************************************************************// // 3rd Row // //***************************************************************// iUtils.CreateFormGridItem lblBankMake = new iUtils.CreateFormGridItem(); UIView lblBankMakeVw = new UIView(); lblBankMake.SetDimensions(0f, iHdrVert, 340f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblBankMake.SetLabelText(sMake); lblBankMake.SetBorderWidth(0.0f); lblBankMake.SetFontName("Verdana"); lblBankMake.SetFontSize(12f); lblBankMake.SetTag(iEquipmentMakeTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { lblBankMake.SetCellColour("Pale Yellow"); } else { lblBankMake.SetCellColour("Pale Orange"); } lblBankMakeVw = lblBankMake.GetLabelCell(); arrItems[0] = lblBankMakeVw; iUtils.CreateFormGridItem btnMakeSearch = new iUtils.CreateFormGridItem(); UIView btnMakeSearchVw = new UIView(); btnMakeSearch.SetDimensions(340f, iHdrVert, 60f, iRowHeight, 8f, 4f, 8f, 4f); btnMakeSearch.SetLabelText("..."); btnMakeSearch.SetBorderWidth(0.0f); btnMakeSearch.SetFontName("Verdana"); btnMakeSearch.SetFontSize(12f); btnMakeSearch.SetTag(iEquipmentMakeSearchTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { btnMakeSearch.SetCellColour("Pale Yellow"); } else { btnMakeSearch.SetCellColour("Pale Orange"); } btnMakeSearchVw = btnMakeSearch.GetButtonCell(); UIButton btnMakeSearchButton = new UIButton(); btnMakeSearchButton = btnMakeSearch.GetButton(); btnMakeSearchButton.TouchUpInside += (sender,e) => { OpenMakeList(sender, e);}; if(bReadOnly) { btnMakeSearchButton.Enabled = false; } arrItems[1] = btnMakeSearchVw; iUtils.CreateFormGridItem lblBankModel = new iUtils.CreateFormGridItem(); UIView lblBankModelVw = new UIView(); lblBankModel.SetDimensions(400f, iHdrVert, 440f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblBankModel.SetLabelText(sModel); lblBankModel.SetBorderWidth(0.0f); lblBankModel.SetFontName("Verdana"); lblBankModel.SetFontSize(12f); lblBankModel.SetTag(iEquipmentModelTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { lblBankModel.SetCellColour("Pale Yellow"); } else { lblBankModel.SetCellColour("Pale Orange"); } lblBankModelVw = lblBankModel.GetLabelCell(); arrItems[2] = lblBankModelVw; UILabel hfSPN = new UILabel(); hfSPN.Text = sSPN; hfSPN.Tag = iEquipmentSPNHiddenTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfSPN.Hidden = true; arrItems[3] = hfSPN; iUtils.CreateFormGridItem btnModelSearch = new iUtils.CreateFormGridItem(); UIView btnModelSearchVw = new UIView(); btnModelSearch.SetDimensions(840f, iHdrVert, 60f, iRowHeight, 8f, 4f, 8f, 4f); btnModelSearch.SetLabelText("..."); btnModelSearch.SetBorderWidth(0.0f); btnModelSearch.SetFontName("Verdana"); btnModelSearch.SetFontSize(12f); btnModelSearch.SetTag(iEquipmentModelSearchTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { btnModelSearch.SetCellColour("Pale Yellow"); } else { btnModelSearch.SetCellColour("Pale Orange"); } btnModelSearchVw = btnModelSearch.GetButtonCell(); UIButton btnModelSearchButton = new UIButton(); btnModelSearchButton = btnModelSearch.GetButton(); btnModelSearchButton.TouchUpInside += (sender,e) => { OpenModelList(sender, e);}; if(bReadOnly) { btnModelSearchButton.Enabled = false; } arrItems[4] = btnModelSearchVw; bool bAssetTextHidden = true; string sMaximoAssetId = iMaximoAssetId.ToString(); if (sEquipType == "U") { bAssetTextHidden = false; sMaximoAssetId = iMaximoAssetId.ToString().PadLeft(10,'0'); } iUtils.CreateFormGridItem txtMaximoAssetId = new iUtils.CreateFormGridItem(); UIView txtMaximoAssetIdVw = new UIView(); txtMaximoAssetId.SetDimensions(900f,iHdrVert, 100f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up txtMaximoAssetId.SetLabelText(sMaximoAssetId); txtMaximoAssetId.SetBorderWidth(0.0f); txtMaximoAssetId.SetFontName("Verdana"); txtMaximoAssetId.SetFontSize(12f); txtMaximoAssetId.SetTextAlignment("right"); txtMaximoAssetId.SetHidden(bAssetTextHidden); txtMaximoAssetId.SetTag(iEquipmentMaximoAssetTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { txtMaximoAssetId.SetCellColour("Pale Yellow"); } else { txtMaximoAssetId.SetCellColour("Pale Orange"); } txtMaximoAssetIdVw = txtMaximoAssetId.GetTextFieldCell(); txtMaximoAssetIdVw.Hidden = bAssetTextHidden; txtMaximoAssetIdVw.Tag = iEquipmentMaximoAssetTextViewTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); UITextField txtMaximoAssetIdView = txtMaximoAssetId.GetTextFieldView(); txtMaximoAssetIdView.AutocorrectionType = UITextAutocorrectionType.No; txtMaximoAssetIdView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtMaximoAssetIdView.ReturnKeyType = UIReturnKeyType.Next; txtMaximoAssetIdView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 9);}; txtMaximoAssetIdView.ShouldEndEditing += (sender) => { return ValidateMaximoAssetId(sender, 0);}; txtMaximoAssetIdView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 9);}; if(bReadOnly) { txtMaximoAssetIdView.Enabled = false; } iUtils.CreateFormGridItem lblMaximoAssetId = new iUtils.CreateFormGridItem(); UIView lblMaximoAssetIdVw = new UIView(); lblMaximoAssetId.SetDimensions(900f,iHdrVert, 100f, iRowHeight, 2f, 2f, 2f, 2f); //Set left to 1 less so border does not double up lblMaximoAssetId.SetLabelText(sMaximoAssetId); lblMaximoAssetId.SetBorderWidth(0.0f); lblMaximoAssetId.SetFontName("Verdana"); lblMaximoAssetId.SetFontSize(12f); lblMaximoAssetId.SetTextAlignment("right"); lblMaximoAssetId.SetHidden(!bAssetTextHidden); lblMaximoAssetId.SetTag(iEquipmentMaximoLblAssetTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1)); if (iPwrIdRowNo % 2 == 0) { lblMaximoAssetId.SetCellColour("Pale Yellow"); } else { lblMaximoAssetId.SetCellColour("Pale Orange"); } lblMaximoAssetIdVw = lblMaximoAssetId.GetLabelCell(); lblMaximoAssetIdVw.Hidden = !bAssetTextHidden; lblMaximoAssetIdVw.Tag = iEquipmentMaximoLblViewAssetTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); arrItems[5] = txtMaximoAssetIdVw; arrItems[6] = lblMaximoAssetIdVw; UILabel hfCurrentMaximoAssetId = new UILabel(); hfCurrentMaximoAssetId.Text = sMaximoAssetId; hfCurrentMaximoAssetId.Tag = iEquipmentMaximoAssetHiddenTagId * (iPwrIdRowNo + 1) + (iEquipRowNo + 1); hfCurrentMaximoAssetId.Hidden = true; arrItems[7] = hfCurrentMaximoAssetId; hdrRow.AddSubviews(arrItems); iHeightToAdd += iRowHeight; iHdrVert += iRowHeight; //Now draw a 1 pixel horizontal line UIView vwHorizLine = new UIView(); vwHorizLine.Frame = new RectangleF(0f,iHdrVert, 1000f, 1f); vwHorizLine.BackgroundColor = UIColor.FromRGBA(0,0,0,255); iHeightToAdd += 1f; iHdrVert += 1f; hdrRow.AddSubview(vwHorizLine); return hdrRow; }
private void EnsureViews() { if (containerView != null) { return; } var navController = controller.NavigationController; if (navController == null) { return; } containerView = new UIView() { ClipsToBounds = true, }; menuView = new UIView().Apply(Style.NavMenu.Background); menuButtons = new[] { (dayButton = new UIButton()), (weekButton = new UIButton()), (yearButton = new UIButton()), }; dayButton.SetTitle("ReportsMenuWeek".Tr(), UIControlState.Normal); weekButton.SetTitle("ReportsMenuMonth".Tr(), UIControlState.Normal); yearButton.SetTitle("ReportsMenuYear".Tr(), UIControlState.Normal); foreach (var menuButton in menuButtons) { var isActive = (menuButton == dayButton && controller.ZoomLevel == ZoomLevel.Week) || (menuButton == weekButton && controller.ZoomLevel == ZoomLevel.Month) || (menuButton == yearButton && controller.ZoomLevel == ZoomLevel.Year); if (isActive) { menuButton.Apply(Style.NavMenu.HighlightedItem); } else { menuButton.Apply(Style.NavMenu.NormalItem); } menuButton.TouchUpInside += OnMenuButtonTouchUpInside; } separators = new UIView[menuButtons.Length - 1]; for (var i = 0; i < separators.Length; i++) { separators [i] = new UIView().Apply(Style.NavMenu.Separator); } menuView.AddSubviews(separators); menuView.AddSubviews(menuButtons); containerView.AddSubview(menuView); // Layout items: var offsetY = 15f; var sepIdx = 0; foreach (var menuButton in menuButtons) { menuButton.SizeToFit(); var frame = menuButton.Frame; frame.Width = navController.View.Frame.Width; frame.Y = offsetY; menuButton.Frame = frame; offsetY += frame.Height; // Position separator if (sepIdx < separators.Length) { var separator = separators [sepIdx]; var rightMargin = menuButton.ContentEdgeInsets.Right; separator.Frame = new RectangleF( x: rightMargin, y: offsetY, width: navController.View.Frame.Width - rightMargin, height: 1f ); sepIdx += 1; offsetY += separator.Frame.Height; } } offsetY += 15f; containerView.Frame = new RectangleF( x: 0, y: navController.NavigationBar.Frame.Bottom, width: navController.View.Frame.Width, height: offsetY ); menuView.Frame = new RectangleF( x: 0, y: -containerView.Frame.Height, width: containerView.Frame.Width, height: containerView.Frame.Height ); return; }
public void ShowPicker () { actionSheet = new UIView () { BackgroundColor = UIColor.Clear }; UIView parentView = UIApplication.SharedApplication.KeyWindow.RootViewController.View; // Creates a transparent grey background who catches the touch actions (and add more style). UIView dimBackgroundView = new UIView (parentView.Bounds) { BackgroundColor = UIColor.Gray.ColorWithAlpha (0.5f) }; const float titleBarHeight = 44; var actionSheetSize = new SizeF ((float)parentView.Frame.Width, (float)this.Frame.Height + titleBarHeight); var actionSheetFrameHidden = new CGRect (0, parentView.Frame.Height, actionSheetSize.Width, actionSheetSize.Height); var actionSheetFrameDisplayed = new CGRect (0, parentView.Frame.Height - actionSheetSize.Height, actionSheetSize.Width, actionSheetSize.Height); // Hide the action sheet before we animate it so it comes from the bottom. actionSheet.Frame = actionSheetFrameHidden; this.Frame = new RectangleF (0, 1, actionSheetSize.Width, actionSheetSize.Height - titleBarHeight); var toolbarPicker = new UIToolbar (new CGRect (0, 0, actionSheet.Frame.Width, titleBarHeight)) { ClipsToBounds = true, Items = new UIBarButtonItem[] { new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem (UIBarButtonSystemItem.Done, (sender, args) => { UIView.Animate (.25, () => { actionSheet.Frame = actionSheetFrameHidden; }, () => { dimBackgroundView.RemoveFromSuperview (); actionSheet.RemoveFromSuperview (); }); }) } }; // Creates a blur background using the toolbar trick. var toolbarBg = new UIToolbar (new CGRect (0, 0, actionSheet.Frame.Width, actionSheet.Frame.Height)) { ClipsToBounds = true }; actionSheet.AddSubviews (new UIView[] { toolbarBg, this, toolbarPicker }); parentView.AddSubviews (new UIView[] { dimBackgroundView, actionSheet }); parentView.BringSubviewToFront (actionSheet); UIView.Animate (.25, () => { actionSheet.Frame = actionSheetFrameDisplayed; }); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = ApplicationTheme.BackgroundColor }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; UILabel decimalDegreesLabel = new UILabel(); decimalDegreesLabel.TranslatesAutoresizingMaskIntoConstraints = false; decimalDegreesLabel.Text = "Decimal degrees:"; UILabel dmsLabel = new UILabel(); dmsLabel.TranslatesAutoresizingMaskIntoConstraints = false; dmsLabel.Text = "Degrees, minutes, seconds:"; UILabel utmLabel = new UILabel(); utmLabel.TranslatesAutoresizingMaskIntoConstraints = false; utmLabel.Text = "UTM:"; UILabel usngLabel = new UILabel(); usngLabel.TranslatesAutoresizingMaskIntoConstraints = false; usngLabel.Text = "USNG:"; _ddEntry = new UITextField(); _dmsEntry = new UITextField(); _utmEntry = new UITextField(); _usngEntry = new UITextField(); // Uniformly configure the entries. foreach (UITextField tf in new[] { _ddEntry, _dmsEntry, _utmEntry, _usngEntry }) { tf.TranslatesAutoresizingMaskIntoConstraints = false; tf.BorderStyle = UITextBorderStyle.RoundedRect; } UIStackView formView = new UIStackView(new UIView[] { decimalDegreesLabel, _ddEntry, dmsLabel, _dmsEntry, utmLabel, _utmEntry, usngLabel, _usngEntry }); formView.TranslatesAutoresizingMaskIntoConstraints = false; formView.Axis = UILayoutConstraintAxis.Vertical; formView.Spacing = 4; formView.LayoutMarginsRelativeArrangement = true; formView.LayoutMargins = new UIEdgeInsets(8, 8, 8, 8); formView.SetContentHuggingPriority((float)UILayoutPriority.DefaultHigh, UILayoutConstraintAxis.Vertical); // Add the views. View.AddSubviews(formView, _myMapView); // Lay out the views. _portraitConstraints = new[] { formView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), formView.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor), formView.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor), formView.BottomAnchor.ConstraintEqualTo(_myMapView.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor) }; _landscapeConstraints = new[] { formView.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor), formView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), formView.TrailingAnchor.ConstraintEqualTo(_myMapView.LeadingAnchor), formView.WidthAnchor.ConstraintGreaterThanOrEqualTo(280), _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor) }; ApplyConstraints(); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _takeMapOfflineButton = new UIBarButtonItem(); _takeMapOfflineButton.Title = "Generate offline map"; UIToolbar toolbar = new UIToolbar(); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; toolbar.Items = new[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _takeMapOfflineButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) }; _statusLabel = new UILabel { Text = "Use the button to take the map offline.", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.FromWhiteAlpha(0, .6f), TextColor = UIColor.White, Lines = 1, TranslatesAutoresizingMaskIntoConstraints = false }; _loadingIndicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge); _loadingIndicator.TranslatesAutoresizingMaskIntoConstraints = false; _loadingIndicator.BackgroundColor = UIColor.FromWhiteAlpha(0, .6f); // Add the views. View.AddSubviews(_myMapView, toolbar, _loadingIndicator, _statusLabel); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), _statusLabel.TopAnchor.ConstraintEqualTo(_myMapView.TopAnchor), _statusLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _statusLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _statusLabel.HeightAnchor.ConstraintEqualTo(40), _loadingIndicator.TopAnchor.ConstraintEqualTo(_statusLabel.BottomAnchor), _loadingIndicator.BottomAnchor.ConstraintEqualTo(View.BottomAnchor), _loadingIndicator.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _loadingIndicator.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor) }); }
private void BuildInterface() { View.BackgroundColor = new UIImage("Images/fondoPrincipal.jpg").GetScaledImageBackground(View); var header = new Header(View.Frame.Width) { LocationTitle = _assignmentVm.SelectedAssignment.CompanyName, LeftButtonImage = "Images/btn-atras.png", ButtonTouch = async(sender, args) => { if (_assignmentVm.SelectedActivity.ActivityType == Enumerations.ActivityType.None) { _assignmentVm.SelectedAssignment.Activities.Remove(_assignmentVm.SelectedActivity); } else { if (_assignmentVm.SelectedActivity.IsRecording) { await _assignmentVm.StopAsync(willContinue : true); _assignmentVm.SelectedActivity.IsRecording = true; } _assignmentVm.SelectedActivity.Traces.Add(new Trace { ActivityId = _assignmentVm.SelectedActivity.Id, ActivityState = _assignmentVm.SelectedActivity.State, TraceDate = DateTime.Now, Longitude = (decimal)_longitude, Latitude = (decimal)_latitude }); await _assignmentVm.SaveActivityAsync(); } _navigationService.GoBack(); } }; var principalData = new AssignmentDataView(View.Frame) { Frame = new CGRect(0, header.Frame.Y + header.Frame.Height, View.Frame.Width, 65) }; _activityType = new ActivityFill { Title = "Tipo de Actividad", BackgroundColor = UIColor.Clear, Frame = new CGRect(10, principalData.Frame.Y + principalData.Frame.Height, View.Frame.Width, 40), Hit = TouchActivityTypeButton }; _description = new ActivityFill { Title = "Decripción", BackgroundColor = UIColor.Clear, Frame = new CGRect(10, _activityType.Frame.Y + _activityType.Frame.Height, View.Frame.Width - 20, 40), Hit = TouchButtonDescription }; _startDate = new ActivityDate { Title = "Fecha de Inicio", Frame = new CGRect(10, _description.Frame.Y + _description.Frame.Height, View.Frame.Width, 40) }; _endDate = new ActivityDate { Title = "Fecha de Inicio", Frame = new CGRect(10, _startDate.Frame.Y + _startDate.Frame.Height, View.Frame.Width, 40) }; _description.NewTitle = string.IsNullOrEmpty(_assignmentVm.SelectedActivity.Description) ? "+" : _assignmentVm.SelectedActivity.Description; _activityType.NewTitle = GetTypeName(_assignmentVm.SelectedActivity.ActivityType); _startDate.Date = (_assignmentVm.SelectedActivity.StartDate != DateTime.MinValue) ? _assignmentVm.SelectedActivity.StartDate.ToString("dd/MM/yyyy hh:mm") : string.Empty; _endDate.Date = (_assignmentVm.SelectedActivity.EndDate != DateTime.MinValue) ? _assignmentVm.SelectedAssignment.EndDate.ToString("dd/MM/yyyy hh:mm") : string.Empty; if (_assignmentVm.SelectedActivity.IsRecording) { var elapsed = DateTime.Now - _assignmentVm.SelectedActivity.StartDate; _assignmentVm.SelectedActivity.Duration = _assignmentVm.SelectedActivity.Duration.Add(elapsed); _assignmentVm.RecordAsync(); } _timerView = new UIView { Frame = new CGRect(View.Frame.Width / 2 - 70, _endDate.Frame.Y + _endDate.Frame.Height + 10, 160, 160) }; _timespan = new UILabel { Frame = new CGRect(0, 0, 160, 60), Font = UIFont.FromName("Helvetica-Bold", 35), TextColor = UIColor.White, Text = _assignmentVm.SelectedActivity.Duration.ToString(@"hh\:mm\:ss") }; var timerButton = UIButton.FromType(UIButtonType.Custom); timerButton.Frame = new CGRect(View.Frame.Width / 2 - 120, _timespan.Frame.Height + 5, 70, 70); timerButton.SetImage( _assignmentVm.SelectedActivity.IsRecording ? new UIImage("Images/btn-stop.png") : new UIImage("Images/btn-play.png"), UIControlState.Normal); timerButton.Enabled = _assignmentVm.SelectedAssignment.Status != Enumerations.AssignmentStatus.Complete; timerButton.TouchUpInside += (sender, args) => { if (_assignmentVm.ActiveActivity != null && _assignmentVm.SelectedActivity.Id != _assignmentVm.ActiveActivity.Id) { new UIAlertView(title: "Ferreyros", message: Constants.Messages.ActivityNotFinished, del: null, cancelButtonTitle: "OK", otherButtons: null).Show(); return; } _activityType.UserInteractionEnabled = false; _description.UserInteractionEnabled = false; timerButton.Enabled = false; _assignmentVm.ActiveActivity = !_assignmentVm.SelectedActivity.IsRecording ? _assignmentVm.SelectedActivity : null; var task = _assignmentVm.SelectedActivity.IsRecording ? _assignmentVm.StopAsync() : _assignmentVm.RecordAsync(); timerButton.SetImage( _assignmentVm.SelectedActivity.IsRecording ? new UIImage("Images/btn-stop.png") : new UIImage("Images/btn-play.png"), UIControlState.Normal); task.ContinueWith(_ => { BeginInvokeOnMainThread(() => { timerButton.Enabled = _assignmentVm.ActiveActivity != null; }); }); }; //_timerView.Hidden = _assignmentVm.SelectedActivity.ActivityType == Enumerations.ActivityType.None; _timerView.AddSubviews(timerButton, _timespan); var notifyClient = UIButton.FromType(UIButtonType.Custom); notifyClient.SetImage(new UIImage("Images/send-mail.png"), UIControlState.Normal); notifyClient.SetTitle("Notificar el fin del servicio al Cliente", UIControlState.Normal); notifyClient.BackgroundColor = UIColor.Clear; notifyClient.TitleLabel.Font = UIFont.FromName("Helvetica-Light", 13f); notifyClient.TitleLabel.TextAlignment = UITextAlignment.Left; notifyClient.TitleLabel.LineBreakMode = UILineBreakMode.WordWrap; notifyClient.TitleEdgeInsets = new UIEdgeInsets(0, -60, 0, -150); notifyClient.Frame = new CGRect(40, _timerView.Frame.Y + _timerView.Frame.Height + 10, 80, 40); notifyClient.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit; //notifyClient.Enabled = _assignmentVm.SelectedActivity.State != Enumerations.ActivityState.Completed; notifyClient.TouchUpInside += (sender, args) => { if (_assignmentVm.SelectedActivity.IsRecording) { new UIAlertView(title: "Ferreyros", message: Constants.Messages.ActivityNotFinished, del: null, cancelButtonTitle: "OK", otherButtons: null).Show(); return; } var okCancelAlertController = UIAlertController.Create("Cerrar Servicio", "¿Con esta actividad se ha completado el servicio?, se enviará un correo al cliente informando.", UIAlertControllerStyle.Alert); okCancelAlertController.AddAction(UIAlertAction.Create("Si", UIAlertActionStyle.Default, async alert => { _assignmentVm.SelectedActivity.State = Enumerations.ActivityState.Completed; await _assignmentVm.SaveActivityAsync(); await _assignmentVm.SendActivityEndsAssignmentMailAsync(); notifyClient.Enabled = false; })); okCancelAlertController.AddAction(UIAlertAction.Create("No", UIAlertActionStyle.Cancel, alert => { })); PresentViewController(okCancelAlertController, true, null); }; var copyRight = new UILabel { Text = "2016 Ferreyros | Derechos Reservados", TextAlignment = UITextAlignment.Center, TextColor = UIColor.White, Font = UIFont.FromName("Helvetica-Light", 10f), Frame = new CGRect(0, View.Frame.Height - 30, View.Frame.Width, 20) }; View.AddSubviews(header, principalData, _activityType, _description, _startDate, _endDate, _timerView, notifyClient, copyRight); }
public static UIView ThreeDotLoadingZooming(CGRect frame) { var loadingView = new UIView (new CGRect ((frame.Width - _padding) / 2f, _padding * 4.5, _padding, _padding)); var dotDiameter = 6f; var padding = 5.5f; UIView middleDot = new UIView (new CGRect ( (loadingView.Frame.Width - dotDiameter) / 2f, (loadingView.Frame.Height - dotDiameter) / 2f, dotDiameter, dotDiameter )); middleDot.Layer.CornerRadius = dotDiameter / 2f; middleDot.BackgroundColor = UIColor.Gray; UIView leftDot = new UIView ( new CGRect ( middleDot.Frame.Left - dotDiameter - padding, middleDot.Frame.Y, dotDiameter, dotDiameter )); leftDot.Layer.CornerRadius = dotDiameter / 2f; leftDot.BackgroundColor = UIColor.Gray; UIView rightDot = new UIView ( new CGRect ( middleDot.Frame.Right + padding, middleDot.Frame.Y, dotDiameter, dotDiameter )); rightDot.Layer.CornerRadius = dotDiameter / 2f; rightDot.BackgroundColor = UIColor.Gray; loadingView.AddSubviews (middleDot, leftDot, rightDot); leftDot.Alpha = 0.5f; middleDot.Alpha = 0.5f; rightDot.Alpha = 0.5f; UIView.Animate (0.6, 0, UIViewAnimationOptions.Repeat | UIViewAnimationOptions.Autoreverse, () => { leftDot.Transform = CGAffineTransform.MakeScale (1.8f, 1.8f); leftDot.Alpha = 1f; }, null); UIView.Animate (0.6, 0.2, UIViewAnimationOptions.Repeat | UIViewAnimationOptions.Autoreverse, () => { middleDot.Transform = CGAffineTransform.MakeScale (1.8f, 1.8f); middleDot.Alpha = 1f; }, null); UIView.Animate (0.6, 0.4, UIViewAnimationOptions.Repeat | UIViewAnimationOptions.Autoreverse, () => { rightDot.Transform = CGAffineTransform.MakeScale (1.8f, 1.8f); rightDot.Alpha = 1f; }, null); return loadingView; }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = ApplicationTheme.BackgroundColor }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _resultLabel = new UILabel { Text = "Adjust the slider to start.", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.FromWhiteAlpha(0, .6f), TextColor = UIColor.White, Lines = 1, TranslatesAutoresizingMaskIntoConstraints = false }; _operationPicker = new UISegmentedControl("Densify", "Generalize"); _operationPicker.TranslatesAutoresizingMaskIntoConstraints = false; _operationPicker.SelectedSegment = 0; _slider = new UISlider(); _slider.TranslatesAutoresizingMaskIntoConstraints = false; _slider.MinValue = 100.0F; _slider.MaxValue = 500.0F; _slider.Value = 100.0F; UIToolbar toolbar = new UIToolbar(); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; toolbar.Items = new[] { new UIBarButtonItem { CustomView = _operationPicker }, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), new UIBarButtonItem { CustomView = _slider, Width = 150 } }; // Add the views. View.AddSubviews(_myMapView, toolbar, _resultLabel); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), _resultLabel.TopAnchor.ConstraintEqualTo(_myMapView.TopAnchor), _resultLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _resultLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _resultLabel.HeightAnchor.ConstraintEqualTo(40) }); }
void CreateNickNameView() { titleContainer = new UIView (new CGRect(0, 0, 200, 20)); nickNameLbl = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, TextAlignment = UITextAlignment.Center, }; nickNameEditIcon = new UIImageView { TranslatesAutoresizingMaskIntoConstraints = false, Image = UIImage.FromBundle ("editNickName"), }; nickNameInput = new UITextField { TranslatesAutoresizingMaskIntoConstraints = false, ShouldReturn = ShouldReturn, TextAlignment = UITextAlignment.Center, BorderStyle = UITextBorderStyle.RoundedRect, BackgroundColor = UIColor.White, }; nickNameInput.Ended += NickNameEditingEnded; titleContainer.AddSubviews (nickNameLbl, nickNameInput, nickNameEditIcon); Center(nickNameLbl); titleContainer.AddConstraint (PlaceOnTheRight (nickNameLbl, nickNameEditIcon, 10)); CenterVertically (nickNameEditIcon); PinLeftRightEdges (nickNameInput); CenterVertically (nickNameInput); tap = new UITapGestureRecognizer (StartEditNickName) { NumberOfTapsRequired = 1 }; titleContainer.AddGestureRecognizer (tap); ShowNormalNickNameVisualState (); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; UIToolbar topToolbar = new UIToolbar(); topToolbar.TranslatesAutoresizingMaskIntoConstraints = false; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _timeLabel = new UILabel { TextColor = UIColor.Black, TextAlignment = UITextAlignment.Center, TranslatesAutoresizingMaskIntoConstraints = false }; _timeSlider = new UISlider { MinValue = 0, MaxValue = 1, TranslatesAutoresizingMaskIntoConstraints = false }; UIToolbar bottomToolbar = new UIToolbar(); bottomToolbar.TranslatesAutoresizingMaskIntoConstraints = false; bottomToolbar.Items = new[] { new UIBarButtonItem(_timeLabel), new UIBarButtonItem(UIBarButtonSystemItem.FixedSpace) { Width = 0 }, new UIBarButtonItem(_timeSlider) }; UIStackView legendView = new UIStackView(); legendView.TranslatesAutoresizingMaskIntoConstraints = false; legendView.Axis = UILayoutConstraintAxis.Horizontal; legendView.Spacing = 8; UIView redIcon = new UIView(); redIcon.TranslatesAutoresizingMaskIntoConstraints = false; redIcon.BackgroundColor = UIColor.Red; redIcon.WidthAnchor.ConstraintEqualTo(16).Active = true; redIcon.HeightAnchor.ConstraintEqualTo(16).Active = true; redIcon.ClipsToBounds = true; redIcon.Layer.CornerRadius = 8; legendView.AddArrangedSubview(redIcon); UILabel _redLabel = new UILabel { Text = "Offset 10 days", TextColor = UIColor.Red, TranslatesAutoresizingMaskIntoConstraints = false }; legendView.AddArrangedSubview(_redLabel); UIView spacer = new UIView(); spacer.TranslatesAutoresizingMaskIntoConstraints = false; spacer.SetContentCompressionResistancePriority((float)UILayoutPriority.DefaultLow, UILayoutConstraintAxis.Horizontal); legendView.AddArrangedSubview(spacer); UIView blueIcon = new UIView(); blueIcon.BackgroundColor = UIColor.Blue; blueIcon.TranslatesAutoresizingMaskIntoConstraints = false; blueIcon.WidthAnchor.ConstraintEqualTo(16).Active = true; blueIcon.HeightAnchor.ConstraintEqualTo(16).Active = true; blueIcon.ClipsToBounds = true; blueIcon.Layer.CornerRadius = 8; legendView.AddArrangedSubview(blueIcon); UILabel _blueLabel = new UILabel { Text = "No offset", TextColor = UIColor.Blue, TranslatesAutoresizingMaskIntoConstraints = false }; legendView.AddArrangedSubview(_blueLabel); // Add the views. View.AddSubviews(topToolbar, _myMapView, bottomToolbar); topToolbar.AddSubview(legendView); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { topToolbar.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), topToolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), topToolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.TopAnchor.ConstraintEqualTo(topToolbar.BottomAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(bottomToolbar.TopAnchor), bottomToolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), bottomToolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), bottomToolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), legendView.LeftAnchor.ConstraintEqualTo(topToolbar.SafeAreaLayoutGuide.LeftAnchor, 8), legendView.RightAnchor.ConstraintEqualTo(topToolbar.SafeAreaLayoutGuide.RightAnchor, -8), legendView.TopAnchor.ConstraintEqualTo(topToolbar.SafeAreaLayoutGuide.TopAnchor, 8), legendView.BottomAnchor.ConstraintEqualTo(topToolbar.SafeAreaLayoutGuide.BottomAnchor, -8), redIcon.CenterYAnchor.ConstraintEqualTo(blueIcon.CenterYAnchor), blueIcon.CenterYAnchor.ConstraintEqualTo(topToolbar.CenterYAnchor), _timeLabel.WidthAnchor.ConstraintEqualTo(150), _timeSlider.WidthAnchor.ConstraintEqualTo(600), }); }
private void Layout() { // add the white bg if(_whiteBg == null){ var img = UIImage.FromFile ("images/login/loginBgWhite.png"); var size = img.CGImage.GetScaledSizeForControl (); _whiteBg = new UIImageView (img); _whiteBg.Frame = new RectangleF (this.Frame.Width/2 - size.Width/2, this.Frame.Height / 2 - size.Width / 2, size.Width, size.Height); // create the login button img = UIImage.FromFile ("images/login/btnLogin.png"); _btnLogin = new UIButton (UIButtonType.Custom); size = img.CGImage.GetScaledSizeForControl (); _btnLogin.Frame = new RectangleF ( _whiteBg.Frame.Width / 2 - size.Width /2, _whiteBg.Frame.Height - size.Height - 10, size.Width, size.Height); _btnLogin.SetBackgroundImage (img, UIControlState.Normal); _btnLogin.SetBackgroundImage (UIImage.FromFile ("images/login/btnLoginSelected.png"), UIControlState.Highlighted); _btnLogin.SetBackgroundImage (UIImage.FromFile ("images/login/btnLoginSelected.png"), UIControlState.Selected); _btnLogin.TouchUpInside += (object sender, EventArgs e) => { if(LoginClicked!=null) LoginClicked(); }; // add the title + icon var lblHeight = 20; _title = new UIView (); _title.Frame = new RectangleF (_whiteBg.Frame.X, _whiteBg.Frame.Top - _whiteBg.Frame.Height / 2 - 20, _whiteBg.Frame.Width, _whiteBg.Frame.Height / 2); img = UIImage.FromFile ("images/icon.png"); size = img.CGImage.GetScaledSizeForControl (); var uiimg = new UIImageView (img); uiimg.Frame = new RectangleF (5, 5, size.Width, size.Height); var lbl = new UILabel (); lbl.Text = "Social Cloud Admin"; lbl.BackgroundColor = UIColor.Clear; lbl.TextColor = UIColor.White; lbl.Frame = new RectangleF (size.Width + 20, _title.Frame.Height / 2 - lblHeight / 2, _title.Frame.Width - size.Width, lblHeight); _title.AddSubviews(uiimg,lbl); // add to the main view this.AddSubviews (_whiteBg, _btnLogin, _title); } else{ _whiteBg.Frame = new RectangleF (this.Frame.Width/2 - _whiteBg.Frame.Width/2, this.Frame.Height / 2 - _whiteBg.Frame.Width / 2, _whiteBg.Frame.Width, _whiteBg.Frame.Height); _btnLogin.Frame = new RectangleF ( (_whiteBg.Frame.Width / 2 - _btnLogin.Frame.Width /2) + _whiteBg.Frame.Left, (_whiteBg.Frame.Height/2 - _btnLogin.Frame.Height/2) + _whiteBg.Frame.Top +5, _btnLogin.Frame.Width, _btnLogin.Frame.Height); _title.Frame = new RectangleF (_whiteBg.Frame.X, _whiteBg.Frame.Top - _whiteBg.Frame.Height / 2 - 20, _whiteBg.Frame.Width, _whiteBg.Frame.Height / 2); } }
public override void LoadView() { // Create the views. View = new UIView() { BackgroundColor = ApplicationTheme.BackgroundColor }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _statusLabel = new UILabel { Text = "Instructions", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Center, BackgroundColor = UIColor.FromWhiteAlpha(0, .6f), TextColor = UIColor.White, Lines = 1, TranslatesAutoresizingMaskIntoConstraints = false }; _tracePickerButton = new UIButton(UIButtonType.System); _tracePickerButton.SetTitle("Trace type: Connected", UIControlState.Normal); _tracePickerButton.TranslatesAutoresizingMaskIntoConstraints = false; _startBarrierPicker = new UISegmentedControl(new string[] { "Start", "Barrier" }); _startBarrierPicker.SelectedSegment = 0; _traceButton = new UIBarButtonItem(); _traceButton.Title = "Trace"; _resetButton = new UIBarButtonItem(); _resetButton.Title = "Reset"; _toolbar = new UIToolbar(); _toolbar.TranslatesAutoresizingMaskIntoConstraints = false; _toolbar.Items = new[] { new UIBarButtonItem(_startBarrierPicker), new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _traceButton, _resetButton }; _activityIndicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge) { TranslatesAutoresizingMaskIntoConstraints = false, HidesWhenStopped = true, BackgroundColor = UIColor.FromWhiteAlpha(0, .5f) }; // Add the views. View.AddSubviews(_myMapView, _statusLabel, _tracePickerButton, _toolbar, _activityIndicator); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(_tracePickerButton.TopAnchor), _tracePickerButton.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _tracePickerButton.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _tracePickerButton.BottomAnchor.ConstraintEqualTo(_toolbar.TopAnchor), _tracePickerButton.HeightAnchor.ConstraintEqualTo(40), _toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), _statusLabel.TopAnchor.ConstraintEqualTo(_myMapView.TopAnchor), _statusLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _statusLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _statusLabel.HeightAnchor.ConstraintEqualTo(40), _activityIndicator.TopAnchor.ConstraintEqualTo(_statusLabel.BottomAnchor), _activityIndicator.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _activityIndicator.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _activityIndicator.BottomAnchor.ConstraintEqualTo(View.BottomAnchor) } ); }
public static UIView TwoDotLoading(CGRect frame) { var dotDiameter = 2f; var loadingView = new UIView (new CGRect ((frame.Width - _padding) / 2f, _padding * 2, _padding, _padding)); UIView firstDot = new UIView (new CGRect ( (loadingView.Frame.Width - dotDiameter) / 2f + 7.5f, (loadingView.Frame.Height - dotDiameter) / 2f, dotDiameter, dotDiameter )); firstDot.Layer.CornerRadius = dotDiameter / 2f; firstDot.BackgroundColor = UIColor.Gray; UIView secondDot = new UIView (new CGRect ( (loadingView.Frame.Width - dotDiameter) / 2f - 7.5f, (loadingView.Frame.Height - dotDiameter) / 2f, dotDiameter, dotDiameter )); secondDot.Layer.CornerRadius = dotDiameter / 2f; secondDot.BackgroundColor = UIColor.Gray; loadingView.AddSubviews (firstDot, secondDot); var firstDotCenter = firstDot.Center; var secondDotCenter = secondDot.Center; UIView.Animate (0.8, 0.4, UIViewAnimationOptions.CurveEaseInOut | UIViewAnimationOptions.Autoreverse | UIViewAnimationOptions.Repeat, () => { firstDot.Center = new CGPoint ( secondDotCenter.X, secondDotCenter.Y + 20f ); firstDot.Transform = CGAffineTransform.MakeScale (5f, 5f); }, () => { firstDot.Center = new CGPoint ( firstDotCenter.X, firstDotCenter.Y ); } ); UIView.Animate (0.8, 0, UIViewAnimationOptions.CurveEaseInOut | UIViewAnimationOptions.Autoreverse | UIViewAnimationOptions.Repeat, () => { secondDot.Center = new CGPoint ( firstDotCenter.X, firstDotCenter.Y + 20f ); secondDot.Transform = CGAffineTransform.MakeScale (5f, 5f); }, () => { secondDot.Center = new CGPoint ( secondDotCenter.X, secondDotCenter.Y ); } ); return loadingView; }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = ApplicationTheme.BackgroundColor }; _myMapView = new MapView() { TranslatesAutoresizingMaskIntoConstraints = false }; _navigateButton = new UIBarButtonItem() { Title = "Navigate", Enabled = false }; _recenterButton = new UIBarButtonItem() { Title = "Recenter", Enabled = false }; _toolbar = new UIToolbar() { TranslatesAutoresizingMaskIntoConstraints = false }; _toolbar.Items = new[] { _navigateButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _recenterButton }; _statusLabel = new UILabel { Text = "", AdjustsFontSizeToFitWidth = true, TextAlignment = UITextAlignment.Left, BackgroundColor = ApplicationTheme.BackgroundColor, TextColor = ApplicationTheme.ForegroundColor, LineBreakMode = UILineBreakMode.WordWrap, Lines = 0, TranslatesAutoresizingMaskIntoConstraints = false }; // Add the views. View.AddSubviews(_myMapView, _toolbar, _statusLabel); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(_toolbar.TopAnchor), _toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), _toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _statusLabel.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _statusLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _statusLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), }); }
public ActivityElementCell(NSString key) : base(UITableViewCellStyle.Default, key) { SelectionStyle = UITableViewCellSelectionStyle.None; logoImage = new UIImageView(); logoImage.Frame = new RectangleF(Border,Border,50,50); logoImage.ContentMode = UIViewContentMode.ScaleAspectFill; logoImage.Layer.CornerRadius = 4f; logoImage.ClipsToBounds = true; BodyContent = new UIImageView(Resources.ActivityBackground); TitleLabel = new UILabel() { BackgroundColor = UIColor.Clear, Font = Fonts.BoldPrimaryFont(14f), TextColor = UIColor.Black }; ActivityTitle = new UILabel() { Font = Fonts.BoldPrimaryFont(13f), TextColor = UIColor.Black }; ActivityInfo = new UILabel() { Font = Fonts.PrimaryFont(8f), TextColor = Colors.SecondaryTextColor }; BodyText = new UILabel() { Font = Fonts.PrimaryFont(13f), TextColor = UIColor.Black, Lines = 20, TextAlignment = UITextAlignment.Left, LineBreakMode = UILineBreakMode.WordWrap }; BodyContent.AddSubviews(TitleLabel, ActivityTitle, ActivityInfo, BodyText); ContentView.AddSubviews(logoImage, BodyContent); }
public override void LoadView() { // Create the views. View = new UIView { BackgroundColor = UIColor.White }; _myMapView = new MapView(); _myMapView.TranslatesAutoresizingMaskIntoConstraints = false; _newMapButton = new UIBarButtonItem(); _newMapButton.Title = "New map"; _basemapButton = new UIBarButtonItem(); _basemapButton.Title = "Basemap"; _layersButton = new UIBarButtonItem(); _layersButton.Title = "Layers"; _saveButton = new UIBarButtonItem(); _saveButton.Title = "Save"; UIToolbar toolbar = new UIToolbar(); toolbar.TranslatesAutoresizingMaskIntoConstraints = false; toolbar.Items = new[] { _newMapButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _basemapButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _layersButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _saveButton }; _activityIndicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge) { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColor.FromWhiteAlpha(0f, .8f), HidesWhenStopped = true }; // Add the views. View.AddSubviews(_myMapView, toolbar, _activityIndicator); // Lay out the views. NSLayoutConstraint.ActivateConstraints(new[] { _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _myMapView.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor), toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor), toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _activityIndicator.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor), _activityIndicator.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor), _activityIndicator.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor), _activityIndicator.BottomAnchor.ConstraintEqualTo(View.BottomAnchor) }); }
public static UIView ThreeDotLoading(CGRect frame) { var loadingView = new UIView (new CGRect ((frame.Width - _padding) / 2f, _padding, _padding, _padding)); var dotDiameter = 8f; var padding = 3f; UIView middleDot = new UIView (new CGRect ( (loadingView.Frame.Width - dotDiameter) / 2f, (loadingView.Frame.Height - dotDiameter) / 2f, dotDiameter, dotDiameter )); middleDot.Layer.CornerRadius = dotDiameter / 2f; middleDot.BackgroundColor = UIColor.Gray; UIView leftDot = new UIView ( new CGRect ( middleDot.Frame.Left - dotDiameter - padding, middleDot.Frame.Y, dotDiameter, dotDiameter )); leftDot.Layer.CornerRadius = dotDiameter / 2f; leftDot.BackgroundColor = UIColor.Gray; UIView rightDot = new UIView ( new CGRect ( middleDot.Frame.Right + padding, middleDot.Frame.Y, dotDiameter, dotDiameter )); rightDot.Layer.CornerRadius = dotDiameter / 2f; rightDot.BackgroundColor = UIColor.Gray; loadingView.AddSubviews (middleDot, leftDot, rightDot); UIView.Animate (0.6, 0, UIViewAnimationOptions.CurveEaseInOut | UIViewAnimationOptions.Autoreverse | UIViewAnimationOptions.Repeat, () => { leftDot.Center = new CGPoint ( leftDot.Center.X, leftDot.Center.Y + 15f ); }, () => { leftDot.Center = new CGPoint ( leftDot.Center.X, leftDot.Center.Y ); } ); UIView.Animate (0.6, 0.15, UIViewAnimationOptions.CurveEaseInOut | UIViewAnimationOptions.Autoreverse | UIViewAnimationOptions.Repeat, () => { middleDot.Center = new CGPoint ( middleDot.Center.X, middleDot.Center.Y + 15f ); }, () => { middleDot.Center = new CGPoint ( middleDot.Center.X, middleDot.Center.Y ); } ); UIView.Animate (0.6, 0.3, UIViewAnimationOptions.CurveEaseInOut | UIViewAnimationOptions.Autoreverse | UIViewAnimationOptions.Repeat, () => { rightDot.Center = new CGPoint ( rightDot.Center.X, rightDot.Center.Y + 15f ); }, () => { rightDot.Center = new CGPoint ( rightDot.Center.X, rightDot.Center.Y ); } ); return loadingView; }