Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using SolidEdge.AddIn.Common;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Runtime.InteropServices.ComTypes;
- using System.Text;
- using System.Windows.Forms;
- using System.Reflection;
- using DevExpress.Xpo;
- using SolidEdge.Manageem.Addin.Utils;
- using System.IO;
- //using ME2DLL.DataStore;
- //using ME2DLL.DataStore.ViewModels;
- using DevExpress.Data.Filtering;
- namespace SolidEdge.Manageem.Addin
- {
- [Guid("1F47DA3A-B2CC-6A86-9031-C7813CD102E3")]
- [ProgId("SolidEdge.Manageem.Addin")]
- [ComVisible(true)]
- [AddInInfo("ManageEm 2.6.2", "Connecting Solid Edge to ManageEm", true)]
- [AddInEnvironmentCategory(CategoryIDs.CATID_SEApplication)]
- [AddInEnvironmentCategory(CategoryIDs.CATID_SEAllDocumentEnvrionments)]
- public class ManageEmAddIn
- : SolidEdgeFramework.ISolidEdgeAddIn, SolidEdgeFramework.ISEAddInEvents
- {
- #region Properties
- public SolidEdgeFramework.Application Application { get { return _application; } }
- public SolidEdgeFramework.ISEAddInEx AddIn { get { return _addInEx; } }
- private enum FormType
- {
- WhereUsed = 0,
- PrintList = 1,
- OpenDraft = 2,
- Search = 3,
- CheckDrafts = 4,
- CustomProperties = 5
- };
- private SolidEdgeFramework.Application _application;
- private SolidEdgeFramework.ISEAddInEx _addInEx;
- private SolidEdgeFramework.DISEApplicationEvents_Event appEvents;
- private Dictionary<IConnectionPoint, int> _connectionPointDictionary = new Dictionary<IConnectionPoint, int>();
- static Assembly _resourceAssembly;
- string _ActiveFileName = string.Empty;
- #endregion
- #region SolidEdgeFramework.ISolidEdgeAddIn
- /// <summary>
- /// Implementation of SolidEdgeFramework.ISolidEdgeAddIn.OnConnection().
- /// </summary>
- public void OnConnection(object Application, SolidEdgeFramework.SeConnectMode ConnectMode, SolidEdgeFramework.AddIn AddInInstance)
- {
- _application = (SolidEdgeFramework.Application)Application;
- _addInEx = (SolidEdgeFramework.ISEAddInEx)AddInInstance;
- _addInEx.Description = String.Format("\n{0}", _addInEx.Description);
- _resourceAssembly = Assembly.GetExecutingAssembly();
- AddInInstance.GuiVersion = 1;
- HookEvents(_addInEx, typeof(SolidEdgeFramework.ISEAddInEvents).GUID);
- switch (ConnectMode)
- {
- case SolidEdgeFramework.SeConnectMode.seConnectAtStartup:
- break;
- case SolidEdgeFramework.SeConnectMode.seConnectByUser:
- break;
- case SolidEdgeFramework.SeConnectMode.seConnectExternally:
- break;
- }
- appEvents = (SolidEdgeFramework.DISEApplicationEvents_Event)_application.ApplicationEvents;
- appEvents.AfterDocumentSave += new SolidEdgeFramework.DISEApplicationEvents_AfterDocumentSaveEventHandler(appEvents_AfterDocumentSave);
- appEvents.AfterActiveDocumentChange += new SolidEdgeFramework.DISEApplicationEvents_AfterActiveDocumentChangeEventHandler(appEvents_AfterActiveDocumentChange);
- appEvents.AfterDocumentOpen += new SolidEdgeFramework.DISEApplicationEvents_AfterDocumentOpenEventHandler(appEvents_AfterDocumentOpen);
- StartThread(string.Empty, FormType.Search);
- }
- /// <summary>
- /// Implementation of SolidEdgeFramework.ISolidEdgeAddIn.OnDisconnection().
- /// </summary>
- public void OnDisconnection(SolidEdgeFramework.SeDisconnectMode DisconnectMode)
- {
- UnhookAllEvents();
- switch (DisconnectMode)
- {
- case SolidEdgeFramework.SeDisconnectMode.seDisconnectAtShutdown:
- break;
- case SolidEdgeFramework.SeDisconnectMode.seDisconnectByUser:
- break;
- case SolidEdgeFramework.SeDisconnectMode.seDisconnectExternally:
- break;
- }
- }
- /// <summary>
- /// Implementation of SolidEdgeFramework.ISolidEdgeAddIn.OnConnectToEnvironment().
- /// </summary>
- public void OnConnectToEnvironment(string EnvCatID, object pEnvironmentDispatch, bool bFirstTime)
- {
- bFirstTime = true;
- try
- {
- //uow = ManageEm.Business.Orm.XpoHelper.GetNewUnitOfWork();
- }
- catch (Exception e)
- {
- String x = e.Message;
- }
- if (!EnvCatID.Equals(CategoryIDs.CATID_SEApplication))
- {
- Guid environmentGuid = new Guid(EnvCatID);
- RibbonCommandInfo rci = null;
- int commandId = 0;
- string _knopName = "";
- //ASSISTANTS TAB
- rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icCustomProp;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icCustomProp;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "Custom properties";
- rci.RibbonCommands.Add(new RibbonCommand("Assistants", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandCustomProps)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);
- rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icFindDraft;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icFindDraft;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "Check Drafts";
- rci.RibbonCommands.Add(new RibbonCommand("Assistants", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandCheckDrafts)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);
- rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icRevisie2;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icRevisie2;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- #region nog niet gebruikt
- /*_knopName = "Revisie";
- rci.RibbonCommands.Add(new RibbonCommand("Assistants", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandRevisie)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);
- rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icReleased2;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icReleased2;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "Release";
- rci.RibbonCommands.Add(new RibbonCommand("Assistants", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandRelease)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);
- rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icCopy;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icCopy;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "Copy Project";
- rci.RibbonCommands.Add(new RibbonCommand("Assistants", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandCopyProject)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);
- rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icDraftView2;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icDraftView2;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "Draft view";
- rci.RibbonCommands.Add(new RibbonCommand("Assistants", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandDraftView)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);*/
- //EXPORT TAB
- /* rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icExport;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icExport;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "FlattenEM Export";
- rci.RibbonCommands.Add(new RibbonCommand("Export", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandFlattenEmExport)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);*/
- //FAVORITES TAB
- /*rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icMarkFavourite_32x32;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icMarkFavourite_32x32;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "Als favoriet opslaan";
- rci.RibbonCommands.Add(new RibbonCommand("Favorites", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandSaveFavourite)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);
- rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icBookmarks;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icBookmarks;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "Opgeslagen favorieten openen";
- rci.RibbonCommands.Add(new RibbonCommand("Favorites", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandOpenFavourites)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);*/
- #endregion
- //PRINT TAB
- rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icPrintList;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icPrintList;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "Printlist";
- rci.RibbonCommands.Add(new RibbonCommand("Print", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandPrintList)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);
- //SEARCH TAB
- rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icSearchText;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icSearchText;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "Zoeken op ingave";
- rci.RibbonCommands.Add(new RibbonCommand("Search", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandSearchOnInput)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);
- rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icWhereUsed;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icWhereUsed;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "Where used";
- rci.RibbonCommands.Add(new RibbonCommand("Search", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandWhereUsed)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);
- rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icOpendrag;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icOpendrag;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "Open Drafts";
- rci.RibbonCommands.Add(new RibbonCommand("Search", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandOpenDraft)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);
- #region nog niet gebruikt
- /*rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icSearchActiveDocument;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icSearchActiveDocument;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "Zoeken op active document";
- rci.RibbonCommands.Add(new RibbonCommand("Search", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandSearchOnActiveDocument)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);
- rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icSearch;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icSearch;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "Zoeken";
- rci.RibbonCommands.Add(new RibbonCommand("Search", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandSearch)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);
- rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icSavedFilters;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icSavedFilters;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "Opgeslagen filters uitvoeren";
- rci.RibbonCommands.Add(new RibbonCommand("Search", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandRunSavedFilters)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);
- rci = new RibbonCommandInfo();
- rci.RibbonTabName = "ManageEm";
- rci.IDColorBitmapLarge = Win32ResourceIDs.PNG.icCustomFilters;
- rci.IDColorBitmapMedium = Win32ResourceIDs.PNG.icCustomFilters;
- rci.ResourceFilename = _resourceAssembly.Location;
- rci.EnvironmentCatID = EnvCatID;
- _knopName = "Custom Filters";
- rci.RibbonCommands.Add(new RibbonCommand("Search", commandId++, _knopName + commandId, _knopName, _knopName, _knopName, SolidEdgeFramework.SeButtonStyle.seButtonIconAndCaptionBelow, new RibbonCommandDelegate(this.OnMouseRibbonCommandCustomFilters)));
- RibbonHelper.AddRibbonCommands(_addInEx, rci, bFirstTime);*/
- #endregion
- }
- }
- #endregion
- #region After Document save
- void appEvents_AfterDocumentSave(object theDocument)
- {
- //save properties
- //SolidEdgeFramework.SolidEdgeDocument doc = (SolidEdgeFramework.SolidEdgeDocument)theDocument;
- //processPropperties(doc);
- }
- /*void processPropperties(SolidEdgeFramework.SolidEdgeDocument d)
- {
- try
- {
- UnitOfWork uow = new UnitOfWork();
- uow.ConnectionString = DataConnection.GetConnectionString();
- listDocumentStatus = new XPCollection<ME2DLL.DataStore.DocumentStatus>(uow);
- listDocumentType = new XPCollection<ME2DLL.DataStore.DocumentType>(uow);
- String x = d.FullName;
- if (File.Exists(d.FullName))
- {
- DocumentViewModel dv = _GetDocumentByName(d.FullName);
- Document doc = null;
- if (dv.List.Count > 0)
- {
- DocumentViewModel div = dv.List.First();
- doc = uow.GetObjectByKey<Document>(div.Oid);
- doc.Name = div.Name;
- doc.Oid = div.Oid;
- doc.Path = div.Path;
- doc.FileName = div.FileName;
- doc.ModifiedDate = div.ModifiedDate;
- doc.ModifiedBy = div.ModifiedBy;
- doc.CreationDate = div.CreationDate;
- doc.CreatedBy = div.CreatedBy;
- // doc.DocType = div.DocType;
- //doc.DocStatus = div.DocStatus;
- doc.DocNumber = div.DocNumber;
- doc.Revision = div.Revision;
- doc.Material = div.Material;
- doc.Profile = div.Profile;
- doc.Category = div.Category;
- doc.Title = div.Title;
- doc.Subject = div.Subject;
- doc.Article = div.Article;
- doc.Manager = div.Manager;
- doc.Company = div.Company;
- doc.Keywords = div.Keywords;
- doc.Comments = div.Comments;
- doc.Template = div.Template;
- doc.Project = div.Project;
- doc.IsLibraryItem = div.IsLibraryItem;
- doc.RoutingCode = div.RoutingCode;
- }
- else
- {
- doc = new Document(uow);
- }
- doc = ProccesSolidEdgePropperties(d, doc, uow);
- if (doc != null)
- {
- if (doc.DocStatus != null)
- doc.DocStatus = uow.GetObjectByKey<DocumentStatus>(doc.DocStatus.Oid);
- if (doc.DocType != null)
- doc.DocType = uow.GetObjectByKey<DocumentType>(doc.DocType.Oid);
- doc.Save();
- uow.CommitChanges();
- }
- else
- {
- }
- }
- else
- {
- }
- }
- catch
- {
- }
- }
- public static XPCollection<DocumentStatus> listDocumentStatus = null;
- public static XPCollection<DocumentType> listDocumentType = null;
- private DocumentViewModel _GetDocumentByName(String g)
- {
- UnitOfWork uow = new UnitOfWork();// XpoHelper.GetNewUnitOfWork();
- uow.ConnectionString = DataConnection.GetConnectionString();
- return new DocumentViewModel
- {
- List = (from o in uow.Query<Document>().ToList()
- where o.Path != null && o.Path.ToLower() == g.ToLower()
- select new DocumentViewModel()
- {
- Name = o.Name,
- Oid = o.Oid,
- Path = o.Path,
- FileName = o.FileName,
- ModifiedDate = o.ModifiedDate,
- ModifiedBy = o.ModifiedBy,
- CreationDate = o.CreationDate,
- CreatedBy = o.CreatedBy,
- DocType = o.DocType,
- DocStatus = o.DocStatus,
- DocNumber = o.DocNumber,
- Revision = o.Revision,
- Material = o.Material,
- Profile = o.Profile,
- Category = o.Category,
- Title = o.Title,
- Subject = o.Subject,
- Article = o.Article,
- Manager = o.Manager,
- Company = o.Company,
- Keywords = o.Keywords,
- Comments = o.Comments,
- Template = o.Template,
- Project = o.Project,
- IsLibraryItem = o.IsLibraryItem,
- RoutingCode = o.RoutingCode,
- }).ToList()
- };
- }
- public Document ProccesSolidEdgePropperties(SolidEdgeFramework.SolidEdgeDocument doc, Document d, UnitOfWork uow)
- {
- SolidEdgeFramework.PropertySets propertySets = null;
- // SolidEdgeFramework.Properties properties = null;
- //SolidEdgeFramework.Property property = null;
- //propertySets = new SolidEdgeFileProperties.PropertySets();
- //propertySets.Open(fileName, false);
- propertySets = doc.Properties as SolidEdgeFramework.PropertySets;
- d.Path = doc.FullName;
- d.FileName = Path.GetFileName(doc.FullName).ToLower();
- foreach (DocumentType s in listDocumentType)
- {
- if (s.Extension == Path.GetExtension(doc.FullName).ToLower())
- {
- d.DocType = uow.GetObjectByKey<DocumentType>(s.Oid);
- }
- }
- foreach(SolidEdgeFramework.Properties properties in propertySets)//for (int i = 0; i < propertySets.Count; i++)
- {
- //properties = (SolidEdgeFileProperties.Properties)propertySets[i];
- //---------------------------------------------------------------
- // ProjectInformation
- //---------------------------------------------------------------
- if (properties.Name == "ProjectInformation")
- {
- foreach(SolidEdgeFramework.Property property in properties)// for (int j = 0; j < properties.Count; j++)
- {
- //property = (SolidEdgeFramework.Property)properties[j];
- switch (property.Name)
- {
- case "Document Number":
- if (property.get_Value() != null)
- d.DocNumber = property.get_Value().ToString();//_DocNumber = property.get_Value().ToString();
- break;
- case "Project Name":
- if (property.get_Value() != null)
- {
- //## d.Project = property.get_Value().ToString();
- }
- break;
- case "Revision":
- if (property.get_Value() != null)
- d.Revision = property.get_Value().ToString();
- //else
- //_Revision = ComposeRevisionNumber(_Revision);
- break;
- }
- }
- }
- //---------------------------------------------------------------
- // SummaryInformation
- //---------------------------------------------------------------
- else if (properties.Name == "SummaryInformation")
- {
- foreach (SolidEdgeFramework.Property property in properties)// for (int j = 0; j < properties.Count; j++)
- {
- // property = (SolidEdgeFileProperties.Property)properties[j];
- switch (property.Name)
- {
- case "Comments":
- if (property.get_Value() != null)
- d.Comments = property.get_Value().ToString();
- break;
- case "Keywords":
- if (property.get_Value() != null)
- d.Keywords = property.get_Value().ToString();
- break;
- case "Subject":
- if (property.get_Value() != null)
- d.Subject = property.get_Value().ToString();
- break;
- case "Template":
- if (property.get_Value() != null)
- d.Template = property.get_Value().ToString();
- break;
- case "Title":
- if (property.get_Value() != null)
- d.Title = property.get_Value().ToString();
- break;
- case "Author":
- if (property.get_Value() != null)
- d.CreatedBy = property.get_Value().ToString();
- break;
- case "Origination Date":
- try
- {
- if (property.get_Value() != null)
- {
- DateTime temp = Convert.ToDateTime(property.get_Value());
- if (temp > DateTime.MinValue.AddYears(1700))
- {
- d.CreationDate = temp;
- }
- }
- }
- catch { }
- break;
- case "Last Author":
- if (property.get_Value() != null)
- d.ModifiedBy = property.get_Value().ToString();
- break;
- case "Last Save Date":
- try
- {
- if (property.get_Value() != null)
- {
- DateTime temp = Convert.ToDateTime(property.get_Value());
- if (temp > DateTime.MinValue.AddYears(1700))
- {
- d.ModifiedDate = temp;
- }
- }
- }
- catch { }
- break;
- }
- }
- }
- //---------------------------------------------------------------
- // DocumentSummaryInformation
- //---------------------------------------------------------------
- else if (properties.Name == "DocumentSummaryInformation")
- {
- foreach (SolidEdgeFramework.Property property in properties) //for (int j = 0; j < properties.Count; j++)
- {
- // property = (SolidEdgeFileProperties.Property)properties[j];
- switch (property.Name)
- {
- case "Company":
- if (property.get_Value() != null)
- d.Company = property.get_Value().ToString();
- break;
- case "Manager":
- if (property.get_Value() != null)
- d.Manager = property.get_Value().ToString();
- break;
- case "Category":
- if (property.get_Value() != null)
- {
- //## d.Category = property.get_Value().ToString();
- }
- break;
- }
- }
- }
- //---------------------------------------------------------------
- // ExtendedSummaryInformation
- //-----------------------------------------------------------------------
- else if (properties.Name == "ExtendedSummaryInformation")
- {
- foreach (SolidEdgeFramework.Property property in properties)// for (int j = 0; j < properties.Count; j++)
- {
- // property = (SolidEdgeFileProperties.Property)properties[j];
- switch (property.Name)
- {
- case "Status":
- if (property.get_Value() != null)
- {
- foreach (DocumentStatus s in listDocumentStatus)
- {
- if (Convert.ToInt32(s.SeStatus) == Convert.ToInt32(property.get_Value()))
- {
- d.DocStatus = uow.GetObjectByKey<DocumentStatus>(s.Oid);
- }
- }
- //## d.DocStatus = property.get_Value().ToString();
- }
- break;
- }
- }
- }
- //---------------------------------------------------------------
- // MechanicalModeling
- //---------------------------------------------------------------
- else if (properties.Name == "MechanicalModeling")
- {
- foreach (SolidEdgeFramework.Property property in properties)// for (int j = 0; j < properties.Count; j++)
- {
- //property = (SolidEdgeFileProperties.Property)properties[j];
- switch (property.Name)
- {
- case "Material":
- if (property.get_Value() != null)
- {
- //## d.Material = property.get_Value().ToString();
- }
- break;
- }
- }
- }
- //---------------------------------------------------------------
- // Custom
- //---------------------------------------------------------------
- else if (properties.Name == "Custom")
- {
- // SePropertyMapReader sem = SePropertyMapReader.GetSeMapping();
- String CustomProppies = "";
- foreach (SolidEdgeFramework.Property property in properties) //for (int j = 0; j < properties.Count; j++)
- {
- // property = (SolidEdgeFileProperties.Property)properties[j];
- String seFieldName = (property.Name);
- if (seFieldName != "")
- {
- String value = "";
- if (property.get_Value() != null)
- {
- value = property.get_Value().ToString();
- value = value.Replace("'", "");
- String Name = property.Name.Replace("'", "");
- CustomProppies += "'" + Name + "':" + "'" + value + "';";
- }
- switch (seFieldName)
- {
- //case "Custom1": Propys.Add("Custom1", value); break;//_Custom1 = value; break;
- //case "Custom2": Propys.Add("Custom2", value); break;//_Custom2 = value; break;
- //case "Custom3": Propys.Add("Custom3", value); break;//_Custom3 = value; break;
- //case "Custom4": Propys.Add("Custom4", value); break;//_Custom4 = value; break;
- //case "Custom5": Propys.Add("Custom5", value); break;//_Custom5 = value; break;
- //case "Custom6": Propys.Add("Custom6", value); break;//_Custom6 = value; break;
- //case "Custom7": Propys.Add("Custom7", value); break;//_Custom7 = value; break;
- //case "Custom8": Propys.Add("Custom8", value); break;//_Custom8 = value; break;
- //case "Custom9": Propys.Add("Custom9", value); break;//_Custom9 = value; break;
- //case "Custom10": Propys.Add("Custom10", value); break;//_Custom10 = value; break;
- //case "Custom11": Propys.Add("Custom11", value); break;//_Custom11 = value; break;
- //case "Custom12": Propys.Add("Custom12", value); break;//_Custom12 = value; break;
- //case "Custom13": Propys.Add("Custom13", value); break;//_Custom13 = value; break;
- //case "Custom14": Propys.Add("Custom14", value); break;//_Custom14 = value; break;
- //case "Custom15": Propys.Add("Custom15", value); break;//_Custom15 = value; break;
- //case "Custom16": Propys.Add("Custom16", value); break;//_Custom16 = value; break;
- //case "Custom17": Propys.Add("Custom17", value); break;//_Custom17 = value; break;
- //case "Custom18": Propys.Add("Custom18", value); break;//_Custom18 = value; break;
- //case "Custom19": Propys.Add("Custom19", value); break;//_Custom19 = value; break;
- //case "Custom20": Propys.Add("Custom20", value); break;//_Custom20 = value; break;
- }
- }
- if (property.Name == "ArticleNumber")
- {
- if (property.get_Value() != null)
- {
- // d.ArticleNumber = property.get_Value().ToString();
- }
- }
- if (property.Name == "Profile")
- {
- if (property.get_Value() != null)
- {
- //## d.Profile = property.get_Value().ToString();
- }
- }
- if (property.Name == "IsLibraryItem")
- {
- try
- {
- if (property.get_Value() != null)
- d.IsLibraryItem = Convert.ToBoolean(property.get_Value());
- }
- catch { }
- }
- }
- d.CustomProps = CustomProppies;
- }
- }
- //RF@ 30-04-2010
- // propertySets.Close();
- return d;
- // retval = true;
- }*/
- #endregion
- #region AfterDocumentOpen
- void appEvents_AfterDocumentOpen(object theDocument)
- {
- try
- {
- if (_application.ActiveDocument != null)
- {
- SolidEdgeFramework.SolidEdgeDocument document = (SolidEdgeFramework.SolidEdgeDocument)_application.ActiveDocument;
- _ActiveFileName = document.FullName;
- }
- }
- catch { }
- }
- #endregion
- #region AfterActiveDocumentChange
- void appEvents_AfterActiveDocumentChange(object theDocument)
- {
- if ((SolidEdgeFramework.SolidEdgeDocument)_application.ActiveDocument != null)
- {
- SolidEdgeFramework.SolidEdgeDocument document = (SolidEdgeFramework.SolidEdgeDocument)_application.ActiveDocument;
- String extension = Path.GetExtension(document.FullName);
- if (_ActiveFileName == document.FullName)
- {
- DoOpenDraftForm(document.FullName, true);
- DoOpenWhereUsedForm(document.FullName, true);
- }
- else
- {
- if (extension.Equals(""))
- {
- DoOpenDraftForm(document.FullName, true);
- return;
- }
- if (!extension.Equals(".asm"))
- {
- DoOpenDraftForm(document.FullName, true, true);
- return;
- }
- else
- DoOpenDraftForm(document.FullName, true);
- }
- _ActiveFileName = document.FullName;
- }
- }
- #endregion
- #region Open WhereUsed
- void OnMouseRibbonCommandWhereUsed(RibbonCommand ribbonCommand)
- {
- SolidEdgeFramework.SolidEdgeDocument document = (SolidEdgeFramework.SolidEdgeDocument)_application.ActiveDocument;
- StartThread(document.FullName, FormType.WhereUsed);
- }
- private void DoOpenWhereUsedForm(String DocumentName, bool bChange = false, bool bClose = false)
- {
- MessageHelper msg = new MessageHelper();
- string s = string.Empty;
- int result;
- String extension = Path.GetExtension(DocumentName);
- if (!IfApplicationWindowOpen("Where Used") && !bChange)
- System.Windows.Forms.Application.Run(new ME2DLL.MdiForms.frmWhereUsed() { HeaderText = string.Format("ManageEm - Where Used - {0}", DocumentName), FileName = DocumentName });
- else
- {
- if (collectionIntPtr.Count > 0)
- {
- if (bClose)
- result = msg.sendWindowsStringMessage((int)collectionIntPtr[0], 0, String.Format("/closewhereused#{0}", DocumentName));
- else
- result = msg.sendWindowsStringMessage((int)collectionIntPtr[0], 0, String.Format("/openwhereused#{0}", DocumentName));
- }
- }
- }
- #endregion
- #region OpenDraft
- void OnMouseRibbonCommandOpenDraft(RibbonCommand ribbonCommand)
- {
- SolidEdgeFramework.SolidEdgeDocument document = (SolidEdgeFramework.SolidEdgeDocument)_application.ActiveDocument;
- StartThread(document.FullName, FormType.OpenDraft);
- }
- private void DoOpenDraftForm(String DocumentName, bool bChange = false, bool bClose = false)
- {
- MessageHelper msg = new MessageHelper();
- string s = string.Empty;
- int result;
- String extension = Path.GetExtension(DocumentName);
- if(extension.Equals(".dft"))
- return;
- if (extension.Equals(".asm") || extension.Equals(""))
- {
- if (!IfApplicationWindowOpen("Open Drafts") && !bChange)
- System.Windows.Forms.Application.Run(new ME2DLL.MdiForms.frmOpenDrafts() { HeaderText = string.Format("ManageEm - Open Drafts - {0}", DocumentName), FileName = DocumentName });
- else
- {
- if (collectionIntPtr.Count > 0)
- {
- if (bClose)
- result = msg.sendWindowsStringMessage((int)collectionIntPtr[0], 0, String.Format("/closedrafts#{0}", DocumentName));
- else
- result = msg.sendWindowsStringMessage((int)collectionIntPtr[0], 0, String.Format("/opendrafts#{0}", DocumentName));
- }
- }
- }
- else
- {
- if (bClose)
- {
- if ( IfApplicationWindowOpen("Open Drafts") && collectionIntPtr.Count > 0)
- result = msg.sendWindowsStringMessage((int)collectionIntPtr[0], 0, String.Format("/closedrafts#{0}", DocumentName));
- else
- return;
- }
- else
- {
- UnitOfWork unitOfWork = new UnitOfWork();
- //unitOfWork.ConnectionString = DataConnection.GetConnection();
- //PopulateDraftDocuments(DocumentName, unitOfWork);
- }
- }
- }
- private Int32 counter;
- /*private void PopulateDraftDocuments(String fileName, UnitOfWork unitOfWork)
- {
- String name = Path.GetFileName(fileName).ToLower();
- String path = Path.GetDirectoryName(fileName).ToLower();
- XPCollection docs = new XPCollection(unitOfWork, typeof(Document),
- CriteriaOperator.Parse("FileName = ? and Path = ? ", name, path));
- if (docs.Count > 0)
- {
- //Check if there is draft, with this file linked to it.
- // If so add the draft ot the list.
- XPCollection draftLinks = new XPCollection(unitOfWork, typeof(DocumentLinks),
- CriteriaOperator.Parse(String.Format("BaseItem.DocType.Extension = '.dft' and LinkedItem = '{0}'", ((Document)docs[0]).Oid)));
- if (draftLinks.Count > 0)
- {
- SolidEdgeFramework.Documents documents = (SolidEdgeFramework.Documents)_application.Documents;
- foreach (DocumentLinks item in draftLinks)
- {
- DocumentLinks link = (DocumentLinks)item;
- String FileName = link.BaseItem.Path + "\\" + link.BaseItem.FileName;
- if (File.Exists(FileName))
- documents.Open(FileName, Missing.Value, Missing.Value, Missing.Value,
- Missing.Value, Missing.Value);
- }
- }
- DraftSubLoop(((Document)docs[0]).Oid, counter, unitOfWork);
- }
- }
- private void DraftSubLoop(Int32 oId, Int32 parentId, UnitOfWork unitOfWork)
- {
- XPCollection links = new XPCollection(unitOfWork, typeof(DocumentLinks),
- CriteriaOperator.Parse(String.Format("BaseItem = '{0}'", oId)));
- int tmp = links.Count;
- SolidEdgeFramework.Documents documents = (SolidEdgeFramework.Documents)_application.Documents;
- foreach (DocumentLinks item in links)
- {
- //Check if there is draft, with this file linked to it.
- // If so add the draft ot the list.
- XPCollection draftLinks = new XPCollection(unitOfWork, typeof(DocumentLinks),
- CriteriaOperator.Parse(String.Format("BaseItem.DocType.Extension = '.dft' and LinkedItem = '{0}'", item.LinkedItem.Oid)));
- if (draftLinks.Count > 0)
- {
- DocumentLinks link = (DocumentLinks)draftLinks[0];
- String fileName = link.BaseItem.Path + "\\" + link.BaseItem.FileName;
- if (File.Exists(fileName))
- documents.Open(fileName, Missing.Value, Missing.Value, Missing.Value,
- Missing.Value, Missing.Value);
- }
- // process the current document.
- DraftSubLoop(item.LinkedItem.Oid, counter, unitOfWork);
- }
- }*/
- #endregion
- #region Search
- void OnMouseRibbonCommandSearchOnInput(RibbonCommand ribbonCommand)
- {
- DoOpenSearchForm(string.Empty);
- }
- private void DoOpenSearchForm(String DocumentName, bool bChange = false, bool bClose = false)
- {
- MessageHelper msg = new MessageHelper();
- string s = string.Empty;
- int result;
- if (!IfApplicationWindowOpen("Search") && !bChange)
- System.Windows.Forms.Application.Run(new ME2DLL.MdiForms.frmSearch() { HeaderText = "ManageEm - Search" });
- else
- {
- if (collectionIntPtr.Count > 0)
- {
- if (bClose)
- result = msg.sendWindowsStringMessage((int)collectionIntPtr[0], 0, String.Format("/closesearch#{0}", DocumentName));
- else
- result = msg.sendWindowsStringMessage((int)collectionIntPtr[0], 0, String.Format("/opensearch#{0}", DocumentName));
- }
- }
- }
- #endregion
- #region PrintList
- void OnMouseRibbonCommandPrintList(RibbonCommand ribbonCommand)
- {
- SolidEdgeFramework.SolidEdgeDocument document = (SolidEdgeFramework.SolidEdgeDocument)_application.ActiveDocument;
- StartThread(document.FullName, FormType.PrintList);
- }
- private void DoOpenPrintListForm(String DocumentName, bool bChange = false, bool bClose = false)
- {
- MessageHelper msg = new MessageHelper();
- string s = string.Empty;
- int result;
- String extension = Path.GetExtension(DocumentName);
- if (!IfApplicationWindowOpen("PrintList") && !bChange)
- System.Windows.Forms.Application.Run(new ME2DLL.MdiForms.frmPrintList() { HeaderText = string.Format("ManageEm - PrintList - {0}", DocumentName), FileName = DocumentName });
- else
- {
- if (collectionIntPtr.Count > 0)
- {
- if (bClose)
- result = msg.sendWindowsStringMessage((int)collectionIntPtr[0], 0, String.Format("/closeprintlist#{0}", DocumentName));
- else
- result = msg.sendWindowsStringMessage((int)collectionIntPtr[0], 0, String.Format("/openprintlist#{0}", DocumentName));
- }
- }
- }
- #endregion
- #region CheckDrafts
- void OnMouseRibbonCommandCheckDrafts(RibbonCommand ribbonCommand)
- {
- SolidEdgeFramework.SolidEdgeDocument document = (SolidEdgeFramework.SolidEdgeDocument)_application.ActiveDocument;
- StartThread(document.FullName, FormType.CheckDrafts);
- }
- private void DoOpenCheckDraftsForm(String DocumentName, bool bChange = false, bool bClose = false)
- {
- MessageHelper msg = new MessageHelper();
- string s = string.Empty;
- int result;
- String extension = Path.GetExtension(DocumentName);
- if (!IfApplicationWindowOpen("Check Drafts") && !bChange)
- System.Windows.Forms.Application.Run(new ME2DLL.MdiForms.frmCheckDrafts() { HeaderText = string.Format("ManageEm - Check Drafts - {0}", DocumentName), FileName = DocumentName });
- else
- {
- if (collectionIntPtr.Count > 0)
- {
- if (bClose)
- result = msg.sendWindowsStringMessage((int)collectionIntPtr[0], 0, String.Format("/closeCheckdrafts#{0}", DocumentName));
- else
- result = msg.sendWindowsStringMessage((int)collectionIntPtr[0], 0, String.Format("/openCheckdrafts#{0}", DocumentName));
- }
- }
- }
- #endregion
- #region ManageEm Properties
- private void DoOpenCustomPropertiesForm(String DocumentName, bool bChange = false, bool bClose = false)
- {
- MessageHelper msg = new MessageHelper();
- string s = string.Empty;
- int result;
- String extension = Path.GetExtension(DocumentName);
- if (!IfApplicationWindowOpen("Custom Properties") && !bChange)
- System.Windows.Forms.Application.Run(new ME2DLL.MdiForms.frmOpenProperties() { HeaderText = string.Format("ManageEm - Properties - {0}", DocumentName), FileName = DocumentName });
- else
- {
- if (collectionIntPtr.Count > 0)
- {
- if (bClose)
- result = msg.sendWindowsStringMessage((int)collectionIntPtr[0], 0, String.Format("/closeCustomProperties#{0}", DocumentName));
- else
- result = msg.sendWindowsStringMessage((int)collectionIntPtr[0], 0, String.Format("/openCustomProperties#{0}", DocumentName));
- }
- }
- }
- void OnMouseRibbonCommandCustomProps(RibbonCommand ribbonCommand)
- {
- SolidEdgeFramework.SolidEdgeDocument document = (SolidEdgeFramework.SolidEdgeDocument)_application.ActiveDocument;
- StartThread(document.FullName, FormType.CustomProperties);
- }
- #endregion
- #region Threading
- private void StartThread(String DocumentName, FormType Type)
- {
- var t = new System.Threading.Thread(() => RealStart(DocumentName, Type));
- t.SetApartmentState(System.Threading.ApartmentState.STA);
- t.IsBackground = false;
- t.Start();
- }
- private void RealStart(String DocumentName, FormType Type)
- {
- System.Windows.Forms.Application.EnableVisualStyles();
- System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
- switch (Type)
- {
- case FormType.Search:
- DoOpenSearchForm(DocumentName);
- break;
- case FormType.WhereUsed:
- DoOpenWhereUsedForm(DocumentName);
- break;
- case FormType.OpenDraft:
- DoOpenDraftForm(DocumentName);
- break;
- case FormType.PrintList:
- DoOpenPrintListForm(DocumentName);
- break;
- case FormType.CheckDrafts:
- DoOpenCheckDraftsForm(DocumentName);
- break;
- case FormType.CustomProperties:
- DoOpenCustomPropertiesForm(DocumentName);
- break;
- }
- }
- private static List<IntPtr> collectionIntPtr = null;
- private static bool IfApplicationWindowOpen(string windowName)
- {
- List<string> collection = new List<string>();
- List<IntPtr> internCollectionIntPtr = new List<IntPtr>();
- collectionIntPtr = new List<IntPtr>();
- User32.EnumDelegate filter = delegate(IntPtr hWnd, int lParam)
- {
- StringBuilder strbTitle = new StringBuilder(255);
- int nLength = User32.GetWindowText(hWnd, strbTitle, strbTitle.Capacity + 1);
- string strTitle = strbTitle.ToString();
- if (User32.IsWindowVisible(hWnd) && string.IsNullOrEmpty(strTitle) == false)
- {
- collection.Add(strTitle);
- internCollectionIntPtr.Add(hWnd);
- }
- return true;
- };
- if (User32.EnumDesktopWindows(IntPtr.Zero, filter, IntPtr.Zero))
- {
- int iTeller = 0;
- foreach (string item in collection)
- {
- if (item.ToString().Contains(windowName))
- {
- collectionIntPtr.Add(internCollectionIntPtr[iTeller]);
- return true;
- }
- iTeller++;
- }
- }
- return false;
- }
- #endregion
- #region IConnectionPoint helpers
- /// <summary>
- /// Attaches specified events to this object.
- /// </summary>
- private void HookEvents(object eventSource, Guid eventGuid)
- {
- IConnectionPointContainer container = null;
- IConnectionPoint connectionPoint = null;
- int cookie = 0;
- container = (IConnectionPointContainer)eventSource;
- container.FindConnectionPoint(eventGuid, out connectionPoint);
- if (connectionPoint != null)
- {
- try
- {
- connectionPoint.Advise(this, out cookie);
- _connectionPointDictionary.Add(connectionPoint, cookie);
- }
- catch (Exception ex) { MessageBox.Show(ex.Message); }
- }
- }
- /// <summary>
- /// Detaches specified events from this object.
- /// </summary>
- private void UnhookAllEvents()
- {
- Dictionary<IConnectionPoint, int>.Enumerator enumerator = _connectionPointDictionary.GetEnumerator();
- while (enumerator.MoveNext())
- {
- enumerator.Current.Key.Unadvise(enumerator.Current.Value);
- }
- _connectionPointDictionary.Clear();
- }
- #endregion
- #region Command Bar commands
- public void OnCommand(int CommandID)
- {
- // Get the GUID of the active environment.
- Guid environmentGuid = _application.GetActiveEnvironmentGuid();
- // Lookup ribbon command by environment and command id.
- RibbonCommand ribbonCommand = RibbonHelper.LookupRibbonCommandByCommandId(environmentGuid, CommandID);
- if (ribbonCommand != null)
- {
- if (ribbonCommand.Callback != null)
- {
- // Forward call to specified delegate.
- ribbonCommand.Callback(ribbonCommand);
- }
- else
- {
- MessageBox.Show("No callback set for ribbon command!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- else
- {
- MessageBox.Show("Lookup for ribbon command failed!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- public void OnCommandHelp(int hFrameWnd, int HelpCommandID, int CommandID)
- {
- }
- public void OnCommandUpdateUI(int CommandID, ref int CommandFlags, out string MenuItemText, ref int BitmapID)
- {
- MenuItemText = null;
- // Default to disabled state.
- CommandFlags = 0;
- // Get the GUID of the active environment.
- Guid environmentGuid = _application.GetActiveEnvironmentGuid();
- // Lookup the ribbon command by it's command id.
- RibbonCommand ribbonCommand = RibbonHelper.LookupRibbonCommandByCommandId(environmentGuid, CommandID);
- if (ribbonCommand != null)
- {
- // Toggle button enabled state if necessary.
- if (ribbonCommand.Enabled)
- {
- CommandFlags = (int)SolidEdgeConstants.SECommandActivation.seCmdActive_Enabled;
- }
- // Toggle button checked state if necessary.
- if (ribbonCommand.Checked)
- {
- CommandFlags |= (int)SolidEdgeConstants.SECommandActivation.seCmdActive_Checked;
- }
- }
- }
- #endregion
- #region regasm.exe
- /// <summary>
- /// Implementation of ComRegisterFunction.
- /// </summary>
- /// <remarks>
- /// This method gets called when regasm.exe is executed against the assembly.
- /// </remarks>
- [ComRegisterFunction]
- public static void Register(Type t)
- {
- RegistrationHelper.Register(t);
- }
- /// <summary>
- /// Implementation of ComUnregisterFunction.
- /// </summary>
- /// <remarks>
- /// This method gets called when regasm.exe is executed against the assembly.
- /// </remarks>
- [ComUnregisterFunction]
- public static void Unregister(Type t)
- {
- ManageEmAddIn.Unregister(t);
- }
- #endregion
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement