private void TwitchRewatcherForm_FormClosing(object sender, FormClosingEventArgs e) { if (minimizeOnClose) { e.Cancel = true; MinimizeToTray(); return; } SaveCurrentConfig(); if (VodDownloader.IsDownloadingChat || VodDownloader.IsDownloadingVideo) { DialogResult r = MessageBox.Show("You are currently downloading a VOD; quitting will result in the download being cancelled. Would you like to quit?", "VOD Downloading", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (r == DialogResult.No) { e.Cancel = true; minimizeOnClose = true; return; } } Cef.Shutdown(); VodDownloader.KillDownloads(); notifyIcon.Visible = false; Program.Close(); }
private void downloadButton_Click(object sender, EventArgs e) { string illegalChars = VodDownloader.GetIllegalChars(titleTextBox.Text); if (illegalChars != null && illegalChars.Length > 0) { DialogResult result = MessageBox.Show( "Title '" + titleTextBox.Text + "' contains illegal characters '" + illegalChars + "' that will be removed if used.", "Illegal Characters", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (result == DialogResult.Cancel) { return; } foreach (char c in illegalChars) { titleTextBox.Text.Replace(c.ToString(), ""); } } if (string.IsNullOrWhiteSpace(titleTextBox.Text)) { MessageBox.Show("Please provide a valid stream title.", "Data Error", MessageBoxButtons.OK, MessageBoxIcon.Error); titleTextBox.Focus(); return; } if (downloadQueue == null) { downloadQueue = new BindingList <VodDownloadEntry> (); } downloadQueue.Add(new VodDownloadEntry(urlTextBox.Text, titleTextBox.Text, destinationTextBox.Text)); if (!VodDownloader.IsDownloadingChat && !VodDownloader.IsDownloadingVideo) { VodDownloader.Download(titleTextBox.Text, urlTextBox.Text, destinationTextBox.Text); } urlTextBox.Clear(); titleTextBox.Clear(); urlTextBox.Focus(); }
private void OnDownloadProgress() { if (!IsHandleCreated) { return; } int downloadProgress = (int)VodDownloader.TotalDownloadProgress(); downloadProgressBar.BeginInvoke((MethodInvoker) delegate() { downloadProgressBar.Value = downloadProgress; }); downloadProgressLabel.BeginInvoke((MethodInvoker) delegate() { downloadProgressLabel.Text = "Progress: " + downloadProgress + "%"; }); }
private void OnDownloadFinished() { if (downloadQueue == null) { return; } if (downloadQueue.Count > 0) { Invoke(new MethodInvoker(delegate { downloadQueue.RemoveAt(0); })); } OnDownloadProgress(); if (downloadQueue.Count <= 0) { return; } VodDownloadEntry nextEntry = downloadQueue[0]; VodDownloader.Download(nextEntry.Name, nextEntry.URL, nextEntry.Destination); }
private void LoadingForm_Shown(object sender, EventArgs e) { VodDownloader.UpdateVideoDl(); TwitchBadgeLoader.LoadGlobalBadges(); BTTVEmoticonLoader.LoadOfficialEmoticons(); }
private void notifyIcon_MouseMove(object sender, MouseEventArgs e) { notifyIcon.Text = "Twitch Rewatcher" + (VodDownloader.IsDownloading ? " " + Math.Floor(VodDownloader.TotalDownloadProgress()) + "%" : ""); }