public ActionStateData( string image, string?name, string?multiActionImage, string?title, bool showTitle, string?titleColor, TitleAlignment titleAlignment, FontFamily fontFamily, FontStyle fontStyle, int?fontSize, bool fontUnderline) { Image = image; Name = name; MultiActionImage = multiActionImage; Title = title; ShowTitle = showTitle; TitleColor = titleColor; TitleAlignment = titleAlignment; FontFamily = fontFamily; FontStyle = fontStyle; FontSize = fontSize; FontUnderline = fontUnderline; Verify(this, x => x.Image).NotNull().NotEmpty(); Verify(this, x => x.Name).NotEmpty(); Verify(this, x => x.MultiActionImage).NotEmpty(); Verify(this, x => x.Title).NotEmpty(); Verify(this, x => x.TitleColor).NotEmpty().Regex("^#[a-fA-F0-9]{6}$"); Verify(this, x => x.FontSize).Min(1); }
// CONSTRUCTORS // <summary> // Initializes a new instance of the FancyControls.Data.Axis class. // </summary> // <param name="axis"> // An axis to config. // </param> internal Axis(System.Windows.Forms.DataVisualization.Charting.Axis axis) { this.axis = axis; this.text = null; this.titleAlignment = (TitleAlignment)axis.TitleAlignment; this.ArrowStyle = AxisArrowStyle.Lines; this.axis.Crossing = 0; this.GridLineWidth = 0; }
/// <param name="image">The default image for the state.</param> /// <param name="name">The name of the state displayed in the dropdown menu in the Multi action.<br/>For example Start or Stop for the states of the Game Capture Record action.<br/>If the name is not provided, the state will not appear in the Multi Action.</param> /// <param name="multiActionImage">This can be used if you want to provide a different image for the state when the action is displayed in a Multi Action.</param> /// <param name="title">Default title.</param> /// <param name="showTitle">Boolean to hide/show the title.<br/>True by default.</param> /// <param name="titleColor">Default title color.</param> /// <param name="titleAlignment">Default title vertical alignment.</param> /// <param name="fontFamily">Default font family for the title.</param> /// <param name="fontStyle">Default font style for the title.</param> /// <param name="fontSize">Default font size for the title.</param> /// <param name="fontUnderline">Boolean to have an underline under the title.<br/>False by default.</param> public StreamDeckActionStateAttribute( string image, string?name = null, string?multiActionImage = null, string?title = null, bool showTitle = true, string?titleColor = null, TitleAlignment titleAlignment = TitleAlignment.Middle, FontFamily fontFamily = FontFamily.Arial, FontStyle fontStyle = FontStyle.Regular, string?fontSize = null, bool fontUnderline = false) { Data = new ActionStateData(image, name, multiActionImage, title, showTitle, titleColor, titleAlignment, fontFamily, fontStyle, fontSize != null ? int.Parse(fontSize) : (int?)null, fontUnderline); }
private void SetTitlePosition(TitleAlignment alignment, Thickness padding, Thickness margin, CGRect vFrame) { var marginX = margin.Top; var marginY = margin.Left; var marginWidth = margin.Left + margin.Right; var marginHeight = margin.Top + margin.Bottom; var paddingWidth = padding.Left + padding.Right; var paddingHeight = padding.Top + padding.Bottom; var paddingX = padding.Left; var paddingY = padding.Top; if (ExtendedNavigationPage.GetTitleBackground(Element) != null && vFrame.Width == 0 && vFrame.Height == 0) { vFrame = titleView.Frame; } marginView.Frame = new CGRect(vFrame.X, vFrame.Y, vFrame.Width, vFrame.Height); double offset = 0; titleLabel.AutoresizingMask = UIViewAutoresizing.All; switch (alignment) { case TitleAlignment.Start: marginView.Frame = new CGRect(vFrame.X, marginView.Frame.Y, marginView.Bounds.Width + marginWidth + paddingWidth, marginView.Bounds.Height + marginHeight + paddingHeight); var startCenter = marginView.Center; startCenter.Y = marginView.Superview.Center.Y; marginView.Center = startCenter; titleLabel.TextAlignment = UITextAlignment.Left; subtitleLabel.TextAlignment = UITextAlignment.Left; offset = marginX; break; case TitleAlignment.Center: offset = marginX; marginView.Frame = new CGRect(marginView.Frame.X, marginView.Frame.Y, marginView.Bounds.Width + marginWidth + paddingWidth, marginView.Bounds.Height + marginHeight + paddingHeight); marginView.Center = marginView.Superview.Center; titleLabel.TextAlignment = UITextAlignment.Center; subtitleLabel.TextAlignment = UITextAlignment.Center; break; case TitleAlignment.End: var endCenter = marginView.Center; endCenter.Y = marginView.Superview.Center.Y; marginView.Center = endCenter; titleLabel.TextAlignment = UITextAlignment.Right; subtitleLabel.TextAlignment = UITextAlignment.Right; marginView.Frame = new CGRect(marginView.Superview.Frame.Width - marginView.Frame.Width - offset - marginWidth - paddingWidth, marginView.Frame.Y, marginView.Bounds.Width + marginWidth + paddingWidth, marginView.Bounds.Height + marginHeight + paddingHeight); offset = marginView.Frame.Width - vFrame.Width - paddingWidth - marginX; break; } titleView.Frame = new CGRect(offset, vFrame.Y + marginY, vFrame.Width + paddingWidth, vFrame.Height + paddingHeight); var cPage = Element as ContentPage; var formattedSubtitle = CustomPage.GetFormattedSubtitle(Element); var subtitle = CustomPage.GetFormattedSubtitle(Element); if (cPage != null && (!string.IsNullOrEmpty(subtitle) || (formattedSubtitle != null && formattedSubtitle.Spans.Count > 0))) { titleLabel.Frame = new CGRect(paddingX, paddingY, titleView.Frame.Width, titleLabel.IntrinsicContentSize.Height); subtitleLabel.Frame = new CGRect(titleLabel.Frame.X, titleLabel.Frame.Y + titleLabel.Frame.Height + 3, titleView.Frame.Width, subtitleLabel.Frame.Height); } else { titleLabel.Frame = new CGRect(paddingX, paddingY, titleLabel.IntrinsicContentSize.Width, titleLabel.IntrinsicContentSize.Height); } }
public static void SetTitleAlignment(DependencyObject element, TitleAlignment value) { element.SetValue(TitleAlignmentProperty, value); }
public static void SetTitlePosition(BindableObject view, TitleAlignment value) => view.SetValue(TitlePositionProperty, value);
public Page GetPage(PageType pageType, object parameter, TitleAlignment titleAlignment) { Page view = null; switch (pageType) { case PageType.USER_REGISTRATION: view = new UserRegistrationPage() { }; break; case PageType.USER_LOGIN: view = new UserLoginPage(parameter as string); break; case PageType.DISCLAIMER: view = new DisclaimerPage(parameter as UserRegistration); break; case PageType.PERSONAL_DATA_PROTECTION: view = new PersonalDataProtectionPage(parameter as UserRegistration); break; case PageType.SMS_VERIFICATION: view = new SmsVerificationPage(parameter as UserRegistration); break; case PageType.HOME: view = new HomePage(parameter /*as UserProfile*/); break; case PageType.CHANGE_PHONE_NUMBER: view = new ChangePhoneNumberPage(parameter); break; case PageType.EDIT_REQUESTOR_PROFILE: view = new EditRequestorProfilePage(parameter); break; case PageType.EDIT_CONTRACTOR_PROFILE: view = new EditContractorProfilePage(parameter); break; case PageType.JOB_REQUEST: view = new JobRequestPage(parameter); break; case PageType.JOB_VIEW: view = new JobViewPage(parameter); break; case PageType.HISTORY_JOB_VIEW: view = new JobHistoryViewPage(parameter); break; case PageType.EDIT_JOB_VIEW: view = new EditJobPage(parameter); break; case PageType.PROFILE_VIEW: view = new ProfilePage(parameter); break; case PageType.JOB_ACCEPTANCE_VIEW: view = new JobAcceptanceViewPage(parameter); break; case PageType.DUMMY: view = new DummyPage(); break; } if (view != null) { if (titleAlignment == TitleAlignment.LEFT) { CustomNavigationPage.SetTitlePosition(view, CustomNavigationPage.TitleAlignment.Start); } else if (titleAlignment == TitleAlignment.RIGHT) { CustomNavigationPage.SetTitlePosition(view, CustomNavigationPage.TitleAlignment.End); } else { CustomNavigationPage.SetTitlePosition(view, CustomNavigationPage.TitleAlignment.Center); } CustomNavigationPage.SetTitleFont(view, Font.SystemFontOfSize(NamedSize.Large)); CustomNavigationPage.SetTitleColor(view, Color.Black); CustomNavigationPage.SetTitleFont(view, Font.SystemFontOfSize(20, FontAttributes.Bold)); } return(view); }
public async Task NavigateTo(PageType pageType, object parameter = null, bool appendFromRoot = false, UIPageType uIPageType = UIPageType.PAGE, TitleAlignment titleAlignment = TitleAlignment.CENTER) { var view = GetPage(pageType, parameter, titleAlignment); if (uIPageType == UIPageType.PAGE) { if (appendFromRoot) { await App.Current.MainPage.Navigation.PopToRootAsync(); await App.Current.MainPage.Navigation.PushAsync(view); } else { await App.Current.MainPage.Navigation.PushAsync(view); } } else if (uIPageType == UIPageType.MODAL) { await App.Current.MainPage.Navigation.PushModalAsync(view); } }