コード例 #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 Button_screen_Click(object sender, RoutedEventArgs e)
        {
            // Screen sur form et envoie sur FTP

            int    index     = 1;
            string LocalPath = "";
            bool   exist     = false;
            string curFile   = @"../captures/capture_robot.jpg";

            exist = File.Exists(curFile);

            // si fichier existe, delete
            if (exist == true)
            {
                File.Delete(curFile);
            }


            exist = ServeurFTP.ReadFTP("/capture_robot/", "capture" + index.ToString() + ".jpg");

            while (exist == true)
            {
                index++;
                exist = ServeurFTP.ReadFTP("/capture_robot/", "capture" + index.ToString() + ".jpg");
            }

            LocalPath = "/capture_robot/capture" + index.ToString() + ".jpg";
            ServeurFTP.CreateScreenShot(this, curFile);
            ServeurFTP.SendFTP(curFile, LocalPath);

            MessageBox.Show("Capture enregistré sur le serveur FTP");
        }
コード例 #3
0
 private void ListBox_img_thermique_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     // Si item sélectionné dans listbox
     if (listBox_img_thermique.SelectedItem != null)
     {
         ServeurFTP.SetItem(listBox_img_thermique.SelectedItem.ToString());
         ServeurFTP.SetList("capture_thermique");
         MessageBox.Show(listBox_img_thermique.SelectedItem.ToString());
         Anomalie fenetre_anomalie = new Anomalie();
         fenetre_anomalie.Show();
     }
 }
コード例 #4
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();
     }
 }
コード例 #5
0
        public Anomalie()
        {
            InitializeComponent();
            string item_selected = ServeurFTP.GetItem();
            string list_name     = ServeurFTP.GetList();
            string file_path     = "";
            int    index         = 1;

            Console.WriteLine("Item : " + item_selected);
            Console.WriteLine("Liste name : " + list_name);

            string connu1 = "Image: ";
            string connu2 = "/ Date:";

            int deb = item_selected.IndexOf(connu1);

            int    fin    = item_selected.IndexOf(connu2);
            string result = item_selected.Substring(deb, fin);

            result = result.Substring(7);

            Console.WriteLine(result);

            bool exist = File.Exists(@"../captures/img_anomalie.jpg");

            while (exist == true)
            {
                index++;
                exist = File.Exists(@"../captures/img_anomalie" + index + ".jpg");
            }

            file_path = @"../captures/img_anomalie" + index + ".jpg";

            if (list_name == "capture_robot")
            {
                ServeurFTP.DownloadFTP(file_path, @"/capture_robot/" + result);
            }

            if (list_name == "capture_thermique")
            {
                ServeurFTP.DownloadFTP(file_path, @"/capture_thermique/" + result);
            }

            string chemin       = file_path;
            string source_image = System.IO.Path.GetFullPath(chemin);

            Uri         urlImage    = new Uri(source_image, UriKind.RelativeOrAbsolute);
            BitmapImage sourceImage = new BitmapImage(urlImage);

            image.Source = sourceImage;
        }
コード例 #6
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();
            }
        }
コード例 #7
0
        private void Button_appliquer_Click(object sender, RoutedEventArgs e)
        {
            string IP       = textBox_ip.Text;
            string user     = textBox_user.Text;
            string password = textBox_password.Text;


            if (IP == "" || user == "" || password == "")
            {
                label_etat.Foreground = Brushes.Red;
                label_etat.Content    = "Vérifiez que vous ayez remplis correctement les champs";
            }
            else
            {
                ServeurFTP.Set_IP_ftp(IP);
                ServeurFTP.Set_user_ftp(user);
                ServeurFTP.Set_password_ftp(password);

                label_etat.Foreground = Brushes.Green;
                label_etat.Content    = "Configuration appliqué";
            }
        }
コード例 #8
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();
            }
        }