Пример #1
0
        /// <summary>
        /// It handles the double click of ServerFile List view control event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ServerFileListView_DockChanged(object sender, EventArgs e)
        {
            if (ServerFileListView.SelectedItems.Count < 1)
            {
                return;
            }

            byte[] file;

            Server.Download(MachineInfo.GetJustIP(), ServerFileListView.SelectedItems[0].SubItems[2].Text, out file);

            SaveFileDialog save = new SaveFileDialog();

            save.Title = "It saves the downloaded file.";
            save.SupportMultiDottedExtensions = false;
            save.Filter   = "All|*.*";
            save.FileName = ServerFileListView.SelectedItems[0].SubItems[2].Text;
            if (save.ShowDialog() != System.Windows.Forms.DialogResult.Cancel)
            {
                System.IO.File.WriteAllBytes(save.FileName, file);
                MessageBox.Show(ServerFileListView.SelectedItems[0].SubItems[2].Text + " has been downloaded.", "FTP File Sharing", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            save.Dispose();
        }