예제 #1
0
        private void Initialize()
        {
            Gpus = new MtObservableCollection <Gpu>();
            for (var i = 0; i < GetTotalNumberOfGpus(); i++)
            {
                var id = i;
                id++;
                Gpus.Add(new Gpu
                {
                    Identifier = id
                });
            }

            var gpuVisibility = new[] { UserSettings.GlobalSettings.VisibilitySystemGpuTemp, UserSettings.GlobalSettings.VisibilitySystemGpuLoad };

            _computer = new Computer
            {
                CPUEnabled = UserSettings.GlobalSettings.VisibilitySystemCpuTemp,
                GPUEnabled = BooleanExtensions.ExceedsThreshold(0, gpuVisibility)
            };

            _computer.Open();

            // Cpu timer
            var timerCpu = new Timer {
                Interval = UserSettings.GlobalSettings.PollingRateCpu
            };

            timerCpu.Elapsed += timerCpu_Elapsed;
            timerCpu.Start();

            // Ram timer
            var timerRam = new Timer {
                Interval = UserSettings.GlobalSettings.PollingRateRam
            };

            timerRam.Elapsed += timerRam_Elapsed;
            timerRam.Start();

            // Temp timer
            var timerTemp = new Timer {
                Interval = UserSettings.GlobalSettings.PollingRateTemps
            };

            timerTemp.Elapsed += timerTemp_Elapsed;
            timerTemp.Start();

            // Get the value at init
            EventExtensions.FireEvent(timerCpu, "onIntervalElapsed", this, null);
            EventExtensions.FireEvent(timerRam, "onIntervalElapsed", this, null);
            EventExtensions.FireEvent(timerTemp, "onIntervalElapsed", this, null);
        }
예제 #2
0
        private void Initialize()
        {
            Drives = new MtObservableCollection <Drive>();

            var timerDriveInfo = new Timer {
                Interval = UserSettings.GlobalSettings.PollingRateDrives
            };

            timerDriveInfo.Elapsed += timerDriveInfo_Elapsed;
            timerDriveInfo.Start();

            // Get the value at init
            EventExtensions.FireEvent(timerDriveInfo, "onIntervalElapsed", this, null);
        }
예제 #3
0
        private void Initialize()
        {
            try
            {
                foreach (var ni in NetworkInterface.GetAllNetworkInterfaces().Where(x => x.OperationalStatus.Equals(OperationalStatus.Up)).Where(x => x.NetworkInterfaceType.Equals(NetworkInterfaceType.Wireless80211) || x.NetworkInterfaceType.Equals(NetworkInterfaceType.Ethernet)))
                {
                    _networkInterfaceName = ni.Description.Replace('(', '[').Replace(')', ']');
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            if (string.IsNullOrEmpty(_networkInterfaceName))
            {
                Logger.Write("NetworkTicker() - NetworkInterface.GetAllNetworkInterfaces() - string.IsNullOrEmpty(_networkInterfaceName)", true);
            }

            // Traffic timer
            var timerTraffic = new Timer {
                Interval = UserSettings.GlobalSettings.PollingRateNetwork
            };

            timerTraffic.Elapsed += timerTraffic_Elapsed;
            timerTraffic.Start();

            // External IP timer
            var timerExternalIp = new Timer {
                Interval = UserSettings.GlobalSettings.PollingRateIpExternal
            };

            timerExternalIp.Elapsed += timerExternalIp_Elapsed;
            timerExternalIp.Start();

            // Internal IP timer
            var timerInternalIp = new Timer {
                Interval = UserSettings.GlobalSettings.PollingRateIpInternal
            };

            timerInternalIp.Elapsed += timerInternalIp_Elapsed;
            timerInternalIp.Start();

            // Get the values at init
            EventExtensions.FireEvent(timerTraffic, "onIntervalElapsed", this, null);
            EventExtensions.FireEvent(timerExternalIp, "onIntervalElapsed", this, null);
            EventExtensions.FireEvent(timerInternalIp, "onIntervalElapsed", this, null);
        }
예제 #4
0
        private void Initialize()
        {
            var timerNow = new Timer {
                Interval = UserSettings.GlobalSettings.PollingRateDateTime
            };

            timerNow.Elapsed += timerNow_Elapsed;
            timerNow.Start();

            var timerWeek = new Timer {
                Interval = UserSettings.GlobalSettings.PollingRateWeek
            };

            timerWeek.Elapsed += timerWeek_Elapsed;
            timerWeek.Start();

            // Get the values at init
            EventExtensions.FireEvent(timerNow, "onIntervalElapsed", this, null);
            EventExtensions.FireEvent(timerWeek, "onIntervalElapsed", this, null);
        }