Beispiel #1
0
        public FormMods()
        {
            InitializeComponent();
            CenterToScreen();
            listBoxInstalled.DataSource    = new BindingList <ModListing>();
            listBoxNotInstalled.DataSource = new BindingList <ModListing>();
            UpdateModList();

            var feh  = new System.IO.FileSystemEventHandler(OnFileEvent);
            var feh2 = new System.IO.RenamedEventHandler(OnFileEvent);

            System.IO.FileSystemWatcher watcher1 = new System.IO.FileSystemWatcher
            {
                Path         = MainForm.Settings.NotInstalledModsDirectory,
                NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName,
                Filter       = "*.botm.zip"
            };
            watcher1.Created            += feh;
            watcher1.Changed            += feh;
            watcher1.Renamed            += feh2;
            watcher1.Deleted            += feh;
            watcher1.EnableRaisingEvents = true;
            System.IO.FileSystemWatcher watcher2 = new System.IO.FileSystemWatcher
            {
                Path         = MainForm.Settings.NotInstalledModsDirectory,
                NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName,
                Filter       = "*.botm.zip"
            };
            watcher2.Created            += feh;
            watcher2.Deleted            += feh;
            watcher2.EnableRaisingEvents = true;
        }
Beispiel #2
0
 private void InvokeHandler(RenamedEventHandler eventHandler, RenamedEventArgs e)
 {
     if (eventHandler != null)
     {
         if (_containedFSW.SynchronizingObject != null && this._containedFSW.SynchronizingObject.InvokeRequired)
         {
             _containedFSW.SynchronizingObject.BeginInvoke(eventHandler, new object[] { this, e });
         }
         else
         {
             eventHandler(this, e);
         }
     }
 }