コード例 #1
0
        private void Button_connexion_Click(object sender, RoutedEventArgs e)
        {
            bool   test     = false;
            string ip_ftp   = ServeurFTP.Get_IP_ftp();
            string user     = ServeurFTP.Get_user_ftp();
            string password = ServeurFTP.Get_password_ftp();

            if (ip_ftp == null)
            {
                label_etat.Foreground = Brushes.Red;
                label_etat.Content    = "Il est nécessaire d'appliquer les changements avant";
            }
            else
            {
                test = ServeurFTP.TestFTP(ip_ftp, user, password);

                if (test == true)
                {
                    label_etat.Foreground = Brushes.Green;
                    label_etat.Content    = "Connexion fonctionnelle";

                    this.mainWindow.label_etat_ftp.Content    = "Connecté au FTP sur :";
                    this.mainWindow.label_etat_ftp.Foreground = Brushes.Green;
                    this.mainWindow.label_ftp_infos.Content   = ServeurFTP.Get_IP_ftp() + ":" + ServeurFTP.Get_user_ftp();
                }
                else
                {
                    label_etat.Foreground = Brushes.Red;
                    label_etat.Content    = "La connexion a échoué";
                }
            }
        }
コード例 #2
0
 private void MenuItem_signaler_anomalie_Click_2(object sender, RoutedEventArgs e)
 {
     // Ouverture fenêtre
     if (ServeurFTP.Get_IP_ftp() == null)
     {
         MessageBox.Show("Il est nécessaire de paramètrer le serveur FTP");
     }
     else
     {
         Signaler_anomalie fenetre_signaler_anomalies = new Signaler_anomalie();
         fenetre_signaler_anomalies.Show();
     }
 }
コード例 #3
0
        public Signaler_anomalie()
        {
            InitializeComponent();

            /*  DirectoryInfo dir = new DirectoryInfo(@"../captures");
             * FileInfo[] fichiers = dir.GetFiles();
             * string[] fichiers_string = Directory.GetFiles(@"../captures", "*.jpg", SearchOption.AllDirectories);
             *
             * foreach (FileInfo fichier in fichiers)
             * {
             *    listBox_img_robot.Items.Add("Image: " + fichier.Name + "/ Date: " + fichier.CreationTime);
             *
             * }*/


            FtpClient client = new FtpClient(ServeurFTP.Get_IP_ftp());

            client.Credentials = new NetworkCredential(ServeurFTP.Get_user_ftp(), ServeurFTP.Get_password_ftp());
            client.Connect();

            foreach (FtpListItem item_capture_robot in client.GetListing("/capture_robot"))
            {
                // if this is a file
                if (item_capture_robot.Type == FtpFileSystemObjectType.File)
                {
                    listBox_img_robot.Items.Add("Image: " + item_capture_robot.Name + "/ Date: " + item_capture_robot.Modified);
                }
            }

            foreach (FtpListItem item_capture_thermique in client.GetListing("/capture_thermique"))
            {
                // if this is a file
                if (item_capture_thermique.Type == FtpFileSystemObjectType.File)
                {
                    listBox_img_thermique.Items.Add("Image: " + item_capture_thermique.Name + "/ Date: " + item_capture_thermique.Modified);
                }


                client.Disconnect();
            }
        }
コード例 #4
0
        public MainWindow()
        {
            Console.WriteLine("////////////////////////////////////////////// " + Client.GetRover() + " " + Client.GetIP() + ":" + Client.GetPort() + " instancié \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");

            InitializeComponent();

            ROVER.Content   = Client.GetRover();
            IP_PORT.Content = Client.GetIP() + ":" + Client.GetPort();
            string ftp = ServeurFTP.Get_IP_ftp();

            if (ftp == null)
            {
                label_etat_ftp.Content    = "Paramètrage FTP nécessaire";
                label_etat_ftp.Foreground = Brushes.Red;
            }
            else if (ftp != null)
            {
                label_etat_ftp.Content    = "Connecté au FTP sur :";
                label_etat_ftp.Foreground = Brushes.Green;
                label_ftp_infos.Content   = ServeurFTP.Get_IP_ftp() + ":" + ServeurFTP.Get_user_ftp();
            }
        }