/// <summary> /// open the context menu /// </summary> /// <param name="menuID"></param> /// <param name="x"></param> /// <param name="y"></param> public override void ShowContextMenu(CommandID menuID, int x, int y) { menu.Items[RuntimeHostSurface.GetTranslatedString(surface, STR_MENU_DELETE)].Visible = surface.AdminMode; menu.Items[RuntimeHostSurface.GetTranslatedString(surface, STR_MENU_DELETE)].Enabled = surface.CanDeleteSelectedItems(); menu.Items[STR_MENU_SEPARATOR].Visible = surface.AdminMode; menu.Items[RuntimeHostSurface.GetTranslatedString(surface, STR_MENU_RESET)].Enabled = CanResetSelectedItems(); menu.Show(x, y); }
/// Empty constructor simply creates a new form. internal RuntimeHostLoader(Type rootComponentType, Form formToClone, CreateAllOwnerDrawControlsDelegate createAllOwnerDrawControls, GetControlDesignerInfoDelegate getControlDesignerInfo, RuntimeHostSurface hostSurface) { this.rootComponentType = rootComponentType; this.Modified = true; this.formToClone = formToClone; this.createAllOwnerDrawControls = createAllOwnerDrawControls; this.getControlDesignerInfo = getControlDesignerInfo; this.runtimeHostSurface = hostSurface; }
//ToolStripButton breakMenuItem; /// <summary> /// CTOR /// </summary> /// <param name="propertyGrid"></param> /// <param name="selectionService"></param> internal PropertyGridManager(PropertyGrid propertyGrid, ISelectionService selectionService, IDesignerHost host, RuntimeHostSurface surface) { this.propertyGrid = propertyGrid; this.selectionService = selectionService; this.surface = surface; selectionService.SelectionChanged += selectionService_SelectionChanged; host.TransactionClosed += host_TransactionClosed; CreateContextMenu(); SetPropertyGridStyle(); }
/// <summary> /// /// </summary> /// <returns></returns> internal string GetFileName() { RuntimeHostSurface runtimeHostSurface = this.CurrentDocumentsHostControl.HostSurface; Form form = CurrentDocumentsHostControl.DesignerHost.RootComponent as Form; String fileName = ""; if (runtimeHostSurface.ComponentsDictionary.ContainsKey(form)) { ComponentWrapper cw = runtimeHostSurface.ComponentsDictionary[form]; PropertyDescriptor pd = cw.PropertiesDescriptors[Constants.ConfigurationFilePropertyName]; if (pd != null) //for tests { fileName = pd.GetValue(form) as String; } } return(fileName); }
/// <summary> /// Initialize the context menu /// </summary> void InitMenu() { menu = new ContextMenuStrip(); String str = RuntimeHostSurface.GetTranslatedString(surface, STR_MENU_RESET); ToolStripMenuItem t = new ToolStripMenuItem(str, null, OnResetClicked); t.Name = t.Text; menu.Items.Add(t); ToolStripSeparator separator = new ToolStripSeparator(); separator.Name = STR_MENU_SEPARATOR; menu.Items.Add(separator); str = RuntimeHostSurface.GetTranslatedString(surface, STR_MENU_DELETE); t = new ToolStripMenuItem(str, null, OnDeleteClicked); t.Name = t.Text; menu.Items.Add(t); }
/// <summary> /// handle restoring a hidden control /// </summary> /// <param name="control"></param> void ControlRestored(Control control) { RuntimeHostSurface.RestoreControl(control); }
/// <summary> /// CTOR /// </summary> /// <param name="serviceProvider"></param> internal RuntimeMenuService(RuntimeHostSurface serviceProvider) : base(serviceProvider) { surface = serviceProvider; InitMenu(); }
/// <summary> /// /// </summary> /// <param name="disposing"></param> protected override void Dispose(bool disposing) { surface = null; base.Dispose(disposing); }