Private
Public Access
Menu reopens when all windows are closed
This commit is contained in:
1 parent
5d2513d6af
commit
a911defa29
5 files changed
+52
-16
No files matched your search
+32
-1
@@ -12,6 +12,21 @@
|
|||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
|
<PublishUrl>publish\</PublishUrl>
|
||||||
|
<Install>true</Install>
|
||||||
|
<InstallFrom>Disk</InstallFrom>
|
||||||
|
<UpdateEnabled>false</UpdateEnabled>
|
||||||
|
<UpdateMode>Foreground</UpdateMode>
|
||||||
|
<UpdateInterval>7</UpdateInterval>
|
||||||
|
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||||
|
<UpdatePeriodically>false</UpdatePeriodically>
|
||||||
|
<UpdateRequired>false</UpdateRequired>
|
||||||
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@@ -32,6 +47,10 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<StartupObject>
|
||||||
|
</StartupObject>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
@@ -52,7 +71,7 @@
|
|||||||
<Compile Include="Console.Designer.cs">
|
<Compile Include="Console.Designer.cs">
|
||||||
<DependentUpon>Console.cs</DependentUpon>
|
<DependentUpon>Console.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Settings.cs" />
|
<Compile Include="SettingsAndHelperFunctions.cs" />
|
||||||
<Compile Include="Menu.cs">
|
<Compile Include="Menu.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -89,5 +108,17 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
|
||||||
|
<Install>true</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||||
|
<Install>false</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@@ -19,8 +19,8 @@ namespace Advanced_Software_Engineering
|
|||||||
|
|
||||||
private void Console_FormClosed(object sender, FormClosedEventArgs e)
|
private void Console_FormClosed(object sender, FormClosedEventArgs e)
|
||||||
{
|
{
|
||||||
SettingsAndHelperFunctions.NumberOfWindows--;
|
SettingsAndHelperFunctions.WindowClosed();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -41,11 +41,6 @@ namespace Advanced_Software_Engineering
|
|||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CheckWindows()
|
|
||||||
{
|
|
||||||
if (SettingsAndHelperFunctions.NumberOfWindows == 0) Menu.Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Menu_Load(object sender, EventArgs e)
|
private void Menu_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//Do things on load
|
//Do things on load
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ namespace Advanced_Software_Engineering
|
|||||||
{
|
{
|
||||||
static class Program
|
static class Program
|
||||||
{
|
{
|
||||||
|
public static Form MainMenu;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -16,7 +18,9 @@ namespace Advanced_Software_Engineering
|
|||||||
{
|
{
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
Application.Run(new Menu());
|
|
||||||
|
MainMenu = new Menu();
|
||||||
|
Application.Run(MainMenu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+13
-7
@@ -1,14 +1,20 @@
|
|||||||
using System;
|
using System.Windows.Forms;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace Advanced_Software_Engineering
|
namespace Advanced_Software_Engineering
|
||||||
{
|
{
|
||||||
class SettingsAndHelperFunctions
|
public class SettingsAndHelperFunctions
|
||||||
{
|
{
|
||||||
public static int NumberOfWindows = 0;
|
public static int NumberOfWindows = 0;
|
||||||
|
|
||||||
|
public static void WindowClosed()
|
||||||
|
{
|
||||||
|
NumberOfWindows--;
|
||||||
|
if (NumberOfWindows == 0)
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("Showing MainMenu");
|
||||||
|
Program.MainMenu.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user