Next









How do I use Next
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


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: frmThiThat.cs Copy
50         void TaoBangRandomCauHoi(DataTable BangQuestion)
51         {
52
53             try
54             {
55                 Random Rnd = new Random();
56                 ArrayList ArrQuestion = new ArrayList();
57
58                 ArrQuestion.Clear();
59                 int x, dem = 0;
60                 int SoCauTrongBangGoc = BangQuestion.Rows.Count;
61                 while (dem < SoCauNgauNhien)
62                 {
63                     x = Rnd.Next(0, SoCauTrongBangGoc);
64                     if (!ArrQuestion.Contains(x))
65                     {
66                         ArrQuestion.Add(x);
67                         dem++;
68                     }
69                 }
70                 for (int j = SoCauTrongBangGoc - 1; j >= 0; j--)
71                     if (!ArrQuestion.Contains(j))
72                         BangQuestion.Rows.RemoveAt(j);
73
74                 BangDeThi = BangQuestion;
75                 BangDeThi.Columns.Add("cauhoi,DAPAN");
76
77             }
78             catch (Exception ex)
79             { MessageBox.Show(ex.Message); }
80
81         }
File name: frmThiThat.cs Copy
82         void TaoBangRandomCauTraLoi()
83         {
84             try
85             {
86                 SoCauHoi = BangDeThi.Rows.Count;
87                 string DapAnDung = "";
88                 string A, B, C, D;
89                 int DapAn;
90                 Random Rnd = new Random();
91                 ArrayList ArrDapAn = new ArrayList();
92                 for (int i = 0; i < SoCauHoi; i++)
93                 {
94                     A = "";
95                     B = "";
96                     C = "";
97                     D = "";
98                     DapAnDung = "";
99                     DapAn = 0;
100                     ArrDapAn.Clear();
101                     ArrDapAn.Add(2);
102                     ArrDapAn.Add(3);
103                     ArrDapAn.Add(4);
104                     ArrDapAn.Add(5);
105
106                     DapAn = Rnd.Next(ArrDapAn.Count);
107                     A = BangDeThi.Rows[i][(int)ArrDapAn[DapAn]].ToString();
108                     if ((BangDeThi.Rows[i][6].ToString().ToUpper().Contains("A") && (int)ArrDapAn[DapAn] == 2) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("B") && (int)ArrDapAn[DapAn] == 3) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("C") && (int)ArrDapAn[DapAn] == 4) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("D") && (int)ArrDapAn[DapAn] == 5))
109                         DapAnDung += "A";
110                     ArrDapAn.RemoveAt(DapAn);
111                     DapAn = Rnd.Next(ArrDapAn.Count);
112                     B = BangDeThi.Rows[i][(int)ArrDapAn[DapAn]].ToString();
113                     if ((BangDeThi.Rows[i][6].ToString().ToUpper().Contains("A") && (int)ArrDapAn[DapAn] == 2) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("B") && (int)ArrDapAn[DapAn] == 3) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("C") && (int)ArrDapAn[DapAn] == 4) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("D") && (int)ArrDapAn[DapAn] == 5))
114                         DapAnDung += "B";
115                     ArrDapAn.RemoveAt(DapAn);
116                     DapAn = Rnd.Next(ArrDapAn.Count);
117                     C = BangDeThi.Rows[i][(int)ArrDapAn[DapAn]].ToString();
118                     if ((BangDeThi.Rows[i][6].ToString().ToUpper().Contains("A") && (int)ArrDapAn[DapAn] == 2) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("B") && (int)ArrDapAn[DapAn] == 3) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("C") && (int)ArrDapAn[DapAn] == 4) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("D") && (int)ArrDapAn[DapAn] == 5))
119                         DapAnDung += "C";
120                     ArrDapAn.RemoveAt(DapAn);
121                     DapAn = Rnd.Next(ArrDapAn.Count);
122                     D = BangDeThi.Rows[i][(int)ArrDapAn[DapAn]].ToString();
123                     if ((BangDeThi.Rows[i][6].ToString().ToUpper().Contains("A") && (int)ArrDapAn[DapAn] == 2) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("B") && (int)ArrDapAn[DapAn] == 3) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("C") && (int)ArrDapAn[DapAn] == 4) || (BangDeThi.Rows[i][6].ToString().ToUpper().Contains("D") && (int)ArrDapAn[DapAn] == 5))
124                         DapAnDung += "D";
125                     BangDeThi.Rows[i][2] = A;
126                     BangDeThi.Rows[i][3] = B;
127                     BangDeThi.Rows[i][4] = C;
128                     BangDeThi.Rows[i][5] = D;
129                     BangDeThi.Rows[i][6] = DapAnDung;
130                 }
131             }
132             catch (Exception ex)
133             { MessageBox.Show(ex.Message); }
134         }
File name: frmThiThat.cs Copy
215         private void btPre_Click(object sender, EventArgs e)
216         {
217             try
218             {
219                 GhiLaiDapAnTS();
220                 if (CauHienTai > 0)
221                 {
222                     GhiLaiDapAnTS();
223                     btNext.Enabled = true;
224                     checkBox1.Checked = false;
225                     checkBox2.Checked = false;
226                     checkBox3.Checked = false;
227                     checkBox4.Checked = false;
228                     CauHienTai--;
229                     LoadCauHoiVaoControl();
230                 }
231                 if (CauHienTai == 0)
232                     btPre.Enabled = false;
233             }
234             catch (Exception ex)
235             { MessageBox.Show(ex.Message); }
236         }
File name: frmThiThat.cs Copy
238         private void btNext_Click(object sender, EventArgs e)
239         {
240             try
241             {
242                 GhiLaiDapAnTS();
243                 if (CauHienTai < SoCauHoi - 1)
244                 {
245                     GhiLaiDapAnTS();
246                     btPre.Enabled = true;
247                     checkBox1.Checked = false;
248                     checkBox2.Checked = false;
249                     checkBox3.Checked = false;
250                     checkBox4.Checked = false;
251                     CauHienTai++;
252                     LoadCauHoiVaoControl();
253                 }
254                 if (CauHienTai == SoCauHoi - 1)
255                     btNext.Enabled = false;
256             }
257             catch (Exception ex)
258             { MessageBox.Show(ex.Message); }
259         }
File name: ChatGui.cs Copy
103     public void OnGUI()
104     {
105         if (!this.IsVisible)
106         {
107             return;
108         }
109
110         GUI.skin.label.wordWrap = true;
111         //GUI.skin.button.richText = true; // this allows toolbar buttons to have bold/colored text. nice to indicate new msgs
112         //GUILayout.Button("lala"); // as richText, html tags could be in text
113
114
115         if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.KeypadEnter || Event.current.keyCode == KeyCode.Return))
116         {
117             if ("ChatInput".Equals(GUI.GetNameOfFocusedControl()))
118             {
119                 // focus on input -> submit it
120                 GuiSendsMsg();
121                 return; // showing the now modified list would result in an error. to avoid this, we just skip this single frame
122             }
123             else
124             {
125                 // assign focus to input
126                 GUI.FocusControl("ChatInput");
127             }
128         }
129
130         GUI.SetNextControlName("");
131         GUILayout.BeginArea(this.GuiRect);
132
133         GUILayout.FlexibleSpace();
134
135         if (this.chatClient.State != ChatState.ConnectedToFrontEnd)
136         {
137             GUILayout.Label("Not in chat yet.");
138         }
139         else
140         {
141             List channels = new List(this.chatClient.PublicChannels.Keys); // this could be cached
142             int countOfPublicChannels = channels.Count;
143             channels.AddRange(this.chatClient.PrivateChannels.Keys);
144
145             if (channels.Count > 0)
146             {
147                 int previouslySelectedChannelIndex = this.selectedChannelIndex;
148                 int channelIndex = channels.IndexOf(this.selectedChannelName);
149                 this.selectedChannelIndex = (channelIndex >= 0) ? channelIndex : 0;
150
151                 this.selectedChannelIndex = GUILayout.Toolbar(this.selectedChannelIndex, channels.ToArray(), GUILayout.ExpandWidth(false));
152                 this.scrollPos = GUILayout.BeginScrollView(this.scrollPos);
153
154                 this.doingPrivateChat = (this.selectedChannelIndex >= countOfPublicChannels);
155                 this.selectedChannelName = channels[this.selectedChannelIndex];
156
157                 if (this.selectedChannelIndex != previouslySelectedChannelIndex)
158                 {
159                     // changed channel -> scroll down, if private: pre-fill "to" field with target user's name
160                     this.scrollPos.y = float.MaxValue;
161                     if (this.doingPrivateChat)
162                     {
163                         string[] pieces = this.selectedChannelName.Split(new char[] {':'}, 3);
164                         this.userIdInput = pieces[1];
165                     }
166                 }
167
168                 GUILayout.Label(ChatGui.WelcomeText);
169
170                 if (this.chatClient.TryGetChannel(selectedChannelName, this.doingPrivateChat, out this.selectedChannel))
171                 {
172                     for (int i = 0; i < this.selectedChannel.Messages.Count; i++)
173                     {
174                         string sender = this.selectedChannel.Senders[i];
175                         object message = this.selectedChannel.Messages[i];
176                         GUILayout.Label(string.Format("{0}: {1}", sender, message));
177                     }
178                 }
179
180                 GUILayout.EndScrollView();
181             }
182         }
183
184
185         GUILayout.BeginHorizontal();
186         if (doingPrivateChat)
187         {
188             GUILayout.Label("to:", GUILayout.ExpandWidth(false));
189             GUI.SetNextControlName("WhisperTo");
190             this.userIdInput = GUILayout.TextField(this.userIdInput, GUILayout.MinWidth(100), GUILayout.ExpandWidth(false));
191             string focussed = GUI.GetNameOfFocusedControl();
192             if (focussed.Equals("WhisperTo"))
193             {
194                 if (this.userIdInput.Equals("username"))
195                 {
196                     this.userIdInput = "";
197                 }
198             }
199             else if (string.IsNullOrEmpty(this.userIdInput))
200             {
201                 this.userIdInput = "username";
202             }
203
204         }
205         GUI.SetNextControlName("ChatInput");
206         inputLine = GUILayout.TextField(inputLine);
207         if (GUILayout.Button("Send", GUILayout.ExpandWidth(false)))
208         {
209             GuiSendsMsg();
210         }
211         GUILayout.EndHorizontal();
212         GUILayout.EndArea();
213     }
File name: NamePickGui.cs Copy
38     public void OnGUI()
39     {
40         // Enter-Key handling:
41         if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.KeypadEnter || Event.current.keyCode == KeyCode.Return))
42         {
43             if (!string.IsNullOrEmpty(this.InputLine))
44             {
45                 this.StartChat();
46                 return;
47             }
48         }
49
50
51         GUI.skin.label.wordWrap = true;
52         GUILayout.BeginArea(guiCenteredRect);
53
54
55         if (this.chatComponent != null && string.IsNullOrEmpty(this.chatComponent.ChatAppId))
56         {
57             GUILayout.Label("To continue, configure your Chat AppId.\nIt's listed in the Chat Dashboard (online).\nStop play-mode and edit:\nScripts/ChatGUI in the Hierarchy.");
58             if (GUILayout.Button("Open Chat Dashboard"))
59             {
60                 Application.OpenURL("https://www.exitgames.com/en/Chat/Dashboard");
61             }
62             GUILayout.EndArea();
63             return;
64         }
65
66         GUILayout.Label(this.helpText);
67
68         GUILayout.BeginHorizontal();
69         GUI.SetNextControlName("NameInput");
70         this.InputLine = GUILayout.TextField(this.InputLine);
71         if (GUILayout.Button("Connect", GUILayout.ExpandWidth(false)))
72         {
73             this.StartChat();
74         }
75         GUILayout.EndHorizontal();
76
77         GUILayout.EndArea();
78
79
80         GUI.FocusControl("NameInput");
81     }
File name: PickupController.cs Copy
286     public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
287     {
288         if (stream.isWriting)
289         {
290             stream.SendNext(this.transform.position);
291             stream.SendNext((byte)this._characterState);
292         }
293         else
294         {
295             bool initialRemotePosition = (remotePosition == Vector3.zero);
296
297             remotePosition = (Vector3)stream.ReceiveNext();
298             this._characterState = (PickupCharacterState)((byte)stream.ReceiveNext());
299
300             if (initialRemotePosition)
301             {
302                 // avoids lerping the character from "center" to the "current" position when this client joins
303                 this.transform.position = remotePosition;
304             }
305         }
306     }
File name: ThirdPersonNetwork.cs Copy
31     void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
32     {
33         if (stream.isWriting)
34         {
35             //We own this player: send the others our data
36             stream.SendNext((int)controllerScript._characterState);
37             stream.SendNext(transform.position);
38             stream.SendNext(transform.rotation);
39         }
40         else
41         {
42             //Network player, receive data
43             controllerScript._characterState = (CharacterState)(int)stream.ReceiveNext();
44             correctPlayerPos = (Vector3)stream.ReceiveNext();
45             correctPlayerRot = (Quaternion)stream.ReceiveNext();
46         }
47     }
File name: NetworkCharacter.cs Copy
17     void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
18     {
19         if (stream.isWriting)
20         {
21             // We own this player: send the others our data
22             stream.SendNext(transform.position);
23             stream.SendNext(transform.rotation);
24
25             myThirdPersonController myC = GetComponent();
26             stream.SendNext((int)myC._characterState);
27         }
28         else
29         {
30             // Network player, receive data
31             this.correctPlayerPos = (Vector3)stream.ReceiveNext();
32             this.correctPlayerRot = (Quaternion)stream.ReceiveNext();
33
34             myThirdPersonController myC = GetComponent();
35             myC._characterState = (CharacterState)stream.ReceiveNext();
36         }
37     }

Download file with original file name:Next

Next 158 lượt xem

Gõ tìm kiếm nhanh...