AddonHelper.Addon.SetShortcuts C# (CSharp) Метод

SetShortcuts() публичный статический Метод

Enables or disables shortcuts in ClipUpload.
public static SetShortcuts ( bool enabled ) : void
enabled bool Bool to enable or disable
Результат void
        public static void SetShortcuts(bool enabled)
        {
            Form form = null;
            foreach(Form f in Application.OpenForms) {
                if(f.GetType().Name == "FormMain") {
                    form = f;
                    break;
                }
            }

            FieldInfo fiListener = form.GetType().GetField("keyboardListener");
            PropertyInfo piEnabled = fiListener.FieldType.GetProperty("Enabled");
            piEnabled.SetValue(fiListener.GetValue(form), enabled, null);
        }

Usage Example

Пример #1
0
        private void FormDrag_MouseUp(object sender, MouseEventArgs e)
        {
            this.timerSet.Enabled = false;

            if (e.Button == MouseButtons.Left && this.ScreenBox.Visible)
            {
                if (this.Selection.Width > 0 && this.Selection.Height > 0)
                {
                    this.Hide();
                    Application.DoEvents();

                    if (DoneDragging != null)
                    {
                        Addon.SetShortcuts(true);
                        DoneDragging(new DragCallback()
                        {
                            Type  = DragCallbackType.Image,
                            Image = this.SelectionImage
                        });
                    }

                    this.Close();
                }
            }
        }
All Usage Examples Of AddonHelper.Addon::SetShortcuts