DesktopHelper.UI.Adapter.PhysicalMemoryTimer_Tick C# (CSharp) Метод

PhysicalMemoryTimer_Tick() приватный Метод

private PhysicalMemoryTimer_Tick ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void
        private void PhysicalMemoryTimer_Tick(object sender, EventArgs e)
        {
            try
            {
                decimal memory = (PhysicalMemory - FreePhysicalMemory) / PhysicalMemory;
                textBlock.Text = memory.ToString("p0");
                if (memory < lv
                    && File.Exists(System.Windows.Forms.Application.StartupPath + @"\Image\green.png"))
                {
                    var uriSource = new Uri(System.Windows.Forms.Application.StartupPath + @"\Image\green.png", UriKind.Absolute);
                    imgBackground.Source = new BitmapImage(uriSource);
                }
                else if (memory >= lv
                    && memory < huang
                    && File.Exists(System.Windows.Forms.Application.StartupPath + @"\Image\yellow.png"))
                {
                    var uriSource = new Uri(System.Windows.Forms.Application.StartupPath + @"\Image\yellow.png", UriKind.Absolute);
                    imgBackground.Source = new BitmapImage(uriSource);
                }
                else if (File.Exists(System.Windows.Forms.Application.StartupPath + @"\Image\red.png"))
                {
                    var uriSource = new Uri(System.Windows.Forms.Application.StartupPath + @"\Image\red.png", UriKind.Absolute);
                    imgBackground.Source = new BitmapImage(uriSource);
                }
            }
            catch
            {
            }
        }