public static void AddColorBoxItems(ToolStripDropDown menu, LanguagableComponent component, string itemName, string itemTip, Bitmap itemIcon, bool enable, ItemSet <Color>[] sets) { ToolStripMenuItem item = CreateOneItem(itemName, itemTip, itemIcon, enable); foreach (var set in sets) { AddColorBoxItem(item.DropDown, component, set); } GH_DocumentObject.Menu_AppendItem(item.DropDown, LanguagableComponent.GetTransLation(new string[] { "Reset Color", "重置颜色" }), resetClick, Properties.Resources.ResetLogo, true, false).ToolTipText = LanguagableComponent.GetTransLation(new string[] { "Click to reset colors.", "点击以重置颜色。" }); void resetClick(object sender, EventArgs e) { foreach (var set in sets) { component.SetValuePub(set.valueName, set.Default); } component.ExpireSolution(true); } menu.Items.Add(item); }
public static void ImportOpenFileDialog(Action <string> openAction) { System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog(); openFileDialog.Title = LanguagableComponent.GetTransLation(new string[] { "Select a template", "选择一个模板" }); openFileDialog.Filter = "*.txt|*.txt"; openFileDialog.FileName = string.Empty; openFileDialog.Multiselect = false; openFileDialog.RestoreDirectory = true; if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { openAction.Invoke(openFileDialog.FileName); } }
public static void AddColorBoxItem(ToolStripDropDown menu, LanguagableComponent component, string itemName, string itemTip, Bitmap itemIcon, bool enable, Color @default, string valueName) { bool flag = true; ToolStripMenuItem item = CreateOneItem(itemName, itemTip, itemIcon, enable); GH_DocumentObject.Menu_AppendColourPicker(item.DropDown, component.GetValuePub(valueName, @default), textcolorChange); void textcolorChange(GH_ColourPicker sender, GH_ColourPickerEventArgs e) { component.SetValuePub(valueName, e.Colour, flag); component.ExpireSolution(true); flag = false; } GH_DocumentObject.Menu_AppendItem(item.DropDown, LanguagableComponent.GetTransLation(new string[] { "Reset Color", "重置颜色" }), resetClick, Properties.Resources.ResetLogo, true, false).ToolTipText = LanguagableComponent.GetTransLation(new string[] { "Click to reset colors.", "点击以重置颜色。" }); void resetClick(object sender, EventArgs e) { component.SetValuePub(valueName, @default); component.ExpireSolution(true); } menu.Items.Add(item); }
public static string GetWriteMessage(string path) { return(LanguagableComponent.GetTransLation(new string[] { "Export successfully! \n Location: ", "导出成功!\n 位置:" }) + path); }