예제 #1
0
        private void openWithNewConnectionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string       imm   = "";
            ListViewItem sItem = contentView.SelectedItems[0];  //GET THE SELECTED OBJECT

            switch (recognizeSelectedItem(sItem))
            {
            case 1:     //DRIVE
                r.DrivesInformationResponse.DriveInfo div = (r.DrivesInformationResponse.DriveInfo)sItem.Tag;
                imm = div.RootDirectoryPath;
                break;

            case 2:     //DIRECTORY
                r.DirectoryInformationResponse.DirectoryInfo dir = (r.DirectoryInformationResponse.DirectoryInfo)sItem.Tag;
                imm = dir.FullName;
                break;

            case 3:     //FILE
                break;

            case 0:
                MessageBox.Show("UnKnown Item found", "Error");
                return;
            }
            NetworkServer.requestNewConnectionToOpenPort(server.serverPort.ServerIP,
                                                         new NetworkServer.NewConnectionEstablished(
                                                             (NetworkServer newServer, CommunicationNetworkStream stream) =>
            {
                exploreForm f   = new exploreForm();
                f.server        = newServer;
                f.ImmidiatePath = imm;
                f.StartPosition = FormStartPosition.CenterScreen;
                Invoke(new UpdateData(() => { f.Show(); }));
            }
                                                             ),
                                                         new NetworkServer.ErrorEncounted(
                                                             (RServer newServer, CommunicationNetworkStream stream, string data) =>
            {
                MessageBox.Show("Server is flooded with connection. Try again later.", "Error");
            }
                                                             )
                                                         );
        }
예제 #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         NetworkServer.requestNewConnectionToOpenPort(listView1.SelectedItems[0].SubItems[1].Text,
                                                      new NetworkServer.NewConnectionEstablished(
                                                          (NetworkServer newServer, CommunicationNetworkStream stream) => {
             exploreForm f = new exploreForm();
             f.server      = newServer;
             Invoke(new UpdateData(() => { f.Show(); Close(); Dispose(); }));
         }
                                                          ),
                                                      new NetworkServer.ErrorEncounted(
                                                          (RServer newServer, CommunicationNetworkStream stream, string data) => {
             MessageBox.Show("Server is flooded with connection. Try again later.", "Error");
         }
                                                          )
                                                      );
     }
     else
     {
         MessageBox.Show("Please select an IP", "Error");
     }
 }