Esempio n. 1
0
 private void CheckMemoryWhileWaitingForUser(object sender, EventArgs e)
 {
     //Called by timer to update currentMemoryUsageBar
     memoryUsageForGUI = SystemMemory.GetMemoryPercentUsed();
     currentMemoryUsageBar.Foreground = SharedStatics.CalculateMemoryBrush(memoryUsageForGUI);
     currentMemoryUsageBar.ToolTip    = String.Format("System memory at {0:F2}%", memoryUsageForGUI);
 }
        private void SetSystemMemoryPercentAndLabel()
        {
            //Gets the system memory percent and performs GUI tasks.

            systemMemoryPercent       = SystemMemory.GetMemoryPercentUsed();
            systemMemoryLabel.Content = string.Format("{0:F2}", systemMemoryPercent);

            //Calcualte colors
            Brush systemBasedBrush = SharedStatics.CalculateMemoryBrush(systemMemoryPercent);

            //Apply brush wherever
            systemMemoryLabel.Background = systemBasedBrush;
            warningLabel.Background      = systemBasedBrush;
        }