예제 #1
0
        // 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");
                }
            }
        }
예제 #2
0
        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");
                }
            }
        }