예제 #1
0
        public void UpdateUI()
        {
            this.Text = lang.GetString(LangKey.application_title);
            this.contextmenu_settings.Text          = lang.GetString(LangKey.contextmenu_settings);
            this.contextmenu_capturearea.Text       = lang.GetString(LangKey.contextmenu_capturearea);
            this.contextmenu_capturelastregion.Text = lang.GetString(LangKey.contextmenu_capturelastregion);
            this.contextmenu_capturewindow.Text     = lang.GetString(LangKey.contextmenu_capturewindow);
            this.contextmenu_capturefullscreen.Text = lang.GetString(LangKey.contextmenu_capturefullscreen);
            this.contextmenu_captureclipboard.Text  = lang.GetString(LangKey.contextmenu_captureclipboard);
            this.contextmenu_openfile.Text          = lang.GetString(LangKey.contextmenu_openfile);
            this.contextmenu_quicksettings.Text     = lang.GetString(LangKey.contextmenu_quicksettings);
            this.contextmenu_help.Text              = lang.GetString(LangKey.contextmenu_help);
            this.contextmenu_about.Text             = lang.GetString(LangKey.contextmenu_about);
            this.contextmenu_donate.Text            = lang.GetString(LangKey.contextmenu_donate);
            this.contextmenu_exit.Text              = lang.GetString(LangKey.contextmenu_exit);
            this.contextmenu_captureie.Text         = lang.GetString(LangKey.contextmenu_captureie);
            this.contextmenu_openrecentcapture.Text = lang.GetString(LangKey.contextmenu_openrecentcapture);

            // Show hotkeys in Contextmenu
            this.contextmenu_capturearea.ShortcutKeyDisplayString       = HotkeyControl.GetLocalizedHotkeyStringFromString(conf.RegionHotkey);
            this.contextmenu_capturelastregion.ShortcutKeyDisplayString = HotkeyControl.GetLocalizedHotkeyStringFromString(conf.LastregionHotkey);
            this.contextmenu_capturewindow.ShortcutKeyDisplayString     = HotkeyControl.GetLocalizedHotkeyStringFromString(conf.WindowHotkey);
            this.contextmenu_capturefullscreen.ShortcutKeyDisplayString = HotkeyControl.GetLocalizedHotkeyStringFromString(conf.FullscreenHotkey);
            this.contextmenu_captureie.ShortcutKeyDisplayString         = HotkeyControl.GetLocalizedHotkeyStringFromString(conf.IEHotkey);
        }
예제 #2
0
        public void UpdateUi()
        {
            // As the form is never loaded, call ApplyLanguage ourselves
            ApplyLanguage();

            // Show hotkeys in Contextmenu
            contextmenu_capturearea.ShortcutKeyDisplayString       = HotkeyControl.GetLocalizedHotkeyStringFromString(_coreConfiguration.RegionHotkey);
            contextmenu_capturelastregion.ShortcutKeyDisplayString = HotkeyControl.GetLocalizedHotkeyStringFromString(_coreConfiguration.LastregionHotkey);
            contextmenu_capturewindow.ShortcutKeyDisplayString     = HotkeyControl.GetLocalizedHotkeyStringFromString(_coreConfiguration.WindowHotkey);
            contextmenu_capturefullscreen.ShortcutKeyDisplayString = HotkeyControl.GetLocalizedHotkeyStringFromString(_coreConfiguration.FullscreenHotkey);
            contextmenu_captureie.ShortcutKeyDisplayString         = HotkeyControl.GetLocalizedHotkeyStringFromString(_coreConfiguration.IEHotkey);
        }
예제 #3
0
        public void Initialize()
        {
            Log.Debug().WriteLine("Initializing MainForm.");
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            try
            {
                InitializeComponent();
                SetupBitmapScaleHandler();
            }
            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();

            // Disable access to the settings, for feature #3521446
            contextmenu_settings.Visible = !_coreConfiguration.DisableSettings;

            UpdateUi();

            if (_coreConfiguration.DisableQuickSettings)
            {
                contextmenu_quicksettings.Visible = false;
            }
            else
            {
                // Do after all plugins & finding the destination, otherwise they are missing!
                InitializeQuickSettingsMenu();
            }

            // 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 = !_coreConfiguration.HideTrayicon;

            // Check if it's the first time launch?
            if (_coreConfiguration.IsFirstLaunch)
            {
                _coreConfiguration.IsFirstLaunch = false;
                Log.Info().WriteLine("FirstLaunch: Created new configuration, showing balloon.");
                try
                {
                    notifyIcon.BalloonTipClicked += BalloonTipClicked;
                    notifyIcon.BalloonTipClosed  += BalloonTipClosed;
                    notifyIcon.ShowBalloonTip(2000, "Greenshot", string.Format(_greenshotLanguage.TooltipFirststart, HotkeyControl.GetLocalizedHotkeyStringFromString(_coreConfiguration.RegionHotkey)), ToolTipIcon.Info);
                }
                catch (Exception ex)
                {
                    Log.Warn().WriteLine(ex, "Exception while showing first launch: ");
                }
            }

            // Make Greenshot use less memory after startup
            if (_coreConfiguration.MinimizeWorkingSetSize)
            {
                PsApi.EmptyWorkingSet();
            }
        }
예제 #4
0
        private void HandleDataTransport(CopyDataTransport dataTransport)
        {
            foreach (KeyValuePair <CommandEnum, string> command in dataTransport.Commands)
            {
                LOG.Debug("Data received, Command = " + command.Key + ", Data: " + command.Value);
                switch (command.Key)
                {
                case CommandEnum.Exit:
                    exit();
                    break;

                case CommandEnum.FirstLaunch:
                    LOG.Info("FirstLaunch: Created new configuration, showing balloon.");
                    try
                    {
                        MainForm.instance.notifyIcon.BalloonTipClicked += HandleBalloonTipClick;
                        MainForm.instance.notifyIcon.BalloonTipClosed  += CleanupBalloonTipClick;
                        MainForm.instance.notifyIcon.ShowBalloonTip(2000, "espUrl", lang.GetFormattedString(LangKey.tooltip_firststart, HotkeyControl.GetLocalizedHotkeyStringFromString(conf.RegionHotkey)), ToolTipIcon.Info);
                    }
                    catch { }
                    break;

                case CommandEnum.ReloadConfig:
                    try
                    {
                        IniConfig.Reload();
                        ReloadConfiguration(null, null);
                    }
                    catch { }
                    break;

                case CommandEnum.OpenFile:
                    string filename = command.Value;
                    if (File.Exists(filename))
                    {
                        captureForm.MakeCapture(filename);
                    }
                    else
                    {
                        LOG.Warn("No such file: " + filename);
                    }
                    break;

                default:
                    LOG.Error("Unknown command!");
                    break;
                }
            }
        }