Esempio n. 1
0
        internal void handleEvent(object sender, ShellChangeEventArgs args)
        {
            if (args.PIDL1 != null)
            {
                switch (args.Changes)
                {
                case ShellAPI.SHCNE.CREATE:     //File Created
                    handleEvent(WatcherChangeTypesEx.Created, false, args.PIDL1);
                    break;

                case ShellAPI.SHCNE.DELETE:     //File Deleted
                    handleEvent(WatcherChangeTypesEx.Deleted, false, args.PIDL1);
                    break;

                case ShellAPI.SHCNE.UPDATEITEM:      //File Changed
                    handleEvent(WatcherChangeTypesEx.Changed, false, args.PIDL1);
                    break;

                case ShellAPI.SHCNE.RENAMEITEM:      //File Renamed
                    handleRenameEvent(false, args.PIDL1, args.PIDL2);
                    break;

                case ShellAPI.SHCNE.MKDIR:     //Make Directory
                    handleEvent(WatcherChangeTypesEx.Created, true, args.PIDL1);
                    break;

                //0.13: Fixed FileSystemWaterEx ignore remove directory event.
                case ShellAPI.SHCNE.RMDIR:     //Remove Directory
                    handleEvent(WatcherChangeTypesEx.Deleted, true, args.PIDL1);
                    break;

                case ShellAPI.SHCNE.UPDATEDIR:     //Directory updated
                    handleEvent(WatcherChangeTypesEx.Changed, true, args.PIDL1);
                    break;

                case ShellAPI.SHCNE.RENAMEFOLDER:      //Folder Renamed
                    handleRenameEvent(true, args.PIDL1, args.PIDL2);
                    break;

                case ShellAPI.SHCNE.DRIVEADD:
                case ShellAPI.SHCNE.DRIVEADDGUI:
                    handleEvent(WatcherChangeTypesEx.Created, true, args.PIDL1);
                    break;

                case ShellAPI.SHCNE.MEDIAINSERTED:
                    handleEvent(WatcherChangeTypesEx.Ready, true, args.PIDL1);
                    break;

                case ShellAPI.SHCNE.MEDIAREMOVED:
                    handleEvent(WatcherChangeTypesEx.NotReady, true, args.PIDL1);
                    break;

                case ShellAPI.SHCNE.ATTRIBUTES:
                    handleEvent(WatcherChangeTypesEx.Changed, true, args.PIDL1);
                    break;
                }
            }
        }
Esempio n. 2
0
        internal void HandleEvent(object sender, ShellChangeEventArgs args)
        {
            //Thread thisThread = System.Threading.Thread.CurrentThread;
            //Threading.ThreadPool.QueueUserWorkItem(
            //    (WaitCallback)delegate(object state)
            //{
            //    ShellChangeEventArgs e = (ShellChangeEventArgs)state;

            //    handleEvent(this, e);
            //}, args);

            handleEvent(sender, args);
        }
 internal void handleEvent(object sender, ShellChangeEventArgs args)
 {
     if (args.PIDL1 != null)
         switch (args.Changes)
         {
             case ShellAPI.SHCNE.CREATE: //File Created
                 handleEvent(WatcherChangeTypesEx.Created, false, args.PIDL1);
                 break;
             case ShellAPI.SHCNE.DELETE: //File Deleted
                 handleEvent(WatcherChangeTypesEx.Deleted, false, args.PIDL1);
                 break;
             case ShellAPI.SHCNE.UPDATEITEM:  //File Changed
                 handleEvent(WatcherChangeTypesEx.Changed, false, args.PIDL1);
                 break;
             case ShellAPI.SHCNE.RENAMEITEM:  //File Renamed
                 handleRenameEvent(false, args.PIDL1, args.PIDL2);
                 break;
             case ShellAPI.SHCNE.MKDIR: //Make Directory
                 handleEvent(WatcherChangeTypesEx.Created, true, args.PIDL1);
                 break;
             //0.13: Fixed FileSystemWaterEx ignore remove directory event.
             case ShellAPI.SHCNE.RMDIR: //Remove Directory
                 handleEvent(WatcherChangeTypesEx.Deleted, true, args.PIDL1);
                 break;
             case ShellAPI.SHCNE.UPDATEDIR: //Directory updated
                 handleEvent(WatcherChangeTypesEx.Changed, true, args.PIDL1);
                 break;
             case ShellAPI.SHCNE.RENAMEFOLDER:  //Folder Renamed
                 handleRenameEvent(true, args.PIDL1, args.PIDL2);
                 break;
             case ShellAPI.SHCNE.DRIVEADD:
             case ShellAPI.SHCNE.DRIVEADDGUI:
                 handleEvent(WatcherChangeTypesEx.Created, true, args.PIDL1);
                 break;
             case ShellAPI.SHCNE.MEDIAINSERTED:
                 handleEvent(WatcherChangeTypesEx.Ready, true, args.PIDL1);
                 break;
             case ShellAPI.SHCNE.MEDIAREMOVED:
                 handleEvent(WatcherChangeTypesEx.NotReady, true, args.PIDL1);
                 break;
             case ShellAPI.SHCNE.ATTRIBUTES:
                 handleEvent(WatcherChangeTypesEx.Changed, true, args.PIDL1);
                 break;
         }
 }
        internal void HandleEvent(object sender, ShellChangeEventArgs args)
        {
            //Thread thisThread = System.Threading.Thread.CurrentThread;
            //Threading.ThreadPool.QueueUserWorkItem(
            //    (WaitCallback)delegate(object state)
            //{
            //    ShellChangeEventArgs e = (ShellChangeEventArgs)state;

            //    handleEvent(this, e);
            //}, args);

            handleEvent(sender, args);
        }