|
using System;
using System.ComponentModel;
using System.Windows.Forms;
namespace OverlayTools {
/// <summary>
/// Optionsform for the plugins
/// </summary>
public partial class MainForm : Form {
public MainForm() {
InitializeComponent();
}
/// <summary>
/// Closes the program
/// </summary>
public void ExitProgram() {
notifyIcon1.Visible = false; //otherwise there'll be a ghost icon ..
Application.Exit();
}
/// <summary>
/// Shows the form
/// </summary>
public void ShowForm() {
if (!Visible) {
WindowState = FormWindowState.Normal;
ShowDialog();
}
}
/// <summary>
/// Hides the form
/// </summary>
public void HideForm() {
if (Visible) {
Hide();
}
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {
if (e.CloseReason != CloseReason.None) {
//Hide may call this too, but only there the closereason is none!
ExitProgram();
}
}
private void bClose_Click(object sender, EventArgs e) {
HideForm();
}
private void MainForm_Resize(object sender, EventArgs e) {
if (WindowState == FormWindowState.Minimized) {
HideForm();
}
}
private void bApply_Click(object sender, EventArgs e) {
Program.SavePlugins();
}
private void bRestart_Click(object sender, EventArgs e) {
Application.Restart();
}
#region Tray icon
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e) {
activeToolStripMenuItem.Checked = Program.General.Active;
}
private void activeToolStripMenuItem_Click(object sender, EventArgs e) {
Program.General.Active = !Program.General.Active;
}
private void optionsToolStripMenuItem_Click(object sender, EventArgs e) {
ShowForm();
}
private void notifyIcon1_DoubleClick(object sender, EventArgs e) {
ShowForm();
}
private void shutdownToolStripMenuItem_Click(object sender, EventArgs e) {
ExitProgram();
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here