Example #1
0
        /// <summary>
        /// Load the properties into the GUI
        /// </summary>
        internal void LoadProperties()
        {
            _logController.AddLog(new ApplicationLog("Loading MainWindow properties"));

            try
            {
                MniWindowDraggable.IsChecked = Properties.Settings.Default.WindowDragging;
                MniRamStatistics.IsChecked   = Properties.Settings.Default.WindowRamStatistics;
                MniRamGauge.IsChecked        = Properties.Settings.Default.DisplayGauge;
                MniRamMonitor.IsChecked      = Properties.Settings.Default.RamMonitor;

                _ramController.EnableRamStatistics  = Properties.Settings.Default.EnableRamStatistics;
                _ramController.MaxUsageHistoryCount = Properties.Settings.Default.RamMaxUsageHistoryCount;
                _ramController.SetProcessExceptionList(Properties.Settings.Default.ProcessExceptions);
                _ramController.EmptyWorkingSets     = Properties.Settings.Default.EmptyWorkingSet;
                _ramController.ClearFileSystemCache = Properties.Settings.Default.FileSystemCache;
                _ramController.ClearStandbyCache    = Properties.Settings.Default.StandByCache;
                _ramController.FillRam                = Properties.Settings.Default.FillRam;
                _ramController.FillRamMaxRuns         = Properties.Settings.Default.FillRamMaxRuns;
                _ramController.InvokeGarbageCollector = Properties.Settings.Default.InvokeGarbageCollector;
                _ramController.SetRamUpdateTimerInterval(Properties.Settings.Default.RamMonitorInterval);
                _ramController.AutoOptimizeTimed(Properties.Settings.Default.AutoOptimizeTimed, Properties.Settings.Default.AutoOptimizeTimedInterval);

                if (!Properties.Settings.Default.EnableRamStatistics)
                {
                    _ramController.ClearRamUsageHistory();
                }

                if (!Properties.Settings.Default.NotifyIconStatistics)
                {
                    TbiIcon.ToolTipText = "MemPlus";
                }

                _ramController.AutoOptimizePercentage = Properties.Settings.Default.AutoOptimizePercentage;
                _ramController.SetAutoOptimizeThreshold(Properties.Settings.Default.AutoOptimizePercentageThreshold);
                _ramController.ClearClipboard = Properties.Settings.Default.ClearClipboard;

                if (Properties.Settings.Default.RamMonitor)
                {
                    _ramController.EnableMonitor();
                }

                if (Properties.Settings.Default.DragDropClear)
                {
                    AllowDrop = true;
                    Drop     += MainWindow_Drop;
                }
                else
                {
                    AllowDrop = false;
                    Drop     -= MainWindow_Drop;
                }

                TbiIcon.Visibility = !Properties.Settings.Default.NotifyIcon ? Visibility.Hidden : Visibility.Visible;
            }
            catch (Exception ex)
            {
                _logController.AddLog(new ErrorLog(ex.Message));
                MessageBox.Show(ex.Message, "MemPlus", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            RamGaugeVisibility();
            RamStatisticsVisibility();
            WindowDraggable();

            _logController.AddLog(new ApplicationLog("Done loading MainWindow properties"));
        }
 /// <summary>
 /// Method that is called when all RamUsage objects should be cleared
 /// </summary>
 /// <param name="sender">The object that called this method</param>
 /// <param name="e">The RoutedEventArgs</param>
 private void BtnClear_OnClick(object sender, RoutedEventArgs e)
 {
     _ramController.ClearRamUsageHistory();
 }