-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFormApp.cs
162 lines (139 loc) · 4.52 KB
/
FormApp.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/***************************************************************************************
* Copyright (C) 2021 Fran Vojković, Martina Gaćina, Matea Čotić, Mirna Keser *
* *
* This file is part of the RP3_Projekt project. *
* *
***************************************************************************************/
using System;
using System.Windows.Forms;
namespace CaffeBar
{
public partial class FormApp : Form
{
//[/ <summary>
/// Main window for application.
/// </summary>
public FormApp()
{
InitializeComponent();
SuspendLayout();
costumizeDesign();
ResumeLayout();
}
#region Toggle subMenu.Visible
private void costumizeDesign()
{
panelManagmentSubmenu.Visible = false;
panelRegisterSubmenu.Visible = false;
}
private void hideSubmenu()
{
if (panelRegisterSubmenu.Visible == true)
panelRegisterSubmenu.Visible = false;
if (panelManagmentSubmenu.Visible == true)
panelManagmentSubmenu.Visible = false;
}
private void showSubMenu(Panel subMenu)
{
if (subMenu.Visible == false)
{
hideSubmenu();
subMenu.Visible = true;
}
else
subMenu.Visible = false;
}
#endregion
#region Submenu
private void buttonRegister_Click(object sender, EventArgs e)
{
showSubMenu(panelRegisterSubmenu);
}
private void buttonNewReceipt_Click(object sender, EventArgs e)
{
openSubForm(new FormNewReceipt());
hideSubmenu();
}
private void button3_Click(object sender, EventArgs e)
{
openSubForm(new FormConsumption());
hideSubmenu();
}
private void button4_Click(object sender, EventArgs e)
{
openSubForm(new FromReceipts());
hideSubmenu();
}
#endregion
#region ManagmentSubmenu
private void buttonManagment_Click(object sender, EventArgs e)
{
showSubMenu(panelManagmentSubmenu);
}
private void button7_Click(object sender, EventArgs e)
{
openSubForm(new FormBackStorage());
hideSubmenu();
}
private void button6_Click(object sender, EventArgs e)
{
openSubForm(new FormAddToHappyHour());
hideSubmenu();
}
private void button5_Click(object sender, EventArgs e)
{
hideSubmenu();
}
#endregion
#region Help
private void buttonHelp_Click(object sender, EventArgs e)
{
openSubForm(new FormHelp());
hideSubmenu();
}
#endregion
private void buttonAccounts_Click(object sender, EventArgs e)
{
hideSubmenu();
}
private Form activeForm = null;
private void openSubForm(Form subForm)
{
if (activeForm != null)
activeForm.Close();
activeForm = subForm;
subForm.TopLevel = false;
subForm.FormBorderStyle = FormBorderStyle.None;
subForm.Dock = DockStyle.Fill;
panelChieldForm.Controls.Add(subForm);
panelChieldForm.Tag = subForm;
subForm.BringToFront();
subForm.Show();
}
private void buttonLogout_Click(object sender, EventArgs e)
{
Application.Restart();
}
private void FormApp_Load(object sender, EventArgs e)
{
//User.name = "konobar";
//User.authorisation = "admin";
//User.id = 4;
User.showNotification = true;
buttonUser.Text = " " + User.name;
if (User.authorisation.Contains("Konobar"))
{
this.buttonAccounts.Dispose();
}
}
private void buttonAccounts_Click_1(object sender, EventArgs e)
{
openSubForm(new FormAccounts());
hideSubmenu();
}
private void FormApp_FormClosed(object sender, FormClosedEventArgs e)
{
Application.Exit();
}
}
}