Example #1
0
        public DownloadEntry(int posX, int posY, String URL, DownloadManagerForm parentForm)
        {
            uri      = new Uri(URL);
            filename = System.IO.Path.GetFileName(uri.LocalPath);
            filePath = AdaptFileNameIfExist(System.IO.Path.Combine(@"D:\test", filename));

            progressBar = new ProgressBar
            {
                Left   = posX,
                Top    = posY,
                Width  = 200,
                Height = 15
            };
            parentForm.Controls.Add(progressBar);

            cancelButton = new Button()
            {
                Left   = progressBar.Right + 10,
                Top    = progressBar.Top,
                Width  = 80,
                Height = 20,
                Text   = "Cancel"
            };
            cancelButton.Font   = new Font(cancelButton.Font.FontFamily, 8);
            cancelButton.Click += (o, a) => { Cancel(); };
            parentForm.Controls.Add(cancelButton);

            statusLabel = new Label()
            {
                Left        = progressBar.Left,
                Top         = progressBar.Bottom + 10,
                Text        = String.Concat("Downloading ", filename),
                AutoSize    = true,
                MaximumSize = new Size(progressBar.Width + cancelButton.Width + 10, 15)
            };
            parentForm.Controls.Add(statusLabel);


            //webClient.DownloadProgressChanged += wc_DownloadProgressChanged;

            //webClient.DownloadFileAsync(uri, filePath);
            progress = new Progress <int>(percent =>
            {
                progressBar.Value = percent;
            });
        }
Example #2
0
        public MainForm()
        {
            InitializeComponent();

            settings = new Settings(this);
            settings.Load();

            left  = new Panel(LeftPathTextbox, LeftDirectoryPanel, LeftDiskMenuButton, this);
            right = new Panel(RightPathTextbox, RightDirectoryPanel, RightDiskMenuButton, this);

            LeftDirectoryPanel.View  = View.Details;
            RightDirectoryPanel.View = View.Details;

            SetActivePanel(left);

            left.ShowDirectory();

            right.ShowDirectory();

            downloadForm = new DownloadManagerForm(this);

            fileSearchTextBox.TextChanged += fileSearchTextBox_TextChanged;
            FormClosing += (o, a) => { downloadForm.Close(); };
        }