Exemple #1
0
        public static void Init()
        {
            // create timer which is used to update the values every second
            Timer timer = new Timer();

            timer.Interval = 1000;
            timer.Enabled  = true;
            timer.Elapsed += timerevent;

            LabelUpdate();
            MemInfoGetter.GetMemInfo();
            CPUInfoGetter.GetCPUInfo();

            if (CPUInfoGetter.CPU.speed != null)
            {
                cpuLabel.contentLabel.Text = $"{CPUInfoGetter.CPU.count}{CPUInfoGetter.CPU.model} ({CPUInfoGetter.CPU.threadCount}) @ {CPUInfoGetter.CPU.speed}";
            }
            else
            {
                cpuLabel.contentLabel.Text = $"{CPUInfoGetter.CPU.count}{CPUInfoGetter.CPU.model} ({CPUInfoGetter.CPU.threadCount})";
            }

            GPUInfoGetter.GetGPUInstances();

            int iter2 = 0;

            switch (GPUInfoGetter.GPUs.Count)
            {
            case 0:
                break;

            case 1:
                // if theres only one gpu only get one element because there isn't gonna be more and dont add any numbers
                InfoLabel gpuLabel = new InfoLabel("gpu", "device_pci", GPUInfoGetter.GetGPUInfo()[0]);
                Labels.labels.Add(gpuLabel);
                break;

            default:
                foreach (string gpuname in GPUInfoGetter.GetGPUInfo())
                {
                    InfoLabel gpuLabels = new InfoLabel($"gpu{iter2}", "device_pci", gpuname);
                    Labels.labels.Add(gpuLabels);
                    iter2++;
                }
                break;
            }

            FSInfoGetter.GetDrives();

            PopulateWindow();
        }
Exemple #2
0
 /// <summary> Function called when the timer elapses that updates contencts for dynamic labels </summary>
 public static void LabelUpdate()
 {
     MemInfoGetter.RefreshMemInfo();
     uptimeLabel.contentLabel.Text = $"{UptimeCalculator.GetUptimeStr()}";
     memoryLabel.contentLabel.Text = $"{Math.Round(MemInfoGetter.Mem.used/1048576, 2)} GiB/{Math.Round(MemInfoGetter.Mem.total/1048576, 2)} GiB";
 }