private void DownloadButton_Click(object sender, RoutedEventArgs e)
        {
            TransferFileDetails temp = (TransferFileDetails)dataGrid.SelectedItem;

            //UserControlPanel.newDownload(temp);
            tfdForTransfer = temp;
            this.Close();
        }
            public void download(TransferFileDetails tfd, DataGrid downloadDataGrid)
            {
                this.tfd              = tfd;
                this.fileName         = tfd.FileName;
                fileSize              = tfd.FileSize;
                numOfPears            = tfd.PearsCount;
                this.downloadDataGrid = downloadDataGrid;
                bytesPerPear          = (int)fileSize / numOfPears;
                stopWatch             = new Stopwatch();
                stopWatch.Start();
                Thread t = new Thread(beginDownload);

                t.Start();
            }
        private void button_Click(object sender, RoutedEventArgs e)
        {
            SearchAndDownload sad = new SearchAndDownload(ns, currentUser);

            sad.ShowDialog();
            if (sad.getTfdForTransfer() != null)
            {
                TransferFileDetails tfd = sad.getTfdForTransfer();
                downloadFiles.Add(new FilesAndStatus(tfd.FileName, tfd.FileSize, "Downloading"));

                updateDataGrid();

                DownloadHandler dh = new DownloadHandler();
                dh.download(tfd, downloadDataGrid);
            }
        }