/// <summary> /// Execute the command /// </summary> public void Exec() { Guid logicalViewGuid = new Guid(LogicalViewID.ProjectSpecificEditor); ModelElementLocator locator = new ModelElementLocator((IServiceProvider)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(Microsoft.VisualStudio.OLE.Interop.IObjectWithSite))); ModelingDocView view = locator.FindDocView(logicalViewGuid, this._diagram); ModelingDocData docdata = view.DocData as ModelingDocData; if (docdata != null && docdata.FileName != null) { // Guid du DataLayerEditorFactory Guid guid1 = new Guid("56AF6F2B-EF94-4297-9857-8653A0AE02D8"); ServiceLocator.Instance.IDEHelper.OpenModelsDiagram(docdata.FileName, guid1); } }
/// <summary> /// Ouverture du diagramme dédié /// </summary> /// <param name="e">The diagram point event arguments.</param> public override void OnDoubleClick(DiagramPointEventArgs e) { base.OnDoubleClick(e); // TODO dans un helper Guid logicalViewGuid = new Guid(LogicalViewID.ProjectSpecificEditor); ModelElementLocator locator = new ModelElementLocator( (IServiceProvider)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(IObjectWithSite))); ModelingDocView view = locator.FindDocView(logicalViewGuid, Diagram); ModelingDocData docdata = view.DocData; if (docdata != null) { OpenDiagram(docdata.FileName); } }
/// <summary> /// Execute the command /// </summary> public void Exec() { ModelElementLocator locator = new ModelElementLocator(_serviceProvider); ModelingDocView view = locator.FindDocView(Guid.Empty, _diagram); if (view != null) { System.Windows.Forms.FolderBrowserDialog ofd = new System.Windows.Forms.FolderBrowserDialog(); ofd.ShowNewFolderButton = true; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string fileName = view.DocData.FileName; DiagramExporter exporter = new DiagramExporter(_serviceProvider); exporter.ExportErrorEvent += exporter_ExportErrorEvent; exporter.ExportDiagram(fileName, ofd.SelectedPath, System.Drawing.Imaging.ImageFormat.Png, true); exporter.ExportErrorEvent -= exporter_ExportErrorEvent; } } }