-
Notifications
You must be signed in to change notification settings - Fork 6
/
Home.cs
173 lines (155 loc) · 5.21 KB
/
Home.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
163
164
165
166
167
168
169
170
171
172
173
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Kimathi_Construction
{
public partial class Home : Form
{
private static Home _instance;
public static Home Instance
{
get
{
if (_instance == null)
{
_instance = new Home();
}
return _instance;
}
}
public Home()
{
InitializeComponent();
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void SetToolTip(Control ctl, string message)
{
ToolTip toolTip1 = new ToolTip();
toolTip1.UseFading = true;
toolTip1.UseAnimation = true;
toolTip1.IsBalloon = true;
toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 1000;
toolTip1.ReshowDelay = 500;
toolTip1.ShowAlways = true;
toolTip1.SetToolTip(ctl, message);
}
private void TabSwitcher(Control UIinstance)
{
if (!this.containerUIs.Controls.Contains(UIinstance))
{
this.containerUIs.Controls.Add(UIinstance);
UIinstance.Dock = DockStyle.Fill;
UIinstance.Visible = false;
UIinstance.BringToFront();
try
{
using (BunifuAnimatorNS.BunifuTransition ss = new BunifuAnimatorNS.BunifuTransition())
{
ss.AnimationType = BunifuAnimatorNS.AnimationType.Mosaic;
//this.bunifuTransitionUIs
ss.ShowSync(UIinstance);
}
}
catch (InvalidOperationException)
{
//this exception occurs when the transition is not complete ;(
}
catch (System.Reflection.TargetInvocationException exp)
{
// MessageBox.Show(exp.Message + " \n" + exp.InnerException.Message);
}
catch (Exception exx)
{
// MessageBox.Show(exx.Message, "Try again");
}
}
else
{
UIinstance.Visible = false;
UIinstance.BringToFront();
try
{
using (BunifuAnimatorNS.BunifuTransition ss = new BunifuAnimatorNS.BunifuTransition())
{
ss.AnimationType = BunifuAnimatorNS.AnimationType.Mosaic;
//this.bunifuTransitionUIs
ss.ShowSync(UIinstance);
}
}
catch (InvalidOperationException)
{
//this exception occurs when the transition is not complete ;(
}
catch (System.Reflection.TargetInvocationException exp)
{
// MessageBox.Show(exp.Message + " \n" + exp.InnerException.Message);
}
catch (Exception exx)
{
// MessageBox.Show(exx.Message, "Try again");
}
finally
{
//incase of transition bug
UIinstance.Visible = true;
UIinstance.BringToFront();
}
}
containerUIs.Refresh();
}
private void tab1_Click(object sender, EventArgs e)
{
//UI code
bunifuSeparator1.Width = tab1.Width;
bunifuSeparator1.Left = tab1.Left;
//Show FeePayment
TabSwitcher(EmployeeUI.Instance);
//TODO Create a global loader
}
private void tab2_Click(object sender, EventArgs e)
{
//UI code
bunifuSeparator1.Width = tab2.Width;
bunifuSeparator1.Left = tab2.Left;
//Show FeePayment
TabSwitcher(StockUI.Instance);
//Create a global loader
}
private void Home_Load(object sender, EventArgs e)
{
//tab1 selected =true;
//Show FeeemploymentPayment
tab1_Click(sender, e);
}
private void tab3_Click(object sender, EventArgs e)
{
//UI code
bunifuSeparator1.Width = tab3.Width;
bunifuSeparator1.Left = tab3.Left;
//Show FeePayment
TabSwitcher(PayrollUI.Instance);
//Create a global loader
PayrollUI.Instance.Global_PayrollUI_Load();
}
private void tab4_Click(object sender, EventArgs e)
{
//UI code
bunifuSeparator1.Width = tab4.Width;
bunifuSeparator1.Left = tab4.Left;
//Show FeePayment
TabSwitcher(StatsUI.Instance);
//Create a global loader
StatsUI.Instance.Global_StatsUI_Load();
}
}
}