コード例 #1
0
        public void ThreadFileSendCheak(Object o)
        {
            SendFilePackage sfPackage = ( SendFilePackage)o;

            if (sfPackage != null)
            {
                for (int i = 0; i < sfPackage.ServerInfoSet.Count; i++)
                {
                    for (int j = 0; j < sfPackage.PathSet.Count; j++)
                    {
                        sfPackage.ServerInfoSet[i].SendFileOrDirectory(sfPackage.PathSet[j]);

                        while (!sfPackage.ServerInfoSet[i].IsSendFileComplete())
                        {
                            ;
                        }
                        String SendDes = "主机:" + sfPackage.ServerInfoSet[i].mHostname + "文件:" + sfPackage.PathSet[j];
                        if (sfPackage.ServerInfoSet[i].mFileSendSuccess)
                        {
                            sfPackage.SendSuccess.Add(SendDes);
                        }
                        else if (sfPackage.ServerInfoSet[i].mFileSendAbort)
                        {
                            sfPackage.SendAbort.Add(SendDes);
                        }
                        else if (sfPackage.ServerInfoSet[i].mFileSendEsc)
                        {
                            sfPackage.SendEsc.Add(SendDes);
                        }
                    }
                }
            }

            this.BeginInvoke(new UiInvoke(this.SendFileSuccess), new object[] { sfPackage });
        }
コード例 #2
0
        public void SendFileSuccess(Object o)
        {
            SendFilePackage sfPackage = (SendFilePackage)o;

            //this.Text = "文件传输------执行完成";
            MessageBox.Show(sfPackage.GetSendInfo());
            this.SendButtonEnable();
        }
コード例 #3
0
        private void buttonSend_Click(object sender, EventArgs e)
        {
            Button button_t = (Button)sender;

            SendFilePackage sfPackage = new SendFilePackage();

            foreach (ListViewItem lvi in this.listViewPhone.Items)  //选中项遍历
            {
                if (lvi.Checked)
                {
                    sfPackage.ServerInfoSet.Add(((ListViewItemServer)lvi).mServerInfo);
                }
            }
            foreach (ListViewItem lvi in this.listViewPC.Items)  //选中项遍历
            {
                if (lvi.Checked)
                {
                    sfPackage.ServerInfoSet.Add(((ListViewItemServer)lvi).mServerInfo);
                }
            }

            if (sfPackage.ServerInfoSet.Count == 0)
            {
                MessageBox.Show("没有选中的服务器");
                return;
            }
            foreach (ListViewItem lvi in this.listViewSendFileBuffer.Items)  //选中项遍历
            {
                sfPackage.PathSet.Add(((ListViewItemFile)lvi).mPath);
            }
            if (sfPackage.PathSet.Count == 0)
            {
                MessageBox.Show("没有选中文件");
                return;
            }
            button_t.Enabled = false;
            this.Invalidate();
            Thread t = new Thread(this.ThreadFileSendCheak);

            t.Start(sfPackage);
        }
コード例 #4
0
        //private void Button_Click(object sender, RoutedEventArgs e)
        //{

        //}

        private void SendFileClick(object sender, RoutedEventArgs e)
        {
            Button button_t = sender as Button;

            SendFilePackage sfPackage = new SendFilePackage();

            foreach (ServerInfo si in this.PHONE)  //选中项遍历
            {
                if (si.WPF_CHECK)
                {
                    sfPackage.ServerInfoSet.Add(si);
                }
            }
            foreach (ServerInfo si in this.PC)  //选中项遍历
            {
                if (si.WPF_CHECK)
                {
                    sfPackage.ServerInfoSet.Add(si);
                }
            }

            if (sfPackage.ServerInfoSet.Count == 0)
            {
                MessageBox.Show("没有选中的服务器");
                return;
            }
            foreach (FileData fd in this.Files)  //选中项遍历
            {
                sfPackage.PathSet.Add(fd.FileFullname);
            }
            if (sfPackage.PathSet.Count == 0)
            {
                MessageBox.Show("没有选中文件");
                return;
            }
            button_t.IsEnabled = false;

            Thread t = new Thread(this.ThreadFileSendCheak);

            t.Start(sfPackage);
        }