예제 #1
0
        private void WorkThread()
        {
            Dictionary <string, string> timedic = ComputerTool.GetUpTime();
            string lastPowerOn    = timedic["lastPowerOn"];
            string lastPowerOff   = timedic["lastPowerOff"];
            string firsetPowerOn  = timedic["firsetPowerOn"];
            string firsetPowerOff = timedic["firsetPowerOff"];

            string lastDownTime = timedic["lastDownTime"];
            string upTime       = timedic["upTime"];
            string totalUpTime  = timedic["totalUpTime"];

            int lastDownTimeInt = Convert.ToInt32(lastDownTime);
            int upTimeInt       = Convert.ToInt32(upTime);
            int totalUpTimeInt  = Convert.ToInt32(totalUpTime);

            lastDownTime = lastDownTime + "秒 - (" + GetClock(lastDownTimeInt) + ")";
            upTime       = upTime + "秒 - (" + GetClock(upTimeInt) + ")";
            totalUpTime  = totalUpTime + "秒 - (" + GetClock(totalUpTimeInt) + ")";

            this.Dispatcher.Invoke((Action) delegate()
            {
                baseDataList[0].Value = lastPowerOn;
                baseDataList[1].Value = lastPowerOff;
                baseDataList[2].Value = lastDownTime;
                baseDataList[4].Value = upTime;
                baseDataList[5].Value = firsetPowerOn;
                baseDataList[6].Value = firsetPowerOff;
                baseDataList[7].Value = totalUpTime;
            });
        }
        void WorkThread()
        {
            //Computer.GetTest();
            string systemType = ComputerTool.GetSystemType("SystemType");
            string systemVer  = ComputerTool.GetSystemVersion();
            string language   = System.Threading.Thread.CurrentThread.CurrentCulture.Name + " " +
                                System.Globalization.CultureInfo.InstalledUICulture.NativeName;
            string account = ComputerTool.GetSystemType("Name");
            string cpu     = ComputerTool.GetCpuName();
            string mem     = ComputerTool.GetMemerySize();
            string disk    = ComputerTool.GetDiskSize();

            //string time = DateTime.Now.ToLocalTime().ToString();

            this.Dispatcher.Invoke((Action) delegate()
            {
                baseDataList[0].Value = systemType;
                baseDataList[1].Value = systemVer;
                baseDataList[2].Value = language;
                baseDataList[3].Value = account;
                baseDataList[4].Value = cpu;
                baseDataList[5].Value = mem;
                baseDataList[6].Value = disk;
                //baseDataList[7].Value = time;
            });
        }
        private void NetWorkView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Console.WriteLine("NetWorkView_SelectionChanged...");
            NetInfoView.ItemsSource = null;
            NetInfoView.Items.Clear();
            NetWorkInfoDataList.Clear();

            ListView netList = (ListView)sender;
            NetWork  network = netList.SelectedItem as NetWork;

            Console.WriteLine(network.NetDevice);

            //ComputerTool.GetNetWorkInfoForAdapter(network.NetDevice);

            networkInfoList = ComputerTool.GetNetWorkAdpterInfo(network.NetDevice);
            if (networkInfoList != null)
            {
                if (NetInfoView.Items.Count == 0)
                {
                    foreach (NetWork net in networkInfoList)
                    {
                        NetWorkInfoDataList.Add(net);
                    }
                    NetInfoView.ItemsSource = NetWorkInfoDataList;
                }
            }
        }
 private void LoadNetWorkDevice()
 {
     networkList = ComputerTool.GetNetWorkAdpter();
     if (networkList != null)
     {
         if (NetWorkView.Items.Count == 0)
         {
             foreach (NetWork net in networkList)
             {
                 NetWorkDataList.Add(net);
             }
             NetWorkView.ItemsSource = NetWorkDataList;
         }
         //NetWorkView.Focus();
         NetWorkView.SelectedIndex = 0;
     }
 }
        private void ShowDataList()
        {
            MBDataList.Add(new BaseData("主板", "..\\Resources\\mainboard.png", 0));
            MBDataList.Add(new BaseData("型号", ComputerTool.GetBoardType()));
            MBDataList.Add(new BaseData("BIOS", ComputerTool.GetBios()));

            memList = ComputerTool.GetMemoryInfo();
            if (memList != null)
            {
                foreach (BaseData baseData in memList)
                {
                    MBDataList.Add(baseData);
                }
            }

            diskList = ComputerTool.GetDiskInfo();
            if (diskList != null)
            {
                foreach (BaseData baseData in diskList)
                {
                    MBDataList.Add(baseData);
                }
            }

            netList = ComputerTool.GetNetWorkInfo();
            if (netList != null)
            {
                foreach (BaseData baseData in netList)
                {
                    MBDataList.Add(baseData);
                }
            }

            this.Dispatcher.Invoke((Action) delegate()
            {
                MBListView.ItemsSource = MBDataList;
            });
        }