예제 #1
0
        private static void Main()
        {
            NetworkMonitor.StateChanged += NetworkMonitor_StateChanged;
            NetworkMonitor.StartMonitor();

            Console.WriteLine("Press any key to stop monitoring.");
            Console.ReadKey();
            NetworkMonitor.StopMonitor();

            Console.WriteLine("Press any key to close program.");
            Console.ReadKey();
        }
예제 #2
0
        private bool TestedeRedeLocal()
        {
            NetworkMonitor.StateChanged += (object sender, StateChangeEventArgs e) => {
                if (e.IsAvailable == false)
                {
                    EventoAoFalharRede("A conexão de rede deste computador está indisponível");
                }
            };

            NetworkMonitor.StartMonitor();
            Thread.Sleep(1000);

            return(NetworkMonitor.CurrentState);
        }
예제 #3
0
        static SystemInfo()
        {
            var mc  = new ManagementClass("Win32_ComputerSystem");
            var moc = mc.GetInstances();

            foreach (var mo in moc)
            {
                if (mo["TotalPhysicalMemory"] != null)
                {
                    PhysicalMemory = long.Parse(mo["TotalPhysicalMemory"].ToString());
                }
            }
            networkMonitor.StartMonitor();
        }