Can
How do I use Can
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: frmLogin.cs
Copy
27 private void btThoat_Click(object sender, EventArgs e)
28 {
29 if (MessageBox.Show("Bạn có muốn thoát hay không ", "Thông Báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == DialogResult.OK)
30 {
31 this.Close();
32 }
33 }
File name: frmLuaChon.cs
Copy
29 private void btThoat_Click(object sender, EventArgs e)
30 {
31 if (MessageBox.Show("Bạn có muốn thoát hay không","Thông Báo",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning) == DialogResult.OK)
32 {
33 this.Close();
34 }
35 }
File name: frmLuaChon.cs
Copy
40 private void btBatDau_Click(object sender, EventArgs e)
41 {
42 if (cbcapdo.Text == "" || dmupdownsoluong.Text == "0" || dmupdownthoigian.Text == "0")
43 MessageBox.Show("Bạn cần chọn đầy đủ thông tin");
44 else
45 //this.Close();
46 showformthi();
47
48
49 }
File name: frmMain.cs
Copy
41 private void button1_Click(object sender, EventArgs e)
42 {
43 if (MessageBox.Show("Bạn có chắc chắn muốn thoát ?","Thông báo",MessageBoxButtons.OKCancel,MessageBoxIcon.Question)==DialogResult.OK)
44
45 {
46 Application.Exit();
47
48 }
49 }
File name: frmMain.cs
Copy
51 private void thoátToolStripMenuItem1_Click(object sender, EventArgs e)
52 {
53 if (MessageBox.Show("Bạn có chắc chắn muốn thoát ?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
54 {
55 Application.Exit();
56
57 }
58 }
File name: frmMain.cs
Copy
113 private void thoátToolStripMenuItem2_Click_1(object sender, EventArgs e)
114 {
115 if (MessageBox.Show("Bạn có chắc chắn muốn thoát ?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
116 {
117 Application.Exit();
118
119 }
120 }
File name: frmReg.cs
Copy
30 private void txt6_Validating_1(object sender, CancelEventArgs e)
31 {
32 if (string.IsNullOrEmpty(txt6.Text))
33 {
34 errorProvider1.SetError(txt6, "Bạn phải nhập giá trị vào ô này");
35 e.Cancel = true;
36 }
37 else
38 {
39 errorProvider1.Clear();
40 }
41 }
File name: frmThi.cs
Copy
197 private void btNext_Click(object sender, EventArgs e)
198 {
199 test();
200 getdapan();
201 iRows += sodonghienlen;
202 getData(iRows);
203 if (i < 1)
204 return;
205 else
206 {
207 //strsoluongcauhoi1 = frmluachon.strsoluongcauhoi;
208 i++;
209 if (int.Parse(strsoluongcauhoi1)< i)
210 {
211 groupBox1.Text = " Nội dung câu hỏi " + i.ToString();
212 if (MessageBox.Show("Bạn đã làm xong","Thông báo",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning)== DialogResult.OK)
213 {
214
215 }
216 }
217 else
218 {
219 groupBox1.Text = " Nội dung câu hỏi " + i.ToString();
220 }
221 }
222 j = j + 1;
223 }
File name: ChatGui.cs
Copy
296 public void OnConnected()
297 {
298 if (this.ChannelsToJoinOnConnect != null && this.ChannelsToJoinOnConnect.Length > 0)
299 {
300 this.chatClient.Subscribe(this.ChannelsToJoinOnConnect, this.HistoryLengthToFetch);
301 }
302
303 this.chatClient.AddFriends(new string[] {"tobi", "ilya"}); // Add some users to the server-list to get their status updates
304 this.chatClient.SetOnlineStatus(ChatUserStatus.Online); // You can set your online state (without a mesage).
305 }
File name: GUICustomAuth.cs
Copy
81 void OnGUI()
82 {
83 if (PhotonNetwork.connected)
84 {
85 GUILayout.Label(PhotonNetwork.connectionStateDetailed.ToString());
86 return;
87 }
88
89
90 GUILayout.BeginArea(GuiRect);
91 switch (guiState)
92 {
93 case GuiState.AuthFailed:
94 GUILayout.Label("Authentication Failed");
95
96 GUILayout.Space(10);
97
98 GUILayout.Label("Error message:\n'" + this.authDebugMessage + "'");
99
100 GUILayout.Space(10);
101
102 GUILayout.Label("For this demo set the Authentication URL in the Dashboard to:\nhttp://photon.webscript.io/auth-demo-equals");
103 GUILayout.Label("That authentication-service has no user-database. It confirms any user if 'name equals password'.");
104 GUILayout.Label("The error message comes from that service and can be customized.");
105
106 GUILayout.Space(10);
107
108 GUILayout.BeginHorizontal();
109 if (GUILayout.Button("Back"))
110 {
111 SetStateAuthInput();
112 }
113 if (GUILayout.Button("Help"))
114 {
115 SetStateAuthHelp();
116 }
117 GUILayout.EndHorizontal();
118 break;
119
120 case GuiState.AuthHelp:
121
122 GUILayout.Label("By default, any player can connect to Photon.\n'Custom Authentication' can be enabled to reject players without valid user-account.");
123
124 GUILayout.Label("The actual authentication must be done by a web-service which you host and customize. Example sourcecode for these services is available on the docs page.");
125
126 GUILayout.Label("For this demo set the Authentication URL in the Dashboard to:\nhttp://photon.webscript.io/auth-demo-equals");
127 GUILayout.Label("That authentication-service has no user-database. It confirms any user if 'name equals password'.");
128
129 GUILayout.Space(10);
130 if (GUILayout.Button("Configure Authentication (Dashboard)"))
131 {
132 Application.OpenURL("https://cloud.exitgames.com/dashboard");
133 }
134 if (GUILayout.Button("Authentication Docs"))
135 {
136 Application.OpenURL("https://doc.exitgames.com/en/pun/current/tutorials/pun-and-facebook-custom-authentication");
137 }
138
139
140 GUILayout.Space(10);
141 if (GUILayout.Button("Back to input"))
142 {
143 SetStateAuthInput();
144 }
145 break;
146
147 case GuiState.AuthInput:
148
149 GUILayout.Label("Authenticate yourself");
150
151 GUILayout.BeginHorizontal();
152 this.authName = GUILayout.TextField(this.authName, GUILayout.Width(Screen.width/4 - 5));
153 GUILayout.FlexibleSpace();
154 this.authToken = GUILayout.TextField(this.authToken, GUILayout.Width(Screen.width/4 - 5));
155 GUILayout.EndHorizontal();
156
157
158 if (GUILayout.Button("Authenticate"))
159 {
160 PhotonNetwork.AuthValues = new AuthenticationValues();
161 PhotonNetwork.AuthValues.SetAuthParameters(this.authName, this.authToken);
162 PhotonNetwork.ConnectUsingSettings("1.0");
163 }
164
165 GUILayout.Space(10);
166
167 if (GUILayout.Button("Help", GUILayout.Width(100)))
168 {
169 SetStateAuthHelp();
170 }
171
172 break;
173 }
174
175 GUILayout.EndArea();
176 }
Download file with original file name:Can
Can 99 lượt xem
Gõ tìm kiếm nhanh...