<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Watch Save\SaveAs Event? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512427#M69949</link>
    <description>Thanks for the code. I was able to write this in vb.net but it doesn't seem to watch the Save\SaveAs\QSave event. During the debug it doesn't even get into the code. &lt;BR /&gt;
&lt;BR /&gt;
here's what i have so far. I'm a noobie so bare with me. Thanks!&lt;BR /&gt;
&lt;BR /&gt;
Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;
Imports Autodesk.AutoCAD.ApplicationServices&lt;BR /&gt;
Imports Autodesk.AutoCAD.DatabaseServices&lt;BR /&gt;
Imports Autodesk.AutoCAD.EditorInput&lt;BR /&gt;
&lt;BR /&gt;
Public Class Class1&lt;BR /&gt;
&lt;BR /&gt;
    Private Sub Sub_Handler()&lt;BR /&gt;
        Try&lt;BR /&gt;
            AddHandler Application.DocumentManager.DocumentLockModeChanged, New DocumentLockModeChangedEventHandler(AddressOf docChange)&lt;BR /&gt;
        Catch ex As Exception&lt;BR /&gt;
&lt;BR /&gt;
        End Try&lt;BR /&gt;
    End Sub&lt;BR /&gt;
&lt;BR /&gt;
    Public Sub docChange(ByVal sender As Object, ByVal e As DocumentLockModeChangedEventArgs)&lt;BR /&gt;
        If e.GlobalCommandName = "_QSAVE" Or e.GlobalCommandName = "_SAVE" Or e.GlobalCommandName = "_SAVEAS" Then&lt;BR /&gt;
            Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor&lt;BR /&gt;
            ed.WriteMessage("Save has occured")&lt;BR /&gt;
        End If&lt;BR /&gt;
    End Sub</description>
    <pubDate>Thu, 25 Jun 2009 20:08:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-06-25T20:08:16Z</dc:date>
    <item>
      <title>Watch Save\SaveAs Event?</title>
      <link>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512425#M69947</link>
      <description>I am fairly new to vb.net programming so sorry if this is an elementary question. I checked some post but didn't see what I was looking for.&lt;BR /&gt;
&lt;BR /&gt;
I want to know how to watch for a save or saveas event. Basically I want to start a command after a save or saveas commands are finished. BTW, I'm coding this in vb.net. &lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
Dan</description>
      <pubDate>Wed, 24 Jun 2009 17:30:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512425#M69947</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-06-24T17:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Watch Save\SaveAs Event?</title>
      <link>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512426#M69948</link>
      <description>Hi.&lt;BR /&gt;
I will give you a code sample in C#.&lt;BR /&gt;
You have to handle the DocumentLockModeChanged event like this:&lt;BR /&gt;
&lt;BR /&gt;
Application.DocumentManager.DocumentLockModeChanged += new DocumentLockModeChangedEventHandler(callback_DocumentManager_DocumentLockModeChanged);&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
and then check if the command is SAVE or SAVEAS:&lt;BR /&gt;
&lt;BR /&gt;
private static void callback_DocumentManager_DocumentLockModeChanged(object sender, DocumentLockModeChangedEventArgs e) &lt;BR /&gt;
{&lt;BR /&gt;
            if (e.GlobalCommandName == "QSAVE" || e.GlobalCommandName == "SAVE"&lt;BR /&gt;
                || e.GlobalCommandName == "SAVEAS")&lt;BR /&gt;
            {&lt;BR /&gt;
                 // do you code&lt;BR /&gt;
            }&lt;BR /&gt;
&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
the end of the command will be like #SAVE #SAVEAS.&lt;BR /&gt;
&lt;BR /&gt;
Edited by: maxim_voloshin on Jun 24, 2009 6:59 PM

Edited by: maxim_voloshin on Jun 24, 2009 7:00 PM</description>
      <pubDate>Wed, 24 Jun 2009 18:59:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512426#M69948</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-06-24T18:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Watch Save\SaveAs Event?</title>
      <link>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512427#M69949</link>
      <description>Thanks for the code. I was able to write this in vb.net but it doesn't seem to watch the Save\SaveAs\QSave event. During the debug it doesn't even get into the code. &lt;BR /&gt;
&lt;BR /&gt;
here's what i have so far. I'm a noobie so bare with me. Thanks!&lt;BR /&gt;
&lt;BR /&gt;
Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;
Imports Autodesk.AutoCAD.ApplicationServices&lt;BR /&gt;
Imports Autodesk.AutoCAD.DatabaseServices&lt;BR /&gt;
Imports Autodesk.AutoCAD.EditorInput&lt;BR /&gt;
&lt;BR /&gt;
Public Class Class1&lt;BR /&gt;
&lt;BR /&gt;
    Private Sub Sub_Handler()&lt;BR /&gt;
        Try&lt;BR /&gt;
            AddHandler Application.DocumentManager.DocumentLockModeChanged, New DocumentLockModeChangedEventHandler(AddressOf docChange)&lt;BR /&gt;
        Catch ex As Exception&lt;BR /&gt;
&lt;BR /&gt;
        End Try&lt;BR /&gt;
    End Sub&lt;BR /&gt;
&lt;BR /&gt;
    Public Sub docChange(ByVal sender As Object, ByVal e As DocumentLockModeChangedEventArgs)&lt;BR /&gt;
        If e.GlobalCommandName = "_QSAVE" Or e.GlobalCommandName = "_SAVE" Or e.GlobalCommandName = "_SAVEAS" Then&lt;BR /&gt;
            Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor&lt;BR /&gt;
            ed.WriteMessage("Save has occured")&lt;BR /&gt;
        End If&lt;BR /&gt;
    End Sub</description>
      <pubDate>Thu, 25 Jun 2009 20:08:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512427#M69949</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-06-25T20:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: Watch Save\SaveAs Event?</title>
      <link>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512428#M69950</link>
      <description>Well after playing around here's what I got. It will watch the save events. I placed a message box to show me if the watch worked but it seems to be displaying twice. Maybe at the beginning of the command and at the end. I want just the end so that my next task will run after the save is completed. Any feedback will be greatly appreciated. TIA.&lt;BR /&gt;
&lt;BR /&gt;
Imports Autodesk.AutoCAD.Runtime&lt;BR /&gt;
Imports Autodesk.AutoCAD.ApplicationServices&lt;BR /&gt;
Imports Autodesk.AutoCAD.DatabaseServices&lt;BR /&gt;
Imports Autodesk.AutoCAD.EditorInput&lt;BR /&gt;
Imports System.Windows&lt;BR /&gt;
&lt;BR /&gt;
Public Class Class1&lt;BR /&gt;
    Implements Autodesk.AutoCAD.Runtime.IExtensionApplication&lt;BR /&gt;
    Dim subHandler As [Delegate]&lt;BR /&gt;
    Public Sub docChange(ByVal sender As Object, ByVal e As DocumentLockModeChangedEventArgs)&lt;BR /&gt;
        If e.GlobalCommandName = "QSAVE" Or e.GlobalCommandName = "SAVE" Or e.GlobalCommandName = "SAVEAS" Then&lt;BR /&gt;
            Application.ShowAlertDialog("Save has occurred")&lt;BR /&gt;
        End If&lt;BR /&gt;
    End Sub&lt;BR /&gt;
&lt;BR /&gt;
    Public Sub Initialize() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Initialize&lt;BR /&gt;
        Try&lt;BR /&gt;
            subHandler = New DocumentLockModeChangedEventHandler(AddressOf docChange)&lt;BR /&gt;
            AddHandler Application.DocumentManager.DocumentLockModeChanged, subHandler&lt;BR /&gt;
        Catch ex As Exception&lt;BR /&gt;
&lt;BR /&gt;
        End Try&lt;BR /&gt;
    End Sub&lt;BR /&gt;
&lt;BR /&gt;
    Public Sub Terminate() Implements Autodesk.AutoCAD.Runtime.IExtensionApplication.Terminate&lt;BR /&gt;
        RemoveHandler Application.DocumentManager.DocumentLockModeChanged, subHandler&lt;BR /&gt;
    End Sub&lt;BR /&gt;
End Class</description>
      <pubDate>Thu, 25 Jun 2009 21:54:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512428#M69950</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-06-25T21:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: Watch Save\SaveAs Event?</title>
      <link>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512429#M69951</link>
      <description>Try &lt;BR /&gt;
&lt;BR /&gt;
If e.GlobalCommandName = "#QSAVE" Or e.GlobalCommandName = "#SAVE" Or e.GlobalCommandName = "#SAVEAS" Then&lt;BR /&gt;
Application.ShowAlertDialog("Save has occurred")&lt;BR /&gt;
End If</description>
      <pubDate>Sat, 27 Jun 2009 15:56:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512429#M69951</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-06-27T15:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Watch Save\SaveAs Event?</title>
      <link>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512430#M69952</link>
      <description>Sorry that didn't work. I still get two dialog boxes. Any other suggestions. &lt;BR /&gt;
&lt;BR /&gt;
Thanks for the reply!</description>
      <pubDate>Wed, 15 Jul 2009 17:15:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512430#M69952</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-07-15T17:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Watch Save\SaveAs Event?</title>
      <link>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512431#M69953</link>
      <description>Check out the attached file for monitoring Database 'save' events. Just displays an alert dialog when Database.BeginSave &amp;amp; Database.SaveComplete are called. The sample code file is for AutoCAD 2009 VB.</description>
      <pubDate>Wed, 22 Jul 2009 07:34:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512431#M69953</guid>
      <dc:creator>cadMeUp</dc:creator>
      <dc:date>2009-07-22T07:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Watch Save\SaveAs Event?</title>
      <link>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512432#M69954</link>
      <description>Thanks! I will give that a try.</description>
      <pubDate>Fri, 07 Aug 2009 15:27:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/watch-save-saveas-event/m-p/2512432#M69954</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-08-07T15:27:56Z</dc:date>
    </item>
  </channel>
</rss>

