// Download selected file private void Download_Click(object sender, RoutedEventArgs e) { string filename = RemoteFileList.SelectedItem.ToString(); string savePath = Path.Combine(DOWNLOAD_DIR, filename); using (var client = new FilerServerProxyService.FileServerClient()) { try { Directory.CreateDirectory(Path.GetDirectoryName(savePath)); using (var fileStream = new FileStream(savePath, FileMode.Create)) { client.GetFile(filename).CopyTo(fileStream); } } catch (Exception ex) { Trace.TraceError(ex.Message); MessageBox.Show(ex.Message, "Error"); } } }
private void RefreshRemoteFiles() { using (var client = new FilerServerProxyService.FileServerClient()) { RemoteFiles.Clear(); try { string[] availableFiles = client.GetAvailableFiles(); foreach (string file in availableFiles) { RemoteFiles.Add(file); } } // Display error and continue catch (Exception ex) { Trace.TraceError(ex.Message); MessageBox.Show(ex.Message, "Error"); } } }