public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = Constants.Color.BackgroundLightGray; Title = $"Find Your {ViewModel.DeviceTypeAsString}'s Network"; NavigationController.NavigationBar.SetBackgroundImage(null, UIBarMetrics.Default); NavigationController.NavigationBar.ShadowImage = null; NavigationController.NavigationBar.Translucent = true; NavigationController.NavigationBar.BackgroundColor = Constants.Color.DarkBlue; NavigationController.NavigationBar.BarTintColor = Constants.Color.DarkBlue; NavigationController.NavigationBar.TintColor = Constants.Color.White; NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes { ForegroundColor = Constants.Color.White, Font = Constants.Fonts.RubikOfSize(Constants.Fonts.Size.Eighteen), }; NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Constants.Assets.CloseX, UIBarButtonItemStyle.Plain, (sender, e) => { DismissViewController(true, null); }); var circleNumberView = new CircleNumberView { TranslatesAutoresizingMaskIntoConstraints = false, Number = 3, }; View.AddSubview(circleNumberView); circleNumberView.LeftAnchor.ConstraintEqualTo(View.LeftAnchor, constant: Constants.Padding).Active = true; circleNumberView.WidthAnchor.ConstraintEqualTo(Constants.CircleNumberSize).Active = true; circleNumberView.HeightAnchor.ConstraintEqualTo(circleNumberView.WidthAnchor).Active = true; var findLabel = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, TextColor = Constants.Color.MidGray, Font = Constants.Fonts.RubikOfSize(Constants.Fonts.Size.Eighteen), AdjustsFontSizeToFitWidth = true, MinimumScaleFactor = 0.1f, LineBreakMode = UILineBreakMode.WordWrap, Lines = 0, Text = $"The {ViewModel.DeviceTypeAsString} should be emitting a WiFi network of the format \"EDISON_XXXX.\"", }; View.AddSubview(findLabel); findLabel.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor, constant: Constants.Padding).Active = true; findLabel.LeftAnchor.ConstraintEqualTo(circleNumberView.RightAnchor, constant: Constants.Padding).Active = true; findLabel.CenterYAnchor.ConstraintEqualTo(circleNumberView.CenterYAnchor).Active = true; findLabel.RightAnchor.ConstraintEqualTo(View.RightAnchor, constant: -Constants.Padding).Active = true; networksTableViewSource = new NetworksTableViewSource(); networksTableView = new UITableView { TranslatesAutoresizingMaskIntoConstraints = false, AlwaysBounceVertical = true, BackgroundColor = Constants.Color.White, TableHeaderView = new UIView(), Source = networksTableViewSource, SeparatorStyle = UITableViewCellSeparatorStyle.None, }; var type = typeof(WifiNetworkTableViewCell); networksTableView.RegisterClassForCellReuse(type, type.Name); View.AddSubview(networksTableView); networksTableView.TopAnchor.ConstraintEqualTo(findLabel.BottomAnchor, constant: Constants.Padding).Active = true; networksTableView.LeftAnchor.ConstraintEqualTo(View.LeftAnchor).Active = true; networksTableView.RightAnchor.ConstraintEqualTo(View.RightAnchor).Active = true; networksTableView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true; var tableViewBackgroundShadowView = new UIView { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = Constants.Color.White, }; tableViewBackgroundShadowView.Layer.ShadowColor = Constants.Color.DarkGray.CGColor; tableViewBackgroundShadowView.Layer.ShadowRadius = 3; tableViewBackgroundShadowView.Layer.ShadowOffset = new CGSize(1, 1); tableViewBackgroundShadowView.Layer.ShadowOpacity = 0.4f; tableViewBackgroundShadowView.Layer.MasksToBounds = false; View.InsertSubviewBelow(tableViewBackgroundShadowView, networksTableView); tableViewBackgroundShadowView.LeftAnchor.ConstraintEqualTo(networksTableView.LeftAnchor).Active = true; tableViewBackgroundShadowView.RightAnchor.ConstraintEqualTo(networksTableView.RightAnchor).Active = true; tableViewBackgroundShadowView.TopAnchor.ConstraintEqualTo(networksTableView.TopAnchor).Active = true; tableViewBackgroundShadowView.BottomAnchor.ConstraintEqualTo(networksTableView.BottomAnchor).Active = true; }
public override void ViewDidLoad() { base.ViewDidLoad(); View.BackgroundColor = Constants.Color.BackgroundLightGray; Title = $"Set Up {ViewModel.DeviceTypeAsString}"; NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Constants.Assets.ArrowLeft, UIBarButtonItemStyle.Plain, (sender, e) => { NavigationController.PopViewController(true); }); var padding = Constants.Padding; var circleNumberView = new CircleNumberView { TranslatesAutoresizingMaskIntoConstraints = false, Number = 4, }; View.AddSubview(circleNumberView); circleNumberView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor, constant: padding).Active = true; circleNumberView.LeftAnchor.ConstraintEqualTo(View.LeftAnchor, constant: padding).Active = true; circleNumberView.WidthAnchor.ConstraintEqualTo(Constants.CircleNumberSize).Active = true; circleNumberView.HeightAnchor.ConstraintEqualTo(circleNumberView.WidthAnchor).Active = true; var deviceTypeLabel = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, TextColor = Constants.Color.MidGray, Font = Constants.Fonts.RubikOfSize(Constants.Fonts.Size.Eighteen), AdjustsFontSizeToFitWidth = true, MinimumScaleFactor = 0.1f, LineBreakMode = UILineBreakMode.WordWrap, Lines = 0, Text = $"Select a Wifi network the {ViewModel.DeviceTypeAsString} should use.", }; View.AddSubview(deviceTypeLabel); deviceTypeLabel.LeftAnchor.ConstraintEqualTo(circleNumberView.RightAnchor, constant: padding).Active = true; deviceTypeLabel.CenterYAnchor.ConstraintEqualTo(circleNumberView.CenterYAnchor).Active = true; deviceTypeLabel.RightAnchor.ConstraintEqualTo(View.RightAnchor, constant: -padding).Active = true; var availableNetworksLabel = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, TextColor = Constants.Color.MidGray, Font = Constants.Fonts.RubikOfSize(Constants.Fonts.Size.Twelve), AdjustsFontSizeToFitWidth = true, MinimumScaleFactor = 0.1f, LineBreakMode = UILineBreakMode.WordWrap, Lines = 0, Text = "Available Networks", }; View.AddSubview(availableNetworksLabel); availableNetworksLabel.LeftAnchor.ConstraintEqualTo(View.LeftAnchor, constant: padding).Active = true; availableNetworksLabel.TopAnchor.ConstraintEqualTo(circleNumberView.BottomAnchor, constant: padding * 2).Active = true; tableViewSource = new NetworksTableViewSource(); tableView = new UITableView { TranslatesAutoresizingMaskIntoConstraints = false, AlwaysBounceVertical = true, TableFooterView = new UIView(), Source = tableViewSource, SeparatorStyle = UITableViewCellSeparatorStyle.None, }; var cellType = typeof(WifiNetworkTableViewCell); tableView.RegisterClassForCellReuse(cellType, cellType.Name); View.AddSubview(tableView); tableView.LeftAnchor.ConstraintEqualTo(View.LeftAnchor).Active = true; tableView.RightAnchor.ConstraintEqualTo(View.RightAnchor).Active = true; tableView.TopAnchor.ConstraintEqualTo(availableNetworksLabel.BottomAnchor, constant: padding).Active = true; tableView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true; var tableViewBackgroundShadowView = new UIView { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = Constants.Color.White, }; tableViewBackgroundShadowView.Layer.ShadowColor = Constants.Color.DarkGray.CGColor; tableViewBackgroundShadowView.Layer.ShadowRadius = 3; tableViewBackgroundShadowView.Layer.ShadowOffset = new CGSize(1, 1); tableViewBackgroundShadowView.Layer.ShadowOpacity = 0.4f; tableViewBackgroundShadowView.Layer.MasksToBounds = false; View.InsertSubviewBelow(tableViewBackgroundShadowView, tableView); tableViewBackgroundShadowView.LeftAnchor.ConstraintEqualTo(tableView.LeftAnchor).Active = true; tableViewBackgroundShadowView.RightAnchor.ConstraintEqualTo(tableView.RightAnchor).Active = true; tableViewBackgroundShadowView.TopAnchor.ConstraintEqualTo(tableView.TopAnchor).Active = true; tableViewBackgroundShadowView.BottomAnchor.ConstraintEqualTo(tableView.BottomAnchor).Active = true; }