예제 #1
0
        public void invoke2()
        {
            Ipconfig e = Ipconfig.GetInstance();

            e.test();
            test(e.ListIp);
            if (passerelle == "")
            {
                MessageBox.Show("Echec test Passerelle", "Ok", MessageBoxButton.OK, MessageBoxImage.Exclamation);

                return;
            }


            ProcessStartInfo psi = new ProcessStartInfo("cmd", "/C " + "ping " + passerelle);

            psi.UseShellExecute        = false;
            psi.RedirectStandardOutput = true;
            psi.CreateNoWindow         = true;
            psi.RedirectStandardError  = true;
            psi.StandardOutputEncoding = System.Text.Encoding.GetEncoding(850);;
            Process proc = Process.Start(psi);

            try
            {
                result = proc.StandardOutput.ReadToEnd();
            }
            catch (Exception e1)
            {
                Console.WriteLine(e1.Message);
            }
            finally
            {
                proc.Dispose();
            }
            string[] str = result.Split(new string[] { "\r\n" }, StringSplitOptions.None);

            if (str.Length < 5)
            {
                MessageBox.Show("Echec test Passerelle", "Ok", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            else
            {
                string percentage = (str[8].Split(new string[] { "(perte ", "%)" }, StringSplitOptions.None)[1]);

                if (float.Parse(percentage) < 51)
                {
                    MessageBox.Show("Test Passerelle OK :", "Ok", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show("Echec test Passerelle:", "Ok", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }
        }
예제 #2
0
        public UserControl2()
        {
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            Uri iconUri = new Uri(@"C:\Program Files (x86)\PFSI-2\pfsi.ico", UriKind.RelativeOrAbsolute);

            this.Icon = BitmapFrame.Create(iconUri);

            InitializeComponent();

            _estAuthentifi = false;
            Script.Ipconfig e = new Ipconfig();
            //e.braw();
            e.test();
            this.transformList(e.ListIp);
            SetInfo();
            this.transformListInfor();
            cbuser.SelectionChanged += this.ComboBox_SelectionChanged2;


            System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer();
            timer1.Interval = 1000;//1 seconds
            timer1.Tick    += new System.EventHandler(braww);
            timer1.Start();
        }