private void Form1_Load(object sender, EventArgs e) { if (Properties.Settings.Default.Maximised) { WindowState = FormWindowState.Maximized; Location = Properties.Settings.Default.Location; Size = Properties.Settings.Default.Size; } else if (Properties.Settings.Default.Minimised) { WindowState = FormWindowState.Minimized; Location = Properties.Settings.Default.Location; Size = Properties.Settings.Default.Size; } else { Location = Properties.Settings.Default.Location; Size = Properties.Settings.Default.Size; } // Setup Clipboard Monitor Listener if (Properties.Settings.Default.CheckClipboard) { this.toolCheckClipboard.Checked = true; ClipboardMonitor.Start(); ClipboardMonitor.OnClipboardChange += ClipboardMonitor_OnClipboardChange; } else { this.toolCheckClipboard.Checked = false; } }
private void toolCheckClipboard_Click(object sender, EventArgs e) { if (this.toolCheckClipboard.Checked == true) { Properties.Settings.Default.CheckClipboard = true; ClipboardMonitor.Start(); ClipboardMonitor.OnClipboardChange += ClipboardMonitor_OnClipboardChange; } else { Properties.Settings.Default.CheckClipboard = false; ClipboardMonitor.Stop(); } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if ((this.tasks[0] != null) && tasks[0].Status == TaskStatus.Running) { try { if (TumblrActiveList.Count != 0) { foreach (TumblrBlog tumblr in TumblrActiveList) { this.SaveBlog(tumblr); } } TumblrActiveList.Clear(); if (this.wait_handle != null) { this.wait_handle.Close(); } if (cts != null) { cts.Cancel(); } } catch (ThreadAbortException exception) { MessageBox.Show("Process stopped by the user. " + exception.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } for (int i = 0; i < Properties.Settings.Default.configSimultaneousDownloads; i++) { this.tasks[i] = null; } this.wait_handle = null; } // Save Window Postion and Size if (WindowState == FormWindowState.Maximized) { Properties.Settings.Default.Location = RestoreBounds.Location; Properties.Settings.Default.Size = RestoreBounds.Size; Properties.Settings.Default.Maximised = true; Properties.Settings.Default.Minimised = false; } else if (WindowState == FormWindowState.Normal) { Properties.Settings.Default.Location = Location; Properties.Settings.Default.Size = Size; Properties.Settings.Default.Maximised = false; Properties.Settings.Default.Minimised = false; } else { Properties.Settings.Default.Location = RestoreBounds.Location; Properties.Settings.Default.Size = RestoreBounds.Size; Properties.Settings.Default.Maximised = false; Properties.Settings.Default.Minimised = true; } if (Properties.Settings.Default.CheckClipboard) { Properties.Settings.Default.CheckClipboard = true; // Terminate Clipboard Monitor ClipboardMonitor.Stop(); } else { Properties.Settings.Default.CheckClipboard = false; } // Save Settings Properties.Settings.Default.Save(); }