public MainForm(CopyDataTransport dataTransport) { instance = this; // Make sure we never capture the mainform WindowDetails.RegisterIgnoreHandle(this.Handle); // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon(); IniConfig.IniChanged += new FileSystemEventHandler(ReloadConfiguration); tooltip = new ToolTip(); UpdateUI(); // Do loading on a different Thread to shorten the startup Thread pluginInitThread = new Thread(delegate() { // Load all the plugins PluginHelper.instance.LoadPlugins(this); // Check destinations, remove all that don't exist foreach (string destination in conf.OutputDestinations.ToArray()) { if (DestinationHelper.GetDestination(destination) == null) { conf.OutputDestinations.Remove(destination); } } // we should have at least one! if (conf.OutputDestinations.Count == 0) { conf.OutputDestinations.Add(Destinations.EditorDestination.DESIGNATION); } BeginInvoke((MethodInvoker)delegate { // Do after all plugins & finding the destination, otherwise they are missing! InitializeQuickSettingsMenu(); }); }); pluginInitThread.Name = "Initialize plug-ins"; pluginInitThread.IsBackground = true; pluginInitThread.Start(); SoundHelper.Initialize(); // Create a new instance of the class: copyData = new CopyData(); copyData = new CopyData(); // Assign the handle: copyData.AssignHandle(this.Handle); // Create the channel to send on: copyData.Channels.Add("Greenshot"); // Hook up received event: copyData.CopyDataReceived += new CopyDataReceivedEventHandler(CopyDataDataReceived); if (dataTransport != null) { HandleDataTransport(dataTransport); } }
public MainForm(CopyDataTransport dataTransport) { _instance = this; // // The InitializeComponent() call is required for Windows Forms designer support. // try { InitializeComponent(); } catch (ArgumentException ex) { // Added for Bug #1420, this doesn't solve the issue but maybe the user can do something with it. ex.Data.Add("more information here", "http://support.microsoft.com/kb/943140"); throw; } notifyIcon.Icon = GreenshotResources.getGreenshotIcon(); Icon = GreenshotResources.getGreenshotIcon(); // Disable access to the settings, for feature #3521446 contextmenu_settings.Visible = !_conf.DisableSettings; // Make sure all hotkeys pass this window! HotkeyControl.RegisterHotkeyHWND(Handle); RegisterHotkeys(); new ToolTip(); UpdateUI(); // This forces the registration of all destinations inside Greenshot itself. DestinationHelper.GetAllDestinations(); // This forces the registration of all processors inside Greenshot itself. ProcessorHelper.GetAllProcessors(); // Load all the plugins PluginHelper.Instance.LoadPlugins(); // Check destinations, remove all that don't exist foreach(string destination in _conf.OutputDestinations.ToArray()) { if (DestinationHelper.GetDestination(destination) == null) { _conf.OutputDestinations.Remove(destination); } } // we should have at least one! if (_conf.OutputDestinations.Count == 0) { _conf.OutputDestinations.Add(EditorDestination.DESIGNATION); } if (_conf.DisableQuickSettings) { contextmenu_quicksettings.Visible = false; } else { // Do after all plugins & finding the destination, otherwise they are missing! InitializeQuickSettingsMenu(); } SoundHelper.Initialize(); coreConfiguration.PropertyChanged += OnIconSizeChanged; OnIconSizeChanged(this, new PropertyChangedEventArgs("IconSize")); // Set the Greenshot icon visibility depending on the configuration. (Added for feature #3521446) // Setting it to true this late prevents Problems with the context menu notifyIcon.Visible = !_conf.HideTrayicon; // Make sure we never capture the mainform WindowDetails.RegisterIgnoreHandle(Handle); // Create a new instance of the class: copyData = new CopyData(); _copyData = new CopyData(); // Assign the handle: _copyData.AssignHandle(Handle); // Create the channel to send on: _copyData.Channels.Add("Greenshot"); // Hook up received event: _copyData.CopyDataReceived += CopyDataDataReceived; if (dataTransport != null) { HandleDataTransport(dataTransport); } // Make Greenshot use less memory after startup if (_conf.MinimizeWorkingSetSize) { PsAPI.EmptyWorkingSet(); } }
/// <summary> /// Send DataTransport Object via Window-messages /// </summary> /// <param name="dataTransport">DataTransport with data for a running instance</param> private static void SendData(CopyDataTransport dataTransport) { string appName = Application.ProductName; CopyData copyData = new CopyData(); copyData.Channels.Add(appName); copyData.Channels[appName].Send(dataTransport); }
public MainForm(CopyDataTransport dataTransport) { instance = this; // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); lang = Language.GetInstance(); IniConfig.IniChanged += new FileSystemEventHandler(ReloadConfiguration); // Make sure all hotkeys pass this window! HotkeyControl.RegisterHotkeyHWND(this.Handle); RegisterHotkeys(); tooltip = new ToolTip(); UpdateUI(); InitializeQuickSettingsMenu(); captureForm = new CaptureForm(); // Load all the plugins PluginHelper.instance.LoadPlugins(this, captureForm); SoundHelper.Initialize(); // Enable the Greenshot icon to be visible, this prevents Problems with the context menu notifyIcon.Visible = true; // Create a new instance of the class: copyData = new CopyData(); copyData = new CopyData(); // Assign the handle: copyData.AssignHandle(this.Handle); // Create the channel to send on: copyData.Channels.Add("Greenshot"); // Hook up received event: copyData.CopyDataReceived += new CopyDataReceivedEventHandler(CopyDataDataReceived); if (dataTransport != null) { HandleDataTransport(dataTransport); } ClipboardHelper.RegisterClipboardViewer(this.Handle); }