protected virtual void AppendDonateMenuItems(ToolStripMenuItem menu) { WinFormPlus.AddMessageBoxItem(menu, GetTransLation(new string[] { "Alipay", "支付宝" }), GetTransLation(new string[] { "Click to donate to us with Alipay!", "点击以使用支付宝赞赏我们!" }), Properties.Resources.AlipayLogo, Properties.Resources.DonateAlipayQRcode); WinFormPlus.AddMessageBoxItem(menu, GetTransLation(new string[] { "WechatPay", "微信" }), GetTransLation(new string[] { "Click to donate to us with WechatPay!", "点击以使用微信赞赏我们!" }), Properties.Resources.WechatLogo, Properties.Resources.DonateWechatQRcode); }
protected virtual void AppendContactMenuItems(ToolStripMenuItem menu) { WinFormPlus.AddMessageBoxItem(menu, GetTransLation(new string[] { "InfoGlasses QQ Group", "InfoGlasses QQ交流群" }), GetTransLation(new string[] { "Click to contact us in InfoGlasses QQ Group!", "点击以加入InfoGlasses QQ交流群。" }), Properties.Resources.QQLogo, Properties.Resources.InfoGlasses_QQGroup_QRcode); WinFormPlus.AddMessageBoxItem(menu, GetTransLation(new string[] { "Bright Zone of Rhino QQ Group", "犀牛之光 QQ交流群" }), GetTransLation(new string[] { "Click to contact us in Bright Zone of Rhino QQ Group!", "点击以加入犀牛之光 QQ交流群。" }), Properties.Resources.QQLogo, Properties.Resources.BrightZoneOfRhino_QQGroup_QRcode); GH_DocumentObject.Menu_AppendSeparator(menu.DropDown); WinFormPlus.AddMessageBoxItem(menu, GetTransLation(new string[] { "Parameterization QQ Group", "参数化交流 QQ群" }), GetTransLation(new string[] { "Click to contact us in Parameterization QQ Group!", "点击以加入参数化交流 QQ群。" }), Properties.Resources.QQLogo, Properties.Resources.Parameterization_QQGroup_QRcode); }
public static void AddNumberBoxItem(ToolStripDropDown menu, LanguagableComponent component, string itemName, string itemTip, Bitmap itemIcon, bool enable, double Default, double Min, double Max, string valueName, int width = 150) { if (Max <= Min) { throw new ArgumentOutOfRangeException("Max less than Min!"); } bool flag = true; string English = "Value must be in " + Min.ToString() + " - " + Max.ToString() + ". Default is " + Default.ToString() + "."; string Chinese = "输入值域为 " + Min.ToString() + " - " + Max.ToString() + ", 默认为 " + Default.ToString() + "。"; string tip = itemTip + LanguagableComponent.GetTransLation(new string[] { English, Chinese }); ToolStripMenuItem item = CreateOneItem(itemName, tip, itemIcon, enable); var slider = new GH_DigitScroller { MinimumValue = (decimal)Min, MaximumValue = (decimal)Max, DecimalPlaces = 3, Value = (decimal)Default, Size = new Size(width, 24) }; slider.ValueChanged += Slider_ValueChanged; void Slider_ValueChanged(object sender, GH_DigitScrollerEventArgs e) { double result = (double)e.Value; result = result >= Min ? result : Min; result = result <= Max ? result : Max; component.SetValuePub(valueName, result, flag); flag = false; component.ExpireSolution(true); } WinFormPlus.AddLabelItem(item.DropDown, itemName, tip); GH_DocumentObject.Menu_AppendCustomItem(item.DropDown, slider); GH_DocumentObject.Menu_AppendItem(item.DropDown, LanguagableComponent.GetTransLation(new string[] { "Reset Number", "重置数值" }), resetClick, Properties.Resources.ResetLogo, true, false).ToolTipText = LanguagableComponent.GetTransLation(new string[] { "Click to reset Number.", "点击以重置数值。" }); void resetClick(object sender, EventArgs e) { component.SetValuePub(valueName, Default); component.ExpireSolution(true); } menu.Items.Add(item); }
protected sealed override void AppendAdditionalComponentMenuItems(ToolStripDropDown menu) { AppendAdditionComponentMenuItems(menu); GH_DocumentObject.Menu_AppendSeparator(menu); if (_showOption) { ToolStripMenuItem donateItem = WinFormPlus.CreateOneItem(GetTransLation(new string[] { "Donate To Us!", "向我们赞赏吧!" }), GetTransLation(new string[] { "Select one way to donate to us!", "选择一个渠道赞赏我们!" }), Properties.Resources.DonateIcon); AppendDonateMenuItems(donateItem); menu.Items.Add(donateItem); ToolStripMenuItem helpItem = WinFormPlus.CreateOneItem(GetTransLation(new string[] { "How to use it?", "如何使用它呢?" }), GetTransLation(new string[] { "Select one Video or URL to know how to use it.", "选择一个视频或者网页了解如何使用它。" }), Properties.Resources.HelpLogo); AppendHelpMenuItems(helpItem); helpItem.Enabled = helpItem.DropDownItems.Count != 0; if (!helpItem.Enabled) { helpItem.Text += GetTransLation(new string[] { " (Coming soon...)", "(即将开启……)" }); } menu.Items.Add(helpItem); ToolStripMenuItem contactItem = WinFormPlus.CreateOneItem(GetTransLation(new string[] { "Contact us!", "联系我们!" }), GetTransLation(new string[] { "Select one contact way to contact us!", "选择一种联系方式联系我们!" }), Properties.Resources.ContactIcon); AppendContactMenuItems(contactItem); menu.Items.Add(contactItem); } string languageTip = GetTransLation(new string[] { "Select one Language.Note: It will Recompute the component with language options!", "请选择一个语言。注意:这将让有语言选项的电池重新计算!" }); ToolStripMenuItem languageItem = WinFormPlus.CreateOneItem(GetTransLation(new string[] { "Language", "语言(Language)" }), languageTip, Properties.Resources.LanguageIcon); AddLanguageItems(languageItem); menu.Items.Add(languageItem); }
protected virtual void AppendHelpMenuItems(ToolStripMenuItem menu) { GH_DocumentObject.Menu_AppendSeparator(menu.DropDown); WinFormPlus.AddURLItem(menu, GetTransLation(new string[] { "See Source Code", "查看源代码" }), GetTransLation(new string[] { "Click to the GitHub to see source code.", "点击以到GitHub查看源代码。" }), WinFormPlus.ItemIconType.GitHub, "https://github.com/ArchiDog1998/GrasshopperPlugins"); }