예제 #1
0
 static HardwareMonitor()
 {
     _computer = new Computer()
     {
         IsCpuEnabled    = true,
         IsGpuEnabled    = true,
         IsMemoryEnabled = true
     };
     try
     {
         _computer.Open();
         _hardware = _computer.Hardware;
     }
     catch (Exception e)
     {
         Global.logger.Error(e);
     }
 }
예제 #2
0
#pragma warning disable CA1810 // Initialize reference type static fields inline
        static HardwareMonitor()
#pragma warning restore CA1810 // Initialize reference type static fields inline
        {
            _computer = new Computer()
            {
                IsCpuEnabled     = true,
                IsGpuEnabled     = true,
                IsMemoryEnabled  = true,
                IsNetworkEnabled = true
            };
            try
            {
                _computer.Open();
                _hardware = _computer.Hardware;
            }
            catch (Exception e)
            {
                Global.logger.Error(e);
            }
        }