Beispiel #1
0
        private void activateButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(commanderName))
            {
                initialize();
                return;
            }
            // Begin watching.
            if (watcher != null && watcher.EnableRaisingEvents)
            {
                watcher.EnableRaisingEvents = false;
                watcher.Dispose();
                watcher = null;
                activateButton.Text = "Activate";
                toolStripStatusLabel1.Text = "Press Activate to start watching for missions";
            }
            else
            {   
                watcher = new FileSystemWatcher();
                watcher.Path = Properties.Settings.Default.PicturesFolder;
                watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName;
                // Only watch text files.
                watcher.Filter = "*.bmp";

                // Add event handlers.
                watcher.Created += new FileSystemEventHandler(RegisterMission);
                watcher.EnableRaisingEvents = true;
                if (analyzer != null)
                    analyzer.Dispose();
                analyzer = new ScreenAnalyzer(Properties.Settings.Default.Language);
                activateButton.Text = "Deactivate";
                toolStripStatusLabel1.Text = "Activated, Wathing for screenshots under: " + Properties.Settings.Default.PicturesFolder;
            }
        }
Beispiel #2
0
 private void onSettingsChanged(object sender, CancelEventArgs e)
 {
     if (analyzer != null && analyzer.getLanguage().Code != Properties.Settings.Default.Language)
     {
         analyzer.Dispose();
         analyzer = new ScreenAnalyzer(Properties.Settings.Default.Language);
     }
     if (watcher != null && watcher.Path != Properties.Settings.Default.PicturesFolder)
     {
         watcher.Path = Properties.Settings.Default.PicturesFolder;
     }
     if(takenMisisonCoolDown.TotalSeconds != Properties.Settings.Default.MissionCoolDown)
         takenMisisonCoolDown = new TimeSpan(0, 0, Properties.Settings.Default.MissionCoolDown);
 }