private void btnSend_Click(object sender, System.EventArgs e)
        {
            this.Hide();

            foreach (ListViewItem lvItem in listView.Items)
            {
                string fileName = lvItem.SubItems[1].Text + Path.DirectorySeparatorChar + lvItem.SubItems[0].Text;

retry:
                if (!File.Exists(fileName))
                {
                    DialogResult dlgFNFResult = RtlAwareMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture,
                                                                                            Strings.FileNoLongerExists, fileName, Environment.NewLine), Strings.FileNotFound,
                                                                        MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1,
                                                                        (MessageBoxOptions)0);
                    if (dlgFNFResult == DialogResult.Yes)
                    {
                        continue;
                    }
                    else if (dlgFNFResult == DialogResult.Cancel)
                    {
                        return;
                    }
                    else
                    {
                        goto retry;
                    }
                }

                Label lblMessage = new Label();
                lblMessage.Font     = new Font("Tahoma", 10f);
                lblMessage.AutoSize = true;
                lblMessage.Text     = string.Format(CultureInfo.CurrentCulture, Strings.SendingFilePleaseWait, fileName);
                lblMessage.Location = new Point(10, 5);

                Form frmMessage = new Form();
                frmMessage.ClientSize      = new Size(lblMessage.Width + 20, lblMessage.Height + 10);
                frmMessage.StartPosition   = FormStartPosition.CenterScreen;
                frmMessage.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                frmMessage.Text            = Strings.SendingFile;
                frmMessage.Controls.Add(lblMessage);
                frmMessage.Show();
                Application.DoEvents();

                FileObject fileObject = new FileObject(fileName);
                fileTransferCapability.SendObject(fileObject);

                frmMessage.Close();
            }

            this.Close();
            RtlAwareMessageBox.Show(this, Strings.FileTransferCompleted,
                                    Strings.SendDone, MessageBoxButtons.OK, MessageBoxIcon.Information,
                                    MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
        }
Beispiel #2
0
        private void btnSend_Click(object sender, System.EventArgs e)
        {
            this.Hide();

            foreach (ListViewItem lvItem in listView.Items)
            {
                string fileName = lvItem.SubItems[1].Text + Path.DirectorySeparatorChar + lvItem.SubItems[0].Text;

retry:
                if (!File.Exists(fileName))
                {
                    DialogResult dlgFNFResult = MessageBox.Show("The file " + fileName + " no longer exists!" + Environment.NewLine +
                                                                "Skip this file and continue?", "File not found",
                                                                MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
                    if (dlgFNFResult == DialogResult.Yes)
                    {
                        continue;
                    }
                    else if (dlgFNFResult == DialogResult.Cancel)
                    {
                        return;
                    }
                    else
                    {
                        goto retry;
                    }
                }

                Label lblMessage = new Label();
                lblMessage.Font     = new Font("Tahoma", 10f);
                lblMessage.AutoSize = true;
                lblMessage.Text     = "Sending file " + fileName + ". Please wait...";
                lblMessage.Location = new Point(10, 5);

                Form frmMessage = new Form();
                frmMessage.ClientSize      = new Size(lblMessage.Width + 20, lblMessage.Height + 10);
                frmMessage.StartPosition   = FormStartPosition.CenterScreen;
                frmMessage.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                frmMessage.Text            = "Sending file...";
                frmMessage.Controls.Add(lblMessage);
                frmMessage.Show();
                Application.DoEvents();

                FileObject fileObject = new FileObject(fileName);
                fileTransferCapability.SendObject(fileObject);

                frmMessage.Close();
            }

            this.Close();
            MessageBox.Show("File transfer completed", "Send done", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }