Exemple #1
0
 protected void OnHotkeyTrigger(HotkeySettings hotkeySetting)
 {
     if (HotkeyTrigger != null)
     {
         HotkeyTrigger(hotkeySetting);
     }
 }
Exemple #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);
            }
        }
        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;
            }
        }
Exemple #4
0
 protected void OnHotkeyTrigger(HotkeySettings hotkeySetting)
 {
     if (HotkeyTrigger != null)
     {
         HotkeyTrigger(hotkeySetting);
     }
 }
 public HotkeySelectionControl(HotkeySettings setting)
 {
     InitializeComponent();
     Setting = setting;
     UpdateDescription();
     UpdateHotkeyText();
     UpdateHotkeyStatus();
 }
Exemple #6
0
        private void HandleHotkeys(HotkeySettings hotkeySetting)
        {
            DebugHelper.WriteLine("Hotkey triggered: " + hotkeySetting);

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

            HandleTask(hotkeySetting.TaskSettings);
        }
Exemple #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;
 }
 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;
 }
        private HotkeySelectionControl FindSelectionControl(HotkeySettings hotkeySetting)
        {
            foreach (Control control in flpHotkeys.Controls)
            {
                HotkeySelectionControl hsc = (HotkeySelectionControl)control;
                if (hsc.Setting == hotkeySetting) return hsc;
            }

            return null;
        }
Exemple #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();
        }
Exemple #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);
        }
        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);
        }
Exemple #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);
        }
Exemple #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);
                }
            }
        }
Exemple #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();
        }
Exemple #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);
            }
        }
        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 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();
     }
 }
Exemple #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);
            }
        }
Exemple #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);
            }
        }
 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();
     }
 }
Exemple #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);
            }
        }
Exemple #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;
            }
        }
 private HotkeySelectionControl FindSelectionControl(HotkeySettings hotkeySetting)
 {
     return(flpHotkeys.Controls.Cast <HotkeySelectionControl>().FirstOrDefault(hsc => hsc.Setting == hotkeySetting));
 }
Exemple #28
0
        public void UnregisterHotkey(HotkeySettings hotkeySetting)
        {
            hotkeyForm.UnregisterHotkey(hotkeySetting.HotkeyInfo);

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

            RegisterHotkey(hotkeySetting);
        }
 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;
            }
        }
 private HotkeySelectionControl FindSelectionControl(HotkeySettings hotkeySetting)
 {
     return flpHotkeys.Controls.Cast<HotkeySelectionControl>().FirstOrDefault(hsc => hsc.Setting == hotkeySetting);
 }
Exemple #33
0
 protected void OnHotkeyTrigger(HotkeySettings hotkeySetting)
 {
     HotkeyTrigger?.Invoke(hotkeySetting);
 }