Example #1
0
        private void LoadData(Action <object> onLoadAction)
        {
            var info = new List <Info>();

            Task.Factory.StartNew(() =>
            {
                info.Add(new Info()
                {
                    Description = "Cpu", Value = CpuUtil.GetCPUInfo()
                });
                info.Add(new Info()
                {
                    Description = "Stepping", Value = CpuUtil.GetCpuCaption()
                });
                info.Add(new Info()
                {
                    Description = "Aktuell Mhz", Value = CpuUtil.GetCpuClockSpeed().ToString()
                });
                info.Add(new Info()
                {
                    Description = "Antal kärnor", Value = CpuUtil.GetCpuCores().ToString()
                });
                info.Add(new Info()
                {
                    Description = "Trådar", Value = CpuUtil.GetCpuNumberOfLogicalProcessors().ToString()
                });
                info.Add(new Info()
                {
                    Description = "Minne", Value = CpuUtil.GetInstalledMemory().ToString()
                });
                info.Add(new Info()
                {
                    Description = "Bitar", Value = CpuUtil.GetCpuDataWidth().ToString() + "Bit"
                });
                info.Add(new Info()
                {
                    Description = "Drivspänning", Value = CpuUtil.GetCpuVoltage().ToString() + "V"
                });
            }, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).ContinueWith((task =>
            {
                Info = new ObservableCollection <Info>(info);
                onLoadAction.Invoke(null);
            }), TaskScheduler.FromCurrentSynchronizationContext());
        }