Beispiel #1
0
        private void HandleOkClick(object sender, EventArgs e)
        {
            if (addingSize)
            {
                addingSize = false;
                return;
            }

            Configuration.Current.OutputPath = Environment.ExpandEnvironmentVariables(folderChooser.Text);
            if (ValidateFileName(fullImageTemplate.Text))
            {
                Configuration.Current.FullImageTemplate = fullImageTemplate.Text;
            }
            if (ValidateFileName(thumbImageTemplate.Text))
            {
                Configuration.Current.ThumbImageTemplate = thumbImageTemplate.Text;
            }

            Configuration.Current.ColorNonFormArea            = colorNonFormAreaCheck.Checked;
            Configuration.Current.NonFormAreaColorArgb        = backgroundColor.BackColor.ToArgb();
            Configuration.Current.UserOpacity                 = (double)(opacitySlider.Value * 10) / 100;
            Configuration.Current.ShowOpacityMenu             = showOpacityMenu.Checked;
            Configuration.Current.TrapPrintScreen             = trapPrintScreen.Checked;
            Configuration.Current.HideFormAfterCapture        = hideAfterCapture.Checked;
            Configuration.Current.LeavePrintScreenOnClipboard = keepPrntScrnOnClipboard.Checked;
            Configuration.Current.AllowMultipleInstances      = allowMultipleCropperInstances.Checked;
            Configuration.Current.IncludeMouseCursorInCapture = includeMouseCursorInCapture.Checked;
            Configuration.Current.PredefinedSizes             = predefinedSizeList.Items.Cast <CropSize>().ToArray();
            Configuration.Current.PredefinedThumbSizes        = predefinedThumbSizeList.Items.Cast <double>().ToArray();
            Configuration.Current.HotKeySettings              = HotKeys.GetRegisteredHotKeys(true).Select(hk => new HotKeySetting {
                Id = hk.Id, KeyCode = (int)hk.KeyData
            }).ToArray();

            List <object> pluginSettings = new List <object>();

            foreach (IPersistableImageFormat output in ImageCapture.ImageOutputs)
            {
                IConfigurablePlugin plugin = output as IConfigurablePlugin;
                plugin?.ConfigurationForm?.Save();
                if (plugin?.Settings != null)
                {
                    pluginSettings.Add(plugin.Settings);
                }
            }
            Configuration.Current.PluginSettings = pluginSettings.ToArray();

            DialogResult = DialogResult.OK;
            Close();
        }
Beispiel #2
0
 private void LoadHotKeys()
 {
     hotKeySelection.HotKeyRegister += HotKeySelectionOnHotKeyRegister;
     hotKeySelection.ShowGroups      = true;
     hotKeySelection.AddRange(HotKeys.GetRegisteredHotKeys());
 }