Esempio n. 1
0
 protected void OnHotkeyTrigger(HotkeySettings hotkeySetting)
 {
     if (HotkeyTrigger != null)
     {
         HotkeyTrigger(hotkeySetting);
     }
 }
Esempio n. 2
0
        public void RegisterHotkey(HotkeySettings hotkeySetting)
        {
            if (!Program.Settings.DisableHotkeys || hotkeySetting.TaskSettings.Job == HotkeyType.DisableHotkeys)
            {
                UnregisterHotkey(hotkeySetting, false);

                if (hotkeySetting.HotkeyInfo.Status != HotkeyStatus.Registered && hotkeySetting.HotkeyInfo.IsValidHotkey)
                {
                    hotkeyForm.RegisterHotkey(hotkeySetting.HotkeyInfo);

                    if (hotkeySetting.HotkeyInfo.Status == HotkeyStatus.Registered)
                    {
                        DebugHelper.WriteLine("Hotkey registered: " + hotkeySetting);
                    }
                    else if (hotkeySetting.HotkeyInfo.Status == HotkeyStatus.Failed)
                    {
                        DebugHelper.WriteLine("Hotkey register failed: " + hotkeySetting);
                    }
                }
            }

            if (!Hotkeys.Contains(hotkeySetting))
            {
                Hotkeys.Add(hotkeySetting);
            }
        }
Esempio n. 3
0
        private void HandleHotkeys(HotkeySettings hotkeySetting)
        {
            DebugHelper.WriteLine(hotkeySetting.ToString());

            if (hotkeySetting.TaskSettings.Job == HotkeyType.None) return;

            TaskSettings taskSettings = TaskSettings.GetSafeTaskSettings(hotkeySetting.TaskSettings);

            switch (hotkeySetting.TaskSettings.Job)
            {
                case HotkeyType.ClipboardUpload:
                    UploadManager.ClipboardUpload(taskSettings);
                    break;
                case HotkeyType.FileUpload:
                    UploadManager.UploadFile(taskSettings);
                    break;
                case HotkeyType.PrintScreen:
                    CaptureScreenshot(CaptureType.Screen, taskSettings, false);
                    break;
                case HotkeyType.ActiveWindow:
                    CaptureScreenshot(CaptureType.ActiveWindow, taskSettings, false);
                    break;
                case HotkeyType.ActiveMonitor:
                    CaptureScreenshot(CaptureType.ActiveMonitor, taskSettings, false);
                    break;
                case HotkeyType.WindowRectangle:
                    CaptureScreenshot(CaptureType.RectangleWindow, taskSettings, false);
                    break;
                case HotkeyType.RectangleRegion:
                    CaptureScreenshot(CaptureType.Rectangle, taskSettings, false);
                    break;
                case HotkeyType.RoundedRectangleRegion:
                    CaptureScreenshot(CaptureType.RoundedRectangle, taskSettings, false);
                    break;
                case HotkeyType.EllipseRegion:
                    CaptureScreenshot(CaptureType.Ellipse, taskSettings, false);
                    break;
                case HotkeyType.TriangleRegion:
                    CaptureScreenshot(CaptureType.Triangle, taskSettings, false);
                    break;
                case HotkeyType.DiamondRegion:
                    CaptureScreenshot(CaptureType.Diamond, taskSettings, false);
                    break;
                case HotkeyType.PolygonRegion:
                    CaptureScreenshot(CaptureType.Polygon, taskSettings, false);
                    break;
                case HotkeyType.FreeHandRegion:
                    CaptureScreenshot(CaptureType.Freehand, taskSettings, false);
                    break;
                case HotkeyType.LastRegion:
                    CaptureScreenshot(CaptureType.LastRegion, taskSettings, false);
                    break;
                case HotkeyType.ScreenRecorder:
                    DoScreenRecorder(taskSettings);
                    break;
                case HotkeyType.AutoCapture:
                    OpenAutoCapture();
                    break;
            }
        }
Esempio n. 4
0
 protected void OnHotkeyTrigger(HotkeySettings hotkeySetting)
 {
     if (HotkeyTrigger != null)
     {
         HotkeyTrigger(hotkeySetting);
     }
 }
Esempio n. 5
0
 public HotkeySelectionControl(HotkeySettings setting)
 {
     InitializeComponent();
     Setting = setting;
     UpdateDescription();
     UpdateHotkeyText();
     UpdateHotkeyStatus();
 }
Esempio n. 6
0
        private void HandleHotkeys(HotkeySettings hotkeySetting)
        {
            DebugHelper.WriteLine("Hotkey triggered: " + hotkeySetting);

            if (hotkeySetting.TaskSettings.Job == HotkeyType.None) return;

            HandleTask(hotkeySetting.TaskSettings);
        }
Esempio n. 7
0
 public HotkeySelectionControl(HotkeySettings setting)
 {
     InitializeComponent();
     Setting = setting;
     UpdateDescription();
     UpdateHotkeyText();
     UpdateHotkeyStatus();
 }
 private HotkeySelectionControl AddHotkeySelectionControl(HotkeySettings hotkeySetting)
 {
     HotkeySelectionControl control = new HotkeySelectionControl(hotkeySetting);
     control.Margin = new Padding(0, 0, 0, 2);
     control.SelectedChanged += control_SelectedChanged;
     control.HotkeyChanged += control_HotkeyChanged;
     control.LabelDoubleClick += control_LabelDoubleClick;
     flpHotkeys.Controls.Add(control);
     return control;
 }
Esempio n. 9
0
 private HotkeySelectionControl AddHotkeySelectionControl(HotkeySettings hotkeySetting)
 {
     HotkeySelectionControl control = new HotkeySelectionControl(hotkeySetting);
     control.Margin = new Padding(0, 0, 0, 2);
     control.SelectedChanged += control_SelectedChanged;
     control.HotkeyChanged += control_HotkeyChanged;
     control.EditRequested += control_EditRequested;
     flpHotkeys.Controls.Add(control);
     return control;
 }
Esempio n. 10
0
        private HotkeySelectionControl FindSelectionControl(HotkeySettings hotkeySetting)
        {
            foreach (Control control in flpHotkeys.Controls)
            {
                HotkeySelectionControl hsc = (HotkeySelectionControl)control;
                if (hsc.Setting == hotkeySetting) return hsc;
            }

            return null;
        }
Esempio n. 11
0
        private void HandleHotkeys(HotkeySettings hotkeySetting)
        {
            DebugHelper.WriteLine("Hotkey triggered: " + hotkeySetting);

            if (hotkeySetting.TaskSettings.Job == HotkeyType.None)
            {
                return;
            }

            HandleTask(hotkeySetting.TaskSettings);
        }
        public HotkeySelectionControl(HotkeySettings setting)
        {
            Setting = setting;

            InitializeComponent();
            lblHotkeyDescription.ForeColor = SystemColors.ControlText;
            btnHotkey.ForeColor            = SystemColors.ControlText;
            UpdateDescription();
            UpdateHotkeyText();
            UpdateHotkeyStatus();
        }
Esempio n. 13
0
        private HotkeySelectionControl AddHotkeySelectionControl(HotkeySettings hotkeySetting)
        {
            HotkeySelectionControl control = new HotkeySelectionControl(hotkeySetting);

            control.Margin            = new Padding(0, 0, 0, 2);
            control.SelectedChanged  += control_SelectedChanged;
            control.HotkeyChanged    += control_HotkeyChanged;
            control.LabelDoubleClick += control_LabelDoubleClick;
            flpHotkeys.Controls.Add(control);
            return(control);
        }
Esempio n. 14
0
        private HotkeySelectionControl AddHotkeySelectionControl(HotkeySettings hotkeySetting)
        {
            HotkeySelectionControl control = new HotkeySelectionControl(hotkeySetting);

            control.Margin           = new Padding(0, 0, 0, 2);
            control.SelectedChanged += control_SelectedChanged;
            control.HotkeyChanged   += control_HotkeyChanged;
            control.EditRequested   += control_EditRequested;
            flpHotkeys.Controls.Add(control);
            return(control);
        }
Esempio n. 15
0
        private ToolStripMenuItem WorkflowMenuItem(HotkeySettings hotkeySetting)
        {
            ToolStripMenuItem tsmi = new ToolStripMenuItem(hotkeySetting.TaskSettings.Description);

            if (hotkeySetting.HotkeyInfo.IsValidHotkey)
            {
                tsmi.ShortcutKeyDisplayString = "  " + hotkeySetting.HotkeyInfo.ToString();
            }
            tsmi.Click += (sender, e) => HandleTask(hotkeySetting.TaskSettings);
            return(tsmi);
        }
Esempio n. 16
0
        private void hotkeyForm_HotkeyPress(ushort id, Keys key, Modifiers modifier)
        {
            if (!IgnoreHotkeys)
            {
                HotkeySettings hotkeySetting = Hotkeys.Find(x => x.HotkeyInfo.ID == id);

                if (hotkeySetting != null)
                {
                    OnHotkeyTrigger(hotkeySetting);
                }
            }
        }
Esempio n. 17
0
        private void hotkeyForm_HotkeyPress(ushort id, Keys key, Modifiers modifier)
        {
            if (!IgnoreHotkeys && (!Program.Settings.DisableHotkeysOnFullscreen || !CaptureHelpers.IsActiveWindowFullscreen()))
            {
                HotkeySettings hotkeySetting = Hotkeys.Find(x => x.HotkeyInfo.ID == id);

                if (hotkeySetting != null)
                {
                    OnHotkeyTrigger(hotkeySetting);
                }
            }
        }
        public HotkeySelectionControl(HotkeySettings setting)
        {
            Setting = setting;

            InitializeComponent();
            UpdateDescription();
            UpdateHotkeyText();
            if (ShareXResources.UseCustomTheme)
            {
                ShareXResources.ApplyCustomThemeToControl(this);
            }
            UpdateHotkeyStatus();
            UpdateTheme();
        }
Esempio n. 19
0
        private void RegisterHotkey(HotkeySettings hotkeySetting)
        {
            if (hotkeySetting.HotkeyInfo.HotkeyPress == null)
            {
                hotkeySetting.HotkeyInfo.HotkeyPress = () => triggerAction(hotkeySetting);
            }

            hotkeySetting.HotkeyInfo = hotkeyForm.RegisterHotkey(hotkeySetting.HotkeyInfo);

            if (!Hotkeys.Contains(hotkeySetting))
            {
                Hotkeys.Add(hotkeySetting);
            }
        }
Esempio n. 20
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            HotkeySettings hotkeySetting = new HotkeySettings();

            hotkeySetting.TaskSettings = TaskSettings.GetDefaultTaskSettings();
            manager.Hotkeys.Add(hotkeySetting);
            HotkeySelectionControl control = AddHotkeySelectionControl(hotkeySetting);

            control.Selected = true;
            Selected         = control;
            UpdateButtons();
            UpdateCheckStates();
            control.Focus();
            Update();
            EditSelected();
        }
Esempio n. 21
0
 private void btnDuplicate_Click(object sender, EventArgs e)
 {
     if (Selected != null)
     {
         HotkeySettings hotkeySetting = new HotkeySettings();
         hotkeySetting.TaskSettings = Selected.Setting.TaskSettings.Copy();
         hotkeySetting.TaskSettings.WatchFolderEnabled = false;
         hotkeySetting.TaskSettings.WatchFolderList    = new List <WatchFolderSettings>();
         manager.Hotkeys.Add(hotkeySetting);
         HotkeySelectionControl control = AddHotkeySelectionControl(hotkeySetting);
         control.Selected = true;
         Selected         = control;
         UpdateCheckStates();
         control.Focus();
     }
 }
Esempio n. 22
0
        public void UnregisterHotkey(HotkeySettings hotkeySetting, bool removeFromList = true)
        {
            if (hotkeySetting.HotkeyInfo.Status == HotkeyStatus.Registered)
            {
                hotkeyForm.UnregisterHotkey(hotkeySetting.HotkeyInfo);

                if (hotkeySetting.HotkeyInfo.Status == HotkeyStatus.NotConfigured)
                {
                    DebugHelper.WriteLine("Hotkey unregistered: " + hotkeySetting);
                }
                else if (hotkeySetting.HotkeyInfo.Status == HotkeyStatus.Failed)
                {
                    DebugHelper.WriteLine("Hotkey unregister failed: " + hotkeySetting);
                }
            }

            if (removeFromList)
            {
                Hotkeys.Remove(hotkeySetting);
            }
        }
Esempio n. 23
0
        public void RegisterHotkey(HotkeySettings hotkeySetting)
        {
            UnregisterHotkey(hotkeySetting, false);

            if (hotkeySetting.HotkeyInfo.Status != HotkeyStatus.Registered && hotkeySetting.HotkeyInfo.IsValidHotkey)
            {
                hotkeyForm.RegisterHotkey(hotkeySetting.HotkeyInfo);

                if (hotkeySetting.HotkeyInfo.Status == HotkeyStatus.Registered)
                {
                    DebugHelper.WriteLine("Hotkey registered: " + hotkeySetting);
                }
                else if (hotkeySetting.HotkeyInfo.Status == HotkeyStatus.Failed)
                {
                    DebugHelper.WriteLine("Hotkey register failed: " + hotkeySetting);
                }
            }

            if (!Hotkeys.Contains(hotkeySetting))
            {
                Hotkeys.Add(hotkeySetting);
            }
        }
Esempio n. 24
0
 private void btnDuplicate_Click(object sender, EventArgs e)
 {
     if (Selected != null)
     {
         HotkeySettings hotkeySetting = new HotkeySettings();
         hotkeySetting.TaskSettings = Selected.Setting.TaskSettings.Copy();
         hotkeySetting.TaskSettings.WatchFolderEnabled = false;
         hotkeySetting.TaskSettings.WatchFolderList = new List<WatchFolderSettings>();
         manager.Hotkeys.Add(hotkeySetting);
         HotkeySelectionControl control = AddHotkeySelectionControl(hotkeySetting);
         control.Selected = true;
         Selected = control;
         UpdateCheckStates();
         control.Focus();
     }
 }
Esempio n. 25
0
        public void UnregisterHotkey(HotkeySettings hotkeySetting, bool removeFromList = true)
        {
            if (hotkeySetting.HotkeyInfo.Status == HotkeyStatus.Registered)
            {
                hotkeyForm.UnregisterHotkey(hotkeySetting.HotkeyInfo);

                if (hotkeySetting.HotkeyInfo.Status == HotkeyStatus.NotConfigured)
                {
                    DebugHelper.WriteLine("Hotkey unregistered: " + hotkeySetting);
                }
                else if (hotkeySetting.HotkeyInfo.Status == HotkeyStatus.Failed)
                {
                    DebugHelper.WriteLine("Hotkey unregister failed: " + hotkeySetting);
                }
            }

            if (removeFromList)
            {
                Hotkeys.Remove(hotkeySetting);
            }
        }
Esempio n. 26
0
        private void HandleHotkeys(HotkeySettings hotkeySetting)
        {
            DebugHelper.WriteLine("Hotkey triggered: " + hotkeySetting);

            if (hotkeySetting.TaskSettings.Job == HotkeyType.None)
            {
                return;
            }

            TaskSettings taskSettings = TaskSettings.GetSafeTaskSettings(hotkeySetting.TaskSettings);

            switch (hotkeySetting.TaskSettings.Job)
            {
            case HotkeyType.StopUploads:
                TaskManager.StopAllTasks();
                break;

            case HotkeyType.ClipboardUpload:
                UploadManager.ClipboardUpload(taskSettings);
                break;

            case HotkeyType.ClipboardUploadWithContentViewer:
                UploadManager.ClipboardUploadWithContentViewer(taskSettings);
                break;

            case HotkeyType.FileUpload:
                UploadManager.UploadFile(taskSettings);
                break;

            case HotkeyType.DragDropUpload:
                OpenDropWindow();
                break;

            case HotkeyType.PrintScreen:
                CaptureScreenshot(CaptureType.Screen, taskSettings, false);
                break;

            case HotkeyType.ActiveWindow:
                CaptureScreenshot(CaptureType.ActiveWindow, taskSettings, false);
                break;

            case HotkeyType.ActiveMonitor:
                CaptureScreenshot(CaptureType.ActiveMonitor, taskSettings, false);
                break;

            case HotkeyType.RectangleRegion:
                CaptureScreenshot(CaptureType.Rectangle, taskSettings, false);
                break;

            case HotkeyType.WindowRectangle:
                CaptureScreenshot(CaptureType.RectangleWindow, taskSettings, false);
                break;

            case HotkeyType.RoundedRectangleRegion:
                CaptureScreenshot(CaptureType.RoundedRectangle, taskSettings, false);
                break;

            case HotkeyType.EllipseRegion:
                CaptureScreenshot(CaptureType.Ellipse, taskSettings, false);
                break;

            case HotkeyType.TriangleRegion:
                CaptureScreenshot(CaptureType.Triangle, taskSettings, false);
                break;

            case HotkeyType.DiamondRegion:
                CaptureScreenshot(CaptureType.Diamond, taskSettings, false);
                break;

            case HotkeyType.PolygonRegion:
                CaptureScreenshot(CaptureType.Polygon, taskSettings, false);
                break;

            case HotkeyType.FreeHandRegion:
                CaptureScreenshot(CaptureType.Freehand, taskSettings, false);
                break;

            case HotkeyType.LastRegion:
                CaptureScreenshot(CaptureType.LastRegion, taskSettings, false);
                break;

            case HotkeyType.ScreenRecorder:
                DoScreenRecorder(taskSettings);
                break;

            case HotkeyType.AutoCapture:
                OpenAutoCapture();
                break;

            case HotkeyType.ScreenColorPicker:
                OpenScreenColorPicker(taskSettings);
                break;

            case HotkeyType.HashCheck:
                OpenHashCheck();
                break;

            case HotkeyType.IndexFolder:
                OpenIndexFolder();
                break;

            case HotkeyType.ImageEffects:
                OpenImageEffects();
                break;

            case HotkeyType.Ruler:
                OpenRuler();
                break;
            }
        }
Esempio n. 27
0
 private HotkeySelectionControl FindSelectionControl(HotkeySettings hotkeySetting)
 {
     return(flpHotkeys.Controls.Cast <HotkeySelectionControl>().FirstOrDefault(hsc => hsc.Setting == hotkeySetting));
 }
Esempio n. 28
0
        public void UnregisterHotkey(HotkeySettings hotkeySetting)
        {
            hotkeyForm.UnregisterHotkey(hotkeySetting.HotkeyInfo);

            Hotkeys.Remove(hotkeySetting);
        }
Esempio n. 29
0
        public void UpdateHotkey(HotkeySettings hotkeySetting)
        {
            hotkeyForm.UnregisterHotkey(hotkeySetting.HotkeyInfo);

            RegisterHotkey(hotkeySetting);
        }
Esempio n. 30
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     HotkeySettings hotkeySetting = new HotkeySettings();
     hotkeySetting.TaskSettings = TaskSettings.GetDefaultTaskSettings();
     manager.Hotkeys.Add(hotkeySetting);
     HotkeySelectionControl control = AddHotkeySelectionControl(hotkeySetting);
     control.Selected = true;
     Selected = control;
     UpdateButtons();
     UpdateCheckStates();
     control.Focus();
     Update();
     EditSelected();
 }
        private void HandleHotkeys(HotkeySettings hotkeySetting)
        {
            DebugHelper.WriteLine("Hotkey triggered: " + hotkeySetting);

            if (hotkeySetting.TaskSettings.Job == HotkeyType.None) return;

            TaskSettings taskSettings = TaskSettings.GetSafeTaskSettings(hotkeySetting.TaskSettings);

            switch (hotkeySetting.TaskSettings.Job)
            {
                case HotkeyType.StopUploads:
                    TaskManager.StopAllTasks();
                    break;
                case HotkeyType.ClipboardUpload:
                    UploadManager.ClipboardUpload(taskSettings);
                    break;
                case HotkeyType.ClipboardUploadWithContentViewer:
                    UploadManager.ClipboardUploadWithContentViewer(taskSettings);
                    break;
                case HotkeyType.FileUpload:
                    UploadManager.UploadFile(taskSettings);
                    break;
                case HotkeyType.PrintScreen:
                    CaptureScreenshot(CaptureType.Screen, taskSettings, false);
                    break;
                case HotkeyType.ActiveWindow:
                    CaptureScreenshot(CaptureType.ActiveWindow, taskSettings, false);
                    break;
                case HotkeyType.ActiveMonitor:
                    CaptureScreenshot(CaptureType.ActiveMonitor, taskSettings, false);
                    break;
                case HotkeyType.RectangleRegion:
                    CaptureScreenshot(CaptureType.Rectangle, taskSettings, false);
                    break;
                case HotkeyType.WindowRectangle:
                    CaptureScreenshot(CaptureType.RectangleWindow, taskSettings, false);
                    break;
                case HotkeyType.RoundedRectangleRegion:
                    CaptureScreenshot(CaptureType.RoundedRectangle, taskSettings, false);
                    break;
                case HotkeyType.EllipseRegion:
                    CaptureScreenshot(CaptureType.Ellipse, taskSettings, false);
                    break;
                case HotkeyType.TriangleRegion:
                    CaptureScreenshot(CaptureType.Triangle, taskSettings, false);
                    break;
                case HotkeyType.DiamondRegion:
                    CaptureScreenshot(CaptureType.Diamond, taskSettings, false);
                    break;
                case HotkeyType.PolygonRegion:
                    CaptureScreenshot(CaptureType.Polygon, taskSettings, false);
                    break;
                case HotkeyType.FreeHandRegion:
                    CaptureScreenshot(CaptureType.Freehand, taskSettings, false);
                    break;
                case HotkeyType.LastRegion:
                    CaptureScreenshot(CaptureType.LastRegion, taskSettings, false);
                    break;
                case HotkeyType.ScreenRecorder:
                    DoScreenRecorder(taskSettings);
                    break;
                case HotkeyType.AutoCapture:
                    OpenAutoCapture();
                    break;
                case HotkeyType.ScreenColorPicker:
                    OpenScreenColorPicker(taskSettings);
                    break;
                case HotkeyType.HashCheck:
                    OpenHashCheck();
                    break;
                case HotkeyType.IndexFolder:
                    OpenIndexFolder();
                    break;
            }
        }
Esempio n. 32
0
 private HotkeySelectionControl FindSelectionControl(HotkeySettings hotkeySetting)
 {
     return flpHotkeys.Controls.Cast<HotkeySelectionControl>().FirstOrDefault(hsc => hsc.Setting == hotkeySetting);
 }
Esempio n. 33
0
 protected void OnHotkeyTrigger(HotkeySettings hotkeySetting)
 {
     HotkeyTrigger?.Invoke(hotkeySetting);
 }