protected override void LayoutContent(UIView container, ContentSet content, LayoutSet layout) { _message = new UITextView(); _message.Frame = new RectangleF(layout.margin, layout.offset + 2, layout.contentWidth, 40); _message.Editable = false; _message.Text = D.PLAESE_WAIT_DATA_IS_LOADED; _message.TextColor = GRAY; _message.BackgroundColor = UIColor.Clear; _message.TextAlignment = UITextAlignment.Center; _message.Font = UIFont.FromName("Arial", 12); container.AddSubview(_message); var indicatorContainer = new UIView(); indicatorContainer.Frame = new RectangleF(layout.margin, _message.Frame.Bottom + 2, layout.contentWidth, 20); indicatorContainer.BackgroundColor = UIColor.White; indicatorContainer.Layer.BorderColor = GRAY.CGColor; indicatorContainer.Layer.BorderWidth = 1; indicatorContainer.Layer.CornerRadius = layout.cornerRadius; indicatorContainer.Layer.MasksToBounds = true; indicatorContainer.ClipsToBounds = true; _indicator = new UIProgressView(); _indicator.Frame = new RectangleF(10, 8, indicatorContainer.Frame.Width - 20, indicatorContainer.Frame.Height - 15); _indicator.TintColor = BaseColor; indicatorContainer.AddSubview(_indicator); container.AddSubview(indicatorContainer); _progress = new UILabel(); _progress.Frame = new RectangleF(layout.margin, indicatorContainer.Frame.Bottom + 2, layout.contentWidth, 40); _progress.BackgroundColor = UIColor.Clear; _progress.TextColor = GRAY; _progress.Text = ""; _progress.TextAlignment = UITextAlignment.Center; container.AddSubview(_progress); }
protected override void LayoutContent (UIView container, ContentSet content, LayoutSet layout) { _message = new UITextView (); _message.Frame = new RectangleF (layout.margin, layout.offset + 2, layout.contentWidth, 40); _message.Editable = false; _message.Text = D.PLAESE_WAIT_DATA_IS_LOADED; _message.TextColor = LogonController.GRAY; _message.BackgroundColor = UIColor.Clear; _message.TextAlignment = UITextAlignment.Center; _message.Font = UIFont.FromName ("Arial", 12); container.AddSubview (_message); UIView indicatorContainer = new UIView (); indicatorContainer.Frame = new RectangleF (layout.margin, _message.Frame.Bottom + 2, layout.contentWidth, 20); indicatorContainer.BackgroundColor = UIColor.White; indicatorContainer.Layer.BorderColor = LogonController.GRAY.CGColor; indicatorContainer.Layer.BorderWidth = 1; indicatorContainer.Layer.CornerRadius = layout.cornerRadius; indicatorContainer.Layer.MasksToBounds = true; indicatorContainer.ClipsToBounds = true; _indicator = new UIProgressView (); _indicator.Frame = new RectangleF (10, 8, indicatorContainer.Frame.Width - 20, indicatorContainer.Frame.Height - 15); _indicator.TintColor = BaseColor; indicatorContainer.AddSubview (_indicator); container.AddSubview (indicatorContainer); _progress = new UILabel (); _progress.Frame = new RectangleF (layout.margin, indicatorContainer.Frame.Bottom + 2, layout.contentWidth, 40); _progress.BackgroundColor = UIColor.Clear; _progress.TextColor = LogonController.GRAY; _progress.Text = ""; _progress.TextAlignment = UITextAlignment.Center; container.AddSubview (_progress); }
public override void ViewDidLoad() { base.ViewDidLoad(); RectangleF af = UIScreen.MainScreen.ApplicationFrame; var content = new ContentSet(); var layout = new LayoutSet(); // prepare solution data content.borderColor = BaseColor; content.buttonColor = BaseColor; if (_settings.CurrentSolutionType == SolutionType.BitMobile) { content.topImg = new UIImage("BitMobileTop.png"); content.botImg = new UIImage("BitMobileBottom.png"); content.borderColor = VIOLET_RED; } else { content.lockImg = GetFilteredImage(content.lockImg, BaseColor); content.usernameImg = GetFilteredImage(content.usernameImg, BaseColor); content.passwordImg = GetFilteredImage(content.passwordImg, BaseColor); switch (_settings.CurrentSolutionType) { case SolutionType.SuperAgent: content.topImg = new UIImage("SuperAgentTop.png"); content.botImg = new UIImage("SuperAgentBottom.png"); content.caption1Text = D.BIT_CATCH1; content.logoImg = new UIImage("SuperAgentLogo.png"); content.caption2Text = D.BIT_CATCH2; break; case SolutionType.SuperService: content.topImg = new UIImage("SuperServiceTop.png"); content.botImg = new UIImage("SuperServiceBottom.png"); content.caption1Text = D.SUPER_SERVICE1; content.logoImg = new UIImage("SuperServiceLogo.png"); content.caption2Text = D.SUPER_SERVICE2; break; case SolutionType.LandSuperService: content.topImg = new UIImage("SuperServiceTop.png"); content.botImg = new UIImage("SuperServiceBottom.png"); content.logoImg = new UIImage("LandSuperServiceLogo.png"); content.customerLogo = new UIImage("LandLogo.png"); break; } } // start building layout.offset = 0; var container = new UIView(); container.Frame = UIScreen.MainScreen.ApplicationFrame; container.BackgroundColor = UIColor.White; layout.cornerRadius = 6; layout.contentWidth = af.Width - 20 > 300 ? 300 : af.Width - 20; layout.margin = (af.Width - layout.contentWidth) / 2; float topHeight = (af.Left + af.Width) * content.topImg.Size.Height / content.topImg.Size.Width; using (var imageTop = new UIImageView()) { imageTop.Image = content.topImg; imageTop.Frame = new RectangleF(0, 0, af.Left + af.Width, topHeight); container.AddSubview(imageTop); } using (var imageBot = new UIImageView()) { imageBot.Image = content.botImg; float botHeight = (af.Left + af.Width) * imageBot.Image.Size.Height / imageBot.Image.Size.Width; imageBot.Frame = new RectangleF(0, (af.Top + af.Height) - botHeight, af.Left + af.Width, botHeight); container.AddSubview(imageBot); layout.offset = imageBot.Frame.Top; } float captionTopMargin = 20 + topHeight / 6; if (content.customerLogo != null) { captionTopMargin -= 20; } float captionHeight = 40; if (_settings.CurrentSolutionType == SolutionType.BitMobile) { using (var caption = new UILabel()) { caption.Frame = new RectangleF(layout.margin, captionTopMargin, layout.contentWidth, captionHeight); caption.BackgroundColor = UIColor.Clear; caption.TextColor = UIColor.White; caption.Text = D.BIT_MOBILE; caption.TextAlignment = UITextAlignment.Center; caption.Font = UIFont.FromName("Arial-BoldMT", 25); container.AddSubview(caption); } } else { float textPadding = 4; float logoHeight = 40; float logoWidth = logoHeight * content.logoImg.Size.Width / content.logoImg.Size.Height; float captionWidth = (layout.contentWidth - logoWidth - textPadding) / 2; float captionOffset = layout.margin; using (var caption = new UILabel()) { caption.Frame = new RectangleF(captionOffset, captionTopMargin, captionWidth - textPadding, captionHeight); caption.BackgroundColor = UIColor.Clear; caption.TextColor = UIColor.White; caption.TextAlignment = UITextAlignment.Right; caption.Font = UIFont.FromName("Arial-BoldMT", 25); caption.Text = content.caption1Text; container.AddSubview(caption); captionOffset = caption.Frame.Right; } using (var imageLogo = new UIImageView()) { imageLogo.Frame = new RectangleF(captionOffset + textPadding, captionTopMargin, logoWidth, logoHeight); imageLogo.Image = content.logoImg; container.AddSubview(imageLogo); captionOffset = imageLogo.Frame.Right; } using (var caption = new UILabel()) { caption.Frame = new RectangleF(captionOffset + textPadding, captionTopMargin, captionWidth, captionHeight); caption.BackgroundColor = UIColor.Clear; caption.TextColor = UIColor.White; caption.TextAlignment = UITextAlignment.Left; caption.Font = UIFont.FromName("Arial-BoldMT", 25); caption.Text = content.caption2Text; container.AddSubview(caption); } if (content.customerLogo != null) { using (var custLogo = new UIImageView()) { float custLogoHeight = 40; float custLogoWidth = custLogoHeight * content.customerLogo.Size.Width / content.customerLogo.Size.Height; float custXOffset = (layout.contentWidth - custLogoWidth) / 2 + layout.margin; float custYOffset = captionTopMargin + logoHeight + 10; custLogo.Frame = new RectangleF(custXOffset, custYOffset, custLogoWidth, custLogoHeight); custLogo.Image = content.customerLogo; container.AddSubview(custLogo); } } } using (var imageLock = new UIImageView()) { imageLock.Image = content.lockImg; float lockHeight = 52; float lockWidth = lockHeight * imageLock.Image.Size.Width / imageLock.Image.Size.Height; imageLock.Frame = new RectangleF(((af.Left + af.Width) - lockWidth) / 2, layout.offset + 16, lockWidth, lockHeight); container.AddSubview(imageLock); layout.offset = imageLock.Frame.Bottom; } LayoutContent(container, content, layout); if (_settings.CurrentSolutionType != SolutionType.BitMobile) { float bottomTextSize = 18; float marginBottom = 10; using (var bottomText = new UILabel()) { bottomText.Frame = new RectangleF(layout.margin, container.Frame.Bottom - bottomTextSize * 2 - marginBottom, layout.contentWidth, bottomTextSize); bottomText.Text = D.EFFECTIVE_SOLUTIONS_BASED_ON_1C_FOR_BUSINESS; bottomText.TextAlignment = UITextAlignment.Center; bottomText.TextColor = UIColor.FromRGB(142, 142, 142); bottomText.LineBreakMode = UILineBreakMode.WordWrap; bottomText.Font = UIFont.FromName("Arial", 12); container.AddSubview(bottomText); } using (var bottomText = new UILabel()) { bottomText.Frame = new RectangleF(layout.margin, container.Frame.Bottom - bottomTextSize - marginBottom, layout.contentWidth, bottomTextSize); bottomText.Text = D.FIRST_BIT_COPYRIGHT; bottomText.TextAlignment = UITextAlignment.Center; bottomText.TextColor = UIColor.FromRGB(184, 184, 184); bottomText.Font = UIFont.FromName("Arial", 12); container.AddSubview(bottomText); } } View = container; }
protected virtual void LayoutContent(UIView container, ContentSet content, LayoutSet layout) { }
public override void ViewDidLoad () { base.ViewDidLoad (); var af = UIScreen.MainScreen.ApplicationFrame; ContentSet content = new ContentSet (); LayoutSet layout = new LayoutSet (); // prepare solution data content.borderColor = BaseColor; content.buttonColor = BaseColor; if (_settings.CurrentSolutionType == SolutionType.BitMobile) { content.topImg = new UIImage ("BitMobileTop.png"); content.botImg = new UIImage ("BitMobileBottom.png"); content.borderColor = VIOLET_RED; } else { content.lockImg = GetFilteredImage (content.lockImg, BaseColor); content.usernameImg = GetFilteredImage (content.usernameImg, BaseColor); content.passwordImg = GetFilteredImage (content.passwordImg, BaseColor); switch (_settings.CurrentSolutionType) { case SolutionType.SuperAgent: content.topImg = new UIImage ("SuperAgentTop.png"); content.botImg = new UIImage ("SuperAgentBottom.png"); content.caption1Text = D.BIT_CATCH1; content.logoImg = new UIImage ("SuperAgentLogo.png"); content.caption2Text = D.BIT_CATCH2; break; case SolutionType.SuperService: content.topImg = new UIImage ("SuperServiceTop.png"); content.botImg = new UIImage ("SuperServiceBottom.png"); content.caption1Text = D.SUPER_SERVICE1; content.logoImg = new UIImage ("SuperServiceLogo.png"); content.caption2Text = D.SUPER_SERVICE2; break; case SolutionType.LandSuperService: content.topImg = new UIImage ("SuperServiceTop.png"); content.botImg = new UIImage ("SuperServiceBottom.png"); content.logoImg = new UIImage ("LandSuperServiceLogo.png"); content.customerLogo = new UIImage ("LandLogo.png"); break; } } // start building layout.offset = 0; UIView container = new UIView (); container.Frame = UIScreen.MainScreen.ApplicationFrame; container.BackgroundColor = UIColor.White; layout.cornerRadius = 6; layout.contentWidth = af.Width - 20 > 300 ? 300 : af.Width - 20; layout.margin = (af.Width - layout.contentWidth) / 2; float topHeight = (af.Left + af.Width) * content.topImg.Size.Height / content.topImg.Size.Width; using (UIImageView imageTop = new UIImageView ()) { imageTop.Image = content.topImg; imageTop.Frame = new RectangleF (0, 0, af.Left + af.Width, topHeight); container.AddSubview (imageTop); } using (UIImageView imageBot = new UIImageView ()) { imageBot.Image = content.botImg; float botHeight = (af.Left + af.Width) * imageBot.Image.Size.Height / imageBot.Image.Size.Width; imageBot.Frame = new RectangleF (0, (af.Top + af.Height) - botHeight, af.Left + af.Width, botHeight); container.AddSubview (imageBot); layout.offset = imageBot.Frame.Top; } float captionTopMargin = 20 + topHeight / 6; if (content.customerLogo != null) captionTopMargin -= 20; float captionHeight = 40; if (_settings.CurrentSolutionType == SolutionType.BitMobile) { using (UILabel caption = new UILabel ()) { caption.Frame = new RectangleF (layout.margin, captionTopMargin, layout.contentWidth, captionHeight); caption.BackgroundColor = UIColor.Clear; caption.TextColor = UIColor.White; caption.Text = D.BIT_MOBILE; caption.TextAlignment = UITextAlignment.Center; caption.Font = UIFont.FromName ("Arial-BoldMT", 25); container.AddSubview (caption); } } else { float textPadding = 4; float logoHeight = 40; float logoWidth = logoHeight * content.logoImg.Size.Width / content.logoImg.Size.Height; float captionWidth = (layout.contentWidth - logoWidth - textPadding) / 2; float captionOffset = layout.margin; using (UILabel caption = new UILabel ()) { caption.Frame = new RectangleF (captionOffset, captionTopMargin, captionWidth - textPadding, captionHeight); caption.BackgroundColor = UIColor.Clear; caption.TextColor = UIColor.White; caption.TextAlignment = UITextAlignment.Right; caption.Font = UIFont.FromName ("Arial-BoldMT", 25); caption.Text = content.caption1Text; container.AddSubview (caption); captionOffset = caption.Frame.Right; } using (UIImageView imageLogo = new UIImageView ()) { imageLogo.Frame = new RectangleF (captionOffset + textPadding, captionTopMargin, logoWidth, logoHeight); imageLogo.Image = content.logoImg; container.AddSubview (imageLogo); captionOffset = imageLogo.Frame.Right; } using (UILabel caption = new UILabel ()) { caption.Frame = new RectangleF (captionOffset + textPadding, captionTopMargin, captionWidth, captionHeight); caption.BackgroundColor = UIColor.Clear; caption.TextColor = UIColor.White; caption.TextAlignment = UITextAlignment.Left; caption.Font = UIFont.FromName ("Arial-BoldMT", 25); caption.Text = content.caption2Text; container.AddSubview (caption); } if (content.customerLogo != null) using (UIImageView custLogo = new UIImageView ()) { float custLogoHeight = 40; float custLogoWidth = custLogoHeight * content.customerLogo.Size.Width / content.customerLogo.Size.Height; float custXOffset = (layout.contentWidth - custLogoWidth) / 2 + layout.margin; float custYOffset = captionTopMargin + logoHeight + 10; custLogo.Frame = new RectangleF (custXOffset, custYOffset, custLogoWidth, custLogoHeight); custLogo.Image = content.customerLogo; container.AddSubview (custLogo); } } using (UIImageView imageLock = new UIImageView ()) { imageLock.Image = content.lockImg; float lockHeight = 52; float lockWidth = lockHeight * imageLock.Image.Size.Width / imageLock.Image.Size.Height; imageLock.Frame = new RectangleF (((af.Left + af.Width) - lockWidth) / 2, layout.offset + 16, lockWidth, lockHeight); container.AddSubview (imageLock); layout.offset = imageLock.Frame.Bottom; } LayoutContent (container, content, layout); if (_settings.CurrentSolutionType != SolutionType.BitMobile) { float bottomTextSize = 18; float marginBottom = 10; using (UILabel bottomText = new UILabel ()) { bottomText.Frame = new RectangleF (layout.margin, container.Frame.Bottom - bottomTextSize * 2 - marginBottom, layout.contentWidth, bottomTextSize); bottomText.Text = D.EFFECTIVE_SOLUTIONS_BASED_ON_1C_FOR_BUSINESS; bottomText.TextAlignment = UITextAlignment.Center; bottomText.TextColor = UIColor.FromRGB (142, 142, 142); bottomText.LineBreakMode = UILineBreakMode.WordWrap; bottomText.Font = UIFont.FromName ("Arial", 12); container.AddSubview (bottomText); } using (UILabel bottomText = new UILabel ()) { bottomText.Frame = new RectangleF (layout.margin, container.Frame.Bottom - bottomTextSize - marginBottom, layout.contentWidth, bottomTextSize); bottomText.Text = D.FIRST_BIT_COPYRIGHT; bottomText.TextAlignment = UITextAlignment.Center; bottomText.TextColor = UIColor.FromRGB (184, 184, 184); bottomText.Font = UIFont.FromName ("Arial", 12); container.AddSubview (bottomText); } } this.View = container; }
protected virtual void LayoutContent (UIView container, ContentSet content, LayoutSet layout) { }
protected override void LayoutContent(UIView container, ContentSet content, LayoutSet layout) { _message = new UITextView(); _message.Frame = new RectangleF(layout.margin, layout.offset + 2, layout.contentWidth, 40); _message.Editable = false; _message.Text = _ctorText ?? D.TO_GET_STARTED_YOU_HAVE_TO_LOGIN; _message.TextColor = _ctorText != null ? RED : GRAY; _message.BackgroundColor = UIColor.Clear; _message.TextAlignment = UITextAlignment.Center; _message.Font = UIFont.FromName("Arial", 12); container.AddSubview(_message); _userName = new UITextField(); _userName.Frame = new RectangleF(layout.margin, _message.Frame.Bottom + 2, layout.contentWidth, 44); _userName.Placeholder = D.USER_NAME; _userName.AutocorrectionType = UITextAutocorrectionType.No; _userName.ClipsToBounds = true; _userName.Layer.BorderColor = content.borderColor.CGColor; _userName.Layer.BorderWidth = 1; _userName.Layer.CornerRadius = layout.cornerRadius; _userName.LeftViewMode = UITextFieldViewMode.Always; _userName.Text = _settings.UserName; UIImageView userNameImage = new UIImageView(); userNameImage.Image = content.usernameImg; float tfUserNameImageHeight = _userName.Frame.Height / 2; float tfUserNameImageWidth = tfUserNameImageHeight * userNameImage.Image.Size.Width / userNameImage.Image.Size.Height; userNameImage.Frame = new RectangleF(0, 0, tfUserNameImageWidth + 20, tfUserNameImageHeight); userNameImage.ContentMode = UIViewContentMode.ScaleAspectFit; _userName.LeftView = userNameImage; container.AddSubview(_userName); _password = new UITextField(); _password.Frame = new RectangleF(layout.margin, _userName.Frame.Bottom + 10, layout.contentWidth, 44); _password.Placeholder = D.PASSWORD; _password.SecureTextEntry = true; _password.ClipsToBounds = true; _password.Layer.BorderColor = content.borderColor.CGColor; _password.Layer.BorderWidth = 1; _password.Layer.CornerRadius = layout.cornerRadius; _password.LeftViewMode = UITextFieldViewMode.Always; if (_settings.DevelopModeEnabled) { _password.Text = _settings.Password; } UIImageView passwordImage = new UIImageView(); passwordImage.Image = content.passwordImg; float tfPasswordImageHeight = _password.Frame.Height / 2; float tfPasswordImageWidth = tfPasswordImageHeight * passwordImage.Image.Size.Width / passwordImage.Image.Size.Height; passwordImage.Frame = new RectangleF(0, 0, tfPasswordImageWidth + 20, tfPasswordImageHeight); passwordImage.ContentMode = UIViewContentMode.ScaleAspectFit; _password.LeftView = passwordImage; container.AddSubview(_password); _logon = new UIButton(UIButtonType.System); _logon.Frame = new RectangleF(layout.margin, _password.Frame.Bottom + 10, layout.contentWidth, 44); _logon.SetTitle(D.LOGON, UIControlState.Normal); _logon.BackgroundColor = content.buttonColor; _logon.SetTitleColor(UIColor.White, UIControlState.Normal); _logon.Layer.BorderWidth = 0; _logon.Layer.CornerRadius = layout.cornerRadius; _logon.TouchUpInside += Logon; container.AddSubview(_logon); }
protected override void LayoutContent(UIView container, ContentSet content, LayoutSet layout) { _message = new UITextView(); _message.Frame = new RectangleF(layout.margin, layout.offset + 2, layout.contentWidth, 40); _message.Editable = false; _message.Text = _ctorText ?? D.TO_GET_STARTED_YOU_HAVE_TO_LOGIN; _message.TextColor = _ctorText != null ? RED : GRAY; _message.BackgroundColor = UIColor.Clear; _message.TextAlignment = UITextAlignment.Center; _message.Font = UIFont.FromName("Arial", 12); container.AddSubview(_message); _userName = new UITextField(); _userName.Frame = new RectangleF(layout.margin, _message.Frame.Bottom + 2, layout.contentWidth, 44); _userName.Placeholder = D.USER_NAME; _userName.AutocorrectionType = UITextAutocorrectionType.No; _userName.ClipsToBounds = true; _userName.Layer.BorderColor = content.borderColor.CGColor; _userName.Layer.BorderWidth = 1; _userName.Layer.CornerRadius = layout.cornerRadius; _userName.LeftViewMode = UITextFieldViewMode.Always; var userNameImage = new UIImageView(); userNameImage.Image = content.usernameImg; float tfUserNameImageHeight = _userName.Frame.Height/2; float tfUserNameImageWidth = tfUserNameImageHeight*userNameImage.Image.Size.Width/ userNameImage.Image.Size.Height; userNameImage.Frame = new RectangleF(0, 0, tfUserNameImageWidth + 20, tfUserNameImageHeight); userNameImage.ContentMode = UIViewContentMode.ScaleAspectFit; _userName.LeftView = userNameImage; _userName.Text = _settings.UserName; container.AddSubview(_userName); _password = new UITextField(); _password.Frame = new RectangleF(layout.margin, _userName.Frame.Bottom + 10, layout.contentWidth, 44); _password.Placeholder = D.PASSWORD; _password.SecureTextEntry = true; _password.ClipsToBounds = true; _password.Layer.BorderColor = content.borderColor.CGColor; _password.Layer.BorderWidth = 1; _password.Layer.CornerRadius = layout.cornerRadius; _password.LeftViewMode = UITextFieldViewMode.Always; var passwordImage = new UIImageView(); passwordImage.Image = content.passwordImg; float tfPasswordImageHeight = _password.Frame.Height/2; float tfPasswordImageWidth = tfPasswordImageHeight*passwordImage.Image.Size.Width/ passwordImage.Image.Size.Height; passwordImage.Frame = new RectangleF(0, 0, tfPasswordImageWidth + 20, tfPasswordImageHeight); passwordImage.ContentMode = UIViewContentMode.ScaleAspectFit; _password.LeftView = passwordImage; if (_settings.DevelopModeEnabled) _password.Text = _settings.Password; container.AddSubview(_password); _logon = new UIButton(UIButtonType.System); _logon.Frame = new RectangleF(layout.margin, _password.Frame.Bottom + 10, layout.contentWidth, 44); _logon.SetTitle(D.LOGON, UIControlState.Normal); _logon.BackgroundColor = content.buttonColor; _logon.SetTitleColor(UIColor.White, UIControlState.Normal); _logon.Layer.BorderWidth = 0; _logon.Layer.CornerRadius = layout.cornerRadius; _logon.TouchUpInside += Logon; container.AddSubview(_logon); }