mirror of
https://github.com/Crypto-Notepad/Crypto-Notepad.git
synced 2026-03-11 08:55:25 +00:00
Resolved #35
This commit is contained in:
parent
5ffbe004bf
commit
e8e2167c3d
4 changed files with 79 additions and 23 deletions
|
|
@ -147,6 +147,12 @@
|
|||
<setting name="mlStyle" serializeAs="String">
|
||||
<value>Solid</value>
|
||||
</setting>
|
||||
<setting name="minimizeToTray" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="closeToTray" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="alwaysOnTop" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
|
|
|
|||
|
|
@ -604,6 +604,10 @@ private void LoadSettings()
|
|||
toolbarPanel.BorderStyle = BorderStyle.None;
|
||||
}
|
||||
|
||||
if (settings.closeToTray | settings.minimizeToTray)
|
||||
{
|
||||
trayIcon.Visible = true;
|
||||
}
|
||||
wordWrapMainMenu.Checked = settings.editorWrap;
|
||||
|
||||
toolbarPanel.BackColor = settings.toolbarBackColor;
|
||||
|
|
@ -727,21 +731,27 @@ public void Toolbaricons(bool oldIcons)
|
|||
|
||||
|
||||
#region Event Handlers
|
||||
private void MainWindow_Activated(object sender, EventArgs e)
|
||||
private void MainForm_Resize(object sender, EventArgs e)
|
||||
{
|
||||
richTextBox.Focus();
|
||||
|
||||
if (PublicVar.keyChanged)
|
||||
if (settings.minimizeToTray)
|
||||
{
|
||||
richTextBox.Modified = true;
|
||||
if (WindowState == FormWindowState.Minimized)
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
|
||||
if (PublicVar.encryptionKey.Get() == null)
|
||||
if (WindowState == FormWindowState.Minimized & settings.autoLock & PublicVar.encryptionKey.Get() != null)
|
||||
{
|
||||
fileLocationToolbarButton.Enabled = false;
|
||||
deleteFileToolbarButton.Enabled = false;
|
||||
changeKeyToolbarButton.Enabled = false;
|
||||
lockToolbarButton.Enabled = false;
|
||||
pnlEnterKey.Visible = true;
|
||||
}
|
||||
|
||||
if (WindowState == FormWindowState.Normal)
|
||||
{
|
||||
if (pnlEnterKey.Visible)
|
||||
{
|
||||
txtKey.Focus();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -755,19 +765,17 @@ private void MainWindow_Activated(object sender, EventArgs e)
|
|||
|
||||
private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (WindowState == FormWindowState.Normal)
|
||||
if (settings.closeToTray)
|
||||
{
|
||||
settings.windowSize = Size;
|
||||
settings.windowLocation = Location;
|
||||
settings.windowState = WindowState;
|
||||
if (settings.autoLock & PublicVar.encryptionKey.Get() != null)
|
||||
{
|
||||
pnlEnterKey.Visible = true;
|
||||
}
|
||||
Hide();
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (WindowState == FormWindowState.Maximized)
|
||||
{
|
||||
settings.windowState = WindowState;
|
||||
}
|
||||
settings.Save();
|
||||
|
||||
SaveConfirm(true);
|
||||
|
||||
if (preventExit)
|
||||
|
|
@ -1184,7 +1192,11 @@ private void DeleteFileToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
||||
private void ExitMainMenu_Click(object sender, EventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
SaveConfirm(true);
|
||||
if (settings.closeToTray)
|
||||
{
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void fileMainMenu_DropDownOpened(object sender, EventArgs e)
|
||||
|
|
@ -1670,6 +1682,11 @@ private void FindNextButton_Click(object sender, EventArgs e)
|
|||
#endregion
|
||||
|
||||
|
||||
SaveConfirm(true);
|
||||
if (settings.closeToTray)
|
||||
{
|
||||
Environment.Exit(0);
|
||||
}
|
||||
#region Debug Menu
|
||||
private void VariablesMainMenu_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
|
|
|||
29
Crypto Notepad/Properties/Settings.Designer.cs
generated
29
Crypto Notepad/Properties/Settings.Designer.cs
generated
|
|
@ -1,4 +1,4 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
|
|
@ -608,6 +608,33 @@ public string mlStyle {
|
|||
this["mlStyle"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool minimizeToTray {
|
||||
get {
|
||||
return ((bool)(this["minimizeToTray"]));
|
||||
}
|
||||
set {
|
||||
this["minimizeToTray"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool closeToTray {
|
||||
get {
|
||||
return ((bool)(this["closeToTray"]));
|
||||
}
|
||||
set {
|
||||
this["closeToTray"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Configuration.SettingsProviderAttribute(typeof(PortableSettingsProvider))]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Crypto_Notepad.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
|
|
@ -137,6 +137,12 @@
|
|||
<Setting Name="mlStyle" Provider="PortableSettingsProvider" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Solid</Value>
|
||||
</Setting>
|
||||
<Setting Name="minimizeToTray" Provider="PortableSettingsProvider" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="closeToTray" Provider="PortableSettingsProvider" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="alwaysOnTop" Provider="PortableSettingsProvider" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
|
|
|
|||
Loading…
Reference in a new issue