示例#1
0
 /// <summary>
 ///     Do work in the background
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BackgroundWorkerTimerTick(object sender, EventArgs e)
 {
     if (_coreConfiguration.MinimizeWorkingSetSize)
     {
         PsApi.EmptyWorkingSet();
     }
 }
示例#2
0
 /// <summary>
 ///     Do work in the background
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BackgroundWorkerTimerTick(object sender, EventArgs e)
 {
     if (_coreConfiguration.MinimizeWorkingSetSize)
     {
         PsApi.EmptyWorkingSet();
     }
     if (UpdateHelper.IsUpdateCheckNeeded())
     {
         Log.Debug().WriteLine("BackgroundWorkerTimerTick checking for update");
         // Start update check in the background
         var backgroundTask = new Thread(UpdateHelper.CheckAndAskForUpdate)
         {
             Name         = "Update check",
             IsBackground = true
         };
         backgroundTask.Start();
     }
 }
示例#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();
            }
        }