Example #1
0
        private void listView2_DoubleClick(object sender, EventArgs e)
        {
            if (listView2.SelectedItems.Count > 0 && CurrentClient!=null)
            {
                ListViewItem item = listView2.SelectedItems[listView2.SelectedItems.Count - 1];
                string DirName = "";

                FileSystem dirinfo = item.Tag as FileSystem;
                if (dirinfo.FileType == FileType.Dir)
                {
                    DirName = dirinfo.FullName;
                }
                else
                {
                    if (MessageBox.Show("是否下载文件:" + dirinfo.Name + "?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                         FileSystem downFile = (this.listView2.SelectedItems[this.listView2.SelectedItems.Count - 1].Tag as FileSystem);

                         if (downFile != null)
                         {
                             Down down = new Down()
                              {
                                  FullName = downFile.FullName

                              };

                             CurrentClient.SendData(BufferFormatV2.FormatFCA(down));

                         }
                    }
                    return;
                }

                GetFile tmp = new GetFile()
                {
                    DirName = DirName,
                    FileSystemList = new List<FileSystem>(),
                    IsSuccess = false,
                    Msg = ""
                };

                CurrentClient.SendData(BufferFormatV2.FormatFCA(tmp));
            }
        }
Example #2
0
        private void listView1_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count > 0)
            {
                ListViewItem item = listView1.SelectedItems[0];

                if (item.Tag != null)
                {
                    UserInfo tmp = item.Tag as UserInfo;

                    if (tmp != null)
                    {

                        CurrentClient = tmp;

                        if (!tmp.IsValidate)
                        {
                            LogOn tmpwin = new LogOn();
                            tmpwin.ShowDialog();

                            string password = tmpwin.PassWrod;

                            Success logon = new Success()
                            {
                                Key = password
                            };

                            tmp.SendData(BufferFormatV2.FormatFCA(logon));

                        }
                        else
                        {
                            GetFile getfile = new GetFile();

                            tmp.SendData(BufferFormatV2.FormatFCA(getfile));
                        }
                    }
                }
            }
        }