예제 #1
0
        public Form1()
        {
            InitializeComponent();

            myFiles = new MyFilesDB();
            scheduler = new MovingTCPScheduler(myFiles);
            myNeighbors = new MyNeighbors(scheduler);
            filesToShareForm = new AddFilesToShare(myFiles);
            scheduler.Start();

            fileSearchForm = new FileSearchForm(myNeighbors, scheduler);

            refreshDataTimer = new System.Windows.Forms.Timer();
            refreshDataTimer.Interval = 10 * 1000;
            refreshDataTimer.Tick += new EventHandler(refreshDataTimer_Tick);
            refreshDataTimer.Start();
            refreshDataTimer_Tick(null, null);

            if (myNeighbors.GetListOfNeighbors().Count == 0)
            {
                MessageBox.Show("Hello, you must be new here...\n\nYou must enter the IP address of someone already in the neighborhood to join.\n\nOnce you are connected go to File>Hash Files to begin sharing and search for filesfrom the main screen.");
                AddNeighborForm addnb = new AddNeighborForm(myNeighbors);
                addnb.ShowDialog();
            }
        }
 public FileSearchForm(MyNeighbors mn,MovingTCPScheduler scheduler)
 {
     InitializeComponent();
     myNeighbors=mn;
     outbound = scheduler.outboundManager;
     scheduler.fileSearchForm = this;
     fullResults = new ArrayList();
     fileTransferDB = scheduler.fileTransferDB;
     System.Threading.ThreadPool.SetMaxThreads(5, 5);
 }
 public AddNeighborForm(MyNeighbors mnb)
 {
     InitializeComponent();
     this.myNeighbors = mnb;
 }