示例#1
0
 /// <summary>
 /// Initializes a new instance of TaskManager.CSystem class to the value of TaskManager.CSystem object.
 /// </summary>
 /// <param name="syst"></param>
 public CSystem(CSystem syst)
 {
     Name = syst.Name;
     BuildNum = syst.BuildNum;
     CSDVersion = syst.CSDVersion;
     CSName = syst.CSName;
     InstallDate = syst.InstallDate;
     LastBootUpTime = syst.LastBootUpTime;
     OSArchitecture = syst.OSArchitecture;
     SerialNumber = syst.SerialNumber;
     this.Version = syst.Version;
     ProcName = SystemInfo.GetProcName();
     PhysMemory = (SystemInfo.GetTotalPhysicalMemory() / 1024 / 1024).ToString() + " Mb";
 }
示例#2
0
        /// <summary>
        /// Initialize some elements of window.
        /// </summary>
        private void Window_Initialized(object sender, EventArgs e)
        {
            _procColl = SystemInfo.GetProcessList();
            ProcCountLabel.Content = _procColl.Count.ToString(); // кол-во процессов
            ProcListView.ItemsSource = _procColl;       // указываем источник ListView

            _appColl = SystemInfo.GetAppList();
            AppListView.ItemsSource = _appColl; // отображение приложений

            _servColl = SystemInfo.GetServiceList();
            ServListView.ItemsSource = _servColl; // отображаем

            _socketColl = GetTcpUdp.GetTcpUdpList();
            SocketListView.ItemsSource = _socketColl;

            PhMemLabel.Content = SystemInfo.GetPhysicalUsage().ToString() + "%"; // процент используемой физ. памяти
            VirtMemLabel.Content = SystemInfo.GetVirtualUsage().ToString() + "%"; // процент используемой вирт. памяти
            CPUPercentLabel.Content = SystemInfo.GetCPU().ToString() + "%"; // процент CPU

            // get information about OS, processor, RAM
            CSystem syst = new CSystem(SystemInfo.GetOSInfo());
            OSNameLabel.Content = syst.Name;
            BuildNumLabel.Content = syst.BuildNum;
            VersionLabel.Content = syst.Version;
            CSDVersionabel.Content = syst.CSDVersion;
            CSNameLabel.Content = syst.CSName;
            string date = syst.InstallDate;
            InstallDateLabel.Content = date.Substring(0, 4) + "." + date.Substring(4, 2) + "." + date.Substring(6, 2) + " " + date.Substring(8, 2) + ":" + date.Substring(10, 2) + ":" + date.Substring(12, 2);
            date = syst.LastBootUpTime;
            LastBootLabel.Content = date.Substring(0, 4) + "." + date.Substring(4, 2) + "." + date.Substring(6, 2) + " " + date.Substring(8, 2) + ":" + date.Substring(10, 2) + ":" + date.Substring(12, 2);
            OSArchLabel.Content = syst.OSArchitecture;
            SerialNumLabel.Content = syst.SerialNumber;
            ProcNameLabel.Content = syst.ProcName;
            RAMLabel.Content = syst.PhysMemory;

            CPUZedGraph = CPUWFH.Child as ZedGraphControl;
            CPUZedGraph.GraphPane.Title.Text = "CPU";
            CPUZedGraph.GraphPane.XAxis.Title.Text = "";
            CPUZedGraph.GraphPane.YAxis.Title.Text = "%";
            CPUZedGraph.GraphPane.YAxis.Scale.Max = 100;
            CPUZedGraph.GraphPane.YAxis.Scale.Min = 0;
            CPUZedGraph.GraphPane.XAxis.Scale.Max = 50;
            CPUZedGraph.GraphPane.XAxis.Scale.Min = 0;
            CPUZedGraph.GraphPane.XAxis.Scale.MaxAuto = false;
            CPUZedGraph.GraphPane.YAxis.Scale.MaxAuto = false;
            CPUZedGraph.GraphPane.XAxis.Scale.MinAuto = false;
            CPUZedGraph.GraphPane.YAxis.Scale.MinAuto = false;
            CPUZedGraph.ZoomEvent += new ZedGraphControl.ZoomEventHandler(zedGraph_ZoomEvent);

            PageFileZedGraph = PageFileWFH.Child as ZedGraphControl;
            PageFileZedGraph.GraphPane.Title.Text = "Page File Usage";
            PageFileZedGraph.GraphPane.XAxis.Title.Text = "";
            PageFileZedGraph.GraphPane.YAxis.Title.Text = "%";
            PageFileZedGraph.GraphPane.YAxis.Scale.Max = 100;
            PageFileZedGraph.GraphPane.YAxis.Scale.Min = 0;
            PageFileZedGraph.GraphPane.XAxis.Scale.Max = 50;
            PageFileZedGraph.GraphPane.XAxis.Scale.Min = 0;
            PageFileZedGraph.GraphPane.XAxis.Scale.MaxAuto = false;
            PageFileZedGraph.GraphPane.YAxis.Scale.MaxAuto = false;
            PageFileZedGraph.GraphPane.XAxis.Scale.MinAuto = false;
            PageFileZedGraph.GraphPane.YAxis.Scale.MinAuto = false;
            PageFileZedGraph.ZoomEvent += new ZedGraphControl.ZoomEventHandler(zedGraph_ZoomEvent);

            PhysMemZedGraph = PhysMemWFH.Child as ZedGraphControl;
            PhysMemZedGraph.GraphPane.Title.Text = "Phys. Memory Usage";
            PhysMemZedGraph.GraphPane.XAxis.Title.Text = "";
            PhysMemZedGraph.GraphPane.YAxis.Title.Text = "%";
            PhysMemZedGraph.GraphPane.YAxis.Scale.Max = 100;
            PhysMemZedGraph.GraphPane.YAxis.Scale.Min = 0;
            PhysMemZedGraph.GraphPane.XAxis.Scale.Max = 50;
            PhysMemZedGraph.GraphPane.XAxis.Scale.Min = 0;
            PhysMemZedGraph.GraphPane.XAxis.Scale.MaxAuto = false;
            PhysMemZedGraph.GraphPane.YAxis.Scale.MaxAuto = false;
            PhysMemZedGraph.GraphPane.XAxis.Scale.MinAuto = false;
            PhysMemZedGraph.GraphPane.YAxis.Scale.MinAuto = false;
            PhysMemZedGraph.ZoomEvent += new ZedGraphControl.ZoomEventHandler(zedGraph_ZoomEvent);

            _bwList.WorkerReportsProgress = true;
            _bwList.WorkerSupportsCancellation = true;
            _bwList.DoWork += new DoWorkEventHandler(bwList_DoWork);
            _bwList.ProgressChanged += new ProgressChangedEventHandler(bwList_ProgressChanged);

            _bwStat.WorkerReportsProgress = true;
            _bwStat.WorkerSupportsCancellation = true;
            _bwStat.DoWork += new DoWorkEventHandler(bwStat_DoWork);
            _bwStat.ProgressChanged += new ProgressChangedEventHandler(bwStat_ProgressChanged);

            _bwNet.WorkerReportsProgress = true;
            _bwNet.WorkerSupportsCancellation = true;
            _bwNet.DoWork += new DoWorkEventHandler(bwNet_DoWork);
            _bwNet.ProgressChanged += new ProgressChangedEventHandler(bwNet_ProgressChanged);

            _bwList.RunWorkerAsync();
            _bwStat.RunWorkerAsync();
            _bwNet.RunWorkerAsync();

            // Grab all local interfaces to this computer
            _niArr = NetworkInterface.GetAllNetworkInterfaces();
            foreach (NetworkInterface ni in _niArr)
            {
                ConnectComboBox.Items.Add(ni.Name);
            }
        }
示例#3
0
 /// <summary>
 /// Gets some information about OS.
 /// </summary>
 /// <returns>Some information about OS.</returns>
 public static CSystem GetOSInfo()
 {
     CSystem temp = new CSystem();
     ManagementObjectSearcher man = new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem");
     foreach (ManagementObject obj in man.Get())
     {
         temp.Name = obj["Caption"].ToString();
         temp.BuildNum = obj["BuildNumber"].ToString();
         temp.CSDVersion = obj["CSDVersion"].ToString();
         temp.CSName = obj["CSName"].ToString();
         temp.InstallDate = obj["InstallDate"].ToString();
         temp.LastBootUpTime = obj["LastBootUpTime"].ToString();
         temp.OSArchitecture = obj["OSArchitecture"].ToString();
         temp.SerialNumber = obj["SerialNumber"].ToString();
         temp.Version = obj["Version"].ToString();
     }
     return temp;
 }