示例#1
0
文件: Form1.cs 项目: Z-Clive/TumblTwo
 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();
     }
 }
示例#2
0
文件: Form1.cs 项目: Z-Clive/TumblTwo
        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();
        }