public override NSAttributedString GetDescription(UIScrollView scrollView) { var text = "Make sure that all words are spelled correctly."; return(new NSMutableAttributedString(text, UIFont.BoldSystemFontOfSize(17))); }
//private void SaveButton_TouchUpInside(object sender, System.EventArgs e) //{ // Control.Text = this.Element.Date.ToString("MM/dd/yyyy"); // datePicker.DateSelectedCommand.Execute(Control.Text); // Control.ResignFirstResponder(); //} //private void CancelButton_TouchUpInside(object sender, System.EventArgs e) //{ // Control.ResignFirstResponder(); //} private void SetCustomToolbar(string doneButtonText, string cancelButtonText, string titleText) { UIToolbar toolbar = new UIToolbar { BarStyle = UIBarStyle.Default, Translucent = true, BackgroundColor = Color.FromHex("#252D3C").ToUIColor(), BarTintColor = Color.FromHex("#252D3C").ToUIColor() }; toolbar.SizeToFit(); UIBarButtonItem cancelButton = new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Plain, (sender, e) => { Control.ResignFirstResponder(); }); cancelButton.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(16) }, UIControlState.Normal); cancelButton.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White }, UIControlState.Selected); UIBarButtonItem flexible = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); UILabel titleView = new UILabel(new CoreGraphics.CGRect(0, 0, 200, 50)) { Text = titleText, TextAlignment = UITextAlignment.Center, TextColor = UIColor.White }; UIBarButtonItem title = new UIBarButtonItem(titleView); titleView.Font = UIFont.BoldSystemFontOfSize(16); title.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White }, UIControlState.Normal); title.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(16) }, UIControlState.Selected); UIBarButtonItem doneButton = new UIBarButtonItem(doneButtonText, UIBarButtonItemStyle.Done, (s, ev) => { if (this.datePicker != null) { Control.TextColor = Color.FromHex("#2E2E2E").ToUIColor(); Control.Text = this.Element.Date.ToString("MM/dd/yyyy"); datePicker.DateSelectedCommand.Execute(Control.Text); Control.ResignFirstResponder(); } }); doneButton.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(16) }, UIControlState.Normal); doneButton.SetTitleTextAttributes( new UITextAttributes { TextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(16) }, UIControlState.Selected); toolbar.SetItems(new UIBarButtonItem[] { cancelButton, flexible, title, flexible, doneButton }, true); Control.InputAccessoryView = toolbar; }
internal static UIFont BestFont(string family, nfloat size, bool bold = false, bool italic = false, Assembly assembly = null) { if (family == null) { family = "sans-serif"; } if (family.ToLower() == "monospace") { family = "Menlo"; } if (family.ToLower() == "serif") { family = "Times New Roman"; } if (family.ToLower() == "sans-serif") { family = "Arial"; } if (size < 0) { size = (nfloat)(UIFont.LabelFontSize * Math.Abs(size)); } // is it in the cache? var key = new FontKey(family, size, bold, italic); Dictionary <FontKey, UIFont> dictionary = UiFontCache; lock (dictionary) { if (dictionary.TryGetValue(key, out UIFont storedUiFont)) { return(storedUiFont); } } UIFont bestAttemptFont = null; if (UIFont.FamilyNames.Contains(family)) { // a system font var fontNames = FontFamilies.FontsForFamily(family); string baseFontName = null; string reqFontName = null; //string fallbackFontName = null; if (fontNames != null && fontNames.Count > 0) { if (fontNames.Count == 1) { baseFontName = fontNames[0]; if (!bold && !italic) { reqFontName = fontNames[0]; } } else { int shortestMatchLength = int.MaxValue; int shortestBaseLength = int.MaxValue; foreach (var fontName in fontNames) { var lowerName = fontName.ToLower(); bool nameHasBold = lowerName.Contains("bold") || lowerName == "avenir-black"; bool nameHasItalic = lowerName.Contains("italic") || lowerName.Contains("oblique"); // assume the shortest name is the base font name if (lowerName.Length < shortestBaseLength) { baseFontName = fontName; shortestBaseLength = lowerName.Length; } // assume the shortest name with matching attributes is a match if (nameHasBold == bold && nameHasItalic == italic && lowerName.Length < shortestMatchLength) { reqFontName = fontName; shortestMatchLength = lowerName.Length; } if (lowerName.Contains("-regular")) { baseFontName = fontName; shortestBaseLength = -1; if (!bold && !italic) { reqFontName = fontName; shortestMatchLength = -1; break; } } } } } if (reqFontName != null) { bestAttemptFont = UIFont.FromName(reqFontName, size); } if (bestAttemptFont == null && baseFontName != null && !bold && !italic) { bestAttemptFont = UIFont.FromName(baseFontName, size); } } else { // an embedded font or a explicitly named system font? bestAttemptFont = EmbeddedFont(family, size, assembly); if (bestAttemptFont == null) { bestAttemptFont = UIFont.FromName(family, size); } } if (bestAttemptFont != null) { // we have a match but is wasn't cached - so let's cache it for future reference lock (dictionary) { if (!dictionary.TryGetValue(key, out UIFont storedUiFont)) { // It could have been added by another thread so only add if we're really sure it's no there! dictionary.Add(key, bestAttemptFont); } } return(bestAttemptFont); } // fall back to a system font if (bold && italic) { UIFont systemFont = UIFont.SystemFontOfSize(size); var descriptor = systemFont.FontDescriptor.CreateWithTraits(UIFontDescriptorSymbolicTraits.Bold | UIFontDescriptorSymbolicTraits.Italic); bestAttemptFont = UIFont.FromDescriptor(descriptor, size); } if (bestAttemptFont == null && italic) { bestAttemptFont = UIFont.ItalicSystemFontOfSize(size); } if (bestAttemptFont == null && bold) { bestAttemptFont = UIFont.BoldSystemFontOfSize(size); } if (bestAttemptFont == null) { bestAttemptFont = UIFont.SystemFontOfSize(size); } return(bestAttemptFont); }
public TTGSnackbar() : base(CoreGraphics.CGRect.FromLTRB(0, 0, 320, 44)) { this.TranslatesAutoresizingMaskIntoConstraints = false; this.BackgroundColor = UIColor.DarkGray; this.Layer.CornerRadius = 4; this.Layer.MasksToBounds = true; SetupSafeAreaInsets(); this.MessageLabel = new UILabel { TranslatesAutoresizingMaskIntoConstraints = false, TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(14), BackgroundColor = UIColor.Clear, LineBreakMode = UILineBreakMode.WordWrap, TextAlignment = UITextAlignment.Left, Lines = 0 }; this.AddSubview(this.MessageLabel); IconImageView = new UIImageView() { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColor.Clear, ContentMode = IconContentMode }; this.AddSubview(IconImageView); this.ActionButton = new UIButton { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColor.Clear }; this.ActionButton.TitleLabel.Font = UIFont.SystemFontOfSize(14); this.ActionButton.TitleLabel.AdjustsFontSizeToFitWidth = true; this.ActionButton.SetTitleColor(UIColor.White, UIControlState.Normal); this.ActionButton.TouchUpInside += (s, e) => { // there is a chance that user doesn't want to do anything here, he simply wants to dismiss ActionBlock?.Invoke(this); Dismiss(); }; this.AddSubview(this.ActionButton); this.SecondActionButton = new UIButton { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColor.Clear }; this.SecondActionButton.TitleLabel.Font = UIFont.BoldSystemFontOfSize(14); this.SecondActionButton.TitleLabel.AdjustsFontSizeToFitWidth = true; this.SecondActionButton.SetTitleColor(UIColor.White, UIControlState.Normal); this.SecondActionButton.TouchUpInside += (s, e) => { SecondActionBlock?.Invoke(this); Dismiss(); }; this.AddSubview(this.SecondActionButton); this.seperateView = new UIView { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColor.Gray }; this.AddSubview(this.seperateView); // Add constraints var hConstraints = NSLayoutConstraint.FromVisualFormat( "H:|-10-[iconImageView]-2-[messageLabel]-2-[seperateView(0.5)]-2-[actionButton(>=44@999)]-0-[secondActionButton(>=44@999)]-0-|", 0, new NSDictionary(), NSDictionary.FromObjectsAndKeys( new NSObject[] { IconImageView, MessageLabel, seperateView, ActionButton, SecondActionButton }, new NSObject[] { new NSString("iconImageView"), new NSString("messageLabel"), new NSString("seperateView"), new NSString("actionButton"), new NSString("secondActionButton") } ) ); var vConstraintsForIconImageView = NSLayoutConstraint.FromVisualFormat( "V:|-2-[iconImageView]-2-|", 0, new NSDictionary(), NSDictionary.FromObjectsAndKeys(new NSObject[] { IconImageView }, new NSObject[] { new NSString("iconImageView") }) ); var vConstraintsForMessageLabel = NSLayoutConstraint.FromVisualFormat( "V:|-0-[messageLabel]-0-|", 0, new NSDictionary(), NSDictionary.FromObjectsAndKeys(new NSObject[] { MessageLabel }, new NSObject[] { new NSString("messageLabel") }) ); var vConstraintsForSeperateView = NSLayoutConstraint.FromVisualFormat( "V:|-4-[seperateView]-4-|", 0, new NSDictionary(), NSDictionary.FromObjectsAndKeys(new NSObject[] { seperateView }, new NSObject[] { new NSString("seperateView") }) ); var vConstraintsForActionButton = NSLayoutConstraint.FromVisualFormat( "V:|-0-[actionButton]-0-|", 0, new NSDictionary(), NSDictionary.FromObjectsAndKeys(new NSObject[] { ActionButton }, new NSObject[] { new NSString("actionButton") }) ); var vConstraintsForSecondActionButton = NSLayoutConstraint.FromVisualFormat( "V:|-0-[secondActionButton]-0-|", 0, new NSDictionary(), NSDictionary.FromObjectsAndKeys(new NSObject[] { SecondActionButton }, new NSObject[] { new NSString("secondActionButton") }) ); iconImageViewWidthConstraint = NSLayoutConstraint.Create(IconImageView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, TTGSnackbar.snackbarIconImageViewWidth); actionButtonWidthConstraint = NSLayoutConstraint.Create(ActionButton, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, TTGSnackbar.snackbarActionButtonMinWidth); secondActionButtonWidthConstraint = NSLayoutConstraint.Create(SecondActionButton, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, TTGSnackbar.snackbarActionButtonMinWidth); //var vConstraintsForActivityIndicatorView = NSLayoutConstraint.FromVisualFormat( //"V:|-2-[activityIndicatorView]-2-|", 0,new NSDictionary(), NSDictionary.FromObjectsAndKeys(new NSObject[] { activityIndicatorView }, new NSObject[] { new NSString("activityIndicatorView") }) //); //todo fix constraint //var hConstraintsForActivityIndicatorView = NSLayoutConstraint.FromVisualFormat( // //"H:[activityIndicatorView(activityIndicatorWidth)]-2-|", // "H:[activityIndicatorView]-2-|", // 0, // new NSDictionary(), // NSDictionary.FromObjectsAndKeys( // new NSObject[] { activityIndicatorView }, // new NSObject[] { new NSString("activityIndicatorView") }) // //NSDictionary.FromObjectsAndKeys(new NSObject[] { activityIndicatorView }, new NSObject[] { }) //); IconImageView.AddConstraint(iconImageViewWidthConstraint); ActionButton.AddConstraint(actionButtonWidthConstraint); SecondActionButton.AddConstraint(secondActionButtonWidthConstraint); this.AddConstraints(hConstraints); this.AddConstraints(vConstraintsForIconImageView); this.AddConstraints(vConstraintsForMessageLabel); this.AddConstraints(vConstraintsForSeperateView); this.AddConstraints(vConstraintsForActionButton); this.AddConstraints(vConstraintsForSecondActionButton); //this.AddConstraints(vConstraintsForActivityIndicatorView); //this.AddConstraints(hConstraintsForActivityIndicatorView); }
public override void ViewDidLoad() { base.ViewDidLoad(); //Hide MT Buttons //Ad1MTButton.Alpha = 0f; //Ad2MTButton.Alpha = 0f; //Ad3MTButton.Alpha = 0f; //Ad4MTButton.Alpha = 0f; var ad1 = DataObject.Ads[0]; //var ad2 = DataObject.Ads[1]; //var ad3 = DataObject.Ads[2]; //var ad4 = DataObject.Ads[3]; //Hide text button if broker doesn't have a cell phone if (string.IsNullOrEmpty(ad1.BrokerCellPhone)) { Ad1MessageButton.Alpha = 0f; } ; //if (string.IsNullOrEmpty(ad2.BrokerCellPhone)) //{ // Ad2MessageButton.Alpha = 0f; //}; //if (string.IsNullOrEmpty(ad3.BrokerCellPhone)) //{ // Ad3MessageButton.Alpha = 0f; //}; //if (string.IsNullOrEmpty(ad4.BrokerCellPhone)) //{ // Ad4MessageButton.Alpha = 0f; //}; AdImage1.SetImage( url: new NSUrl(ad1.ImageURL), placeholder: UIImage.FromBundle("ad_placeholder.jpg") ); AdName1.Text = ad1.Name; AdPrice1.Text = ad1.Price; Ad1NameButton.SetTitle(ad1.Name, UIControlState.Normal); // AdImage2.SetImage( // url: new NSUrl(ad2.ImageURL), // placeholder: UIImage.FromBundle("ad_placeholder.jpg") //); // AdName2.Text = ad2.Name; // AdPrice2.Text = ad2.Price; // Ad2NameButton.SetTitle(ad2.Name, UIControlState.Normal); // AdImage3.SetImage( // url: new NSUrl(ad3.ImageURL), // placeholder: UIImage.FromBundle("ad_placeholder.jpg") //); // AdName3.Text = ad3.Name; // AdPrice3.Text = ad3.Price; // Ad3NameButton.SetTitle(ad3.Name, UIControlState.Normal); // AdImage4.SetImage( // url: new NSUrl(ad4.ImageURL), // placeholder: UIImage.FromBundle("ad_placeholder.jpg") //); // AdName4.Text = ad4.Name; // AdPrice4.Text = ad4.Price; // Ad4NameButton.SetTitle(ad4.Name, UIControlState.Normal); var labelAttribute = new UIStringAttributes { Font = UIFont.BoldSystemFontOfSize(18) }; var brokerLabelAttribute = new UIStringAttributes { Font = UIFont.BoldSystemFontOfSize(15) }; var valueAttribute = new UIStringAttributes { Font = UIFont.SystemFontOfSize(15), ForegroundColor = UIColor.Blue }; Ad1TeaserLabel.Text = ad1.Teaser == string.Empty ? "Inquire for Details" : ad1.Teaser; //Ad2TeaserLabel.Text = ad2.Teaser == string.Empty ? "Inquire for Details" : ad2.Teaser; //Ad3TeaserLabel.Text = ad3.Teaser == string.Empty ? "Inquire for Details" : ad3.Teaser; //Ad4TeaserLabel.Text = ad4.Teaser == string.Empty ? "Inquire for Details" : ad4.Teaser; #region attributed labels Ad1BrokerButton.SetAttributedTitle(HelperMethods.GetBrokerAttributedString(ad1, brokerLabelAttribute, valueAttribute), UIControlState.Normal); //Ad2BrokerButton.SetAttributedTitle(HelperMethods.GetBrokerAttributedString(ad2, brokerLabelAttribute, valueAttribute), UIControlState.Normal); //Ad3BrokerButton.SetAttributedTitle(HelperMethods.GetBrokerAttributedString(ad3, brokerLabelAttribute, valueAttribute), UIControlState.Normal); //Ad4BrokerButton.SetAttributedTitle(HelperMethods.GetBrokerAttributedString(ad4, brokerLabelAttribute, valueAttribute), UIControlState.Normal); Ad1RegistrationLabel.AttributedText = HelperMethods.GetRegistrationAttributedString(ad1, labelAttribute); //Ad2RegistrationLabel.AttributedText = HelperMethods.GetRegistrationAttributedString(ad2, labelAttribute); //Ad3RegistrationLabel.AttributedText = HelperMethods.GetRegistrationAttributedString(ad3, labelAttribute); //Ad4RegistrationLabel.AttributedText = HelperMethods.GetRegistrationAttributedString(ad4, labelAttribute); Ad1SerialLabel.AttributedText = HelperMethods.GetSerialAttributedString(ad1, labelAttribute); //Ad2SerialLabel.AttributedText = HelperMethods.GetSerialAttributedString(ad2, labelAttribute); //Ad3SerialLabel.AttributedText = HelperMethods.GetSerialAttributedString(ad3, labelAttribute); //Ad4SerialLabel.AttributedText = HelperMethods.GetSerialAttributedString(ad4, labelAttribute); Ad1TimeLabel.AttributedText = HelperMethods.GetTotalTimeAttributedString(ad1, labelAttribute); //Ad2TimeLabel.AttributedText = HelperMethods.GetTotalTimeAttributedString(ad2, labelAttribute); //Ad3TimeLabel.AttributedText = HelperMethods.GetTotalTimeAttributedString(ad3, labelAttribute); //Ad4TimeLabel.AttributedText = HelperMethods.GetTotalTimeAttributedString(ad4, labelAttribute); Ad1LocationLabel.AttributedText = HelperMethods.GetLocationAttributedString(ad1, labelAttribute); //Ad2LocationLabel.AttributedText = HelperMethods.GetLocationAttributedString(ad2, labelAttribute); //Ad3LocationLabel.AttributedText = HelperMethods.GetLocationAttributedString(ad3, labelAttribute); //Ad4LocationLabel.AttributedText = HelperMethods.GetLocationAttributedString(ad4, labelAttribute); #endregion #region price changed if (!HelperMethods.ShowPriceChangedLabel(ad1.PriceLastUpdated)) { Ad1PriceChangeLabel.Alpha = 0f; } //if (!HelperMethods.ShowPriceChangedLabel(ad2.PriceLastUpdated)) //{ // Ad2PriceChangeLabel.Alpha = 0f; //} //if (!HelperMethods.ShowPriceChangedLabel(ad3.PriceLastUpdated)) //{ // Ad3PriceChangeLabel.Alpha = 0f; //} //if (!HelperMethods.ShowPriceChangedLabel(ad4.PriceLastUpdated)) //{ // Ad4PriceChangeLabel.Alpha = 0f; //} #endregion //Set initial state of like buttons if (DataObject.Ads[0].IsLiked) { HelperMethods.SetInitialLikeButtonState(AdLike1, DataObject.Ads[0]); } //if (DataObject.Ads[1].IsLiked) //{ // HelperMethods.SetInitialLikeButtonState(AdLike2, DataObject.Ads[1]); //} //if (DataObject.Ads[2].IsLiked) //{ // HelperMethods.SetInitialLikeButtonState(AdLike3, DataObject.Ads[2]); //} //if (DataObject.Ads[3].IsLiked) //{ // HelperMethods.SetInitialLikeButtonState(AdLike4, DataObject.Ads[3]); //} //webview image tap gestures AdImage1.UserInteractionEnabled = true; AdImage2.UserInteractionEnabled = true; AdImage3.UserInteractionEnabled = true; AdImage4.UserInteractionEnabled = true; //UITapGestureRecognizer tapGesture1 = new UITapGestureRecognizer(TapImageAction1); //AdImage1.AddGestureRecognizer(tapGesture1); //UITapGestureRecognizer tapGesture2 = new UITapGestureRecognizer(TapImageAction2); //AdImage2.AddGestureRecognizer(tapGesture2); //UITapGestureRecognizer tapGesture3 = new UITapGestureRecognizer(TapImageAction3); //AdImage3.AddGestureRecognizer(tapGesture3); //UITapGestureRecognizer tapGesture4 = new UITapGestureRecognizer(TapImageAction4); //AdImage4.AddGestureRecognizer(tapGesture4); tapGesture1 = new UITapGestureRecognizer(TapImageAction1); tapGesture2 = new UITapGestureRecognizer(TapImageAction2); tapGesture3 = new UITapGestureRecognizer(TapImageAction3); tapGesture4 = new UITapGestureRecognizer(TapImageAction4); int currentIndex = this.DataObject.MagazinePageIndex; int totalPages = this.DataObject.TotalPages; PageIndicator.SetIndicatorState(currentIndex, totalPages); //Randomly load banmanpro //HelperMethods.LoadWebBanManPro(this.View); }
public override void ViewDidLoad() { base.ViewDidLoad(); //hidden by request. _letterTitleLabel.Text = ""; _letterLabel.TextAlignment = UITextAlignment.Center; _letterLabel.Font = UIFont.BoldSystemFontOfSize(130.0f); _letterLabel.TranslatesAutoresizingMaskIntoConstraints = false; ChooseNewLetter(); //_timerTitleLabel.Text = "Compteur"; //_timerTitleLabel.Font = UIFont.BoldSystemFontOfSize(16.0f); _newGameButton.TitleLabel.Text = "Nouvelle Partie"; _newGameButton.TranslatesAutoresizingMaskIntoConstraints = false; _secs = GetTimerValueInSeconds(); _timerLabel.Text = FormatSeconds(GetTimerValueInSeconds()); _timerLabel.TranslatesAutoresizingMaskIntoConstraints = false; _timerLabel.TextAlignment = UITextAlignment.Center; _timerLabel.Font = UIFont.BoldSystemFontOfSize(50.0f); _timerSlider.TranslatesAutoresizingMaskIntoConstraints = false; _timerSlider.ValueChanged += (sender, e) => { var value = (float)Math.Round(GetTimerValueInSeconds()); _timerLabel.Text = FormatSeconds(value); _secs = value; _timerSlider.Value = (float)Math.Round(_timerSlider.Value); }; var swipeRight = new UISwipeGestureRecognizer(ChooseNewLetter); swipeRight.Direction = UISwipeGestureRecognizerDirection.Right; var swipeLeft = new UISwipeGestureRecognizer(ChooseNewLetter); swipeLeft.Direction = UISwipeGestureRecognizerDirection.Left; _letterLabel.AddGestureRecognizer(swipeRight); _letterLabel.AddGestureRecognizer(swipeLeft); _letterLabel.UserInteractionEnabled = true; _newGameButton.SetTitle("Nouvelle partie", UIControlState.Normal); _newGameButton.Layer.BorderWidth = 1; _newGameButton.Layer.CornerRadius = 15; _newGameButton.Layer.BorderColor = UIColor.Black.CGColor; _newGameButton.UserInteractionEnabled = true; _newGameButton.TouchUpInside += NewGameButton_OnNewGame; _timerLabel.Font = UIFont.BoldSystemFontOfSize(50.0f); _stopButton.SetTitle("Stop", UIControlState.Normal); _stopButton.TranslatesAutoresizingMaskIntoConstraints = false; _stopButton.UserInteractionEnabled = true; _stopButton.TouchUpInside += StopButton_OnStop; _stopButton.Layer.BorderWidth = 1; _stopButton.Layer.CornerRadius = 15; _stopButton.Layer.BorderColor = UIColor.Black.CGColor; var viewToAdd = NSDictionary.FromObjectsAndKeys(new object[] { _letterLabel, _timerLabel, _timerSlider, _newGameButton, _stopButton } , new object[] { "letter", "timerLabel", "timerSlider", "newGameButton", "stopButton" }); var sidePadding = 50; View.AddConstraints(NSLayoutConstraint.FromVisualFormat(@"H:|-[letter]-|", 0, null, viewToAdd)); View.AddConstraints(NSLayoutConstraint.FromVisualFormat(@"H:|-[timerLabel]-|", 0, null, viewToAdd)); View.AddConstraints(NSLayoutConstraint.FromVisualFormat(@"H:|-[timerSlider]-|", 0, null, viewToAdd)); View.AddConstraints(NSLayoutConstraint.FromVisualFormat($@"H:|-({sidePadding})-[newGameButton]-({sidePadding})-|", 0, null, viewToAdd)); View.AddConstraints(NSLayoutConstraint.FromVisualFormat($@"H:|-({sidePadding})-[stopButton]-({sidePadding})-|", 0, null, viewToAdd)); View.AddConstraints(NSLayoutConstraint.FromVisualFormat(@"V:|-(100)-[letter]-(100@200)-[timerLabel]-[timerSlider]", 0, null, viewToAdd)); View.AddConstraints(NSLayoutConstraint.FromVisualFormat(@"V:[newGameButton(50)]-[stopButton(50)]-(125)-|", 0, null, viewToAdd)); }
public override CGSize GetSizeForItem(UICollectionView collectionView, UICollectionViewLayout layout, NSIndexPath indexPath) { var friend = ((DataSource)collectionView.WeakDataSource)._friends[indexPath.Row]; CGSize size = new NSString(friend.FirstLastName + " " ).GetSizeUsingAttributes(new UIStringAttributes(NSDictionary.FromObjectAndKey(UIFont.BoldSystemFontOfSize(15), UIStringAttributeKey.Font))); size.Width += 10; size.Height += 10; collectionView.SystemLayoutSizeFittingSize(size, 1.0f, 1.0f); return size; }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = "Floating Label Demo"; View.BackgroundColor = UIColor.White; float topOffset = UIApplication.SharedApplication.StatusBarFrame.Size.Height + NavigationController.NavigationBar.Frame.Size.Height; UIColor floatingLabelColor = UIColor.Gray, floatingLabelActiveColor = UIColor.Blue; var titleField = new JVFloatLabeledTextField(new RectangleF(JVFieldHMargin, topOffset, View.Frame.Size.Width - 2 * JVFieldHMargin, JVFieldHeight)) { Placeholder = "Title", Font = UIFont.SystemFontOfSize(JVFieldFontSize), ClearButtonMode = UITextFieldViewMode.WhileEditing, FloatingLabelFont = UIFont.BoldSystemFontOfSize(JVFieldFloatingLabelFontSize), FloatingLabelTextColor = floatingLabelColor, FloatingLabelActiveTextColor = floatingLabelActiveColor }; View.AddSubview(titleField); var div1 = new UIView(new RectangleF(JVFieldHMargin, titleField.Frame.Y + titleField.Frame.Size.Height, View.Frame.Size.Width - 2 * JVFieldHMargin, 1)) { BackgroundColor = UIColor.LightGray.ColorWithAlpha(0.3f) }; View.AddSubview(div1); var priceField = new JVFloatLabeledTextField(new RectangleF(JVFieldHMargin, div1.Frame.Y + div1.Frame.Size.Height, 80, JVFieldHeight)) { Placeholder = "Price", Font = UIFont.SystemFontOfSize(JVFieldFontSize), FloatingLabelFont = UIFont.BoldSystemFontOfSize(JVFieldFloatingLabelFontSize), FloatingLabelTextColor = floatingLabelColor, FloatingLabelActiveTextColor = floatingLabelActiveColor, Text = "3.14" }; View.AddSubview(priceField); var div2 = new UIView(new RectangleF(JVFieldHMargin + priceField.Frame.Size.Width, titleField.Frame.Y + titleField.Frame.Size.Height, 1, JVFieldHeight)) { BackgroundColor = UIColor.LightGray.ColorWithAlpha(0.3f) }; View.AddSubview(div2); var locationField = new JVFloatLabeledTextField(new RectangleF(JVFieldHMargin + JVFieldHMargin + priceField.Frame.Size.Width + 1.0f, div1.Frame.Y + div1.Frame.Size.Height, View.Frame.Size.Width - 3 * JVFieldHMargin - priceField.Frame.Size.Width - 1.0f, JVFieldHeight)) { Placeholder = "Specific Location (optional)", Font = UIFont.SystemFontOfSize(JVFieldFontSize), FloatingLabelFont = UIFont.BoldSystemFontOfSize(JVFieldFloatingLabelFontSize), FloatingLabelTextColor = floatingLabelColor, FloatingLabelActiveTextColor = floatingLabelActiveColor }; View.AddSubview(locationField); var div3 = new UIView(new RectangleF(JVFieldHMargin, priceField.Frame.Y + priceField.Frame.Size.Height, View.Frame.Size.Width - 2 * JVFieldHMargin, 1)) { BackgroundColor = UIColor.LightGray.ColorWithAlpha(0.3f) }; View.AddSubview(div3); var descriptionField = new JVFloatLabeledTextField(new RectangleF(JVFieldHMargin, div3.Frame.Y + div3.Frame.Size.Height, View.Frame.Size.Width - 2 * JVFieldHMargin, JVFieldHeight)) { Placeholder = "Description", Font = UIFont.SystemFontOfSize(JVFieldFontSize), FloatingLabelFont = UIFont.BoldSystemFontOfSize(JVFieldFloatingLabelFontSize), FloatingLabelTextColor = floatingLabelColor, FloatingLabelActiveTextColor = floatingLabelActiveColor }; View.AddSubview(descriptionField); titleField.BecomeFirstResponder(); NavigationItem.RightBarButtonItem = new UIBarButtonItem("Dialog Demo", UIBarButtonItemStyle.Plain, delegate { this.NavigationController.PushViewController(new DialogDemoViewController(), true); }); }
public override void ViewDidLoad() { base.ViewDidLoad(); UIButton backButton = new UIButton(); View.BackgroundColor = UIColor.White; backButton.TranslatesAutoresizingMaskIntoConstraints = false; backButton.SetTitle("Back", UIControlState.Normal); backButton.SetTitleColor(UIColor.SystemBlueColor, UIControlState.Normal); backButton.TouchUpInside += (sender, e) => { this.DismissViewController(true, null); }; UIButton deleteButton = new UIButton(); View.BackgroundColor = UIColor.White; deleteButton.TranslatesAutoresizingMaskIntoConstraints = false; deleteButton.SetTitle("Delete", UIControlState.Normal); deleteButton.SetTitleColor(UIColor.SystemRedColor, UIControlState.Normal); deleteButton.TouchUpInside += (sender, e) => { DataService.DeleteNote(data, indexPath); this.DismissViewController(true, null); }; UILabel titleLabel = new UILabel(); titleLabel.Text = data.Title; titleLabel.TranslatesAutoresizingMaskIntoConstraints = false; titleLabel.Font = UIFont.BoldSystemFontOfSize(17); UITextView contentsTextView = new UITextView(); contentsTextView.Text = data.Contents; contentsTextView.TranslatesAutoresizingMaskIntoConstraints = false; contentsTextView.TextAlignment = UITextAlignment.Left; View.AddSubview(backButton); View.AddSubview(titleLabel); View.AddSubview(contentsTextView); View.AddSubview(deleteButton); backButton.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor, 10).Active = true; backButton.TopAnchor.ConstraintEqualTo(View.TopAnchor, 20).Active = true; backButton.WidthAnchor.ConstraintEqualTo(60).Active = true; backButton.HeightAnchor.ConstraintEqualTo(30).Active = true; titleLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor, 10).Active = true; titleLabel.TopAnchor.ConstraintEqualTo(backButton.TopAnchor, 30).Active = true; titleLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor, 10).Active = true; titleLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor, -10).Active = true; titleLabel.HeightAnchor.ConstraintEqualTo(50).Active = true; contentsTextView.TopAnchor.ConstraintEqualTo(titleLabel.BottomAnchor, 5).Active = true; contentsTextView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor, 10).Active = true; contentsTextView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor, -10).Active = true; contentsTextView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active = true; deleteButton.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor, -10).Active = true; deleteButton.TopAnchor.ConstraintEqualTo(View.TopAnchor, 20).Active = true; deleteButton.WidthAnchor.ConstraintEqualTo(100).Active = true; deleteButton.HeightAnchor.ConstraintEqualTo(30).Active = true; }
private void DrawDate(DateTime dateTime, float startX, float startY) { int year = dateTime.Year; int month = dateTime.Month; #region 画时间 daysString = new int[6, 7]; UIFont font = UIFont.BoldSystemFontOfSize(mDaySize); //mPaint.TextSize = mDaySize * mDisplayMetrics.ScaledDensity;//.scaledDensity; string dayString; int pMonthDays = getMonthDays(dateTime.AddMonths(-1).Year, dateTime.AddMonths(-1).Month); int mMonthDays = getMonthDays(year, month); int weekNumber = (int)new DateTime(year, month, 1).DayOfWeek + 1;// DateUtils.getFirstDayWeek(year, month); int row = 0, column = 0; int firstDay = 0; bool isPreviousDone = true; if (weekNumber == 1) { firstDay = pMonthDays - 7; } else { firstDay = pMonthDays - weekNumber + 1; }; oDayColor.SetFill(); for (int day = firstDay; row < 6; row++) { for (; column < 7; day++, column++) { if (day == pMonthDays && isPreviousDone) { day = 0; isPreviousDone = false; } else if (day == mMonthDays && !isPreviousDone) { day = 0; oDayColor.SetFill(); isPreviousDone = true; } dayString = (day + 1).ToString(); daysString[row, column] = day + 1; //startX = columnWidth * i + (columnWidth - fontWidth) / 2; //startY = (int)(height / 2 - ((float)text.StringSize(font).Height) / 2); float fontWidth;// = (float)day.ToString().StringSize(font).Width; if (day.ToString().Length > 1) { fontWidth = (float)"00".StringSize(font).Width; } else { fontWidth = (float)"0".StringSize(font).Width; } startX = (mColumnSize * column + (mColumnSize - fontWidth) / 2); startY = (mRowSize * row + mRowSize / 2 - (float)day.ToString().StringSize(font).Height / 2); Console.WriteLine(day + "," + day.ToString().StringSize(font).Width + "," + fontWidth); if (day == 9) { //Console.WriteLine("day==10," + day.ToString().StringSize(font).Width + "," + fontWidth); startX -= fontWidth / 2;// (int)(mColumnSize - fontWidth) / 4; } if (dayString.Equals(mSelDay + "") && !isPreviousDone) { //绘制背景色矩形 int startRecX = mColumnSize * column; int startRecY = mRowSize * row; int endRecX = startRecX + mColumnSize; int endRecY = startRecY + mRowSize; mSelectBGColor.SetFill();//.SetColor(mSelectBGColor); //this.DrawRect(new CGRect(startRecX, startRecY, endRecX, endRecY), UIViewPrintFormatter.); //canvas.DrawRect(startRecX, startRecY, endRecX, endRecY, mPaint); //记录第几行,即第几周 weekRow = row + 1; } //绘制事务圆形标志 //if (!isPreviousDone) DrawCircle(row, column, year, month, day + 1, canvas); if (dayString.Equals(mSelDay + "") && !isPreviousDone) { mSelectDayColor.SetFill(); } //else if (dayString.Equals(mCurrDay + "") && mCurrDay != mSelDay && mCurrMonth == this.Element.Date.Month && mCurrYear == this.Element.Date.Year && !isPreviousDone) //{ // //正常月,选中其他日期,则今日为红色 // mCurrentColor.SetFill(); //} else if (!isPreviousDone) { mDayColor.SetFill(); } new NSString(dayString).DrawString(new CGPoint(startX, startY), font); //canvas.DrawText(dayString, startX, startY, mPaint); continue; } column = 0; } #endregion //canvas.Restore();//.restore(); }
/// <summary> /// Setups the view. /// </summary> private void SetupView() { // this.ActualBox.Layer.CornerRadius = 4.0f; this.ActualBox.Layer.MasksToBounds = true; // UIColor messageLabelTextColor = null; UIColor elementBackgroundColor = null; UIColor buttonBackgroundColor = null; // var style = this.BlurEffectStyle; // switch (style) { case UIBlurEffectStyle.Dark: { messageLabelTextColor = UIColor.White; elementBackgroundColor = UIColor.FromWhiteAlpha(1.0f, 0.07f); buttonBackgroundColor = UIColor.FromWhiteAlpha(1.0f, 0.07f); } break; default: { messageLabelTextColor = UIColor.Black; elementBackgroundColor = UIColor.FromWhiteAlpha(1.0f, 0.50f); buttonBackgroundColor = UIColor.FromWhiteAlpha(1.0f, 0.2f); } break; } this.VisualEffectView = new UIVisualEffectView(UIBlurEffect.FromStyle(style)); var padding = 10.0f; var width = this.ActualBox.Frame.Size.Width - padding * 2; UILabel titleLabel = new UILabel(new CGRect(padding, padding, width, 20)); titleLabel.Font = UIFont.BoldSystemFontOfSize(17.0f); titleLabel.Text = this.Title; titleLabel.TextAlignment = UITextAlignment.Center; titleLabel.TextColor = TitleLabelTextColor; this.VisualEffectView.ContentView.Add(titleLabel); var messageLabel = new UILabel(new CGRect(padding, padding + titleLabel.Frame.Size.Height + 5, width, 31.5)); messageLabel.Lines = 2; messageLabel.Font = UIFont.SystemFontOfSize(13.0f); messageLabel.Text = this.Message; messageLabel.TextAlignment = UITextAlignment.Center; messageLabel.TextColor = messageLabelTextColor; messageLabel.SizeToFit(); //center the frame var mFrame = messageLabel.Frame; mFrame.Width = width; messageLabel.Frame = mFrame; this.VisualEffectView.ContentView.Add(messageLabel); var aView = this.ContentView; var conFrame = aView.Frame; conFrame.Y = messageLabel.Frame.Y + messageLabel.Frame.Height + padding / 1.5f; conFrame.X = (this.ActualBox.Frame.Size.Width / 2) - (conFrame.Width / 2); aView.Frame = conFrame; var buttonHeight = 40.0f; var aPos = messageLabel.Frame.Bottom + buttonHeight; CGRect extendedFrame = this.ActualBox.Frame; extendedFrame.Height = aPos + padding; extendedFrame.Height += aView.Frame.Height; this.ActualBox.Frame = extendedFrame; this.VisualEffectView.ContentView.Add(aView); // foreach (UIView element in aView.Subviews) { if (element is UITextField) { element.Layer.BorderColor = UIColor.FromWhiteAlpha(0.0f, 0.1f).CGColor; element.Layer.BorderWidth = 0.5f; element.BackgroundColor = elementBackgroundColor; } } // var buttonWidth = this.ActualBox.Frame.Size.Width / 2; switch (ButtonMode) { case ButtonMode.OkAndCancel: { // UIButton cancelButton = new UIButton(new CGRect(0, this.ActualBox.Frame.Size.Height - buttonHeight, buttonWidth, buttonHeight)); cancelButton.SetTitle(!(String.IsNullOrWhiteSpace(this.CancelButtonText)) ? this.CancelButtonText : @"Cancel", UIControlState.Normal); cancelButton.TouchUpInside += (object sender, EventArgs e) => { CancelButtonTapped(); }; cancelButton.TitleLabel.Font = UIFont.SystemFontOfSize(16.0f); cancelButton.SetTitleColor(ButtonsTextColor, UIControlState.Normal); cancelButton.SetTitleColor(UIColor.Gray, UIControlState.Highlighted); cancelButton.BackgroundColor = buttonBackgroundColor; cancelButton.Layer.BorderColor = UIColor.FromWhiteAlpha(0.0f, 0.1f).CGColor; cancelButton.Layer.BorderWidth = 0.5f; this.VisualEffectView.ContentView.Add(cancelButton); // var submitButton = new UIButton(new CGRect(buttonWidth, this.ActualBox.Frame.Size.Height - buttonHeight, buttonWidth, buttonHeight)); submitButton.SetTitle(!(String.IsNullOrWhiteSpace(this.SubmitButtonText)) ? this.SubmitButtonText : @"OK", UIControlState.Normal); submitButton.TouchUpInside += (object sender, EventArgs e) => { SubmitButtonTapped(); }; submitButton.TitleLabel.Font = UIFont.SystemFontOfSize(16.0f); submitButton.SetTitleColor(ButtonsTextColor, UIControlState.Normal); submitButton.SetTitleColor(UIColor.Gray, UIControlState.Highlighted); submitButton.BackgroundColor = buttonBackgroundColor; submitButton.Layer.BorderColor = UIColor.FromWhiteAlpha(0.0f, 0.1f).CGColor; submitButton.Layer.BorderWidth = 0.5f; this.VisualEffectView.ContentView.Add(submitButton); } break; case ButtonMode.Ok: { var submitButton = new UIButton(new CGRect(0, this.ActualBox.Frame.Size.Height - buttonHeight, this.ActualBox.Frame.Size.Width, buttonHeight)); submitButton.SetTitle(!(String.IsNullOrWhiteSpace(this.SubmitButtonText)) ? this.SubmitButtonText : @"OK", UIControlState.Normal); submitButton.TouchUpInside += (object sender, EventArgs e) => { SubmitButtonTapped(); }; submitButton.TitleLabel.Font = UIFont.SystemFontOfSize(16.0f); submitButton.SetTitleColor(ButtonsTextColor, UIControlState.Normal); submitButton.SetTitleColor(UIColor.Gray, UIControlState.Highlighted); submitButton.BackgroundColor = buttonBackgroundColor; submitButton.Layer.BorderColor = UIColor.FromWhiteAlpha(0.0f, 0.1f).CGColor; submitButton.Layer.BorderWidth = 0.5f; this.VisualEffectView.ContentView.Add(submitButton); } break; case ButtonMode.Cancel: { UIButton cancelButton = new UIButton(new CGRect(0, this.ActualBox.Frame.Size.Height - buttonHeight, this.ActualBox.Frame.Size.Width, buttonHeight)); cancelButton.SetTitle(!(String.IsNullOrWhiteSpace(this.CancelButtonText)) ? this.CancelButtonText : @"Cancel", UIControlState.Normal); cancelButton.TouchUpInside += (object sender, EventArgs e) => { CancelButtonTapped(); }; cancelButton.TitleLabel.Font = UIFont.SystemFontOfSize(16.0f); cancelButton.SetTitleColor(ButtonsTextColor, UIControlState.Normal); cancelButton.SetTitleColor(UIColor.Gray, UIControlState.Highlighted); cancelButton.BackgroundColor = buttonBackgroundColor; cancelButton.Layer.BorderColor = UIColor.FromWhiteAlpha(0.0f, 0.1f).CGColor; cancelButton.Layer.BorderWidth = 0.5f; this.VisualEffectView.ContentView.Add(cancelButton); } break; } // this.VisualEffectView.Frame = new CGRect(0, 0, this.ActualBox.Frame.Size.Width, this.ActualBox.Frame.Size.Height + 45); this.ActualBox.Add(this.VisualEffectView); this.ActualBox.Center = this.Center; var window = UIApplication.SharedApplication.Windows[UIApplication.SharedApplication.Windows.Length - 1]; mBackingView = new UIView(window.Bounds); if (!DisableBackgroundOverlay) { mBackingView.BackgroundColor = BackgroundOverlayColor; this.InsertSubview(mBackingView, 0); } }
protected override void InitializeObjects() { base.InitializeObjects(); var topView = new UIView(); var scrollView = new UIScrollView(); var topTextRowView = new UIView(); var centerTextRowView = new UIView(); var bottomTextRowView = new UIView(); var bottomView = new UIView(); var profileNavigationBarBackground = new UIImageView(UIImage.FromBundle(@"Images/navigation_bar_background.png")); backHomeView = UIButton.FromType(UIButtonType.Custom); backHomeView.SetImage(UIImage.FromFile(@"Images/ic_back.png"), UIControlState.Normal); nameOfPageLabel = LabelInformationAboutPage(UIColor.White, "Profile", UIFont.BoldSystemFontOfSize(16f)); informationAboutPageLabel = LabelInformationAboutPage(UIColor.FromRGB(29, 157, 189), "Please, Enter Your Personal Information.", UIFont.FromName("Helvetica", 14f)); // Hide navigation bar NavigationController.SetNavigationBarHidden(true, false); View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(@"Images/tab_background.png").Scale(View.Frame.Size)); profileNavigationBarBackground.Frame = new CGRect(10, 10, profileNavigationBarBackground.Image.CGImage.Width, profileNavigationBarBackground.Image.CGImage.Height); var labelView = new UIView(); labelView.AddIfNotNull(nameOfPageLabel, informationAboutPageLabel); labelView.AddConstraints( nameOfPageLabel.AtTopOf(labelView, 20), nameOfPageLabel.WithSameCenterX(labelView), nameOfPageLabel.WithSameCenterY(labelView), nameOfPageLabel.WithSameWidth(labelView), nameOfPageLabel.WithRelativeHeight(labelView, 0.3f), informationAboutPageLabel.Below(nameOfPageLabel, 5), informationAboutPageLabel.WithSameWidth(labelView), informationAboutPageLabel.WithSameCenterX(labelView), informationAboutPageLabel.WithRelativeHeight(labelView, 0.3f) ); topView.AddIfNotNull(profileNavigationBarBackground, backHomeView, labelView); topView.AddConstraints( profileNavigationBarBackground.WithSameWidth(topView), profileNavigationBarBackground.WithSameHeight(topView), profileNavigationBarBackground.AtTopOf(topView), backHomeView.WithSameCenterY(topView), backHomeView.AtLeftOf(topView, 20), backHomeView.WithRelativeWidth(topView, 0.1f), backHomeView.WithRelativeHeight(topView, 0.2f), labelView.WithSameCenterX(topView), labelView.WithSameCenterY(topView), labelView.WithRelativeWidth(topView, 0.8f), labelView.WithRelativeHeight(topView, 0.6f) ); firstNameTextField = TextFieldInitializer("First Name"); lastNameTextField = TextFieldInitializer("Last Name"); emailTextField = TextFieldInitializer("Email"); addressTextField = TextFieldInitializer("Address"); cityTextField = TextFieldInitializer("City"); zipCodeTextField = TextFieldInitializer("Zip Code"); stateTextField = TextFieldInitializer("State"); statesPicker = new UIPickerView(); statesPickerViewModel = new MvxPickerViewModel(statesPicker); statesPicker.Model = statesPickerViewModel; statesPicker.ShowSelectionIndicator = true; statesPicker.BackgroundColor = UIColor.White; addLicenseButton = ProfileButtonManager.ButtonInitiaziler("Add License Plate", UIImage.FromFile(@"Images/ProfileView/ic_license.png")); addCreditCardButton = ProfileButtonManager.ButtonInitiaziler("Add Credit Card", UIImage.FromFile(@"Images/ProfileView/ic_card.png")); topTextRowView.AddIfNotNull(firstNameTextField, lastNameTextField); topTextRowView.AddConstraints( firstNameTextField.AtTopOf(topTextRowView), firstNameTextField.AtLeftOf(topTextRowView), firstNameTextField.WithRelativeWidth(topTextRowView, 0.475f), firstNameTextField.WithSameHeight(topTextRowView), lastNameTextField.AtTopOf(topTextRowView), lastNameTextField.AtRightOf(topTextRowView), lastNameTextField.WithRelativeWidth(topTextRowView, 0.475f), lastNameTextField.WithSameHeight(topTextRowView) ); centerTextRowView.AddIfNotNull(emailTextField, addressTextField, cityTextField); centerTextRowView.AddConstraints( emailTextField.AtTopOf(centerTextRowView), emailTextField.WithSameCenterX(centerTextRowView), emailTextField.WithSameWidth(centerTextRowView), emailTextField.WithRelativeHeight(centerTextRowView, 0.3f), addressTextField.Below(emailTextField, 10), addressTextField.WithSameCenterX(centerTextRowView), addressTextField.WithSameWidth(centerTextRowView), addressTextField.WithRelativeHeight(centerTextRowView, 0.3f), cityTextField.Below(addressTextField, 10), cityTextField.WithSameCenterX(centerTextRowView), cityTextField.WithSameWidth(centerTextRowView), cityTextField.WithRelativeHeight(centerTextRowView, 0.3f) ); bottomTextRowView.AddIfNotNull(stateTextField, zipCodeTextField); bottomTextRowView.AddConstraints( stateTextField.AtTopOf(bottomTextRowView), stateTextField.AtLeftOf(bottomTextRowView), stateTextField.WithRelativeWidth(bottomTextRowView, 0.475f), stateTextField.WithSameHeight(bottomTextRowView), zipCodeTextField.AtTopOf(bottomTextRowView), zipCodeTextField.AtRightOf(bottomTextRowView), zipCodeTextField.WithRelativeWidth(bottomTextRowView, 0.475f), zipCodeTextField.WithSameHeight(bottomTextRowView) ); bottomView.AddIfNotNull(addLicenseButton, addCreditCardButton); bottomView.AddConstraints( addLicenseButton.AtTopOf(bottomView), addLicenseButton.WithSameCenterX(bottomView), addLicenseButton.WithSameWidth(bottomView), addLicenseButton.WithRelativeHeight(bottomView, 0.4f), addCreditCardButton.Below(addLicenseButton, 10), addCreditCardButton.WithSameCenterX(bottomView), addCreditCardButton.WithSameWidth(bottomView), addCreditCardButton.WithRelativeHeight(bottomView, 0.4f) ); scrollView.AddIfNotNull(topTextRowView, centerTextRowView, bottomTextRowView, bottomView); scrollView.AddConstraints( topTextRowView.AtTopOf(scrollView, 30), topTextRowView.WithSameWidth(scrollView), topTextRowView.WithSameCenterX(scrollView), topTextRowView.WithRelativeHeight(scrollView, 0.12f), centerTextRowView.Below(topTextRowView, 10), centerTextRowView.WithSameWidth(scrollView), centerTextRowView.AtLeftOf(scrollView), centerTextRowView.AtRightOf(scrollView), centerTextRowView.WithRelativeHeight(scrollView, 0.4f), bottomTextRowView.Below(centerTextRowView, 10), bottomTextRowView.WithSameWidth(scrollView), bottomTextRowView.WithSameCenterX(scrollView), bottomTextRowView.WithRelativeHeight(scrollView, 0.12f), bottomView.Below(bottomTextRowView, 10), bottomView.WithSameWidth(scrollView), bottomView.AtLeftOf(scrollView), bottomView.AtRightOf(scrollView), bottomView.AtBottomOf(scrollView, 100), bottomView.WithRelativeHeight(scrollView, 0.27f) ); View.AddIfNotNull(topView, scrollView); View.AddConstraints( topView.AtTopOf(View), topView.WithSameWidth(View), topView.WithRelativeHeight(View, 0.2f), scrollView.Below(topView, 30), scrollView.AtLeftOf(View, 30), scrollView.AtRightOf(View, 30), scrollView.WithRelativeHeight(View, 0.8f) ); EnableNextKeyForTextFields(firstNameTextField.TextFieldWithValidator.TextField, lastNameTextField.TextFieldWithValidator.TextField, emailTextField.TextFieldWithValidator.TextField, addressTextField.TextFieldWithValidator.TextField, cityTextField.TextFieldWithValidator.TextField, stateTextField.TextFieldWithValidator.TextField, zipCodeTextField.TextFieldWithValidator.TextField); }
//~SearchResultsViewController() //{ // Console.WriteLine("SearchResultsViewController is about to be garbage collected"); //} public override void ViewDidLoad() { base.ViewDidLoad(); var titleString = ""; if (Classification != null) { titleString = Classification + " " + "Search"; } else { titleString = "Aircraft Search"; } View.BackgroundColor = UIColor.Black; var statusBarHeight = UIApplication.SharedApplication.StatusBarFrame.Height; var closeButton = new UIButton(new CGRect(View.Bounds.Width - 110, statusBarHeight, 100, 25)); closeButton.SetTitle("Close", UIControlState.Normal); closeButton.SetTitleColor(UIColor.White, UIControlState.Normal); View.Add(closeButton); //var titleView = new UITextView(titleRect); var tableViewYValue = statusBarHeight + (closeButton.Bounds.Height + 5); var tableViewHeight = this.View.Bounds.Height - tableViewYValue; SearchResultsTableView = new UITableView(new CGRect(0, tableViewYValue, this.View.Bounds.Width, tableViewHeight)); var backgroundImage = UIImage.FromBundle("new_home_bg1.png").ResizeImage((float)this.View.Bounds.Width, (float)this.View.Bounds.Height); //SearchResultsTableView.BackgroundColor = UIColor.FromPatternImage(backgroundImage); //var imageView = new UIImageView() this.View.BackgroundColor = UIColor.FromPatternImage(backgroundImage); SearchResultsTableView.BackgroundColor = UIColor.Clear; View.Add(SearchResultsTableView); searchController = new UISearchController((UIViewController)null); searchController.DimsBackgroundDuringPresentation = false; SearchResultsTableView.TableHeaderView = searchController.SearchBar; searchController.SearchBar.SizeToFit(); this.DefinesPresentationContext = true; searchController.SearchResultsUpdater = this; var titleViewHeight = this.View.Bounds.Height - (this.SearchResultsTableView.Bounds.Height); var titleView = new UITextView(new CGRect(0, 0, this.View.Bounds.Width * .4f, titleViewHeight)); titleView.Center = new CGPoint(View.Frame.Size.Width / 2, titleViewHeight / 1.8f); titleView.Text = titleString; titleView.TextAlignment = UITextAlignment.Center; titleView.TextColor = UIColor.White; titleView.BackgroundColor = UIColor.Clear; titleView.Font = UIFont.BoldSystemFontOfSize(UIKit.UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone ? 15f : 20f); titleView.AdjustsFontForContentSizeCategory = true; this.View.Add(titleView); closeButton.TouchUpInside += (sender, e) => { this.DismissViewController(true, null); }; SearchResultsTableView.Source = new SearchResultsTableSource(this); }
public void UpdateFrom(TradeDoneModel model) { // // Currencies 'one, 'two' are always base, counter for the time being. // TODO: Understand when they might swap, eg if notional currency changed? // string currencyOne = "???"; string currencyTwo = "???"; string tradeStatus = ""; UIStringAttributes strikethroughAttributes; switch (model.Trade.TradeStatus) { case Domain.Models.Execution.TradeStatus.Rejected: strikethroughAttributes = new UIStringAttributes { StrikethroughStyle = NSUnderlineStyle.Single }; tradeStatus = "(REJECTED)"; break; case Domain.Models.Execution.TradeStatus.Done: default: strikethroughAttributes = new UIStringAttributes { StrikethroughStyle = NSUnderlineStyle.None }; break; } // Always displayed 'plain'... Direction.Text = model.Trade.Direction.ToString(); TradeId.Text = String.Format("{0} {1}", model.Trade.TradeId.ToString(), tradeStatus); // Displayed plain but needs some formatting to make nice... if (model.Trade.CurrencyPair.Length == 6) { currencyOne = model.Trade.CurrencyPair.Substring(0, 3); currencyTwo = model.Trade.CurrencyPair.Substring(3, 3); CurrencyPair.Text = String.Format("{0} / {1}", currencyOne, currencyTwo); } else { // We expect the currency pair to always be 3 + 3, but just in case... CurrencyPair.Text = model.Trade.CurrencyPair; } // System.Console.WriteLine ("Trade details: {0}", model.Trade.ToString()); // The following fields may be struck through in the event of trade failure... // // Note that we always use currencyTwo here for now... // This will be wrong when we allow notional to be in the counter currency. // TODO: Complete this implementation at that point. And work out what DealtCurrency means then. // CounterCCY.AttributedText = new NSAttributedString(currencyTwo, strikethroughAttributes); DirectionAmount.AttributedText = new NSAttributedString(Styles.FormatNotional(model.Trade.Notional, true), strikethroughAttributes); Rate.AttributedText = new NSAttributedString(model.Trade.SpotRate.ToString(), strikethroughAttributes); // // Note that 'Proper' trade dates (with spot date calculated with holidays etc taken into account). // TODO: Make sure we bind the correct date when it becomes available in future. // string valueDateFormatted = String.Format("SP. {0}", model.Trade.ValueDate.ToString("dd MMM")); ValueDate.AttributedText = new NSAttributedString(valueDateFormatted, strikethroughAttributes); // We use some BOLD if the trader id matches the current user... UIStringAttributes maybeStrikeMaybeBold = new UIStringAttributes(); maybeStrikeMaybeBold.StrikethroughStyle = strikethroughAttributes.StrikethroughStyle; if (model.Trade.TraderName == UserModel.Instance.TraderId) { maybeStrikeMaybeBold.Font = UIFont.BoldSystemFontOfSize(TraderId.Font.PointSize); } TraderId.AttributedText = new NSAttributedString(model.Trade.TraderName, maybeStrikeMaybeBold); // // Not directly available from ITrade, so we derive it thus? // At first was hardcoded 'EUR'! // So... using currencyOne is better but may not be right once UI and models allow notional currency to change. // // Maybe we'll end up with something akin to this... // string directionCurrency = (model.Trade.Direction == Adaptive.ReactiveTrader.Client.Domain.Models.Direction.BUY) ? currencyOne : currencyTwo; // string directionCurrency = currencyOne; DirectionCCY.AttributedText = new NSAttributedString(directionCurrency, strikethroughAttributes); DoneButton.Hidden = true; }
public override void Draw(RectangleF rect) { // Drawing code // Here Draw timeline from 12 am to noon to 12 am next day // Times appearance UIFont timeFont = UIFont.BoldSystemFontOfSize(FONT_SIZE); UIColor timeColor = UIColor.Black; // Periods appearance UIFont periodFont = UIFont.SystemFontOfSize(FONT_SIZE); UIColor periodColor = UIColor.Gray; // Draw each times string for (Int32 i = 0; i < this.times.Length; i++) { // Draw time timeColor.SetStroke(); string time = this.times[i]; RectangleF timeRect = new RectangleF(HORIZONTAL_OFFSET, VERTICAL_OFFSET + i * VERTICAL_DIFF, TIME_WIDTH, FONT_SIZE + 4.0f); // Find noon if (i == 24 / 2) { timeRect = new RectangleF(HORIZONTAL_OFFSET, VERTICAL_OFFSET + i * VERTICAL_DIFF, TIME_WIDTH + PERIOD_WIDTH, FONT_SIZE + 4.0f); } DrawString(time, timeRect, timeFont, UILineBreakMode.WordWrap, UITextAlignment.Right); // Draw period // Only if it is not noon if (i != 24 / 2) { periodColor.SetStroke(); string period = this.periods[i]; DrawString(period, new RectangleF(HORIZONTAL_OFFSET + TIME_WIDTH, VERTICAL_OFFSET + i * VERTICAL_DIFF, PERIOD_WIDTH, FONT_SIZE + 4.0f), periodFont, UILineBreakMode.WordWrap, UITextAlignment.Right); var context = UIGraphics.GetCurrentContext(); // Save the context state context.SaveState(); context.SetStrokeColorWithColor(UIColor.LightGray.CGColor); // Draw line with a black stroke color // Draw line with a 1.0 stroke width context.SetLineWidth(0.5f); // Translate context for clear line context.TranslateCTM(-0.5f, -0.5f); context.BeginPath(); context.MoveTo(HORIZONTAL_OFFSET + TIME_WIDTH + PERIOD_WIDTH + HORIZONTAL_LINE_DIFF, VERTICAL_OFFSET + i * VERTICAL_DIFF + (float)Math.Round(((FONT_SIZE + 4.0) / 2.0))); context.AddLineToPoint(this.Bounds.Size.Width, VERTICAL_OFFSET + i * VERTICAL_DIFF + (float)Math.Round((FONT_SIZE + 4.0) / 2.0)); context.StrokePath(); if (i != this.times.Length - 1) { context.BeginPath(); context.MoveTo(HORIZONTAL_OFFSET + TIME_WIDTH + PERIOD_WIDTH + HORIZONTAL_LINE_DIFF, VERTICAL_OFFSET + i * VERTICAL_DIFF + (float)Math.Round(((FONT_SIZE + 4.0f) / 2.0f)) + (float)Math.Round((VERTICAL_DIFF / 2.0f))); context.AddLineToPoint(this.Bounds.Size.Width, VERTICAL_OFFSET + i * VERTICAL_DIFF + (float)Math.Round(((FONT_SIZE + 4.0f) / 2.0f)) + (float)Math.Round((VERTICAL_DIFF / 2.0f))); float[] dash1 = { 2.0f, 1.0f }; context.SetLineDash(0.0f, dash1, 2); context.StrokePath(); } // Restore the context state context.RestoreState(); } } }
public Pubnub_MessagingMain() : base(UITableViewStyle.Grouped, null) { UIView labelView = new UIView(new RectangleF(0, 0, this.View.Bounds.Width, 24)); int left = 20; string hardwareVer = DeviceHardware.Version.ToString().ToLower(); if (hardwareVer.IndexOf("ipad") >= 0) { left = 55; } labelView.AddSubview(new UILabel(new RectangleF(left, 10, this.View.Bounds.Width - left, 24)) { Font = UIFont.BoldSystemFontOfSize(16), BackgroundColor = UIColor.Clear, TextColor = UIColor.FromRGB(76, 86, 108), Text = "Basic Settings" }); var headerMultipleChannels = new UILabel(new RectangleF(0, 0, this.View.Bounds.Width, 24)) { Font = UIFont.SystemFontOfSize(12), TextColor = UIColor.Brown, BackgroundColor = UIColor.Clear, TextAlignment = UITextAlignment.Center }; headerMultipleChannels.Text = "Enter multiple channel names separated by comma"; EntryElement entrySubscribeKey = new EntryElement("Subscribe Key", "Enter Subscribe Key", "demo"); entrySubscribeKey.AutocapitalizationType = UITextAutocapitalizationType.None; entrySubscribeKey.AutocorrectionType = UITextAutocorrectionType.No; EntryElement entryPublishKey = new EntryElement("Publish Key", "Enter Publish Key", "demo"); entryPublishKey.AutocapitalizationType = UITextAutocapitalizationType.None; entryPublishKey.AutocorrectionType = UITextAutocorrectionType.No; EntryElement entrySecretKey = new EntryElement("Secret Key", "Enter Secret Key", "demo"); entrySecretKey.AutocapitalizationType = UITextAutocapitalizationType.None; entrySecretKey.AutocorrectionType = UITextAutocorrectionType.No; EntryElement entryChannelName = new EntryElement("Channel(s)", "Enter Channel Name", ""); entryChannelName.AutocapitalizationType = UITextAutocapitalizationType.None; entryChannelName.AutocorrectionType = UITextAutocorrectionType.No; EntryElement entryCipher = new EntryElement("Cipher", "Enter Cipher", ""); entryCipher.AutocapitalizationType = UITextAutocapitalizationType.None; entryCipher.AutocorrectionType = UITextAutocorrectionType.No; EntryElement entryProxyServer = new EntryElement("Server", "Enter Server", ""); entryProxyServer.AutocapitalizationType = UITextAutocapitalizationType.None; entryProxyServer.AutocorrectionType = UITextAutocorrectionType.No; EntryElement entryProxyPort = new EntryElement("Port", "Enter Port", ""); EntryElement entryProxyUser = new EntryElement("Username", "Enter Username", ""); entryProxyUser.AutocapitalizationType = UITextAutocapitalizationType.None; entryProxyUser.AutocorrectionType = UITextAutocorrectionType.No; EntryElement entryProxyPassword = new EntryElement("Password", "Enter Password", "", true); EntryElement entryCustonUuid = new EntryElement("CustomUuid", "Enter Custom UUID", ""); entryCustonUuid.AutocapitalizationType = UITextAutocapitalizationType.None; entryCustonUuid.AutocorrectionType = UITextAutocorrectionType.No; BooleanElement proxyEnabled = new BooleanElement("Proxy", false); BooleanElement sslEnabled = new BooleanElement("Enable SSL", false); Root = new RootElement("Pubnub Messaging") { new Section(labelView) { }, new Section(headerMultipleChannels) { }, new Section("Enter Subscribe Key.") { entrySubscribeKey }, new Section("Enter Publish key.") { entryPublishKey }, new Section("Enter Secret key.") { entrySecretKey }, new Section() { entryChannelName, sslEnabled }, new Section("Enter cipher key for encryption. Leave blank for unencrypted transfer.") { entryCipher }, new Section("Enter custom UUID or leave blank to use the default UUID") { entryCustonUuid }, new Section() { new RootElement("Proxy Settings", 0, 0) { new Section() { proxyEnabled }, new Section("Configuration") { entryProxyServer, entryProxyPort, entryProxyUser, entryProxyPassword }, } }, new Section() { new StyledStringElement("Launch Example", () => { bool errorFree = true; errorFree = ValidateAndInitPubnub(entryChannelName.Value, entryCipher.Value, sslEnabled.Value, entryCustonUuid.Value, proxyEnabled.Value, entryProxyPort.Value, entryProxyUser.Value, entryProxyServer.Value, entryProxyPassword.Value, entrySubscribeKey.Value, entryPublishKey.Value, entrySecretKey.Value ); if (errorFree) { new Pubnub_MessagingSub(entryChannelName.Value, entryCipher.Value, sslEnabled.Value, pubnub); } }) { BackgroundColor = UIColor.Blue, TextColor = UIColor.White, Alignment = UITextAlignment.Center }, }, /*new Section() * { * new StyledStringElement ("Launch Speed Test", () => { * bool errorFree = true; * errorFree = ValidateAndInitPubnub(entryChannelName.Value, entryCipher.Value, sslEnabled.Value, * entryCustonUuid.Value, proxyEnabled.Value, entryProxyPort.Value, * entryProxyUser.Value, entryProxyServer.Value, entryProxyPassword.Value * ); * * if(errorFree) * { * new Pubnub_MessagingSpeedTest(entryChannelName.Value, entryCipher.Value, sslEnabled.Value, pubnub); * } * }) * { * BackgroundColor = UIColor.Blue, * TextColor = UIColor.White, * Alignment = UITextAlignment.Center * }, * }*/ }; }
private void setupView() { var margins = View.LayoutMarginsGuide; CancelButton = new UIButton() { TranslatesAutoresizingMaskIntoConstraints = false }; View.Add(CancelButton); //CancelButton.SetTitle("Close", UIControlState.Normal); CancelButton.SetImage(UIImage.FromBundle("Cancel"). ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), UIControlState.Normal); CancelButton.TintColor = UIColor.White; CancelButton.TopAnchor.ConstraintEqualTo(margins.TopAnchor).Active = true; CancelButton.LeadingAnchor.ConstraintEqualTo(margins.LeadingAnchor).Active = true; CancelButton.TrailingAnchor.ConstraintEqualTo(margins.TrailingAnchor).Active = true; CancelButton.HeightAnchor.ConstraintEqualTo(50).Active = true; CancelButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; CancelButton.TouchUpInside += CancelButton_TouchUpInside; CancelButton.BackgroundColor = UIColor.Clear; int count = 0; LeftStackView = new UIStackView { Axis = UILayoutConstraintAxis.Vertical, Alignment = UIStackViewAlignment.Fill, Distribution = UIStackViewDistribution.FillEqually, Spacing = 10, TranslatesAutoresizingMaskIntoConstraints = false }; RightStackView = new UIStackView { Axis = UILayoutConstraintAxis.Vertical, Alignment = UIStackViewAlignment.Fill, Distribution = UIStackViewDistribution.FillEqually, Spacing = 10, TranslatesAutoresizingMaskIntoConstraints = false }; foreach (var i in buttonList) { UIButton SettingsButton = new UIButton { TranslatesAutoresizingMaskIntoConstraints = false }; SettingsButton.TitleLabel.Font = UIFont.BoldSystemFontOfSize(25); CancelButton.BackgroundColor = UIColor.Clear; SettingsButton.TouchUpInside += SettingsButton_TouchUpInside; SettingsButton.SetTitle(i, UIControlState.Normal); if (count < 3) { LeftStackView.AddArrangedSubview(SettingsButton); } else { RightStackView.AddArrangedSubview(SettingsButton); } count++; } FullStackView = new UIStackView { Axis = UILayoutConstraintAxis.Horizontal, Alignment = UIStackViewAlignment.Fill, Distribution = UIStackViewDistribution.FillEqually, Spacing = 10, TranslatesAutoresizingMaskIntoConstraints = false }; FullStackView.AddArrangedSubview(LeftStackView); FullStackView.AddArrangedSubview(RightStackView); View.Add(FullStackView); FullStackView.TopAnchor.ConstraintEqualTo(CancelButton.BottomAnchor, 20).Active = true; FullStackView.BottomAnchor.ConstraintEqualTo(margins.BottomAnchor, -200).Active = true; FullStackView.LeadingAnchor.ConstraintEqualTo(margins.LeadingAnchor, 100).Active = true; FullStackView.TrailingAnchor.ConstraintEqualTo(margins.TrailingAnchor, -100).Active = true; }
private void InitializeComponent() { // Email text fiels this.View.BackgroundColor = UIColor.FromRGB(98, 136, 174); this.Title = LocalizedStrings.SignUp; this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes() { ForegroundColor = UIColor.White }; this.NavigationController.NavigationBar.TintColor = UIColor.White; this.NavigationController.NavigationBar.BarStyle = UIBarStyle.Black; // Email text field EmailTextField.AttributedPlaceholder = new NSAttributedString(LocalizedStrings.Email, font: UIFont.SystemFontOfSize(14.0f, UIFontWeight.Regular), foregroundColor: UIColor.FromRGB(155, 155, 155)); EmailTextField.Font = UIFont.SystemFontOfSize(14.0f, UIFontWeight.Regular); EmailTextField.KeyboardType = UIKeyboardType.EmailAddress; EmailTextField.AutocapitalizationType = UITextAutocapitalizationType.None; EmailTextField.AutocorrectionType = UITextAutocorrectionType.No; var clearButtonEmail = new UIButton { Frame = new CGRect(0, 0, 20, 20) }; clearButtonEmail.TouchUpInside += (sender, e) => { EmailTextField.Text = string.Empty; }; clearButtonEmail.SetImage(UIImage.FromBundle("IcoClear"), UIControlState.Normal); clearButtonEmail.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit; EmailTextField.RightView = clearButtonEmail; EmailTextField.ClearButtonMode = UITextFieldViewMode.Never; EmailTextField.RightViewMode = UITextFieldViewMode.WhileEditing; // Name text field NameTextField.AttributedPlaceholder = new NSAttributedString(LocalizedStrings.Name, font: UIFont.SystemFontOfSize(14.0f, UIFontWeight.Regular), foregroundColor: UIColor.FromRGB(155, 155, 155)); NameTextField.Font = UIFont.SystemFontOfSize(14.0f, UIFontWeight.Regular); NameTextField.AutocorrectionType = UITextAutocorrectionType.No; var clearButtonName = new UIButton { Frame = new CGRect(0, 0, 20, 20) }; clearButtonName.TouchUpInside += (sender, e) => { NameTextField.Text = string.Empty; }; clearButtonName.SetImage(UIImage.FromBundle("IcoClear"), UIControlState.Normal); clearButtonName.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit; NameTextField.RightView = clearButtonName; NameTextField.ClearButtonMode = UITextFieldViewMode.Never; NameTextField.RightViewMode = UITextFieldViewMode.WhileEditing; // Password text field PasswordTextField.AttributedPlaceholder = new NSAttributedString(LocalizedStrings.Password, font: UIFont.SystemFontOfSize(14.0f, UIFontWeight.Regular), foregroundColor: UIColor.FromRGB(155, 155, 155)); PasswordTextField.SecureTextEntry = true; PasswordTextField.Font = UIFont.SystemFontOfSize(14.0f, UIFontWeight.Regular); PasswordTextField.AutocapitalizationType = UITextAutocapitalizationType.None; PasswordTextField.AutocorrectionType = UITextAutocorrectionType.No; var showPasword = new UIButton { Frame = new CGRect(0, 0, 26, 15) }; showPasword.TouchUpInside += (sender, e) => { PasswordTextField.SecureTextEntry = !PasswordTextField.SecureTextEntry; }; showPasword.SetImage(UIImage.FromBundle("IcoEye"), UIControlState.Normal); showPasword.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit; PasswordTextField.RightView = showPasword; PasswordTextField.ClearButtonMode = UITextFieldViewMode.Never; PasswordTextField.RightViewMode = UITextFieldViewMode.Always; // SignUp button SignUpButton.SetTitle(LocalizedStrings.SignUp.ToUpper(), UIControlState.Normal); SignUpButton.SetTitleColor(UIColor.White, UIControlState.Normal); SignUpButton.TitleLabel.Font = UIFont.BoldSystemFontOfSize(16.0f); SignUpButton.BackgroundColor = UIColor.FromRGB(128, 204, 166); SignUpButton.Layer.CornerRadius = 5; SignUpButton.ClipsToBounds = true; View.AddSubviews(EmailTextField, NameTextField, PasswordTextField, SignUpButton); AddLayoutConstraints(); }
public override void LoadView() { // Create a chart view that will display the chart. m_view = new NChartView(); // Paste your license key here. m_view.Chart.LicenseKey = ""; // Margin to ensure some free space for the iOS status bar. m_view.Chart.CartesianSystem.Margin = new NChartMargin(10.0f, 10.0f, 10.0f, 20.0f); m_view.Chart.CartesianSystem.XAxis.ShouldBeautifyMinAndMax = true; m_view.Chart.CartesianSystem.XAxis.MinTickSpacing = 50; m_view.Chart.CartesianSystem.YAxis.ShouldBeautifyMinAndMax = true; m_view.Chart.CartesianSystem.YAxis.MinTickSpacing = 10; // !!! This is mandatory to provide ticks for X-Axis. m_view.Chart.CartesianSystem.XAxis.DataSource = this; // !!! Increase the minimal tick spacing for X-Axis to avoid line breaks in ticks. m_view.Chart.CartesianSystem.XAxis.MinTickSpacing = 80.0f; // Create series that will be displayed on the chart. NChartCandlestickSeries series = new NChartCandlestickSeries(); series.PositiveColor = UIColor.Green; series.PositiveBorderColor = series.PositiveColor; series.NegativeColor = UIColor.Red; series.NegativeBorderColor = series.NegativeColor; series.BorderThickness = 1.0f; series.DataSource = this; m_view.Chart.AddSeries(series); // Activate auto scroll and auto toggle of scroll by pan. m_view.Chart.ShouldAutoScroll = true; m_view.Chart.ShouldToggleAutoScrollByPan = true; // Create label that is shown when auto scroll toggles. NChartAutoScrollLabel lbl = new NChartAutoScrollLabel(); lbl.Background = new NChartSolidColorBrush(new UIColor(0.0f, 0.0f, 0.0f, 0.8f)); lbl.Font = UIFont.BoldSystemFontOfSize(16.0f); lbl.TextColor = UIColor.White; lbl.Padding = new NChartMargin(20.0f, 20.0f, 5.0f, 10.0f); lbl.OnText = @"Autoscroll ON"; lbl.OffText = @"Autoscroll OFF"; m_view.Chart.AutoScrollLabel = lbl; // Enable auto-zoom of the Y-Axis. m_view.Chart.CartesianSystem.ShouldAutoZoom = true; m_view.Chart.CartesianSystem.AutoZoomAxes = NChartAutoZoomAxes.NormalAxis; // This can also be NChartAutoZoomAxes.SecondaryAxis, in case series are hosted on the secondary axis. // Disable unwanted interactive vertical panning and zooming not to conflict with automatic ones. m_view.Chart.UserInteractionMode = (m_view.Chart.UserInteractionMode) ^ ((uint)NChartUserInteraction.ProportionalZoom | (uint)NChartUserInteraction.VerticalZoom | (uint)NChartUserInteraction.VerticalMove); m_view.Chart.ZoomMode = NChartZoomMode.Directional; // Update data in the chart. m_view.Chart.UpdateData(); // Set chart view to the controller. this.View = m_view; TimerCallback timerCallback = new TimerCallback(stream); m_timer = new Timer(timerCallback, m_view.Chart.Series() [m_view.Chart.Series().Length - 1], 100, 100); }
public AccessUsers(UIView parentView) { ion = AppState.context as IosION; accessView = new UIView(new CGRect(0, 0, parentView.Bounds.Width, parentView.Bounds.Height)); accessView.BackgroundColor = UIColor.White; allowedHeader = new UILabel(new CGRect(.05 * parentView.Bounds.Width, 0, .9 * parentView.Bounds.Width, .05 * parentView.Bounds.Height)); allowedHeader.AdjustsFontSizeToFitWidth = true; allowedHeader.Font = UIFont.BoldSystemFontOfSize(20); allowedHeader.TextAlignment = UITextAlignment.Center; allowedHeader.BackgroundColor = UIColor.Black; allowedHeader.TextColor = UIColor.FromRGB(255, 215, 101); allowedHeader.Text = "Following"; viewingTable = new UITableView(new CGRect(.05 * parentView.Bounds.Width, .05 * parentView.Bounds.Height, .9 * parentView.Bounds.Width, .4 * parentView.Bounds.Height)); viewingTable.Layer.BorderWidth = 1f; viewingTable.SeparatorStyle = UITableViewCellSeparatorStyle.None; viewingTable.RegisterClassForCellReuse(typeof(ViewingUserCell), "viewingCell"); grantedHeader = new UILabel(new CGRect(.05 * parentView.Bounds.Width, .5 * parentView.Bounds.Height, .9 * parentView.Bounds.Width, .05 * parentView.Bounds.Height)); grantedHeader.Font = UIFont.BoldSystemFontOfSize(20); grantedHeader.AdjustsFontSizeToFitWidth = true; grantedHeader.TextAlignment = UITextAlignment.Center; grantedHeader.BackgroundColor = UIColor.Black; grantedHeader.TextColor = UIColor.FromRGB(255, 215, 101); grantedHeader.Text = "Followers"; allowingTable = new UITableView(new CGRect(.05 * parentView.Bounds.Width, .55 * parentView.Bounds.Height, .9 * parentView.Bounds.Width, .4 * parentView.Bounds.Height)); allowingTable.Layer.BorderWidth = 1f; allowingTable.SeparatorStyle = UITableViewCellSeparatorStyle.None; allowingTable.RegisterClassForCellReuse(typeof(AllowingUserCell), "allowingCell"); followingRefresh = new UIRefreshControl(); followingRefresh.ValueChanged += (sender, e) => { getAllUserAccess(parentView); }; followerRefresh = new UIRefreshControl(); followerRefresh.ValueChanged += (sender, e) => { getAllUserAccess(parentView); }; viewingTable.InsertSubview(followingRefresh, 0); viewingTable.SendSubviewToBack(followingRefresh); allowingTable.InsertSubview(followerRefresh, 0); allowingTable.SendSubviewToBack(followerRefresh); loadingRequests = new UIActivityIndicatorView(new CGRect(.05 * parentView.Bounds.Width, 0, .9 * parentView.Bounds.Width, .95 * parentView.Bounds.Height)); loadingRequests.Alpha = .8f; loadingRequests.BackgroundColor = UIColor.Gray; loadingRequests.HidesWhenStopped = true; accessView.AddSubview(loadingRequests); accessView.AddSubview(allowedHeader); accessView.AddSubview(viewingTable); accessView.AddSubview(grantedHeader); accessView.AddSubview(allowingTable); accessView.BringSubviewToFront(loadingRequests); getAllUserAccess(parentView); }
public override void ViewDidLoad() { base.ViewDidLoad(); var bounds = View.Bounds; var backgroundColor = new UIColor(0.859f, 0.866f, 0.929f, 1); View.BackgroundColor = backgroundColor; // // Add the bubble chat interface // discussionHost = new UIView(new RectangleF(bounds.X, bounds.Y, bounds.Width, bounds.Height - entryHeight)) { AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth, AutosizesSubviews = true, UserInteractionEnabled = true }; View.AddSubview(discussionHost); discussion = new DialogViewController(UITableViewStyle.Plain, root, true); discussionHost.AddSubview(discussion.View); discussion.View.BackgroundColor = backgroundColor; // // Add styled entry // chatBar = new UIImageView(new RectangleF(0, bounds.Height - entryHeight, bounds.Width, entryHeight)) { ClearsContextBeforeDrawing = false, AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleWidth, Image = UIImage.FromFile("ChatBar.png").StretchableImage(18, 20), UserInteractionEnabled = true }; View.AddSubview(chatBar); entry = new UITextView(new RectangleF(10, 9, 234, 22)) { ContentSize = new SizeF(234, 22), AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight, ScrollEnabled = false, ScrollIndicatorInsets = new UIEdgeInsets(5, 0, 4, -2), ClearsContextBeforeDrawing = false, Font = UIFont.SystemFontOfSize(messageFontSize), DataDetectorTypes = UIDataDetectorType.All, BackgroundColor = UIColor.Clear, }; // Fix a scrolling glitch entry.ShouldChangeText = (textView, range, text) => { entry.ContentInset = new UIEdgeInsets(0, 0, 3, 0); return(true); }; previousContentHeight = entry.ContentSize.Height; chatBar.AddSubview(entry); // // The send button // sendButton = UIButton.FromType(UIButtonType.Custom); sendButton.ClearsContextBeforeDrawing = false; sendButton.Frame = new RectangleF(chatBar.Frame.Width - 70, 8, 64, 26); sendButton.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin; var sendBackground = UIImage.FromFile("SendButton.png"); sendButton.SetBackgroundImage(sendBackground, UIControlState.Normal); sendButton.SetBackgroundImage(sendBackground, UIControlState.Disabled); sendButton.TitleLabel.Font = UIFont.BoldSystemFontOfSize(16); sendButton.TitleLabel.ShadowOffset = new SizeF(0, -1); sendButton.SetTitle("Send", UIControlState.Normal); sendButton.SetTitleShadowColor(new UIColor(0.325f, 0.463f, 0.675f, 1), UIControlState.Normal); sendButton.AddTarget(SendMessage, UIControlEvent.TouchUpInside); DisableSend(); chatBar.AddSubview(sendButton); // // Listen to keyboard notifications to animate // showObserver = UIKeyboard.Notifications.ObserveWillShow(PlaceKeyboard); hideObserver = UIKeyboard.Notifications.ObserveWillHide(PlaceKeyboard); ScrollToBottom(false); // Track changes in the entry to resize the view accordingly entry.Changed += HandleEntryChanged; }
public override void LayoutSubviews() { base.LayoutSubviews(); //Set diagram width and height diagram.Width = (float)Frame.Width; diagram.Height = (float)Frame.Height; diagram.EnableSelectors = false; //Create Node Node n1 = DrawNode(270, 165, 100, 60); n1.Style.Brush = new SolidBrush(UIColor.White); n1.Annotations.Add(new Annotation() { Content = "NODE" }); diagram.AddNode(n1); Node n2 = DrawNode(50, (float)141.5, 110, 110); n2.Style.Brush = new SolidBrush(UIColor.White); n2.Style.StrokeWidth = 3; var img = new UIImageView(UIImage.FromBundle("Images/Diagram/emp.png")); img.Frame = new CGRect(n2.Style.StrokeWidth / 2, n2.Style.StrokeWidth / 2, n2.Width - n2.Style.StrokeWidth, n2.Height - n2.Style.StrokeWidth); n2.Annotations.Add(new Annotation() { Content = img }); diagram.AddNode(n2); Node n3 = DrawNode(50, 300, 230, 140); n3.ShapeType = ShapeType.RoundedRectangle; n3.CornerRadius = 8; n3.Style.Brush = new SolidBrush(UIColor.FromRGB(58, 179, 255)); n3.Style.StrokeBrush = new SolidBrush(UIColor.FromRGB(0, 117, 168)); n3.Style.StrokeWidth = 3; //To defines the button properties var button = new UIButton(); button.Frame = new CGRect(60, 100, 110, 30); button.SetTitle("View Profile", UIControlState.Normal); button.SetTitleColor(UIColor.White, UIControlState.Normal); button.Layer.CornerRadius = 5; button.Layer.BorderWidth = 2; button.Layer.BorderColor = UIColor.White.CGColor; button.Font = UIFont.BoldSystemFontOfSize(10); //Create new uiimageview var emp = new UIImageView(UIImage.FromBundle("Images/Diagram/Paul.png")); emp.Frame = new CGRect(14, 14, 70, 70); //Defines the lable for node var label = new UILabel() { Text = "JOHN STEEL \n Business Analyst", TextColor = UIColor.White, Font = UIFont.FromName(".SF UI Text", 12), LineBreakMode = UILineBreakMode.WordWrap, Lines = 0, Frame = new CGRect(95, -25, n3.Width, n3.Height) }; //Add annotation to the node. n3.Annotations.Add(new Annotation() { Content = label }); n3.Annotations.Add(new Annotation() { Content = button }); n3.Annotations.Add(new Annotation() { Content = emp }); diagram.AddNode(n3); Node n4 = DrawNode(390, 300, 140, 140); n4.Style.StrokeWidth = 0; n4.Style.Brush = new SolidBrush(UIColor.FromRGB(69, 179, 157)); var txt = new UILabel() { Text = "CONTENT SHAPE", Font = UIFont.FromName("ArialMT", 14), TextAlignment = UITextAlignment.Center }; txt.Frame = new CGRect(2, 45, n4.Width, n4.Height); var contentShape = new Shape(n4); n4.Annotations.Add(new Annotation() { Content = contentShape }); n4.Annotations.Add(new Annotation() { Content = txt }); diagram.AddNode(n4); //Create Connector Connector c1 = new Connector(n1, n2); c1.SegmentType = SegmentType.StraightSegment; diagram.AddConnector(c1); Connector c2 = new Connector(n1, n3); c2.SegmentType = SegmentType.StraightSegment; diagram.AddConnector(c2); Connector c3 = new Connector(n1, n4); c3.SegmentType = SegmentType.StraightSegment; diagram.AddConnector(c3); this.AddSubview(diagram); }
public AllocEmpTableItem(string cellId) : base(UITableViewCellStyle.Default, cellId) { Layout = new LinearLayout(Orientation.Vertical) { Padding = new UIEdgeInsets(5, 5, 5, 5), LayoutParameters = new LayoutParameters() { Width = AutoSize.FillParent, Height = AutoSize.WrapContent, }, SubViews = new View[] { new LinearLayout(Orientation.Horizontal) { LayoutParameters = new LayoutParameters() { Width = AutoSize.FillParent, Height = AutoSize.WrapContent, }, SubViews = new View[] { new NativeView() { View = EmployeePersonnelNumber = new UILabel() { Text = "EmployeePersonnelNumber", BackgroundColor = UIColor.Clear, Font = UIFont.BoldSystemFontOfSize(12), HighlightedTextColor = UIColor.White, }, LayoutParameters = new LayoutParameters() { Width = AutoSize.FillParent, Height = AutoSize.WrapContent, } }, new NativeView() { View = ProjectNumber = new UILabel() { Text = "ProjectNumber", BackgroundColor = UIColor.Clear, Font = UIFont.BoldSystemFontOfSize(14), HighlightedTextColor = UIColor.White, }, LayoutParameters = new LayoutParameters() { Width = AutoSize.WrapContent, Height = AutoSize.WrapContent, } }, } }, new LinearLayout(Orientation.Horizontal) { LayoutParameters = new LayoutParameters() { Width = AutoSize.FillParent, Height = AutoSize.WrapContent, }, SubViews = new View[] { new NativeView() { View = allocatedLabel = new UILabel() { Text = "Allocated: 10.0", BackgroundColor = UIColor.Clear, Font = UIFont.BoldSystemFontOfSize(10), TextColor = UIColor.Black, HighlightedTextColor = UIColor.White, }, LayoutParameters = new LayoutParameters() { Width = AutoSize.FillParent, Height = AutoSize.WrapContent, } }, new NativeView() { View = workedLabel = new UILabel() { Text = "Worked: 0.0", BackgroundColor = UIColor.Clear, Font = UIFont.SystemFontOfSize(10), TextColor = UIColor.Red, HighlightedTextColor = UIColor.White, }, LayoutParameters = new LayoutParameters() { Width = AutoSize.FillParent, Height = AutoSize.WrapContent, } }, new NativeView() { View = remainingLabel = new UILabel() { Text = "Remaining: 10.0", BackgroundColor = UIColor.Clear, Font = UIFont.SystemFontOfSize(10), TextColor = UIColor.Red, HighlightedTextColor = UIColor.White, Lines = 0, }, LayoutParameters = new LayoutParameters() { Width = AutoSize.FillParent, Height = AutoSize.WrapContent, } }, } } //new NativeView() //{ // View = _labelPercent = new UILabel() // { // Text = "20%", // BackgroundColor = UIColor.Clear, // TextColor = UIColor.FromRGB(51,102,153), // HighlightedTextColor = UIColor.White, // Font = UIFont.BoldSystemFontOfSize(24), // TextAlignment = UITextAlignment.Right, // }, // LayoutParameters = new LayoutParameters() // { // Width = 50, // Height = AutoSize.FillParent, // Margins = new UIEdgeInsets(0, 10, 0, 0), // } //} } }; this.ContentView.Add(new UILayoutHost(Layout, this.ContentView.Bounds)); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Initializing the Voucher Code module. CGRect frame = UIScreen.MainScreen.ApplicationFrame; frame = new CGRect(frame.X, frame.Y + NavigationController.NavigationBar.Frame.Size.Height, frame.Width, frame.Height - NavigationController.NavigationBar.Frame.Size.Height); scanView = new AnylineOCRModuleView(frame); SetupLicensePlateConfig(); // We'll copy the required traineddata files here error = null; success = scanView.CopyTrainedData(NSBundle.MainBundle.PathForResource(@"Modules/OCR/Alte", @"traineddata"), @"f52e3822cdd5423758ba19ed75b0cc32", out error); if (!success) { (alert = new UIAlertView("Error", error.DebugDescription, null, "OK", null)).Show(); } error = null; success = scanView.CopyTrainedData(NSBundle.MainBundle.PathForResource(@"Modules/OCR/Arial", @"traineddata"), @"9a5555eb6ac51c83cbb76d238028c485", out error); if (!success) { (alert = new UIAlertView("Error", error.DebugDescription, null, "OK", null)).Show(); } error = null; success = scanView.CopyTrainedData(NSBundle.MainBundle.PathForResource(@"Modules/OCR/GL-Nummernschild-Mtl7_uml", @"traineddata"), @"8ea050e8f22ba7471df7e18c310430d8", out error); if (!success) { (alert = new UIAlertView("Error", error.DebugDescription, null, "OK", null)).Show(); } // We tell the module to bootstrap itself with the license key and delegate. The delegate will later get called // by the module once we start receiving results. error = null; success = scanView.SetupWithLicenseKey(licenseKey, this.Self, ocrConfig, out error); // SetupWithLicenseKey:delegate:error returns true if everything went fine. In the case something wrong // we have to check the error object for the error message. if (!success) { // Something went wrong. The error object contains the error description (alert = new UIAlertView("Error", error.DebugDescription, null, "OK", null)).Show(); } // We stop scanning manually scanView.CancelOnResult = false; // We load the UI config for our VoucherCode view from a .json file. String configFile = NSBundle.MainBundle.PathForResource(@"Modules/OCR/license_plate_view_config", @"json"); scanView.CurrentConfiguration = ALUIConfiguration.CutoutConfigurationFromJsonFile(configFile); scanView.TranslatesAutoresizingMaskIntoConstraints = false; // After setup is complete we add the module to the view of this view controller View.AddSubview(scanView); /* * The following view will present the scanned values. Here we start listening for taps * to later dismiss the view. */ resultView = new ResultOverlayView(new CGRect(0, 0, View.Frame.Width, View.Frame.Height), UIImage.FromBundle(@"drawable/license_plate_background.png")); resultView.AddGestureRecognizer(new UITapGestureRecognizer(this, new ObjCRuntime.Selector("ViewTapSelector:"))); resultView.Center = View.Center; resultView.Alpha = 0; resultView.Result.Center = new CGPoint(View.Center.X, View.Center.Y); resultView.Result.Font = UIFont.BoldSystemFontOfSize(27); resultView.Result.TextColor = UIColor.Black; View.AddSubview(resultView); }
public DemoTableViewCell() : base(UITableViewCellStyle.Default, "DemoTableViewCell") { Layout = new LinearLayout(Orientation.Horizontal) { Padding = new UIEdgeInsets(5, 5, 5, 5), LayoutParameters = new LayoutParameters() { Width = AutoSize.FillParent, Height = AutoSize.WrapContent, }, SubViews = new View[] { new NativeView() { View = new UIImageView(RectangleF.Empty) { Image = UIImage.FromBundle("tts512.png"), }, LayoutParameters = new LayoutParameters() { Width = 40, Height = 40, Margins = new UIEdgeInsets(0, 0, 0, 10), } }, new LinearLayout(Orientation.Vertical) { LayoutParameters = new LayoutParameters() { Width = AutoSize.FillParent, Height = AutoSize.WrapContent, }, SubViews = new View[] { new NativeView() { View = _labelTitle = new UILabel() { Text = "Title", BackgroundColor = UIColor.Clear, Font = UIFont.BoldSystemFontOfSize(18), HighlightedTextColor = UIColor.White, }, LayoutParameters = new LayoutParameters() { Width = AutoSize.FillParent, Height = AutoSize.WrapContent, } }, new NativeView() { View = _labelSubTitle = new UILabel() { Text = "SubTitle", BackgroundColor = UIColor.Clear, Font = UIFont.SystemFontOfSize(12), TextColor = UIColor.DarkGray, HighlightedTextColor = UIColor.White, }, LayoutParameters = new LayoutParameters() { Width = AutoSize.FillParent, Height = AutoSize.WrapContent, } }, new NativeView() { View = _labelLongText = new UILabel() { BackgroundColor = UIColor.Clear, Font = UIFont.SystemFontOfSize(12), TextColor = UIColor.DarkGray, HighlightedTextColor = UIColor.White, Lines = 0, }, LayoutParameters = new LayoutParameters() { Width = AutoSize.FillParent, Height = AutoSize.WrapContent, } } } }, new NativeView() { View = _labelPercent = new UILabel() { Text = "20%", BackgroundColor = UIColor.Clear, TextColor = UIColor.FromRGB(51, 102, 153), HighlightedTextColor = UIColor.White, Font = UIFont.BoldSystemFontOfSize(24), TextAlignment = UITextAlignment.Right, }, LayoutParameters = new LayoutParameters() { Width = 50, Height = AutoSize.FillParent, Margins = new UIEdgeInsets(0, 10, 0, 0), } } } }; this.ContentView.Add(new UILayoutHost(Layout, this.ContentView.Bounds)); this.Accessory = UITableViewCellAccessory.DisclosureIndicator; }
public GridCellDisconnected(CGRect frame) : base(frame) { if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) { textSize = 15f; } else { textSize = 25f; } ion = AppState.context; BackgroundView = new UIView { BackgroundColor = UIColor.Clear }; ContentView.BackgroundColor = UIColor.Clear; typeLabel = new UILabel(new CGRect(0, 0, ContentView.Bounds.Width, .5 * ContentView.Bounds.Height)); typeLabel.Font = UIFont.BoldSystemFontOfSize(textSize); typeLabel.TextColor = UIColor.White; typeLabel.TextAlignment = UITextAlignment.Center; typeLabel.Layer.CornerRadius = 5; typeLabel.ClipsToBounds = true; typeLabel.BackgroundColor = UIColor.Red; typeLabel.AdjustsFontSizeToFitWidth = true; typeLabelMask = new UILabel(new CGRect(0, .8 * typeLabel.Bounds.Height, typeLabel.Bounds.Width, .2 * typeLabel.Bounds.Height)); typeLabelMask.BackgroundColor = UIColor.Red; typeLabelMask.ClipsToBounds = false; sensorStatusView = new UIView(new CGRect(0, .5 * ContentView.Bounds.Height, ContentView.Bounds.Width, .5 * ContentView.Bounds.Height)); sensorStatusView.BackgroundColor = UIColor.Black; sensorStatusView.Layer.CornerRadius = 5; sensorStatusView.ClipsToBounds = true; sensorStatusMask = new UILabel(new CGRect(0, .5 * ContentView.Bounds.Height, sensorStatusView.Bounds.Width, .2 * sensorStatusView.Bounds.Height)); sensorStatusMask.BackgroundColor = UIColor.Black; connectionImage = new UIImageView(new CGRect(.05 * sensorStatusView.Bounds.Width, .25 * sensorStatusView.Bounds.Height, .7 * sensorStatusView.Bounds.Height, .6 * sensorStatusView.Bounds.Height)); connectionImage.Image = UIImage.FromBundle("ic_radio_blank"); connectionImage.Image = connectionImage.Image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate); connectionImage.Layer.MasksToBounds = true; extraImage = new UIImageView(new CGRect(.25 * sensorStatusView.Bounds.Width, .1 * sensorStatusView.Bounds.Height, .25 * sensorStatusView.Bounds.Width, sensorStatusView.Bounds.Height)); extraImage.BackgroundColor = UIColor.Black; workbenchImage = new UIImageView(new CGRect(.51 * sensorStatusView.Bounds.Width, .05 * sensorStatusView.Bounds.Width, .21 * sensorStatusView.Bounds.Width, .8 * sensorStatusView.Bounds.Height)); workbenchImage.Image = UIImage.FromBundle("ic_nav_workbench"); workbenchImage.Image = workbenchImage.Image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate); workbenchImage.TintColor = UIColor.White; analyzerImage = new UIImageView(new CGRect(.76 * sensorStatusView.Bounds.Width, .05 * sensorStatusView.Bounds.Width, .21 * sensorStatusView.Bounds.Width, .8 * sensorStatusView.Bounds.Height)); analyzerImage.Image = UIImage.FromBundle("ic_nav_analyzer"); analyzerImage.Image = analyzerImage.Image.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate); analyzerImage.TintColor = UIColor.White; sensorStatusView.AddSubview(connectionImage); sensorStatusView.AddSubview(extraImage); sensorStatusView.AddSubview(workbenchImage); sensorStatusView.AddSubview(analyzerImage); ContentView.AddSubview(typeLabel); ContentView.AddSubview(sensorStatusView); ContentView.AddSubview(typeLabelMask); ContentView.AddSubview(sensorStatusMask); }
protected override void InitializeView() { base.InitializeView(); nfloat top = UIApplication.SharedApplication.StatusBarFrame.Height + this.NavigationController.NavigationBar.Bounds.Height; nfloat height = (UIScreen.MainScreen.Bounds.Height - top) / 4; nfloat top2 = top + height; nfloat top3 = top2 + height; nfloat top4 = top3 + height; this.Label1 = new UILabel() { Frame = new CGRect(UIScreen.MainScreen.Bounds.Left + (UIScreen.MainScreen.Bounds.Width * 5 / 6) - 6, top, UIScreen.MainScreen.Bounds.Width / 6, height / 2), Text = "User", Font = UIFont.BoldSystemFontOfSize(10), TextAlignment = UITextAlignment.Right }; View.AddSubview(this.Label1); this.Label2 = new UILabel() { Frame = new CGRect(UIScreen.MainScreen.Bounds.Left + (UIScreen.MainScreen.Bounds.Width * 5 / 6) - 6, top + (height / 2), UIScreen.MainScreen.Bounds.Width / 6, 10), Font = UIFont.BoldSystemFontOfSize(14), TextAlignment = UITextAlignment.Right, TextColor = UIColor.FromRGB(88, 114, 253) }; View.AddSubview(this.Label2); this.Label3 = new UILabel() { Frame = new CGRect(UIScreen.MainScreen.Bounds.Left + (UIScreen.MainScreen.Bounds.Width * 5 / 6) - 6, top2, UIScreen.MainScreen.Bounds.Width / 6, height / 2), Text = "Download", Font = UIFont.BoldSystemFontOfSize(10), TextAlignment = UITextAlignment.Right }; View.AddSubview(this.Label3); this.Label4 = new UILabel() { Frame = new CGRect(UIScreen.MainScreen.Bounds.Left + (UIScreen.MainScreen.Bounds.Width * 5 / 6) - 6, top2 + (height / 2), UIScreen.MainScreen.Bounds.Width / 6, 10), Font = UIFont.BoldSystemFontOfSize(14), TextAlignment = UITextAlignment.Right, TextColor = UIColor.FromRGB(5, 226, 117) }; View.AddSubview(this.Label4); this.Label5 = new UILabel() { Frame = new CGRect(UIScreen.MainScreen.Bounds.Left + (UIScreen.MainScreen.Bounds.Width * 5 / 6) - 6, top3, UIScreen.MainScreen.Bounds.Width / 6, height / 2), Text = "Upload", Font = UIFont.BoldSystemFontOfSize(10), TextAlignment = UITextAlignment.Right }; View.AddSubview(this.Label5); this.Label6 = new UILabel() { Frame = new CGRect(UIScreen.MainScreen.Bounds.Left + (UIScreen.MainScreen.Bounds.Width * 5 / 6) - 6, top3 + (height / 2), UIScreen.MainScreen.Bounds.Width / 6, 10), Font = UIFont.BoldSystemFontOfSize(14), TextAlignment = UITextAlignment.Right, TextColor = UIColor.FromRGB(217, 39, 255) }; View.AddSubview(this.Label6); this.Label7 = new UILabel() { Frame = new CGRect(UIScreen.MainScreen.Bounds.Left + (UIScreen.MainScreen.Bounds.Width * 5 / 6) - 6, top4, UIScreen.MainScreen.Bounds.Width / 6, height / 2), Text = "Crashes", Font = UIFont.BoldSystemFontOfSize(10), TextAlignment = UITextAlignment.Right }; View.AddSubview(this.Label7); this.Label8 = new UILabel() { Frame = new CGRect(UIScreen.MainScreen.Bounds.Left + (UIScreen.MainScreen.Bounds.Width * 5 / 6) - 6, top4 + (height / 2), UIScreen.MainScreen.Bounds.Width / 6, 10), Font = UIFont.BoldSystemFontOfSize(14), TextAlignment = UITextAlignment.Right, TextColor = UIColor.FromRGB(0, 176, 254) }; View.AddSubview(this.Label8); this.ChartView = new UIChartView() { Frame = new CGRect(UIScreen.MainScreen.Bounds.Left, top, UIScreen.MainScreen.Bounds.Width * 5 / 6, height) }; View.AddSubview(this.ChartView); this.ChartView2 = new UIChartView() { Frame = new CGRect(UIScreen.MainScreen.Bounds.Left, top2, UIScreen.MainScreen.Bounds.Width * 5 / 6, height) }; View.AddSubview(this.ChartView2); this.ChartView3 = new UIChartView() { Frame = new CGRect(UIScreen.MainScreen.Bounds.Left, top3, UIScreen.MainScreen.Bounds.Width * 5 / 6, height) }; View.AddSubview(this.ChartView3); this.ChartView4 = new UIChartView() { Frame = new CGRect(UIScreen.MainScreen.Bounds.Left, top4, UIScreen.MainScreen.Bounds.Width * 5 / 6, height) }; View.AddSubview(this.ChartView4); UIBarButtonItem actionPresenterButton = new UIBarButtonItem(UIBarButtonSystemItem.Action); UIBarButtonItem[] barButton = new UIBarButtonItem[1]; barButton[0] = actionPresenterButton; this.NavigationItem.SetRightBarButtonItems(barButton, false); this.NavigationItem.Title = "Website Statistics"; this.RegisterViewIdentifier("ActionPresenterButton", actionPresenterButton); this.RegisterViewIdentifier("ChartView", this.ChartView); this.RegisterViewIdentifier("ChartView2", this.ChartView2); this.RegisterViewIdentifier("ChartView3", this.ChartView3); this.RegisterViewIdentifier("ChartView4", this.ChartView4); this.RegisterViewIdentifier("Label1", this.Label1); this.RegisterViewIdentifier("Label2", this.Label2); this.RegisterViewIdentifier("Label3", this.Label3); this.RegisterViewIdentifier("Label4", this.Label4); this.RegisterViewIdentifier("Label5", this.Label5); this.RegisterViewIdentifier("Label6", this.Label6); this.RegisterViewIdentifier("Label7", this.Label7); this.RegisterViewIdentifier("Label8", this.Label8); }
public GradientRange() { gauge = new SFCircularGauge(); gauge.BackgroundColor = UIColor.White; ObservableCollection <SFCircularScale> scales = new ObservableCollection <SFCircularScale>(); SFCircularScale scale = new SFCircularScale(); scale.StartValue = 0; scale.EndValue = 100; scale.Interval = 10; scale.ShowRim = false; scale.ShowTicks = false; scale.ShowLabels = false; SFCircularRange range = new SFCircularRange(); range.Offset = 0.8f; range.StartValue = 0; range.EndValue = 100; range.Width = 25; GaugeGradientStop color1 = new GaugeGradientStop(); color1.Value = 0; color1.Color = UIColor.FromRGB(240, 62, 62); range.GradientStops.Add(color1); GaugeGradientStop color2 = new GaugeGradientStop(); color2.Value = 35; color2.Color = UIColor.FromRGB(255, 221, 0); range.GradientStops.Add(color2); GaugeGradientStop color3 = new GaugeGradientStop(); color3.Value = 75; color3.Color = UIColor.FromRGB(255, 221, 0); range.GradientStops.Add(color3); GaugeGradientStop color4 = new GaugeGradientStop(); color4.Value = 100; color4.Color = UIColor.FromRGB(48, 179, 45); range.GradientStops.Add(color4); scale.Ranges.Add(range); ObservableCollection <SFMarkerPointer> pointers = new ObservableCollection <SFMarkerPointer>(); SFMarkerPointer pointer = new SFMarkerPointer(); pointer.MarkerShape = MarkerShape.InvertedTriangle; pointer.Offset = 0.8f; pointer.Value = 55; pointer.MarkerWidth = 15; pointer.MarkerHeight = 15; pointer.Color = UIColor.Red; pointers.Add(pointer); scale.Pointers.Add(pointer); SFGaugeHeader header1 = new SFGaugeHeader(); header1.Text = (Foundation.NSString) "0"; header1.TextColor = UIColor.FromRGB(240, 62, 62); header1.Position = new CGPoint(0.28, 0.86); header1.TextStyle = UIFont.BoldSystemFontOfSize(12); gauge.Headers.Add(header1); SFGaugeHeader header2 = new SFGaugeHeader(); header2.Text = (Foundation.NSString) "100"; header2.TextColor = UIColor.FromRGB(48, 179, 45); header2.Position = new CGPoint(0.75, 0.86); header2.TextStyle = UIFont.BoldSystemFontOfSize(12); gauge.Headers.Add(header2); SFGaugeHeader header3 = new SFGaugeHeader(); header3.Text = (Foundation.NSString) "55%"; header3.TextColor = UIColor.FromRGB(240, 62, 62); header3.Position = new CGPoint(0.5, 0.5); header1.TextStyle = UIFont.BoldSystemFontOfSize(16); gauge.Headers.Add(header3); scales.Add(scale); gauge.Scales = scales; this.AddSubview(gauge); }
protected override void InitializeObjects() { base.InitializeObjects(); View.BackgroundColor = UIColor.LightGray; var topView = new UIView(); var profileNavigationBarBackground = new UIImageView(UIImage.FromBundle(@"Images/navigation_bar_background.png")); profileNavigationBarBackground.Frame = new CoreGraphics.CGRect(10, 10, profileNavigationBarBackground.Image.CGImage.Width, profileNavigationBarBackground.Image.CGImage.Height); backToPayHistoryViewButton = UIButton.FromType(UIButtonType.Custom); backToPayHistoryViewButton.SetImage(UIImage.FromFile(@"Images/ic_back.png"), UIControlState.Normal); openInButton = UIButton.FromType(UIButtonType.Custom); openInButton.SetImage(UIImage.FromFile(@"Images/PayHistoryView/ic_openIn.png"), UIControlState.Normal); informationLabel = new UILabel(); informationLabel.TextColor = UIColor.White; informationLabel.Text = "Payment History"; informationLabel.Font = UIFont.BoldSystemFontOfSize(16f); informationLabel.TextAlignment = UITextAlignment.Center; urlLabel = new UILabel(); pdfWebView = new UIWebView(View.Bounds); // Hide navigation bar NavigationController.SetNavigationBarHidden(true, false); View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(@"Images/tab_background.png").Scale(View.Frame.Size)); topView.AddIfNotNull(profileNavigationBarBackground, backToPayHistoryViewButton, informationLabel, openInButton); topView.AddConstraints( profileNavigationBarBackground.WithSameWidth(topView), profileNavigationBarBackground.WithSameHeight(topView), profileNavigationBarBackground.AtTopOf(topView), backToPayHistoryViewButton.WithSameCenterY(topView), backToPayHistoryViewButton.AtLeftOf(topView, 20), backToPayHistoryViewButton.WithRelativeWidth(topView, 0.1f), backToPayHistoryViewButton.WithRelativeHeight(topView, 0.2f), informationLabel.WithSameCenterY(topView), informationLabel.WithSameCenterX(topView), informationLabel.WithSameWidth(topView), informationLabel.WithRelativeHeight(topView, 0.3f), openInButton.WithSameCenterY(topView), openInButton.AtRightOf(topView, 20), openInButton.WithRelativeWidth(topView, 0.1f), openInButton.WithRelativeHeight(topView, 0.2f) ); View.AddIfNotNull(topView, pdfWebView); View.AddConstraints( topView.AtTopOf(View), topView.WithSameWidth(View), topView.WithRelativeHeight(View, 0.2f), pdfWebView.Below(topView, 10), pdfWebView.AtLeftOf(View, 30), pdfWebView.AtRightOf(View, 30), pdfWebView.WithRelativeHeight(View, 0.8f) ); }
void InitLayout() { DateTime currentTime = DateTime.Now; // add date label - first row for (int i = 0; i < 7; i++) { UILabel lb = new UILabel(); lb.Frame = new CoreGraphics.CGRect(i * _itemSize, 0, _itemSize, _itemSize); lb.Text = Constants.DaysInWeek.ElementAt(i); lb.TextAlignment = UITextAlignment.Center; lb.ClipsToBounds = true; lb.Layer.CornerRadius = _itemSize / 2; lb.BackgroundColor = _labelColor; lb.Layer.BorderWidth = 1; lb.Layer.BorderColor = UIColor.Black.CGColor; this.AddSubview(lb); } // add month UILabel lbMonth = new UILabel(); lbMonth.Frame = new CoreGraphics.CGRect(0, _itemSize, this.Bounds.Width, 70); lbMonth.TextAlignment = UITextAlignment.Center; lbMonth.TextColor = UIColor.Black; lbMonth.Font = UIFont.BoldSystemFontOfSize(22); Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); string[] monthNames = System.Globalization.CultureInfo.CurrentCulture .DateTimeFormat.MonthGenitiveNames; lbMonth.Text = string.Format("{0} {1}", monthNames[currentTime.Month], currentTime.Year); this.AddSubview(lbMonth); // draw the table UIView viewTable = new UIView(); viewTable.BackgroundColor = UIColor.Clear; viewTable.Frame = new CoreGraphics.CGRect(0, _itemSize + 70, this.Bounds.Width, _itemSize * _numberRows); _buttons = new List <CalendarButton> (); for (int row = 0; row < _numberRows; row++) { for (int col = 0; col < _numberItemPerRow; col++) { CalendarButton btn = new CalendarButton(); btn.Frame = new CoreGraphics.CGRect(col * _itemSize, row * _itemSize, _itemSize, _itemSize); btn.BackgroundColor = UIColor.White; // default color; btn.Layer.BorderColor = UIColor.Black.CGColor; btn.Layer.BorderWidth = 1; btn.Layer.CornerRadius = _itemSize / 2; btn.Tag = 0; btn.SetTitleColor(UIColor.Black, UIControlState.Normal); _buttons.Add(btn); viewTable.AddSubview(btn); } } // get the first and last date of current month; DateTime nexMonth = currentTime.AddMonths(1); var startDate = new DateTime(nexMonth.Year, nexMonth.Month, 1); var endDate = startDate.AddMonths(1).AddDays(-1); int currentDateOfWeek = (int)startDate.Date.DayOfWeek; for (int i = 0; i < endDate.Day; i++) { CalendarButton btn = _buttons.ElementAt(currentDateOfWeek + i); btn.BackgroundColor = _labelColor; btn.SetTitle((i + 1).ToString(), UIControlState.Normal); btn.ID = i + 1; btn.TouchUpInside += (object sender, EventArgs e) => { CalendarButton sd = (CalendarButton)sender; sd.Tag++; if (sd.Tag % 3 == 0) { // gray sd.State = 0; sd.BackgroundColor = _labelColor; } else if (sd.Tag % 3 == 1) { // red sd.State = 1; sd.BackgroundColor = _oneTouchColor; } else { // green sd.State = 2; sd.BackgroundColor = _twoTouchColor; } }; } this.AddSubview(viewTable); }