-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMessageBoxForm.cs
151 lines (127 loc) · 4.14 KB
/
MessageBoxForm.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
using miniSys0._3.Controls.Others;
using Sunny.UI;
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 miniSys0._3
{
public partial class MessageBoxForm : UIForm
{
public static MessageBoxForm Instance;
private Color btnColor = Color.Black;
public MessageBoxForm()
{
InitializeComponent();
Instance = this;
InitEvent();
InitTheme();
}
public void InitTheme()
{
dynamic[] lable = { mark,delect};
uiLine1.FillColor = Color.Transparent;
uiLine2.FillColor = Color.Transparent;
if (User_type.user_theme == "dark")
{
this.BackColor = Color.FromArgb(28, 47, 70);
this.rectColor = Color.FromArgb(28, 47, 70);
ShowShadow = false;
foreach (var item in lable)
{
item.ForeColor = Color.White;
}
uiLine1.LineColor = Color.FromArgb(55, 55, 57);
uiLine2.LineColor = Color.FromArgb(55, 55, 57);
btnColor = Color.White;
}
else if (User_type.user_theme=="light")
{
this.BackColor = Color.White;
ShowShadow = true;
foreach (var item in lable)
{
item.ForeColor = Color.Black;
}
uiLine1.LineColor = Color.Gainsboro;
uiLine2.LineColor = Color.Gainsboro;
btnColor = Color.Black;
}
}
public void Init(List<dynamic> messageInfoList)
{
InitTheme();
panel.Controls.Clear();
for (int i = 0; i < messageInfoList.Count; i++)
{
UC_Message_Card message_Card = new UC_Message_Card();
message_Card.Location = new Point(0, i * 80);
message_Card.Init(messageInfoList[i]);
panel.Controls.Add(message_Card);
}
}
private void InitEvent()
{
mark.MouseHover += new EventHandler(btnHover);
delect.MouseHover += new EventHandler(btnHover);
mark.MouseLeave += new EventHandler(btnLeave);
delect.MouseLeave += new EventHandler(btnLeave);
}
private void btnHover(object sender, EventArgs e)
{
if (sender.Equals(mark))
{
mark.ForeColor = Color.FromArgb(22, 93, 255);
}
else if (sender.Equals(delect))
{
delect.ForeColor = Color.FromArgb(22, 93, 255);
}
}
private void btnLeave(object sender, EventArgs e)
{
if (sender.Equals(mark))
{
mark.ForeColor = btnColor;
}
else if (sender.Equals(delect))
{
delect.ForeColor = btnColor;
}
}
private void mark_Click(object sender, EventArgs e)
{
string sql = "UPDATE Messages SET Status = 1 WHERE " + curOrSta();
SQLCursor.Execute(sql);
Main.main.checkMessage();
Init(Main.main.messagesList);
}
private void delect_Click(object sender, EventArgs e)
{
string sql = "UPDATE Messages SET Status = -1 WHERE " + curOrSta();
SQLCursor.Execute(sql);
Main.main.checkMessage();
Init(Main.main.messagesList);
}
private string curOrSta()
{
//return receiverID_cus == 'Sta000011';
string useID = User_type.user_ID;
string first = useID.Substring(0, 3);
if (first == "Cus")
{
return $"receiverID_cus = '{useID}';";
}
else if (first == "Sta")
{
return $"receiverID_sta = '{useID}';";
}
return null;
}
}
}