예제 #1
0
        private async void DownloadClick(object sender, RoutedEventArgs e)
        {
            Directory.CreateDirectory("Downloads");
            connection = new Connection();
            await connection.Connect(Settings.Default.ServerIP, Settings.Default.ServerPort);

            await connection.SendPacket(new FileDownloadRequest(File.ID));

            download_Button.IsEnabled = false;

            progressWindow       = new ProgressWindow();
            progressWindow.Owner = this;
            progressWindow.Show();
            try
            {
                await progressWindow.StartDownload(connection, File);
            }
            catch (Exception)
            {
                MessageBox.Show("Er ging iets fout.");
            }
        }