Exemplo n.º 1
0
        public async void AsyncUpdateSystemInformation(object parameter = null)
        {
            IsModelInformationBeingUpdated = true;
            _modelActivity = "(Fetching System Info)";
            RaisePropertyChanged("ModelTarget");
            UpdateSystemInformationCommand.RaiseCanExecuteChanged();
            System = await Task.Run(() =>
            {
                IServiceFactory sf = ServiceFactoryProducer.GetServiceFactory();

                IComputerSystemService css = sf.CreateComputerSystemService();

                return(css.GetComputerSystem());
            });

            CpuInfo = new CPUInfoViewModel(_system.CpuInfo);

            IsModelInformationBeingUpdated = false;
            _modelActivity      = "(Idle)";
            PhysicalMemoryCount = System.PhysicalMemoryCollection.Count;


            ulong tpm = 0;

            foreach (PhysicalMemory pm in System.PhysicalMemoryCollection)
            {
                tpm += pm.Capacity;
            }

            TotalPhysicalMemoryInt = tpm;
            FreePhysicalMemoryInt  = System.FreePhysicalMemory;
            UsedPhysicalMemoryInt  = TotalPhysicalMemoryInt - FreePhysicalMemoryInt;
            MemoryAllocation       = _usedPhysicalMemoryInt / 1024 / 1024 + " / " + _totalPhysicalMemoryInt / 1024 / 1024 + " MegaBytes";
            RaisePropertyChanged("ModelTarget");
            UpdateSystemInformationCommand.RaiseCanExecuteChanged();
        }