示例#1
0
        private void requestFiles()
        {
            // request file

            string fileName = requestFileTxtBox.Text;

            UserXML.File        file        = new UserXML.File(fileName);
            List <UserXML.File> listOfFiles = new List <UserXML.File>();

            listOfFiles.Add(file);
            UserXML userXML = new UserXML(User.Username, User.Password, listOfFiles);

            MediationServer.WebService ws = new MediationServer.WebService();

            string respond = ws.RequestFiles(userXML.getXMLFormatToString());

            if (respond != null)
            {
                UserXML listOfFilesXML = new UserXML(respond);

                listOfFiles = listOfFilesXML.getFilesListWithNumberOfActiveUsers();

                listView.ItemsSource = listOfFiles;
            }
            else
            {
                MessageBox.Show("File not exists");
                listView.ItemsSource = null;
                listView.Items.Clear();
            }
        }
示例#2
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            user.Password = txtPassword.Password;

            if (user.checkUserValidation() && !string.IsNullOrEmpty(folderDlg.SelectedPath))
            {
                UserXML userXML = new UserXML(user.Username, user.Password, user.IP, user.PORT, filesList);

                MediationServer.WebService ws = new MediationServer.WebService();

                if (ws.SignIn(userXML.getXMLFormatToString()))
                {
                    Torrent torrentWindow = new Torrent(user);
                    torrentWindow.Show();
                    this.Close();
                }
                else
                {
                    System.Windows.MessageBox.Show(WRONG_SIGNIN);
                }
            }
            else
            {
                System.Windows.MessageBox.Show(EMPTY_FIELDS);
            }
        }
示例#3
0
        private void signOut(bool isClosed)
        {
            MediationServer.WebService ws = new MediationServer.WebService();

            UserXML userXML = new UserXML(User.Username, User.Password);

            if (ws.SignOut(userXML.getXMLFormatToString()))
            {
                if (!isClosed)
                {
                    Configuration mainWindow = new Configuration();
                    mainWindow.Show();
                    this.Close();
                }
            }
        }