public string GetLabelValue(string id) { HtmlLabel Label = new HtmlLabel(Doc); Label.SearchProperties[HtmlLabel.PropertyNames.Id] = id; return(Label.InnerText); }
public virtual void Visit(FormTitle formTitle, HtmlContainer htmlContainer) { HtmlDiv htmlDiv = verbose ? new HtmlDiv(formTitle.Path) : new HtmlDiv(); htmlDiv.Class.Add("formTitle"); if (!string.IsNullOrWhiteSpace(formTitle.CssClass)) { htmlDiv.Class.AddRange(formTitle.CssClass.Split(' ').Where(s => s != string.Empty)); } if (!string.IsNullOrWhiteSpace(formTitle.Path)) { htmlDiv.Class.Add(string.Format("{0}{1}", "formId", formTitle.Path)); } htmlDiv.Hidden.Value = formTitle.IsHidden; htmlContainer.Add(htmlDiv); HtmlLabel htmlLabel = new HtmlLabel(verbose ? formTitle.Path : string.Empty); htmlDiv.Add(htmlLabel); htmlLabel.Add(new HtmlText(formTitle.Content)); }
private void UpdateText() { if (Control == null || Element == null) { return; } var isHtml = HtmlLabel.GetIsHtml(Element); if (!isHtml) { return; } var removeTags = HtmlLabel.GetRemoveHtmlTags(Element); if (removeTags) { Control.Text = HtmlToText.ConvertHtml(Control.Text); } else { var value = Element.Text ?? string.Empty; var attr = new NSAttributedStringDocumentAttributes(); var nsError = new NSError(); attr.DocumentType = NSDocumentType.HTML; var myHtmlData = NSData.FromString(value, NSStringEncoding.Unicode); Control.AttributedText = new NSAttributedString(myHtmlData, attr, ref nsError); } SetNeedsDisplay(); }
private void EditCarti_Load(object sender, EventArgs e) { try { bk = Storage.libCarti.Find(x => x.ImageUrl == Storage.urlCrt); nrCrt = Storage.libCarti.FindIndex(x => x == bk); defPictureBox.Load(bk.ImageUrl); lblTitlu.Text = bk.Title; HtmlLabel lblDescr = new HtmlLabel(); lblDescr.Location = lblDesc.Location; lblDescr.Parent = lblDesc.Parent; if (bk.Description.Length > 600) { lblDescr.Text = bk.Description.Substring(0, 600) + " ... Mai multe pe www.Goodreads.com"; } else { lblDescr.Text = bk.Description + " ... Mai multe pe www.Goodreads.com"; } lblDescr.IsSelectionEnabled = false; lblDescr.BackColor = Color.Transparent; lblDescr.MaximumSize = lblDesc.Size; lblDescr.BorderStyle = BorderStyle.FixedSingle; lblRating.Text = "Rating: " + bk.AverageRating.ToString(); cbRead.Checked = Storage.libCartiCit.ElementAt(nrCrt); } catch (Exception ex) { Console.WriteLine(ex); } }
public ProjectGanttWindow(MicrosoftDynamics365Window bw) { m_bw = bw; ProjectGanttDocument doc = m_bw.MicrosoftDynamics365Document.MainContentAreaFrame.ProjectGanttDocument; m_filterButton = doc.FilterButton.ItemPane; m_saveChangesButtonPane = doc.SaveButton.SavePane; m_expandAllButtonPane = doc.ExpandAllButton.ExpandAllPane; m_collapseAllButtonPane = doc.CollapseAllButton.CollapseallPane; m_geveePane = doc.GanttBasePane.GeveePane; m_addNewProjectPane = doc.AddNewProjectCustom.AddnewprojectPane; m_newProjectPane = doc.GanttBasePane.NewProjectPane; m_addChildTaskPane = doc.AddChildTaskCustom.AddChildTaskPane; m_projectItemEdit = doc.EditProjectTaskWindowPane.ItemEdit; m_projectOkLabel = doc.EditProjectTaskWindowPane.OKLabel; m_resourceCategoryPane = doc.EditProjectTaskResourceRolePane.ItemPane; m_developerJuniorPane = doc.DeveloperJuniorPane; m_itemStatusPane = doc.ItemStatusPane; m_chargeableCustom = doc.ChargeableCustom; m_projectNameEdit = doc.PromxCreateNewProjPane.ProjectNameItemEdit; m_selectBillingTypePane = doc.PromxCreateNewProjPane.SelectBillingTypePane; m_OKButton = doc.PromxCreateNewProjPane.OKButton; m_itemPane1 = doc.UIPromx_create_new_proPane1.ProjectManagerItemPane; m_itemEdit1 = doc.ItemEdit; m_itemCustom = doc.ItemCustom; m_itemCustom1 = doc.ItemCustom1; m_userNamePane = doc.UserNamePane; m_addButton = doc.AddButton; m_expandProjectFirstLevel = doc.GanttBasePane.ExpandFirstLevelItemPane; m_expandProjectSecondLevel = doc.GanttBasePane.ExpandSecondLevelItemPane; m_task1Pane = doc.GanttBasePane.Task1Pane; m_deleteMenuPane = doc.DeleteCustom.DeletePane; }
private void UpdateText() { if (Control == null || Element == null) { return; } var isHtml = HtmlLabel.GetIsHtml(Element); if (!isHtml) { return; } var removeTags = HtmlLabel.GetRemoveHtmlTags(Element); var text = removeTags ? HtmlToText.ConvertHtml(Control.Text) : Element.Text; var helper = new LabelRendererHelper(Element, text); CreateAttributedString(Control, helper.ToString()); SetNeedsDisplay(); }
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (e.PropertyName == Label.TextProperty.PropertyName) { if (Control != null) { HtmlLabel wer = Element as HtmlLabel; Control?.SetText(Html.FromHtml(Element.Text), TextView.BufferType.Spannable); TextView x = Control; if (wer != null && wer.Align == HtmlLabel.Alignment.Right) { x.Gravity = Android.Views.GravityFlags.Right | Android.Views.GravityFlags.CenterVertical; } else if (wer != null && wer.Align == HtmlLabel.Alignment.Center) { x.Gravity = Android.Views.GravityFlags.Center | Android.Views.GravityFlags.CenterVertical; } else if (wer != null && wer.Align == HtmlLabel.Alignment.Left) { x.Gravity = Android.Views.GravityFlags.Left | Android.Views.GravityFlags.CenterVertical; } } } }
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (e.PropertyName == Label.TextProperty.PropertyName) { if (Control != null) { HtmlLabel wer = Element as HtmlLabel; var text = Control.Text.AsAttributedString(NSDocumentType.HTML); Control.AttributedText = new UITextView { AttributedText = text }.AttributedText; Control.TextColor = UIColor.White; UILabel x = Control; if (wer != null && wer.Align == HtmlLabel.Alignment.Right) { x.TextAlignment = UITextAlignment.Right; } else if (wer != null && wer.Align == HtmlLabel.Alignment.Center) { x.TextAlignment = UITextAlignment.Center; } else if (wer != null && wer.Align == HtmlLabel.Alignment.Left) { x.TextAlignment = UITextAlignment.Left; } } } }
public string ReplaceLabels(List <HtmlLabel> labelList) { foreach (HtmlLabel newLabel in labelList) { bool labelFound = false; HtmlLabel oldLabel = null; foreach (HtmlLabel pair in ReplacedLabels) { if (pair.Key == newLabel.Key) { labelFound = true; oldLabel = pair; } } if (!labelFound) { Html = Html.Replace(newLabel.Key, string.Format(ReplaceLabelTemplate, newLabel.Key, newLabel.Value)); ReplacedLabels.Add(newLabel); } else { Html = Html.Replace(string.Format(ReplaceLabelTemplate, oldLabel.Key, oldLabel.Value), string.Format(ReplaceLabelTemplate, newLabel.Key, newLabel.Value)); ReplacedLabels.Remove(oldLabel); ReplacedLabels.Add(newLabel); } } return(Html); }
protected override void OnElementChanged(ElementChangedEventArgs <Label> e) { base.OnElementChanged(e); var text = Control.Text.AsAttributedString(NSDocumentType.HTML); Control.AttributedText = new UITextView { AttributedText = text }.AttributedText; Control.TextColor = UIColor.White; HtmlLabel wer = Element as HtmlLabel; UILabel x = Control; if (wer != null && wer.Align == HtmlLabel.Alignment.Right) { x.TextAlignment = UITextAlignment.Right; } else if (wer != null && wer.Align == HtmlLabel.Alignment.Center) { x.TextAlignment = UITextAlignment.Center; } else if (wer != null && wer.Align == HtmlLabel.Alignment.Left) { x.TextAlignment = UITextAlignment.Left; } }
private void UpdateText() { if (Control == null || Element == null) { return; } var isHtml = HtmlLabel.GetIsHtml(Element); if (!isHtml) { return; } var removeTags = HtmlLabel.GetRemoveHtmlTags(Element); var text = removeTags ? HtmlToText.ConvertHtml(Control.Text) : Element.Text; var helper = new LabelRendererHelper(Element, text); var value = helper.ToString(); var html = Build.VERSION.SdkInt >= BuildVersionCodes.N ? Html.FromHtml(value, FromHtmlOptions.ModeCompact) : Html.FromHtml(value); Control.SetText(html, TextView.BufferType.Spannable); Control.MovementMethod = LinkMovementMethod.Instance; }
public void LabelFor_OnHtmlLabel_Succeeds() { //Arrange using (var webPage = new TempWebPage( @"<html> <head> <title>test</title> </head> <body> <form> <label for=""male"">Male</label> <input type=""radio"" name=""sex"" id=""male"" value=""male""><br> <label for=""female"">Female</label> <input type=""radio"" name=""sex"" id=""female"" value=""female""><br> <label id=""other"" for=""other"">Other</label> <input type=""radio"" name=""sex"" id=""other"" value=""other""><br> <input type=""submit"" value=""Submit""> </form> </body> </html>")) { var browserWindow = BrowserWindow.Launch(webPage.FilePath); HtmlLabel label = browserWindow.Find <HtmlLabel>(By.Id("other")); //Assert Assert.AreEqual("other", label.LabelFor); browserWindow.Close(); } }
private void UpdateText() { if (Control == null || Element == null) { return; } var isHtml = HtmlLabel.GetIsHtml(Element); if (!isHtml) { return; } var attr = new NSAttributedStringDocumentAttributes(); var nsError = new NSError(); attr.DocumentType = NSDocumentType.HTML; var removeTags = HtmlLabel.GetRemoveHtmlTags(Element); var text = removeTags ? HtmlToText.ConvertHtml(Control.Text) : Element.Text; var helper = new LabelRendererHelper(Element, text); var htmlData = NSData.FromString(helper.ToString(), NSStringEncoding.Unicode); Control.AttributedText = new NSAttributedString(htmlData, attr, ref nsError); SetNeedsDisplay(); }
private void UpdateText() { if (Control == null || Element == null) { return; } var isHtml = HtmlLabel.GetIsHtml(Element); if (!isHtml) { return; } var removeTags = HtmlLabel.GetRemoveHtmlTags(Element); if (removeTags) { Control.Text = HtmlToText.ConvertHtml(Control.Text); } else { var value = Element.Text ?? string.Empty; var html = Build.VERSION.SdkInt >= BuildVersionCodes.N ? Html.FromHtml(value, FromHtmlOptions.ModeCompact) : Html.FromHtml(value); Control.SetText(html, TextView.BufferType.Spannable); } }
private void UpdateText() { if (Control == null || Element == null) { return; } var isHtml = HtmlLabel.GetIsHtml(Element); if (!isHtml) { return; } var removeTags = HtmlLabel.GetRemoveHtmlTags(Element); var text = removeTags ? HtmlToText.ConvertHtml(Control.Text) : Element.Text; var helper = new LabelRendererHelper(Element, text); Control.Text = helper.ToString(); var behavior = new HtmlTextBehavior(); Interaction.GetBehaviors(Control).Add(behavior); }
private void UpdateText() { if (Control == null || Element == null) { return; } var isHtml = HtmlLabel.GetIsHtml(Element); if (!isHtml) { return; } var removeTags = HtmlLabel.GetRemoveHtmlTags(Element); var text = removeTags ? HtmlToText.ConvertHtml(Control.Text) : Element.Text; var helper = new LabelRendererHelper(Element, text); var html = Html.FromHtml(helper.ToString(), FromHtmlOptions.ModeCompact); Control.SetText(html, TextView.BufferType.Spannable); }
private static void SetLinksStyles(HtmlLabel element, NSMutableAttributedString mutableHtmlString) { using var linkAttributeName = new NSString("NSLink"); UIStringAttributes linkAttributes = null; if (!element.UnderlineText) { linkAttributes ??= new UIStringAttributes(); linkAttributes.UnderlineStyle = NSUnderlineStyle.None; } ; if (!element.LinkColor.IsDefault) { linkAttributes ??= new UIStringAttributes(); linkAttributes.ForegroundColor = element.LinkColor.ToUIColor(); } ; mutableHtmlString.EnumerateAttribute(linkAttributeName, new NSRange(0, mutableHtmlString.Length), NSAttributedStringEnumeration.LongestEffectiveRangeNotRequired, (NSObject value, NSRange range, ref bool stop) => { if (value != null && value is NSUrl) { // Replace the standard NSLink because iOS does not change the aspect of it otherwise. mutableHtmlString.AddAttribute(LinkTapHelper.CustomLinkAttribute, value, range); mutableHtmlString.RemoveAttribute("NSLink", range); // Applies the style if (linkAttributes != null) { mutableHtmlString.AddAttributes(linkAttributes, range); } } }); }
private static HtmlLabel GetHtmlLabel(string uiTitle, string uiType) { dynamic htmlControl = new HtmlLabel(Browser.Locate(uiTitle, uiType)); htmlControl.TechnologyName = TechnologyNameWeb; return(htmlControl); }
public FRadioButton() { InitializeComponent(); myLayout.Margin = new Thickness(10, 0, 10, 0); var myScroll = new ScrollView(); var myStack = new StackLayout(); myScroll.Content = myStack; HtmlLabel kerdes = new HtmlLabel(); kerdes.Text = Constans.aktQuestion.question_title; kerdes.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)); myStack.Children.Add(kerdes); foreach (var item in Constans.aktQuestion.choices) { RadioButton button = new RadioButton(); button.Text = item; //button.HorizontalOptions = LayoutOptions.Start; //button.FontSize = "Large"; button.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)); button.BackgroundColor = Color.Transparent; int padding = Convert.ToInt16(Constans.ScreenWidth / 7); button.Padding = new Thickness(padding, 0, padding, 0); listCheckbox.Add(button); //button.Opacity = 1; button.CheckedChange += Button_CheckedChange; myStack.Children.Add(button); } //myLayout myLayout.Children.Add(myScroll); }
public void OnSendNavigated_Navigated_IsInvoked() { // Arrange var label = new HtmlLabel(); var url = Guid.NewGuid().ToString(); var source = new UrlWebViewSource(); var expectedArgs = new WebNavigatingEventArgs(WebNavigationEvent.Forward, source, url); label.Navigated += LabelNavigated; WebNavigatingEventArgs actualArgs = null; object actualSender = null; void LabelNavigated(object sender, WebNavigatingEventArgs e) { actualSender = sender; actualArgs = e; } // Act label.SendNavigated(expectedArgs); // Assert Assert.Equal(expectedArgs, actualArgs); Assert.Equal(label, actualSender); }
public void ClickLabel(UITestControl parent, string value) { var link = new HtmlLabel(parent); link.SearchProperties.Add(HtmlHyperlink.PropertyNames.Id, value); Mouse.Click(link); }
public void InsertOutOfRange1() { HtmlDiv g = new HtmlDiv(""); HtmlLabel l = new HtmlLabel(""); g.Insert(1, l); }
private void InitializeComponent() { AvaloniaXamlLoader.Load(this); var grid = this.FindControl <Grid>("MainGrid"); _releaseNotesRow = grid.RowDefinitions[2]; _htmlLabel = this.FindControl <HtmlLabel>("ChangeNotesHTMLLabel"); //_htmlLabel.SetValue(HtmlLabel.AutoSizeHeightOnlyProperty, true); // throws on 0.10.0 for some reason? }
private HtmlLabel GetLabel(FormInput formInput, HtmlElement htmlElement) { HtmlLabel htmlLabel = verbose ? new HtmlLabel(formInput.Path) : new HtmlLabel(); htmlLabel.Class.Add("formInputLabel"); htmlLabel.For.Value = htmlElement.Id.Value; htmlLabel.Add(new HtmlText(formInput.Label)); return(htmlLabel); }
private void UpdateMaxLines() { var maxLines = HtmlLabel.GetMaxLines(Element); if (maxLines == default(int)) { return; } Control.MaximumNumberOfLines = maxLines; }
private void UpdateMaxLines() { var maxLines = HtmlLabel.GetMaxLines(Element); if (maxLines == default) { return; } Control.SetMaxLines(maxLines); }
public void Create() { //var layout = new StackLayout() { // Orientation = StackOrientation.Horizontal //}; var layout = new Grid() { ColumnDefinitions = new ColumnDefinitionCollection(), HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.StartAndExpand }; layout.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); layout.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Star }); this.Content = layout; this.Icon = new Image() { Source = this.OffImg, WidthRequest = this.Size, HeightRequest = this.Size }; this.Icon.SetBinding(Image.IsVisibleProperty, new Binding("ShowRadio", source: this)); layout.Children.Add(this.Icon); Grid.SetColumn(this.Icon, 0); this.Lbl = new HtmlLabel() { VerticalTextAlignment = TextAlignment.Center, //HorizontalOptions = LayoutOptions.Fill, //HorizontalTextAlignment = TextAlignment.Center, //BackgroundColor = Color.Yellow }; this.Lbl.SetBinding(Label.HorizontalTextAlignmentProperty, new Binding("TextAlignment", source: this)); this.Lbl.Text = this.Text; this.Lbl.SetBinding(Label.TextColorProperty, new Binding("TextColor", source: this)); this.Lbl.TextColor = this.TextColor; layout.Children.Add(this.Lbl); if (this.RadioOrientation.Equals(StackOrientation.Vertical)) { Grid.SetRow(this.Lbl, 1);//Vertical } else { Grid.SetColumn(this.Lbl, 1); //Horizontal } }
public void Insert() { HtmlDiv g = new HtmlDiv(""); HtmlLabel l = new HtmlLabel(""); g.Insert(0, l); Assert.AreSame(l.Container, g); Assert.IsTrue(g.Contents.Any(c => ReferenceEquals(c, l))); Assert.AreEqual(g.Contents.Count, 1); }
private void SetHTMLPanelText(HtmlLabel ctl, string text) { try { ctl.Text = text; m_htmlText = text; } catch (ArgumentException) { ctl.Text = text; } }
private void UpdateMaxLines() { var maxLines = HtmlLabel.GetMaxLines(Element); if (maxLines == default(int)) { return; } Control.Lines = maxLines; SetNeedsDisplay(); }
public InfoToolTipForm() { Padding = new Padding(5); // add scroll page _panel = new YamuiScrollPanel { Dock = DockStyle.Fill, NoBackgroundImage = true }; Controls.Add(_panel); // add label _labelContent = new HtmlLabel { AutoSizeHeightOnly = true, Location = new Point(0, 0), Anchor = AnchorStyles.Top | AnchorStyles.Left }; _panel.ContentPanel.Location = new Point(0, 0); _panel.ContentPanel.Controls.Add(_labelContent); Size = new Size(50, 50); }
public string GetLabelValue(string id) { HtmlLabel Label = new HtmlLabel(Doc); Label.SearchProperties[HtmlLabel.PropertyNames.Id] = id; return Label.InnerText; }
/// <summary> /// Add a new HTML label within the layout at the given position. The client bounds determine the /// maximum extent of the text. /// </summary> public override void Add(CanvasItemLayout layout, Rectangle clientBounds, Point position) { int width = clientBounds.Width - (position.X - clientBounds.X); if (_text == null) { _text = new StringBuilder((HTMLText != null) ? HTMLWrap(HTMLText) : HTML(Text)); } // Do Smiley replacement if (!DisableMarkup) { ReplaceEmoticon(_text, emoSmiley); ReplaceEmoticon(_text, emoFrown); ReplaceEmoticon(_text, emoLaugh); ReplaceEmoticon(_text, emoWink); ReplaceEmoticon(_text, emoShades); } string stylesheet = string.Format("pre {{ white-space: pre-wrap; margin-top: 0px }}\n" + "div {{ color: rgb({0}) }}\n" + "::selection {{ color: rgb({1}); background-color: rgb({2}) }}\n" + "blockquote {{ color: rgb({3}) }}\n" + "blockquote blockquote {{ color: rgb({4}) }}\n" + "blockquote blockquote blockquote {{ color: rgb({5}) }}", UI.ToString(layout.Container.Selected ? UI.Forums.SelectionTextColour : ForeColour), UI.ToString(layout.Container.Selected ? UI.Forums.SelectionColour : UI.Forums.SelectionTextColour), UI.ToString(layout.Container.Selected ? UI.Forums.SelectionTextColour : UI.Forums.SelectionColour), UI.ToString(layout.Container.Selected ? UI.Forums.SelectionTextColour : UI.Forums.Level1QuoteColour), UI.ToString(layout.Container.Selected ? UI.Forums.SelectionTextColour : UI.Forums.Level2QuoteColour), UI.ToString(layout.Container.Selected ? UI.Forums.SelectionTextColour : UI.Forums.Level3QuoteColour)); Size size = new Size(width, MaxHeight); HtmlLabel label = new HtmlLabel { AutoSizeHeightOnly = false, AutoSize = true, Size = size, MaximumSize = size, Location = position, ForeColor = ForeColour, BaseStylesheet = stylesheet, BackColor = Color.Transparent, IsSelectionEnabled = true, Visible = true }; Control = label; label.LinkClicked += OnLinkClicked; label.Click += OnClick; label.MouseDown += OnMouseDown; label.MouseMove += OnMouseMove; label.ImageLoad += LabelOnImageLoad; label.PreviewKeyDown += OnPreviewKeyDown; label.KeyDown += OnKeyDown; label.ContextMenuInvoked += OnContextMenuInvoked; label.LinkHover += OnLinkHover; try { label.Text = _text.ToString(); } catch (Exception) { // This can crash in HtmlRenderer so we need this safeguard. label.Text = string.Empty; } layout.Container.Controls.Add(Control); Bounds = new Rectangle(position.X, position.Y, Control.Size.Width, Control.Size.Height + SpaceAfter); _layout = layout; }
public YamuiMenu(Point location, List<YamuiMenuItem> content, string htmlTitle = null) { if (content == null || content.Count == 0) return; // init menu form SetStyle( ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); ControlBox = false; FormBorderStyle = FormBorderStyle.None; MaximizeBox = false; MinimizeBox = false; ShowIcon = false; ShowInTaskbar = false; SizeGripStyle = SizeGripStyle.Hide; StartPosition = FormStartPosition.Manual; var useImageIcon = content.Exists(item => item.ItemImage != null); var noChildren = !content.Exists(item => item.Children != null); var maxWidth = content.Select(item => TextRenderer.MeasureText(item.SubText, FontManager.GetFont(FontFunction.Small)).Width).Concat(new[] { 0 }).Max(); maxWidth += maxWidth == 0 ? 0 : 15; maxWidth += content.Select(item => TextRenderer.MeasureText(item.ItemName, FontManager.GetStandardFont()).Width).Concat(new[] { 0 }).Max(); maxWidth += (useImageIcon ? 35 : 8) + 12 + (noChildren ? 0 : 12); int yPos = BorderWidth; // title HtmlLabel title = null; if (htmlTitle != null) { title = new HtmlLabel { AutoSizeHeightOnly = true, BackColor = Color.Transparent, Width = maxWidth - BorderWidth * 2, Text = htmlTitle, Location = new Point(BorderWidth, BorderWidth), IsSelectionEnabled = false, IsContextMenuEnabled = false, Enabled = false }; yPos += title.Height; } // insert buttons int index = 0; Controls.Clear(); foreach (var item in content) { if (item.IsSeparator) { _yPosOfSeparators.Add(yPos); yPos += SeparatorLineHeight; } else { var button = new YamuiMenuButton { Text = item.ItemName, NoChildren = item.Children == null || !item.Children.Any(), Location = new Point(BorderWidth, yPos), Size = new Size(maxWidth - BorderWidth * 2, LineHeight), NoIconImage = !useImageIcon, IconImage = item.ItemImage, SubText = item.SubText, Tag = index, SubTextOpacity = SubTextOpacity }; button.Click += ButtonOnButtonPressed; button.PreviewKeyDown += OnPreviewKeyDown; Controls.Add(button); _content.Add(item); yPos += LineHeight; index++; } } // add title if needed if (title != null) { Controls.Add(title); } // Size the form Size = new Size(maxWidth, yPos + BorderWidth); MinimumSize = Size; MaximumSize = Size; // menu position var screen = Screen.FromPoint(location); if (location.X > screen.WorkingArea.X + screen.WorkingArea.Width/2) { location.X = location.X - Width; _reverseX = true; } if (location.Y > screen.WorkingArea.Y + screen.WorkingArea.Height/2) { location.Y = location.Y - Height; _reverseY = true; } Location = location; // events Deactivate += OnDeactivate; Activated += OnActivated; Closing += OnClosing; if (ListOfOpenededMenuHandle == null) { ListOfOpenededMenuHandle = new List<IntPtr>(); } ListOfOpenededMenuHandle.Add(Handle); // keydown KeyPreview = true; PreviewKeyDown += OnPreviewKeyDown; }
public override void OnShow() { foreach (Control control in scrollPanel.ContentPanel.Controls) { if (!control.Name.StartsWith("static")) control.Dispose(); } // build the interface var yPos = static_name.Location.Y + 35; foreach (var item in AppliMenu.Instance.ShortcutableItemList.OrderBy(item => item.ItemName)) { // icon var imgButton = new YamuiPictureBox { BackGrndImage = item.ItemImage, Size = new Size(20, 20), Location = new Point(static_name.Location.X - 30, yPos), Tag = item.ItemId, TabStop = false }; scrollPanel.ContentPanel.Controls.Add(imgButton); // name var label = new HtmlLabel { AutoSizeHeightOnly = true, BackColor = Color.Transparent, Location = new Point(static_name.Location.X, yPos + 2), Size = new Size(340, 10), IsSelectionEnabled = false, Text = item.ItemName }; scrollPanel.ContentPanel.Controls.Add(label); // keys var button = new YamuiButton { Anchor = AnchorStyles.Right | AnchorStyles.Top, Location = new Point(static_keys.Location.X + static_keys.Width - 220, yPos - 1), Size = new Size(220, 24), Tag = item.ItemId, Text = item.ItemSpec ?? "", Name = "bt" + item.ItemId, TabStop = true, BackGrndImage = item.ItemImage, }; scrollPanel.ContentPanel.Controls.Add(button); button.Click += ButtonOnButtonPressed; tooltip.SetToolTip(button, "<b>" + item.ItemName + "</b><br><br>Click to modify this shortcut<br><i>You can press ESCAPE to cancel the changes</i>"); // reset button = new YamuiButtonImage { Anchor = AnchorStyles.Right | AnchorStyles.Top, BackGrndImage = ImageResources.UndoUserAction, Size = new Size(20, 20), Location = new Point(button.Location.X + button.Width + 10, yPos), Tag = item.ItemId, TabStop = false, }; scrollPanel.ContentPanel.Controls.Add(button); button.ButtonPressed += UndoButtonOnButtonPressed; tooltip.SetToolTip(button, "Click this button to reset the shortcut to its default value"); // reset button = new YamuiButtonImage { Anchor = AnchorStyles.Right | AnchorStyles.Top, BackGrndImage = ImageResources.Delete, Size = new Size(20, 20), Location = new Point(button.Location.X + button.Width, yPos), Tag = item.ItemId, TabStop = false, }; scrollPanel.ContentPanel.Controls.Add(button); button.ButtonPressed += ButtonDeleteOnButtonPressed; tooltip.SetToolTip(button, "Click this button to clear this shortcut"); yPos += label.Height + 15; } // Activate scrollbars scrollPanel.ContentPanel.Height = yPos + 20; Height = yPos; }
public ExportPage() { InitializeComponent(); // dynamically reorder the controls for a correct tab order on notepad++ SetTabOrder.RemoveAndAddForTabOrder(scrollPanel); // browse btBrowse.BackGrndImage = ImageResources.SelectFile; btBrowse.ButtonPressed += BtBrowseOnButtonPressed; tooltip.SetToolTip(btBrowse, "Click to <b>select</b> a folder"); btOpen.BackGrndImage = ImageResources.OpenInExplorer; btOpen.ButtonPressed += BtOpenOnButtonPressed; tooltip.SetToolTip(btOpen, "Click to <b>open</b> this folder in the explorer"); btHistoric.BackGrndImage = ImageResources.Historic; btHistoric.ButtonPressed += BtHistoricOnButtonPressed; tooltip.SetToolTip(btHistoric, "Click to <b>browse</b> the previous folders"); if (string.IsNullOrEmpty(Config.Instance.SharedConfHistoric)) btHistoric.Visible = false; btRefresh.BackGrndImage = ImageResources.refresh; btRefresh.ButtonPressed += BtRefreshOnButtonPressed; tooltip.SetToolTip(btRefresh, "Click to <b>refresh</b> the local and distant file status"); btDownloadAll.BackGrndImage = ImageResources.DownloadAll; btDownloadAll.ButtonPressed += BtDownloadAllOnButtonPressed; btDownloadAll.Hide(); tooltip.SetToolTip(btDownloadAll, "Click to <b>fetch</b> all the distant versions newer than the local versions"); fl_directory.Text = Config.Instance.SharedConfFolder; // build the interface var iNbLine = 0; var yPos = btRefresh.Location.Y + 35; foreach (var confLine in ShareExportConf.List) { var xPos = btDownloadAll.Location.X - 25; // label var label = new HtmlLabel { Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left, AutoSizeHeightOnly = true, BackColor = Color.Transparent, Location = new Point(30, yPos + 2), Size = new Size(topAuto.Location.X - 30, 10), IsSelectionEnabled = false, Text = confLine.Label }; tooltip.SetToolTip(label, "File or folder handled :<br>" + confLine.HandledItem); scrollPanel.ContentPanel.Controls.Add(label); // switch, auto update? var toggleControl = new YamuiCheckBox { Anchor = AnchorStyles.Top | AnchorStyles.Right, Location = new Point(xPos, yPos + 2), Size = new Size(15, 15), Text = @" ", Checked = confLine.AutoUpdate, Tag = confLine }; toggleControl.CheckedChanged += ToggleControlOnCheckedChanged; scrollPanel.ContentPanel.Controls.Add(toggleControl); tooltip.SetToolTip(toggleControl, "Check this option to automatically fetch the most recent version of the file<br>This update occurs on notepad++ startup and each time you refresh the local/distant file status"); xPos += 25; // do we have an update available? var strButton = new YamuiButtonImage { Anchor = AnchorStyles.Top | AnchorStyles.Right, BackGrndImage = ImageResources.OutDated, Size = new Size(20, 20), Location = new Point(xPos, yPos), Tag = confLine, TabStop = false, Name = "btm_" + iNbLine, Visible = false }; strButton.ButtonPressed += StrButtonOnButtonPressed; scrollPanel.ContentPanel.Controls.Add(strButton); tooltip.SetToolTip(strButton, "The distant version is more recent than the local one<br>Press this button to <b>fetch</b> the distant version"); xPos += 30; // local date var date = new HtmlLabel { Anchor = AnchorStyles.Top | AnchorStyles.Right, AutoSizeHeightOnly = true, BackColor = Color.Transparent, Location = new Point(xPos, yPos + 2), Size = new Size(130, 10), IsSelectionEnabled = false, Text = @"???", Name = "datel_" + iNbLine }; scrollPanel.ContentPanel.Controls.Add(date); xPos += 140; // local open strButton = new YamuiButtonImage { Anchor = AnchorStyles.Top | AnchorStyles.Right, BackGrndImage = ImageResources.OpenInExplorer, Size = new Size(20, 20), Location = new Point(xPos, yPos), Tag = confLine, TabStop = false, Enabled = false, Name = "bto_" + iNbLine }; strButton.ButtonPressed += OpenFileOnButtonPressed; strButton.MouseDown += OpenFileOnMouseDown; scrollPanel.ContentPanel.Controls.Add(strButton); tooltip.SetToolTip(strButton, "Left click to <b>open</b> this file in notepad++<br>Right click to <b>open</b> this file / folder in the explorer"); xPos += 20; // local import strButton = new YamuiButtonImage { Anchor = AnchorStyles.Top | AnchorStyles.Right, BackGrndImage = ImageResources.Import, Size = new Size(20, 20), Location = new Point(xPos, yPos), Tag = confLine, TabStop = false, Enabled = false, Name = "bti_" + iNbLine }; strButton.ButtonPressed += StrButtonOnButtonPressed; scrollPanel.ContentPanel.Controls.Add(strButton); tooltip.SetToolTip(strButton, "Click to <b>import</b> this file<br>It reads its content and use it in this session of 3P"); xPos += 20; // local export strButton = new YamuiButtonImage { Anchor = AnchorStyles.Top | AnchorStyles.Right, BackGrndImage = ImageResources.Export, Size = new Size(20, 20), Location = new Point(xPos, yPos), Tag = confLine, TabStop = false, Name = "bte_" + iNbLine, Enabled = false }; strButton.ButtonPressed += StrButtonOnButtonPressed; scrollPanel.ContentPanel.Controls.Add(strButton); tooltip.SetToolTip(strButton, "Click to <b>export</b> this file to a local version,<br>you will use the exported file instead of the embedded file in 3P"); xPos += 20; // local delete strButton = new YamuiButtonImage { Anchor = AnchorStyles.Top | AnchorStyles.Right, BackGrndImage = ImageResources.Delete, Size = new Size(20, 20), Location = new Point(xPos, yPos), Tag = confLine, TabStop = false, Name = "btd_" + iNbLine, Enabled = false }; strButton.ButtonPressed += StrButtonOnButtonPressed; scrollPanel.ContentPanel.Controls.Add(strButton); tooltip.SetToolTip(strButton, "Click to <b>delete</b> the local version of your file,<br>you will use the embedded (default) file of 3P instead"); xPos += 40; // distant date date = new HtmlLabel { Anchor = AnchorStyles.Top | AnchorStyles.Right, AutoSizeHeightOnly = true, BackColor = Color.Transparent, Location = new Point(xPos, yPos + 2), Size = new Size(130, 10), IsSelectionEnabled = false, Text = @"???", Name = "dated_" + iNbLine }; scrollPanel.ContentPanel.Controls.Add(date); xPos += 140; // distant open strButton = new YamuiButtonImage { Anchor = AnchorStyles.Top | AnchorStyles.Right, BackGrndImage = ImageResources.OpenInExplorer, Size = new Size(20, 20), Location = new Point(xPos, yPos), Tag = confLine, TabStop = false, Enabled = false, Name = "btz_" + iNbLine }; strButton.ButtonPressed += OpenFileOnButtonPressed; strButton.MouseDown += OpenFileOnMouseDown; scrollPanel.ContentPanel.Controls.Add(strButton); tooltip.SetToolTip(strButton, "Left click to <b>open</b> this file in notepad++<br>Right click to <b>open</b> this file / folder in the explorer"); xPos += 20; // distant fetch strButton = new YamuiButtonImage { Anchor = AnchorStyles.Top | AnchorStyles.Right, BackGrndImage = ImageResources.Fetch, Size = new Size(20, 20), Location = new Point(xPos, yPos), Tag = confLine, TabStop = false, Name = "btf_" + iNbLine, Enabled = false }; strButton.ButtonPressed += StrButtonOnButtonPressed; scrollPanel.ContentPanel.Controls.Add(strButton); tooltip.SetToolTip(strButton, "Click to <b>fetch</b> this file from the shared directory,<br>replacing the local one"); xPos += 20; // distant push strButton = new YamuiButtonImage { Anchor = AnchorStyles.Top | AnchorStyles.Right, BackGrndImage = ImageResources.Push, Size = new Size(20, 20), Location = new Point(xPos, yPos), Tag = confLine, TabStop = false, Name = "btp_" + iNbLine, Enabled = false }; strButton.ButtonPressed += StrButtonOnButtonPressed; scrollPanel.ContentPanel.Controls.Add(strButton); tooltip.SetToolTip(strButton, "Click to <b>push</b> the local file to the shared directory,<br>replacing any existing file"); yPos += label.Height + 15; iNbLine++; } // Activate scrollbars scrollPanel.ContentPanel.Height = yPos + 50; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OpenCreateCloneControl)); this._debounceListIndexChangedEvent = new System.Windows.Forms.Timer(this.components); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this._browseButton = new System.Windows.Forms.Button(); this.button6 = new System.Windows.Forms.Button(); this.button7 = new System.Windows.Forms.Button(); this.button8 = new System.Windows.Forms.Button(); this.button9 = new System.Windows.Forms.Button(); this._templateButton = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this._lookingForSourceCollectionsHtml = new Bloom.HtmlLabel(); this._readMoreLink = new System.Windows.Forms.LinkLabel(); this._L10NSharpExtender = new L10NSharp.UI.L10NSharpExtender(this.components); this.tableLayoutPanel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this._L10NSharpExtender)).BeginInit(); this.SuspendLayout(); // // toolTip1 // this.toolTip1.AutomaticDelay = 300; // // tableLayoutPanel2 // this.tableLayoutPanel2.BackColor = System.Drawing.Color.White; this.tableLayoutPanel2.ColumnCount = 3; this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 260F)); this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel2.Controls.Add(this._browseButton, 0, 5); this.tableLayoutPanel2.Controls.Add(this.button6, 2, 1); this.tableLayoutPanel2.Controls.Add(this.button7, 2, 2); this.tableLayoutPanel2.Controls.Add(this.button8, 2, 3); this.tableLayoutPanel2.Controls.Add(this.button9, 0, 0); this.tableLayoutPanel2.Controls.Add(this._templateButton, 0, 1); this.tableLayoutPanel2.Controls.Add(this.label1, 2, 0); this.tableLayoutPanel2.Controls.Add(this._lookingForSourceCollectionsHtml, 0, 6); this.tableLayoutPanel2.Controls.Add(this._readMoreLink, 2, 4); this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; this.tableLayoutPanel2.RowCount = 7; this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 60F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 45F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 45F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 45F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 55F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 55F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel2.Size = new System.Drawing.Size(889, 343); this.tableLayoutPanel2.TabIndex = 19; // // _browseButton // this._browseButton.Dock = System.Windows.Forms.DockStyle.Fill; this._browseButton.FlatAppearance.BorderSize = 0; this._browseButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this._browseButton.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this._browseButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this._browseButton.Image = global::Bloom.Properties.Resources.open; this._browseButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this._L10NSharpExtender.SetLocalizableToolTip(this._browseButton, null); this._L10NSharpExtender.SetLocalizationComment(this._browseButton, null); this._L10NSharpExtender.SetLocalizingId(this._browseButton, "OpenCreateNewCollectionsDialog.BrowseForOtherCollections"); this._browseButton.Location = new System.Drawing.Point(3, 253); this._browseButton.Name = "_browseButton"; this._browseButton.Size = new System.Drawing.Size(254, 49); this._browseButton.TabIndex = 29; this._browseButton.Text = "Browse for another collection on this computer"; this._browseButton.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this._browseButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this._browseButton.UseVisualStyleBackColor = true; this._browseButton.Click += new System.EventHandler(this.OnBrowseForExistingLibraryClick); // // button6 // this.button6.FlatAppearance.BorderSize = 0; this.button6.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button6.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.button6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.button6.Image = global::Bloom.Properties.Resources.cloneFromUsb; this.button6.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this._L10NSharpExtender.SetLocalizableToolTip(this.button6, null); this._L10NSharpExtender.SetLocalizationComment(this.button6, null); this._L10NSharpExtender.SetLocalizingId(this.button6, "OpenCreateNewCollectionsDialog.CopyFromUsbDrive"); this.button6.Location = new System.Drawing.Point(363, 63); this.button6.Name = "button6"; this.button6.Size = new System.Drawing.Size(404, 39); this.button6.TabIndex = 19; this.button6.Tag = "sendreceive"; this.button6.Text = "Copy from USB Drive"; this.button6.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.button6.UseVisualStyleBackColor = true; this.button6.Click += new System.EventHandler(this.OnGetFromUsb); // // button7 // this.button7.FlatAppearance.BorderSize = 0; this.button7.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button7.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.button7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.button7.Image = ((System.Drawing.Image)(resources.GetObject("button7.Image"))); this.button7.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this._L10NSharpExtender.SetLocalizableToolTip(this.button7, null); this._L10NSharpExtender.SetLocalizationComment(this.button7, null); this._L10NSharpExtender.SetLocalizingId(this.button7, "OpenCreateNewCollectionsDialog.CopyFromInternet"); this.button7.Location = new System.Drawing.Point(363, 108); this.button7.Name = "button7"; this.button7.Size = new System.Drawing.Size(405, 36); this.button7.TabIndex = 20; this.button7.Tag = "sendreceive"; this.button7.Text = "Copy from Internet"; this.button7.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.button7.UseVisualStyleBackColor = true; this.button7.Click += new System.EventHandler(this.OnGetFromInternet); // // button8 // this.button8.FlatAppearance.BorderSize = 0; this.button8.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button8.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.button8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.button8.Image = global::Bloom.Properties.Resources.cloneFromChorusHub; this.button8.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this._L10NSharpExtender.SetLocalizableToolTip(this.button8, null); this._L10NSharpExtender.SetLocalizationComment(this.button8, null); this._L10NSharpExtender.SetLocalizingId(this.button8, "OpenCreateNewCollectionsDialog.CopyFromChorusHub"); this.button8.Location = new System.Drawing.Point(363, 153); this.button8.Name = "button8"; this.button8.Size = new System.Drawing.Size(391, 36); this.button8.TabIndex = 21; this.button8.Tag = "sendreceive"; this.button8.Text = "Copy From Chorus Hub on Local Network"; this.button8.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.button8.UseVisualStyleBackColor = true; this.button8.Click += new System.EventHandler(this.OnGetFromChorusHub); // // button9 // this.button9.FlatAppearance.BorderSize = 0; this.button9.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button9.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.button9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.button9.Image = global::Bloom.Properties.Resources.newLibrary32x32; this.button9.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this._L10NSharpExtender.SetLocalizableToolTip(this.button9, null); this._L10NSharpExtender.SetLocalizationComment(this.button9, null); this._L10NSharpExtender.SetLocalizingId(this.button9, "OpenCreateNewCollectionsDialog.CreateNewCollection"); this.button9.Location = new System.Drawing.Point(3, 3); this.button9.Name = "button9"; this.button9.Size = new System.Drawing.Size(244, 36); this.button9.TabIndex = 22; this.button9.Text = "Create New Collection"; this.button9.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.button9.UseVisualStyleBackColor = true; this.button9.Click += new System.EventHandler(this.CreateNewLibrary_LinkClicked); // // _templateButton // this._templateButton.Dock = System.Windows.Forms.DockStyle.Fill; this._templateButton.FlatAppearance.BorderSize = 0; this._templateButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this._templateButton.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this._templateButton.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this._templateButton.Image = global::Bloom.Properties.Resources.library32x32; this._templateButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this._L10NSharpExtender.SetLocalizableToolTip(this._templateButton, null); this._L10NSharpExtender.SetLocalizationComment(this._templateButton, null); this._L10NSharpExtender.SetLocalizationPriority(this._templateButton, L10NSharp.LocalizationPriority.NotLocalizable); this._L10NSharpExtender.SetLocalizingId(this._templateButton, "OpenCreateNewCollectionsDialog.OpenCreateCloneControl._templateButton"); this._templateButton.Location = new System.Drawing.Point(3, 63); this._templateButton.Name = "_templateButton"; this._templateButton.Size = new System.Drawing.Size(254, 39); this._templateButton.TabIndex = 23; this._templateButton.Text = "template collection button"; this._templateButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this._templateButton.UseVisualStyleBackColor = true; // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Segoe UI", 9.75F); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(77)))), ((int)(((byte)(77))))); this._L10NSharpExtender.SetLocalizableToolTip(this.label1, null); this._L10NSharpExtender.SetLocalizationComment(this.label1, null); this._L10NSharpExtender.SetLocalizingId(this.label1, "OpenCreateNewCollectionsDialog.TextAboutGetUsingChorus"); this.label1.Location = new System.Drawing.Point(363, 10); this.label1.Margin = new System.Windows.Forms.Padding(3, 10, 3, 0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(420, 50); this.label1.TabIndex = 24; this.label1.Tag = "sendreceive"; this.label1.Text = "Has someone else used Send/Receive to share a collection with you?\r\nUse one of th" + "ese red buttons to copy their collection to your computer.\r\nLater, use Send/Recei" + "ve to share your work back with them."; // // _lookingForSourceCollectionsHtml // this._lookingForSourceCollectionsHtml.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.tableLayoutPanel2.SetColumnSpan(this._lookingForSourceCollectionsHtml, 3); this._lookingForSourceCollectionsHtml.Dock = System.Windows.Forms.DockStyle.Bottom; this._lookingForSourceCollectionsHtml.Font = new System.Drawing.Font("Segoe UI", 9.75F); this._lookingForSourceCollectionsHtml.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(77)))), ((int)(((byte)(77))))); this._lookingForSourceCollectionsHtml.HTML = "Are you are looking for shell books to translate into your language? Read about <" + "a href=\"http://bloom.palaso.org/bloompacks\">how to get free Bloom Packs</a>"; this._L10NSharpExtender.SetLocalizableToolTip(this._lookingForSourceCollectionsHtml, null); this._L10NSharpExtender.SetLocalizationComment(this._lookingForSourceCollectionsHtml, null); this._L10NSharpExtender.SetLocalizingId(this._lookingForSourceCollectionsHtml, "OpenCreateNewCollectionsDialog.MoreBloompacksInformation"); this._lookingForSourceCollectionsHtml.Location = new System.Drawing.Point(0, 318); this._lookingForSourceCollectionsHtml.Margin = new System.Windows.Forms.Padding(0); this._lookingForSourceCollectionsHtml.Name = "_lookingForSourceCollectionsHtml"; this._lookingForSourceCollectionsHtml.Size = new System.Drawing.Size(889, 25); this._lookingForSourceCollectionsHtml.TabIndex = 27; // // _readMoreLink // this._readMoreLink.AutoSize = true; this._readMoreLink.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this._L10NSharpExtender.SetLocalizableToolTip(this._readMoreLink, null); this._L10NSharpExtender.SetLocalizationComment(this._readMoreLink, "This opens the Chorus Help to learn more about send/receive."); this._L10NSharpExtender.SetLocalizingId(this._readMoreLink, "OpenCreateNewCollectionsDialog.ReadMoreLink"); this._readMoreLink.Location = new System.Drawing.Point(363, 210); this._readMoreLink.Margin = new System.Windows.Forms.Padding(3, 15, 3, 0); this._readMoreLink.Name = "_readMoreLink"; this._readMoreLink.Size = new System.Drawing.Size(63, 13); this._readMoreLink.TabIndex = 30; this._readMoreLink.TabStop = true; this._readMoreLink.Tag = "sendreceive"; this._readMoreLink.Text = "Read More"; this._readMoreLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this._readMoreLabel_Click); // // _L10NSharpExtender // this._L10NSharpExtender.LocalizationManagerId = "Bloom"; this._L10NSharpExtender.PrefixForNewItems = "OpenCreateNewCollectionsDialog"; // // OpenCreateCloneControl // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.Color.White; this.Controls.Add(this.tableLayoutPanel2); this._L10NSharpExtender.SetLocalizableToolTip(this, null); this._L10NSharpExtender.SetLocalizationComment(this, null); this._L10NSharpExtender.SetLocalizingId(this, "OpenCreateNewCollectionsDialog.OpenCreateCloneControl.OpenCreateCloneControl"); this.Name = "OpenCreateCloneControl"; this.Size = new System.Drawing.Size(889, 343); this.Load += new System.EventHandler(this.OnLoad); this.tableLayoutPanel2.ResumeLayout(false); this.tableLayoutPanel2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this._L10NSharpExtender)).EndInit(); this.ResumeLayout(false); }
/// <summary> /// Initializes the label to use to display HTML. /// </summary> private void InitializeHtmlLabel() { if (m_htmHtmlLabel != null) return; m_htmHtmlLabel = new HtmlLabel(); m_htmHtmlLabel.Dock = DockStyle.Fill; m_htmHtmlLabel.AllowSelection = AllowSelection; m_htmHtmlLabel.Font = Font; m_htmHtmlLabel.BackColor = BackColor; m_htmHtmlLabel.ForeColor = ForeColor; m_htmHtmlLabel.DetectUrls = DetectUrls; Controls.Add(m_htmHtmlLabel); }
private void GeneratePage() { var lastCategory = ""; var yPos = 0; var configInstance = Config.Instance; ForEachConfigPropertyWithDisplayAttribute((property, attribute) => { var valObj = property.GetValue(configInstance); // new group if (!lastCategory.EqualsCi(attribute.GroupName)) { if (!string.IsNullOrEmpty(lastCategory)) // ReSharper disable once AccessToModifiedClosure yPos += 10; lastCategory = attribute.GroupName; scrollPanel.ContentPanel.Controls.Add(new YamuiLabel { AutoSize = true, Function = FontFunction.Heading, Location = new Point(0, yPos), Text = lastCategory.ToUpper() }); yPos += 30; } // name of the field var label = new HtmlLabel { AutoSizeHeightOnly = true, BackColor = Color.Transparent, Location = new Point(30, yPos), Size = new Size(190, 10), IsSelectionEnabled = false, Text = attribute.Name }; scrollPanel.ContentPanel.Controls.Add(label); var listRangeAttr = property.GetCustomAttributes(typeof(RangeAttribute), false); var rangeAttr = (listRangeAttr.Any()) ? (RangeAttribute)listRangeAttr.FirstOrDefault() : null; if (valObj is string) { // string var strControl = new YamuiTextBox { Location = new Point(240, yPos), Text = (string)property.GetValue(configInstance), Size = new Size(300, 20), Tag = property.Name }; scrollPanel.ContentPanel.Controls.Add(strControl); var strButton = new YamuiButtonImage { Text = @"save", BackGrndImage = ImageResources.Save, Size = new Size(20, 20), Location = new Point(545, yPos), Tag = strControl, TabStop = false }; strButton.ButtonPressed += SaveButtonOnButtonPressed; scrollPanel.ContentPanel.Controls.Add(strButton); tooltip.SetToolTip(strButton, "Click to <b>set the value</b> of this field<br>Otherwise, your modifications will not be saved"); var undoButton = new YamuiButtonImage { BackGrndImage = ImageResources.UndoUserAction, Size = new Size(20, 20), Location = new Point(565, yPos), Tag = strControl, TabStop = false }; undoButton.ButtonPressed += UndoButtonOnButtonPressed; scrollPanel.ContentPanel.Controls.Add(undoButton); tooltip.SetToolTip(undoButton, "Click to <b>reset this field</b> to its default value"); tooltip.SetToolTip(strControl, attribute.Description + "<br><div class='ToolTipBottomGoTo'>Click on the save button <img src='Save'> to set your modifications</div>"); } if (valObj is int || valObj is double) { // number var numControl = new YamuiTextBox { Location = new Point(240, yPos), Text = ((valObj is int) ? ((int)property.GetValue(configInstance)).ToString() : ((double)property.GetValue(configInstance)).ToString(CultureInfo.CurrentCulture)), Size = new Size(300, 20), Tag = property.Name }; scrollPanel.ContentPanel.Controls.Add(numControl); var numButton = new YamuiButtonImage { Text = @"save", BackGrndImage = ImageResources.Save, Size = new Size(20, 20), Location = new Point(545, yPos), Tag = numControl, TabStop = false }; numButton.ButtonPressed += SaveButtonOnButtonPressed; scrollPanel.ContentPanel.Controls.Add(numButton); tooltip.SetToolTip(numButton, "Click to <b>set the value</b> of this field<br>Otherwise, your modifications will not be saved"); var undoButton = new YamuiButtonImage { BackGrndImage = ImageResources.UndoUserAction, Size = new Size(20, 20), Location = new Point(565, yPos), Tag = numControl, TabStop = false }; undoButton.ButtonPressed += UndoButtonOnButtonPressed; scrollPanel.ContentPanel.Controls.Add(undoButton); tooltip.SetToolTip(undoButton, "Click to <b>reset this field</b> to its default value"); tooltip.SetToolTip(numControl, attribute.Description + "<br>" + (rangeAttr != null ? "<br><b><i>" + "Min value = " + rangeAttr.Minimum + "<br>Max value = " + rangeAttr.Maximum + "</i></b><br>" : "") + "<div class='ToolTipBottomGoTo'>Click on the save button <img src='Save'> to set your modifications</div>"); } else if (valObj is bool) { // bool var toggleControl = new YamuiButtonToggle { Location = new Point(240, yPos), Size = new Size(40, 16), Text = null, Checked = (bool)valObj, Tag = property.Name }; toggleControl.ButtonPressed += ToggleControlOnCheckedChanged; scrollPanel.ContentPanel.Controls.Add(toggleControl); // tooltip tooltip.SetToolTip(toggleControl, attribute.Description + "<br><div class='ToolTipBottomGoTo'>Click to <b>toggle on/off</b> this feature<br>Your choice is automatically applied</div>"); } yPos += label.Height + 15; }); yPos += 15; _btSave = new YamuiButton { Location = new Point(30, yPos), Size = new Size(120, 24), Text = @"Save everything", BackGrndImage = ImageResources.Save }; _btSave.ButtonPressed += SaveAllButtonOnButtonPressed; tooltip.SetToolTip(_btSave, "Click to <b>save</b> all the options<br><i>This as the same effect than clicking save for each option</i>"); scrollPanel.ContentPanel.Controls.Add(_btSave); var defaultButton = new YamuiButton { Location = new Point(155, yPos), Size = new Size(120, 24), Text = @"Reset to default", BackGrndImage = ImageResources.UndoUserAction }; defaultButton.ButtonPressed += DefaultButtonOnButtonPressed; tooltip.SetToolTip(defaultButton, "Click to <b>reset</b> all the options to default"); scrollPanel.ContentPanel.Controls.Add(defaultButton); // add a button for the updates if (_allowedGroups.Contains("Updates")) { var updateButton = new YamuiButton { Location = new Point(280, yPos), Size = new Size(150, 24), Text = @"Check for updates", BackGrndImage = ImageResources.Update }; updateButton.ButtonPressed += (sender, args) => UpdateHandler.CheckForUpdate(); tooltip.SetToolTip(updateButton, "Click to <b>check for updates</b>"); scrollPanel.ContentPanel.Controls.Add(updateButton); } scrollPanel.ContentPanel.Height = yPos + 50; }