-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFormFloating.cs
168 lines (146 loc) · 4.75 KB
/
FormFloating.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CefSharp;
using miniSys0._3.Controls;
using Sunny.UI;
using static Sunny.UI.UIAvatar;
namespace miniSys0._3
{
public partial class FormFloating : UIForm
{
public static FormFloating profileFloating;
public FormFloating()
{
InitializeComponent();
profileFloating = this;
userName.Text = User_type.user_name;
userPost.Text = "";
if (User_type.user_deparment != "Customer")
{
userPost.Text = User_type.user_post + " | " + User_type.user_ID;
}
else
{
userPost.Text = User_type.user_ID;
}
icon.Text = User_type.user_name.Substring(0,1);
icon.ForeColor = User_type.LogoFore;
icon.FillColor = User_type.LogoBkg;
InitTheme();
InitAvatar();
}
private void InitTheme()
{
if (User_type.user_theme == "dark")
{
this.BackColor = Color.FromArgb(28, 47, 70);
rectColor = Color.FromArgb(28, 47, 70);
dynamic[] lable = { userName, userPost };
foreach (var item in lable)
{
item.ForeColor = Color.White;
}
dynamic[] btns = { logoutButton2, exitButton1 };
foreach (var item in btns)
{
item.ForeColor = Color.White;
item.SymbolColor = Color.White;
item.FillColor = Color.FromArgb(55, 55, 57);
}
//logoutButton2.SymbolColor = Color.White;
}
}
private void uiSymbolButton1_Click(object sender, EventArgs e)
{
this.Close();
SearchBox.Instance.Hide();
FormFloating.profileFloating.Dispose();
Main.main.Dispose();
//UC_main.WebBrowser.Dispose();
//UC_main.WebBrowser1.Dispose();
//Reader.reader.Dispose();
//Cef.Shutdown();
Environment.Exit(0);
if (MessageBoxForm.Instance !=null)
{
MessageBoxForm.Instance.Hide();
}
}
private void logoutButton2_Click(object sender, EventArgs e)
{
//UC_main.WebBrowser.Dispose();
//UC_main.WebBrowser1.GetBrowser().CloseBrowser(true);
//UC_main.WebBrowser1.Dispose();
//Cef.Shutdown();
User_type.loginStatus = "Relogin";
Main.main.CSharpInc.Visible = false;
Login login = new Login();
login.Show();
this.Close();
ResetSetting();
Main.uniqueInstance = null;
Main.main.Hide();
}
private void ResetSetting()
{
User_type.user_avatarPath = "";
UserSettings.DefaultSetting();
}
public void InitAvatar()
{
if (User_type.user_avatarPath != "")
{
icon.Icon = UIIcon.Image;
icon.Image = Image.FromFile(User_type.user_avatarPath);
icon.Size = new Size(84, 84);
icon.AvatarSize = 84;
icon.Location = new Point(82, 9);
}
if (User_type.user_deparment != "Customer")
{
userPost.Text = User_type.user_post + " | " + User_type.user_ID;
}
else
{
userPost.Text = User_type.user_ID;
}
}
private int num = 1;
private void ChangeAvatarToImage()
{
if (num == 1)
{
icon.Icon = UIIcon.Image;
icon.Image = Image.FromFile(@"E:\Materials\【LOOP】\Assignment\miniSys0.3\Html\Avatars\1.jpg");
icon.Size = new Size(84, 84);
icon.AvatarSize = 84;
icon.Location = new Point(82, 9);
num = 0;
}
else
{
icon.Size = new Size(80, 80);
icon.AvatarSize = 80;
icon.Location = new Point(85, 12);
icon.Icon = UIIcon.Text;
num = 1;
}
}
private void button1_Click(object sender, EventArgs e)
{
ChangeAvatarToImage();
}
private void button1_Click_1(object sender, EventArgs e)
{
ChangeAvatarToImage();
}
}
}