public IResourceEditor CreateEditorInstance(IResourceHolder Target) { int id = getHolderIndex(Target.GetType()); IResourceEditor RetVal = (List[id] as ClassLoaderItem).GetEditorInstance(); RetVal.Target = Target; return(RetVal); }
internal IResourceEditor GetEditorInstance() { IResourceEditor RetVal = null; System.Reflection.ConstructorInfo ci = editorType.GetConstructor(Type.EmptyTypes); if (ci != null) { RetVal = ci.Invoke(null) as IResourceEditor; } return(RetVal); }
public Control CreateControl() { try { dlg = services.RequireService<IDialogFactory>().CreateResourceEditor(); switch (resource.Type) { case "Windows.BMP": GenerateWindowsBitmap(); break; case "Windows.ICO": GenerateWindowsIcon(); break; default: return DumpBytes(); } } catch { return DumpBytes(); } return (Control)dlg; }
public object CreateControl() { try { dlg = services.RequireService <IDialogFactory>().CreateResourceEditor(); switch (resource.Type) { case "Windows.BMP": GenerateWindowsBitmap(); break; case "Windows.ICO": GenerateWindowsIcon(); break; default: return(DumpBytes()); } } catch { return(DumpBytes()); } return((Control)dlg); }
private void treeViewResources_AfterSelect(object sender, TreeViewEventArgs e) { // Get the editor host. var editorHost = tableLayoutPanel1.GetControlFromPosition(1, 1); // Release any existing editor. if (currentEditor != null) { editorHost.Controls.Remove((Control)currentEditor); currentEditor.Release(); } // Create the appropriate control. var resource = e.Node?.Tag as Win32Resource; if (resource == null) { return; } if (resource.ResourceType.IsKnownResourceType(ResType.RT_BITMAP)) { var bitmapEditor = new BitmapEditor { Dock = DockStyle.Fill }; currentEditor = bitmapEditor; var parent = tableLayoutPanel1.GetControlFromPosition(1, 1); parent.Controls.Add(bitmapEditor); bitmapEditor.Initialise(resource); } else if (resource.ResourceType.IsKnownResourceType(ResType.RT_ICON)) { var iconEditor = new IconEditor { Dock = DockStyle.Fill }; currentEditor = iconEditor; var parent = tableLayoutPanel1.GetControlFromPosition(1, 1); parent.Controls.Add(iconEditor); iconEditor.Initialise(resource); } }
private void UpdateMenuButtons(IResourceEditor editor) { this.undoMenuItem.Enabled = this.undoButton.Enabled = editor.CanUndo; this.redoButton.Enabled = this.redoButton.Enabled = editor.CanRedo; }
private void UnbindEditor(IResourceEditor editor) { var notifyPropertyChanged = editor as INotifyPropertyChanged; if (notifyPropertyChanged != null) { notifyPropertyChanged.PropertyChanged -= this.EditorPropertyChanged; } }
private void BindEditor(IResourceEditor editor) { var notifyPropertyChanged = editor as INotifyPropertyChanged; if (notifyPropertyChanged != null) { notifyPropertyChanged.PropertyChanged += this.EditorPropertyChanged; } this.UpdateMenuButtons(editor); }
/// <summary> /// Constructor that calls the Microsoft.VisualStudio.Shell.WindowPane constructor then /// our initialization functions. /// </summary> /// <param name="package">Our Package instance.</param> public EditorPane(Package package, string getExtension, IResourceEditor editor) : base(null) { this._getExtension = getExtension; this.editorControl = editor; this.PrivateInit(package); }
protected override void Dispose(bool disposing) { try { if (disposing) { // Dispose the timers if (null != this.FileChangeTrigger) { this.FileChangeTrigger.Dispose(); this.FileChangeTrigger = null; } if (null != this.FNFStatusbarTrigger) { this.FNFStatusbarTrigger.Dispose(); this.FNFStatusbarTrigger = null; } this.SetFileChangeNotification(null, false); if (this.editorControl != null) { //editorControl.RichTextBoxControl.Dispose(); this.editorControl.Dispose(); this.editorControl = null; } if (this.FileChangeTrigger != null) { this.FileChangeTrigger.Dispose(); this.FileChangeTrigger = null; } if (this.extensibleObjectSite != null) { this.extensibleObjectSite.NotifyDelete(this); this.extensibleObjectSite = null; } GC.SuppressFinalize(this); } } finally { base.Dispose(disposing); } }
public void Edit(IResourceHolder Value) { IResourceEditor editor = loader.CreateEditorInstance(Value); editor.ShowEditor(); }