Exemplo n.º 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 PacketSorter(MyFilesDB myFiles,MovingTCPScheduler scheduler)
 {
     _myFiles = myFiles;
     _fileSaver = new FileSaver(_myFiles,scheduler.fileTransferDB);
     _outBoundManager = scheduler.outboundManager;
     _scheduler = scheduler;
 }
 public AddFilesToShare(MyFilesDB db)
 {
     InitializeComponent();
     myFilesDb = db;
 }
 public FileSaver(MyFilesDB myFiles, PendingFileTransferDB pendingFileTransferDB)
 {
     _myFiles = myFiles;
     _pendingFileTransferDB = pendingFileTransferDB;
     pendingFileQueue = new Hashtable();
 }