forked from comsmobiler/demo-coms-landscape
-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmMune.cs
258 lines (248 loc) · 10.5 KB
/
frmMune.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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
using COMSSmobilerDemo.Reimbursement.RB;
using COMSSmobilerDemo.Reimbursement.CostCenter;
using COMSSmobilerDemo.Message;
namespace COMSSmobilerDemo
{
partial class frmMune : Smobiler.Core.MobileForm
{
internal string ToolBarName = "";
/// <summary>
/// 显示左侧栏
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmMune_TitleImageClick(object sender, EventArgs e)
{
ShowSlider(Slider.Left);
}
private void frmMune_LeftLayoutItemClick(object sender, MobileFormLayoutItemEventArgs e)
{
ProcessLeftMenuFormName(e.CellItem.Name);
}
private void ProcessLeftMenuFormName(string leftLayoutActionName)
{
try
{
switch (leftLayoutActionName)
{
case "":
this.Close();
break;
case "imgindex":
case "btnindex":
//this.CloseSlider();
break;
case "imginfo":
case "btninfo":
frmInfo frm = new frmInfo();
this.Redirect(frm, (MobileForm sender1, object args) => ProcessLeftMenuFormName(frm.LeftLayoutAction));
break;
case "imgtz":
case "btntz":
frmMessage frmMessage = new frmMessage();
this.Redirect(frmMessage, (MobileForm sender1, object args) => ProcessLeftMenuFormName(frmMessage.LeftLayoutAction));
break;
case "imgbz":
case "btnbz":
frmHelp frmHelp = new frmHelp();
this.Redirect(frmHelp, (MobileForm sender1, object args) => ProcessLeftMenuFormName(frmHelp.LeftLayoutAction));
break;
case "imgtc":
case "btnExit":
MessageBox.Show("是否确定退出系统?", MessageBoxButtons.YesNo, (Object s, MessageBoxHandlerArgs args) =>
{
if (args.Result == Smobiler.Core.ShowResult.Yes)
{
this .Close ();
}
}
);
break;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private DateTime taosttime;
private bool handleExit = false;
/// <summary>
/// 手机自带回退按钮事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MobileForm_KeyDown(object sender, KeyDownEventArgs e)
{
if (e.KeyCode == KeyCode.Back)
{
HandleToast();
}
}
private void HandleToast()
{
if (handleExit == true && taosttime.AddSeconds(3) >= DateTime.Now)
{
handleExit = false;
this.Close();
}
else
{
handleExit = true;
taosttime = DateTime.Now;
this.Toast("再按一次退出系统", ToastLength.SHORT);
}
}
/// <summary>
/// 地理位置赋值
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Gps1_GotLocation(object sender, GPSData e)
{
try
{
if (e.Longitude.Equals(0) & e.Latitude.Equals(0))
{
this.LeftLayoutData.Items["lblAddress"].Text = "";
}
else
{
this.LeftLayoutData.Items["lblAddress"].Text = e.Location;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
/// <summary>
/// 菜单点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MenuView1_MenuItemClick(object sender, IconMenuItemEventArgs e)
{
switch (e.Item.ID)
{
case "MenuRB":
IconMenuViewGroup grp = new IconMenuViewGroup();
grp.Title = "报销";
grp.Items.Add(new IconMenuViewItem("RBMain", "报销", "RBMain"));
grp.Items.Add(new IconMenuViewItem("RBPostMain", "报销送审", "RBPostMain"));
grp.Items.Add(new IconMenuViewItem("RBCheckCofirmed", "责任人审批", "RBCheckCofirmed"));
grp.Items.Add(new IconMenuViewItem("RBChecking", "行政审批", "RBChecking"));
grp.Items.Add(new IconMenuViewItem("RBCheckAccounted", "财务审批", "RBCheckAccounted"));
IconMenuView1.ShowDialogMenu(grp);
break;
case "MenuWorkD":
COMSSmobilerDemo.WorkDocument.frmWorkDMain frmWorkDMain = new COMSSmobilerDemo.WorkDocument.frmWorkDMain();
this.Redirect(frmWorkDMain);
break;
case "MenuLeave":
COMSSmobilerDemo.Leave.frmLeaveGrid frmLeaveGrid = new COMSSmobilerDemo.Leave.frmLeaveGrid();
this.Redirect(frmLeaveGrid);
break;
case "MenuUnCCUser":
COMSSmobilerDemo.Reimbursement.CostCenter.frmAttentionCC frmAttentionCC =new COMSSmobilerDemo.Reimbursement.CostCenter.frmAttentionCC();
this.Redirect(frmAttentionCC);
break;
case "MenuSign":
COMSSmobilerDemo.SignIn.frmSignInMain frmSignInMain = new COMSSmobilerDemo.SignIn.frmSignInMain();
this.Redirect(frmSignInMain);
break;
case "MenuOperational":
COMSSmobilerDemo.Operational.frmOperationalRMain frmOperationalRMain =new COMSSmobilerDemo.Operational.frmOperationalRMain();
this.Redirect(frmOperationalRMain);
break;
case "RBMain":
COMSSmobilerDemo.Reimbursement.RB.frmRBMain frmRBMain = new COMSSmobilerDemo.Reimbursement.RB.frmRBMain();
this.Redirect(frmRBMain);
break;
case "RBPostMain":
COMSSmobilerDemo.Reimbursement.RB.frmRBPostMain frmRBPostMain = new COMSSmobilerDemo.Reimbursement.RB.frmRBPostMain();
this.Redirect(frmRBPostMain);
break;
case "RBCheckCofirmed":
COMSSmobilerDemo.Reimbursement.RB.frmRBCheck2 frmRBCheck2 = new COMSSmobilerDemo.Reimbursement.RB.frmRBCheck2();
this.Redirect(frmRBCheck2);
break;
case "RBChecking":
COMSSmobilerDemo.Reimbursement.RB.frmRBCheck3 frmRBCheck3 = new COMSSmobilerDemo.Reimbursement.RB.frmRBCheck3();
this.Redirect(frmRBCheck3);
break;
case "RBCheckAccounted":
COMSSmobilerDemo.Reimbursement.RB.frmRBCheck4 frmRBCheck4 = new COMSSmobilerDemo.Reimbursement.RB.frmRBCheck4();
this.Redirect(frmRBCheck4);
break;
case "MenuRItems":
COMSSmobilerDemo.RecipientsItems.frmRIMain frmRIMain = new COMSSmobilerDemo.RecipientsItems.frmRIMain();
this.Redirect(frmRIMain);
break;
case "MenuFixedAssets":
IconMenuViewGroup grp1 = new IconMenuViewGroup();
grp1.Items.Add(new IconMenuViewItem("NBMain", "笔记本", "NBMain"));
grp1.Items.Add(new IconMenuViewItem("BooksMain", "书", "BooksMain"));
grp1.Items.Add(new IconMenuViewItem("BooksLogCheckMain", "图书借阅", "BooksLogCheckMain"));
IconMenuView1.ShowDialogMenu(grp1);
break;
case "NBMain":
COMSSmobilerDemo.FixedAssets.NootBooks.frmNBMain frmNBMain = new COMSSmobilerDemo.FixedAssets.NootBooks.frmNBMain();
this.Redirect(frmNBMain);
break;
case "BooksMain":
COMSSmobilerDemo.FixedAssets.Books.frmBooksMain frmBooksMain = new COMSSmobilerDemo.FixedAssets.Books.frmBooksMain();
this.Redirect(frmBooksMain);
break;
case "BooksLogCheckMain":
COMSSmobilerDemo.FixedAssets.Books.frmBookLogCheckMain frmBookLogCheckMain = new COMSSmobilerDemo.FixedAssets.Books.frmBookLogCheckMain();
this.Redirect(frmBookLogCheckMain);
break;
}
}
/// <summary>
/// 初始化事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frmMune_Load(object sender, EventArgs e)
{
ScreenGestures();
Bind();
}
private void Bind()
{
LeftLayoutExtension.upleftLayoutbtncolorExt(this);
Gps1.GetGps();
}
//手势创建
private void ScreenGestures()
{
if (string.IsNullOrWhiteSpace(this.Client.Pattern.Password )== true)
{
//当设备手势密码为空时,进行手势创建
this.Client.Pattern.Create((object s1, Smobiler.Core.API.PatternCreatedEventArgs args) =>
{
if (args.IsError == true)
{
MessageBox.Show(args.ErrorInfo);
}
else
{
if (string.IsNullOrWhiteSpace(this.Client.Pattern.Password) == false)
{
//赋值手势密码
this.Client.Pattern.Password = args.Password;
}
}
});
}
}
}
}