Example #1
0
        private void login_Click(object sender, RoutedEventArgs e)
        {
            if (username.Text == "" || password.Password == "")
            {
                message.Content = "Non lasciare campi vuoti";
            }
            else
            {
                Client client = new Client();

                client.connect_to_server();


                int login = client.login(username.Text, password.Password);
                if (login == 1)
                {
                    //signup a buon fine
                    //apro finestra dell'utente

                    /* questa parte la sostituisco
                     * Home_window home_win = new Home_window(username.Text,client);
                     * home_win.Show();
                     * apro add_folder o view a seconda del risultato di view
                     */
                    if (client.view_folders() == 1)
                    {
                        ViewFolder view_f = new ViewFolder(client);
                        view_f.Show();
                    }
                    else
                    {
                        AddFolder add_f = new AddFolder(client);
                        add_f.Show();
                    }
                    this.Close();
                }
                else if (login == 0)
                {
                    //credenziali errate
                    //stampo un messaggio e do la possibilita di rifare il login
                    message.Content = "Username o pwd errati";
                }
                else
                {
                    //errore di connessione
                    message.Content = "Nessuna risposta dal server";
                }
            }
        }
Example #2
0
        //
        private void load_folder_Click(object sender, RoutedEventArgs e)
        {
            if (path.Text != "")
            {
                //  ZIP THE FILE
                string startPath = @path.Text;
                //TODO change the path
                string zipPath = @"C:\Users\sds\Desktop\progetto\result.zip";
                // string extractPath = @"C:\Users\sds\Desktop\progetto";
                ZipFile.CreateFromDirectory(startPath, zipPath);
                //ZipFile.ExtractToDirectory(zipPath, extractPath);

                //SEND THE ZIP FILE
                client.send_zip(path.Text, zipPath);

                //change window
                ViewFolder view_f = new ViewFolder(client);
                view_f.Show();
                this.Close();
            }
        }