Vault Customization

Reply
Distinguished Contributor
xdumont
Posts: 173
Registered: ‎03-20-2006
Message 1 of 3 (185 Views)
Accepted Solution

Copy Design Event

185 Views, 2 Replies
01-21-2014 05:49 AM

Hi all,

 

I want to get a list of all new files created by a Copy-Design command.

 

Then I need to create a Vault add-in who can hook CommandEnd Event and if the command is CopyDesign, get the list on new file.

 

But I don't find any list of file.ids when this command event fire.

 

I found this link, but don't understand how can I do that because I think it's two kind of add-in (IWebServiceExtension + IExplorerExtension).

http://justonesandzeros.typepad.com/blog/2011/09/vault-explorer-command-events.html

 

Sorry, I'm not a developper, maybe the solution is very easy but I don't find a way to do that.

 

Thanks in advance and hav a nice day.

Yes, as Doug said in the blog post, it can be a combination of explorer command events and web service command events, I did a quick demo as below, without error checking, just for your reference: 

 

    public class Class1 : IExplorerExtension
    {


        #region IExplorerExtenion implemenation
//some methods are ommited

        public void OnStartup(IApplication application)
        {
            application.CommandBegin += application_CommandBegin;
            application.CommandEnd += application_CommandEnd;

        }

        void application_CommandEnd(object sender, CommandEndEventArgs e)
        {
            if (String.Compare(e.CommandId,"CopyDesign") == 0)
            {
                string filenames = WebServiceEventHandler.fileNames.ToString();
                MessageBox.Show(filenames);
            }
        }


        TextDialog m_commandBox;
        void application_CommandBegin(object sender, CommandBeginEventArgs e)
        {


            if (String.Compare(e.CommandId, "CopyDesign") == 0)
            {
                WebServiceEventHandler.fileNames.Clear();
             
            }
        }
        #endregion

}



    class WebServiceEventHandler : IWebServiceExtension
    {

        public static StringBuilder fileNames = new StringBuilder();
        public void OnLoad()
        {
            DocumentService.AddFileEvents.Post += AddFileEvents_Post;
        }

        void AddFileEvents_Post(object sender, AddFileCommandEventArgs e)
        {
            fileNames.Append(e.FileName + "\n");
        }
    }


and here is vcet.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectivity.ExtensionSettings3>
    <extension
      interface="Autodesk.Connectivity.Explorer.Extensibility.IExplorerExtension, Autodesk.Connectivity.Explorer.Extensibility, Version=18.0.0.0, Culture=neutral, PublicKeyToken=aa20f34aedd220e1"
      type="ExplorerEventSample.Class1, ExplorerEventSample">
    </extension>
    <extension
        interface="Autodesk.Connectivity.WebServices.IWebServiceExtension, Autodesk.Connectivity.WebServices, Version=18.0.0.0, Culture=neutral, PublicKeyToken=aa20f34aedd220e1"
        type="ExplorerEventSample.WebServiceEventHandler, ExplorerEventSample">
    </extension>
  </connectivity.ExtensionSettings3>
</configuration>







Board Manager
Daniel.Du
Posts: 202
Registered: ‎12-23-2008
Message 2 of 3 (167 Views)

Re: Copy Design Event

01-22-2014 07:14 PM in reply to: xdumont

Yes, as Doug said in the blog post, it can be a combination of explorer command events and web service command events, I did a quick demo as below, without error checking, just for your reference: 

 

    public class Class1 : IExplorerExtension
    {


        #region IExplorerExtenion implemenation
//some methods are ommited

        public void OnStartup(IApplication application)
        {
            application.CommandBegin += application_CommandBegin;
            application.CommandEnd += application_CommandEnd;

        }

        void application_CommandEnd(object sender, CommandEndEventArgs e)
        {
            if (String.Compare(e.CommandId,"CopyDesign") == 0)
            {
                string filenames = WebServiceEventHandler.fileNames.ToString();
                MessageBox.Show(filenames);
            }
        }


        TextDialog m_commandBox;
        void application_CommandBegin(object sender, CommandBeginEventArgs e)
        {


            if (String.Compare(e.CommandId, "CopyDesign") == 0)
            {
                WebServiceEventHandler.fileNames.Clear();
             
            }
        }
        #endregion

}



    class WebServiceEventHandler : IWebServiceExtension
    {

        public static StringBuilder fileNames = new StringBuilder();
        public void OnLoad()
        {
            DocumentService.AddFileEvents.Post += AddFileEvents_Post;
        }

        void AddFileEvents_Post(object sender, AddFileCommandEventArgs e)
        {
            fileNames.Append(e.FileName + "\n");
        }
    }


and here is vcet.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectivity.ExtensionSettings3>
    <extension
      interface="Autodesk.Connectivity.Explorer.Extensibility.IExplorerExtension, Autodesk.Connectivity.Explorer.Extensibility, Version=18.0.0.0, Culture=neutral, PublicKeyToken=aa20f34aedd220e1"
      type="ExplorerEventSample.Class1, ExplorerEventSample">
    </extension>
    <extension
        interface="Autodesk.Connectivity.WebServices.IWebServiceExtension, Autodesk.Connectivity.WebServices, Version=18.0.0.0, Culture=neutral, PublicKeyToken=aa20f34aedd220e1"
        type="ExplorerEventSample.WebServiceEventHandler, ExplorerEventSample">
    </extension>
  </connectivity.ExtensionSettings3>
</configuration>









Daniel Du
Developer Technical Services
Autodesk Developer Network

Distinguished Contributor
xdumont
Posts: 173
Registered: ‎03-20-2006
Message 3 of 3 (142 Views)

Re: Copy Design Event

01-28-2014 08:03 AM in reply to: xdumont

It's perfect. I found now where I'm wrong regarding the vcet.config file.

 

Thanks a lot.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.