public void creatFilemov(byte[] videoData) { // change UIImageView tumbnil = new UIImageView(); UIImageView playerbutton = new UIImageView(); playerbutton.Frame = new CGRect(45, 45, 30, 30); tumbnil.Frame = new CGRect(0, 0, 75, 75); playerbutton.Image = UIImage.FromBundle("player.png"); tumbnil.Image = coVimage(videoData); // avplayerLayer.BackgroundColor = UIColor.Black.CGColor; // avpvc.Title = "this video"; // ebutton.SetImage(coVimage(videoData), UIControlState.Normal); ebutton.AddSubviews(tumbnil); //ebutton.Layer.AddSublayer(avplayerLayer); ebutton.AddSubviews(playerbutton); ebutton.TouchUpInside += Ebutton_TouchUpInside; //ebutton.AddSubviews(avplayerLayer) }
private void GenerateInsightsHeader(InsightDataModel insightDM) { double insightsHeight = NavigationController.NavigationBar.Bounds.Bottom; UIButton btnInsights = new UIButton() { Frame = new CGRect(0, insightsHeight + 20, View.Bounds.Width, 50), BackgroundColor = UIColor.FromRGB(228, 228, 228), Font = UIFont.FromName("Futura-Medium", 12f), }; UILabel.Appearance.Font = UIFont.FromName("Futura-Medium", 20f); double lblWidth = (View.Bounds.Width / 3) - 10; string strConsumed = Convert.ToString(Math.Round(insightDM.ConsumptionValue / 1000, 2)) + " k"; string strExpected = Convert.ToString(Math.Round(insightDM.PredictedValue / 1000, 2)) + " k"; string strOverused = Convert.ToString(Math.Round((insightDM.ConsumptionValue - insightDM.PredictedValue) / 1000, 2)) + " k"; UIImageView imgConsumed = new UIImageView() { Frame = new CGRect(5, 5, 10, 20), Image = UIImage.FromBundle("Arrow_Blue.png"), }; UILabel lblConsumedCount = new UILabel() { Frame = new CGRect(30, 0, lblWidth, 30), Text = strConsumed, Font = UIFont.FromName("Futura-Medium", 18f), TextColor = UIColor.DarkTextColor, BackgroundColor = UIColor.Clear, LineBreakMode = UILineBreakMode.WordWrap, Lines = 3, TextAlignment = UITextAlignment.Center }; UIImageView imgExpected = new UIImageView() { Frame = new CGRect(5, 5, 10, 20), Image = UIImage.FromBundle("Arrow_Green.png"), }; UILabel lblExpectedCount = new UILabel() { Frame = new CGRect(lblWidth + 30, 0, lblWidth, 30), Text = strExpected, Font = UIFont.FromName("Futura-Medium", 18f), TextColor = UIColor.DarkTextColor, BackgroundColor = UIColor.Clear, LineBreakMode = UILineBreakMode.WordWrap, Lines = 3, TextAlignment = UITextAlignment.Center }; UILabel lblOverusedCount = new UILabel() { Frame = new CGRect((lblWidth * 2) + 20, 0, lblWidth, 30), Text = strOverused, Font = UIFont.FromName("Futura-Medium", 18f), TextColor = UIColor.DarkTextColor, BackgroundColor = UIColor.Clear, LineBreakMode = UILineBreakMode.WordWrap, Lines = 3, TextAlignment = UITextAlignment.Center }; lblConsumedCount.AddSubview(imgConsumed); lblExpectedCount.AddSubview(imgExpected); UILabel lblConsumed = new UILabel() { Frame = new CGRect(10, 25, lblWidth, 30), Text = "CONSUMED", Font = UIFont.FromName("Futura-Medium", 10f), TextColor = UIColor.Gray, BackgroundColor = UIColor.Clear, LineBreakMode = UILineBreakMode.WordWrap, Lines = 3, TextAlignment = UITextAlignment.Center }; UILabel lblExpected = new UILabel() { Frame = new CGRect(new CGPoint(lblWidth + 20, 25), new CGSize(lblWidth, 30)), Text = "EXPECTED", Font = UIFont.FromName("Futura-Medium", 10f), TextColor = UIColor.Gray, BackgroundColor = UIColor.Clear, LineBreakMode = UILineBreakMode.WordWrap, Lines = 3, TextAlignment = UITextAlignment.Center }; UILabel lblOverused = new UILabel() { Frame = new CGRect(new CGPoint((lblWidth * 2) + 10, 25), new CGSize(lblWidth, 30)), Text = "OVERUSED", Font = UIFont.FromName("Futura-Medium", 10f), TextColor = UIColor.Gray, BackgroundColor = UIColor.Clear, LineBreakMode = UILineBreakMode.WordWrap, Lines = 3, TextAlignment = UITextAlignment.Center }; if ((Math.Round((insightDM.ConsumptionValue - insightDM.PredictedValue) / 1000, 2)) > 0) { lblOverused.Text = "OVERUSED"; UIImageView imgOverused = new UIImageView() { Frame = new CGRect(5, 5, 10, 20), Image = UIImage.FromBundle("Arrow_Red.png"), }; lblOverusedCount.AddSubview(imgOverused); } else { lblOverused.Text = "UNDERUSED"; UIImageView imgOverused = new UIImageView() { Frame = new CGRect(5, 5, 10, 20), Image = UIImage.FromBundle("Arrow_Green_Down.png"), }; lblOverusedCount.AddSubview(imgOverused); } btnInsights.AddSubviews(lblConsumed, lblExpected, lblOverused, lblConsumedCount, lblExpectedCount, lblOverusedCount); View.AddSubviews(btnInsights); }
public ConsumptionCell(NSString cellId) : base(UITableViewCellStyle.Default, cellId) { SelectionStyle = UITableViewCellSelectionStyle.Default; btnInsights = new UIButton() { Frame = new CGRect((IOSUtil.LayoutWidth - Bounds.Width) / 2, 0, Bounds.Width, 98), BackgroundColor = UIColor.Clear, Font = UIFont.FromName("Futura-Medium", 12f), }; UILabel.Appearance.Font = UIFont.FromName("Futura-Medium", 20f); double lblWidth = (Bounds.Width / 3) - 10; UIImageView imgConsumed = new UIImageView() { Frame = new CGRect(-2, 5, 10, 20), Image = UIImage.FromBundle("Arrow_Blue.png"), }; lblConsumptionName = new UILabel() { Frame = new CGRect(0, 5, Bounds.Width, 25), Font = UIFont.FromName("Futura-Medium", 20f), TextColor = UIColor.FromRGB(0, 102, 153), BackgroundColor = UIColor.Clear, LineBreakMode = UILineBreakMode.Clip, Lines = 1, TextAlignment = UITextAlignment.Center }; lblConsumedCount = new UILabel() { Frame = new CGRect(10, 35, lblWidth, 30), Font = UIFont.FromName("Futura-Medium", 18f), TextColor = UIColor.DarkTextColor, BackgroundColor = UIColor.Clear, LineBreakMode = UILineBreakMode.WordWrap, Lines = 3, TextAlignment = UITextAlignment.Center }; UIImageView imgExpected = new UIImageView() { Frame = new CGRect(-2, 5, 10, 20), Image = UIImage.FromBundle("Arrow_Green.png"), }; lblExpectedCount = new UILabel() { Frame = new CGRect(lblWidth + 12, 35, lblWidth, 30), Font = UIFont.FromName("Futura-Medium", 18f), TextColor = UIColor.DarkTextColor, BackgroundColor = UIColor.Clear, LineBreakMode = UILineBreakMode.WordWrap, Lines = 3, TextAlignment = UITextAlignment.Center }; //UIImageView imgOverused = new UIImageView() //{ // Frame = new CGRect(0, 5, 10, 20), // Image = UIImage.FromBundle("Arrow_Red.png"), // Tag = 1 //}; lblOverusedCount = new UILabel() { Frame = new CGRect((lblWidth * 2) + 12, 35, lblWidth, 30), Font = UIFont.FromName("Futura-Medium", 18f), TextColor = UIColor.DarkTextColor, BackgroundColor = UIColor.Clear, LineBreakMode = UILineBreakMode.WordWrap, Lines = 3, TextAlignment = UITextAlignment.Center }; lblConsumedCount.AddSubview(imgConsumed); lblExpectedCount.AddSubview(imgExpected); //lblOverusedCount.AddSubview(imgOverused); UILabel lblConsumed = new UILabel() { Frame = new CGRect(5, 60, lblWidth, 30), Text = "CONSUMED", Font = UIFont.FromName("Futura-Medium", 10f), TextColor = UIColor.Gray, BackgroundColor = UIColor.Clear, LineBreakMode = UILineBreakMode.WordWrap, Lines = 3, TextAlignment = UITextAlignment.Center }; UILabel lblExpected = new UILabel() { Frame = new CGRect(new CGPoint(lblWidth + 15, 60), new CGSize(lblWidth, 30)), Text = "EXPECTED", Font = UIFont.FromName("Futura-Medium", 10f), TextColor = UIColor.Gray, BackgroundColor = UIColor.Clear, LineBreakMode = UILineBreakMode.WordWrap, Lines = 3, TextAlignment = UITextAlignment.Center }; lblOverused = new UILabel() { Frame = new CGRect(new CGPoint((lblWidth * 2) + 20, 60), new CGSize(lblWidth, 30)), //Text = "OVERUSED", Font = UIFont.FromName("Futura-Medium", 10f), TextColor = UIColor.Gray, BackgroundColor = UIColor.Clear, LineBreakMode = UILineBreakMode.WordWrap, Lines = 3, TextAlignment = UITextAlignment.Center }; UIView seperator = new UIView() { Frame = new CGRect(0, 99, IOSUtil.LayoutWidth, 2), BackgroundColor = UIColor.Gray }; btnInsights.AddSubviews(lblConsumptionName, lblConsumed, lblExpected, lblOverused, lblConsumedCount, lblExpectedCount, lblOverusedCount); ContentView.AddSubviews(btnInsights, seperator); }
public override void ViewDidLoad() { base.ViewDidLoad(); var maxWidth = UIScreen.MainScreen.Bounds.Width - (MARGIN + SPACING + MARGIN); var buttonHeight = maxWidth * 2; _garageViewModel = new GarageViewModel(); _buttonStack = new UIStackView(); _leftButton = new UIButton(UIButtonType.Custom); _rightButton = new UIButton(UIButtonType.Custom); _retryButton = new UIButton(UIButtonType.Custom); _leftStatus = new UILabel(); _rightStatus = new UILabel(); _connectionStatus = new UILabel(); _leftButton.HeightAnchor.ConstraintEqualTo(buttonHeight).Active = true; _leftButton.WidthAnchor.ConstraintEqualTo(maxWidth / 2).Active = true; _rightButton.HeightAnchor.ConstraintEqualTo(buttonHeight).Active = true; _rightButton.WidthAnchor.ConstraintEqualTo(maxWidth / 2).Active = true; _connectionStatus.WidthAnchor.ConstraintEqualTo(maxWidth).Active = true; _buttonStack.ContentMode = UIViewContentMode.ScaleAspectFill; _buttonStack.Alignment = UIStackViewAlignment.Fill; _buttonStack.Distribution = UIStackViewDistribution.FillEqually; _buttonStack.Axis = UILayoutConstraintAxis.Horizontal; _buttonStack.TranslatesAutoresizingMaskIntoConstraints = false; _buttonStack.Spacing = MARGIN / 2; _buttonStack.AddArrangedSubview(_leftButton); _buttonStack.AddArrangedSubview(_rightButton); View.BackgroundColor = UIColor.White; _leftLetter = new UILabel { Text = "L", TextAlignment = UITextAlignment.Center, TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(150, UIFontWeight.Semibold), TranslatesAutoresizingMaskIntoConstraints = false }; _leftLetter.Layer.Opacity = 0.4f; _leftStatus = new UILabel { Text = "Unknown", TextAlignment = UITextAlignment.Center, TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(16.0f, UIFontWeight.Regular), TranslatesAutoresizingMaskIntoConstraints = false }; _leftButton.BackgroundColor = UIColor.FromRGB(65, 217, 73); _rightLetter = new UILabel { Text = "R", TextAlignment = UITextAlignment.Center, TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(150, UIFontWeight.Semibold), TranslatesAutoresizingMaskIntoConstraints = false }; _rightLetter.Layer.Opacity = 0.4f; _rightStatus = new UILabel { Text = "Unknown", TextAlignment = UITextAlignment.Center, TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(16.0f, UIFontWeight.Regular), TranslatesAutoresizingMaskIntoConstraints = false }; _rightButton.BackgroundColor = UIColor.FromRGB(247, 210, 0); _connectionStatus.Layer.Opacity = 0; _buttonStack.Layer.Opacity = 0; _connectionStatus.Text = _garageViewModel.Status; _connectionStatus.TextAlignment = UITextAlignment.Center; _connectionStatus.Font = UIFont.BoldSystemFontOfSize(16.0f); _leftButton.AddSubviews(_leftLetter, _leftStatus); _rightButton.AddSubviews(_rightLetter, _rightStatus); View.AddSubviews(_buttonStack, _connectionStatus); View.ConstrainLayout(() => _buttonStack.Frame.GetCenterY() == View.Frame.GetCenterY() && _buttonStack.Frame.Left == View.Frame.Left + MARGIN && _buttonStack.Frame.Right == View.Frame.Left - MARGIN && _buttonStack.Frame.Height == View.Frame.Height * 0.5f && _connectionStatus.Frame.Top == _buttonStack.Frame.Top * 0.5f && _connectionStatus.Frame.GetCenterX() == View.Frame.GetCenterX() && _connectionStatus.Frame.Height == 40 ); _leftButton.ConstrainLayout(() => _leftLetter.Frame.GetCenterY() == _leftButton.Frame.GetCenterY() && _leftLetter.Frame.GetCenterX() == _leftButton.Frame.GetCenterX() && _leftStatus.Frame.GetCenterX() == _leftButton.Frame.GetCenterX() && _leftStatus.Frame.Top == _leftLetter.Frame.Bottom - 20.0f ); _rightButton.ConstrainLayout(() => _rightLetter.Frame.GetCenterY() == _rightButton.Frame.GetCenterY() && _rightLetter.Frame.GetCenterX() == _rightButton.Frame.GetCenterX() && _rightStatus.Frame.GetCenterX() == _rightButton.Frame.GetCenterX() && _rightStatus.Frame.Top == _rightLetter.Frame.Bottom - 20.0f ); _didBecomeActiveObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.DidBecomeActiveNotification, HandleDidBecomeActiveNotification); }