Exemple #1
0
        private void DoTriggerAction(Trigger trigger)
        {
            // These actions need to directly correspond with the TriggerActionType class.
            switch (trigger.ActionType)
            {
            case TriggerActionType.ExitApplication:
                ExitApplication();
                break;

            case TriggerActionType.HideInterface:
                HideInterface();
                break;

            case TriggerActionType.RunEditor:
                Editor editor = _formEditor.EditorCollection.GetByName(trigger.Value);
                RunEditor(editor, _screenshotCollection.GetLastScreenshot());
                break;

            case TriggerActionType.ShowInterface:
                ShowInterface();
                break;

            case TriggerActionType.StartScreenCapture:
                StartScreenCapture();
                break;

            case TriggerActionType.StopScreenCapture:
                StopScreenCapture();
                break;

            case TriggerActionType.EmailScreenshot:
                EmailScreenshot(TriggerActionType.EmailScreenshot);
                break;

            case TriggerActionType.SetScreenCaptureInterval:
                timerScreenCapture.Stop();

                _screenCapture.Interval     = trigger.ScreenCaptureInterval;
                timerScreenCapture.Interval = trigger.ScreenCaptureInterval;

                decimal screenCaptureIntervalHours   = Convert.ToDecimal(TimeSpan.FromMilliseconds(Convert.ToDouble(trigger.ScreenCaptureInterval)).Hours);
                decimal screenCaptureIntervalMinutes = Convert.ToDecimal(TimeSpan.FromMilliseconds(Convert.ToDouble(trigger.ScreenCaptureInterval)).Minutes);
                decimal screenCaptureIntervalSeconds = Convert.ToDecimal(TimeSpan.FromMilliseconds(Convert.ToDouble(trigger.ScreenCaptureInterval)).Seconds);

                _formSetup.numericUpDownHoursInterval.Value   = screenCaptureIntervalHours;
                _formSetup.numericUpDownMinutesInterval.Value = screenCaptureIntervalMinutes;
                _formSetup.numericUpDownSecondsInterval.Value = screenCaptureIntervalSeconds;

                timerScreenCapture.Start();
                break;

            case TriggerActionType.EnableScreen:
                _formScreen.ScreenCollection.GetByName(trigger.Value).Enable = true;
                BuildScreensModule();
                break;

            case TriggerActionType.DisableScreen:
                _formScreen.ScreenCollection.GetByName(trigger.Value).Enable = false;
                BuildScreensModule();
                break;

            case TriggerActionType.EnableRegion:
                _formRegion.RegionCollection.GetByName(trigger.Value).Enable = true;
                BuildRegionsModule();
                break;

            case TriggerActionType.DisableRegion:
                _formRegion.RegionCollection.GetByName(trigger.Value).Enable = false;
                BuildRegionsModule();
                break;

            case TriggerActionType.EnableSchedule:
                _formSchedule.ScheduleCollection.GetByName(trigger.Value).Enable = true;
                BuildSchedulesModule();
                break;

            case TriggerActionType.DisableSchedule:
                _formSchedule.ScheduleCollection.GetByName(trigger.Value).Enable = false;
                BuildSchedulesModule();
                break;

            case TriggerActionType.EnableMacroTag:
                _formMacroTag.MacroTagCollection.GetByName(trigger.Value).Enable = true;
                BuildMacroTagsModule();
                break;

            case TriggerActionType.DisableMacroTag:
                _formMacroTag.MacroTagCollection.GetByName(trigger.Value).Enable = false;
                BuildMacroTagsModule();
                break;

            case TriggerActionType.EnableTrigger:
                _formTrigger.TriggerCollection.GetByName(trigger.Value).Enable = true;
                BuildTriggersModule();
                break;

            case TriggerActionType.DisableTrigger:
                _formTrigger.TriggerCollection.GetByName(trigger.Value).Enable = false;
                BuildTriggersModule();
                break;

            case TriggerActionType.DeleteScreenshotsByDays:
                _screenshotCollection.DeleteScreenshotsByDays(trigger.Days, trigger.Value, _macroParser, _formMacroTag.MacroTagCollection, _failedUploads);
                break;

            case TriggerActionType.SetLabel:
                ApplyLabel(trigger.Value);
                break;

            case TriggerActionType.SetActiveWindowTitleAsMatch:
                SetActiveWindowTitleAsMatch(trigger.Value);
                break;

            case TriggerActionType.SetApplicationFocus:
                _formSetup.SetApplicationFocus(trigger.Value);
                break;

            case TriggerActionType.FileTransferScreenshot:
                FileTransferScreenshot(TriggerActionType.FileTransferScreenshot);
                break;

            case TriggerActionType.SetActiveWindowTitleAsNoMatch:
                SetActiveWindowTitleAsNoMatch(trigger.Value);
                break;

            case TriggerActionType.ShowSystemTrayIcon:
                ShowSystemTrayIcon();
                break;

            case TriggerActionType.HideSystemTrayIcon:
                HideSystemTrayIcon();
                break;

            case TriggerActionType.TakeScreenshot:
                TakeScreenshot(captureNow: true);
                break;

            case TriggerActionType.RegionSelectClipboard:
                toolStripMenuItemRegionSelectClipboard_Click(null, null);
                break;

            case TriggerActionType.RegionSelectClipboardAutoSave:
                toolStripMenuItemRegionSelectClipboardAutoSave_Click(null, null);
                break;

            case TriggerActionType.RegionSelectClipboardAutoSaveEdit:
                toolStripMenuItemRegionSelectClipboardAutoSaveEdit_Click(null, null);
                break;

            case TriggerActionType.RegionSelectClipboardFloatingScreenshot:
                toolStripMenuItemRegionSelectClipboardFloatingScreenshot_Click(null, null);
                break;

            case TriggerActionType.RegionSelectFloatingScreenshot:
                toolStripMenuItemRegionSelectFloatingScreenshot_Click(null, null);
                break;

            case TriggerActionType.ShowOrHideInterface:
                toolStripMenuItemShowHideInterface_Click(null, null);
                break;

            case TriggerActionType.StartOrStopScreenCapture:
                if (_screenCapture.Running)
                {
                    StopScreenCapture();
                }
                else
                {
                    StartScreenCapture();
                }
                break;

            case TriggerActionType.RestartScreenCapture:
                StopScreenCapture();
                StartScreenCapture();
                break;

            case TriggerActionType.DeleteScreenshotsByCycleCount:
                _screenshotCollection.DeleteScreenshotsByCycleCount(trigger.CycleCount, _failedUploads);
                break;

            case TriggerActionType.DeleteScreenshotsFromOldestCaptureCycle:
                _screenshotCollection.DeleteScreenshotsFromOldestCaptureCycle(_failedUploads);
                break;
            }
        }