private void timer1_Tick(object sender, EventArgs e) { if (Ss == 0 && Mm == 0 && Hh == 0) { this.Close(); Environment.Exit(0); } if (Ss == 0) { if (Mm == 0) { Hh--; Mm += 59; Ss += 59; } else { Mm--; Ss += 59; } } else { Ss--; } textBox1.Text = (Hh < 10 ? "0" + Hh.ToString() : Hh.ToString()); textBox2.Text = (Mm < 10 ? "0" + Mm.ToString() : Mm.ToString()); textBox3.Text = (Ss < 10 ? "0" + Ss.ToString() : Ss.ToString()); }
public void Test0() { var aa = new Ss(); Console.WriteLine(aa.i); Assert.Fail(); }
static void Main() { Sc sc = new Sc(); int n = sc.I; for (int i = 0; i < n; i++) { string[] s = sc.Sa; if (!hs.ContainsKey(s[0])) { hs.Add(s[0], new List <Ss>()); hs[s[0]].Add(new Ss("", 1)); } hs[s[0]].Add(new Ss(s[2], int.Parse(s[1]))); if (!hs.ContainsKey(s[2])) { hs.Add(s[2], new List <Ss>()); hs[s[2]].Add(new Ss("", 0)); } else { Ss q = hs[s[2]][0]; q.n = 0; hs[s[2]][0] = q; } hs[s[2]].Add(new Ss(s[0], 1.0 / int.Parse(s[1]))); } foreach (KeyValuePair <string, List <Ss> > e in hs) { Fu(e.Key, e.Key, 1); } Console.WriteLine("{0}{1}={2}{3}", ans1.n, ans1.s, Math.Round(ans2.n), ans2.s); }
private void eDownInfoToBox(object sender, DataReceivedEventArgs e) { if (e.Data != null) { if (this.IsHandleCreated) { this.BeginInvoke(new Action <string>((result) => { string[] results = result.Split('\n'); foreach (string Ss in results) { if (Ss.EndsWith("&exit") && !this.IsPrint) { this.IsPrint = true; continue; } if (!Ss.StartsWith(" ") && this.IsPrint) { string[] SSS = Ss.Split(' '); this.listBox1.Items.Add(SSS[0]); } } }), new object[] { e.Data }); } } }
private static void VerifyStructWithValueConstant(Ss value) { Expression <Func <Ss> > e = Expression.Lambda <Func <Ss> >( Expression.Constant(value, typeof(Ss)), Enumerable.Empty <ParameterExpression>()); Func <Ss> f = e.Compile(); Assert.Equal(value, f()); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { ComboBox comboBox = (ComboBox)sender; string chosenTable = databaseTablePicker1.SelectedValue.ToString(); TableFetch tablevar = new TableFetch(); tablevar.tablechoice = chosenTable; Ss Select = new Ss { Sql = "SELECT * FROM " + tablevar.tablechoice }; if (tablevar.tablechoice == "System.Data.DataRowView") { } else { databaseTablePickerLabel1.Visible = false; try { //pretty much everything but a simple table call with MYSQL probably needs a try block MSQC congrid = new MSQC(); MySqlConnection con1 = new MySqlConnection(congrid.Mysqc); con1.Open(); MySqlDataAdapter adapter1 = new MySqlDataAdapter(Select.Sql, con1); ///////////begin filling table DataSet ds = new DataSet(); //adapt the data to fill it into the table adapter1.Fill(ds, "MadonnaSongs"); dataGridView1.DataSource = ds.Tables["MadonnaSongs"]; VarGrab.sqlrows = dataGridView1.RowCount; //this is going to be important for looping //need to send this to the next form TablePass.chosentable = tablevar.tablechoice; } catch (MySqlException ex) { MessageBox.Show(Select.Sql + "Error: " + ex.ToString()); } } }
static void Fu(string s, string n, double d) { Ss q = hs[n][0]; q.s = s; hs[n][0] = q; for (int i = 1; i < hs[n].Count; i++) { if (hs[hs[n][i].s][0].s != s) { Fu(s, hs[n][i].s, d * hs[n][i].n); } } if (d > ans2.n) { ans1.s = s; ans2.s = n; ans2.n = d; } }
//next event updates the MYSQL tables. private void updateSQLButton_Click(object sender, EventArgs e) { ////-\\\\\ATTENTION: Dr. Spears: /*I could have done a whole thing where I had many albums and many songs and used JOINS but this * a test of what you taught me in C# not my incredible SQL prowess .*/ Ss Update = new Ss(); Update.Sql = null; //its safer to null this each loop before we get to business. if (!(checkBox1.Checked) && !(checkBox2.Checked) && !(checkBox3.Checked)) { debugLabel1.Visible = true; debugLabel1.Text = "You WILL select a box to proceed!"; } else if (checkBox1.Checked) { debugLabel1.Visible = false; Update.Sql = "UPDATE " + TablePass.chosentable + " SET SongTitle= '" + LevGrab.controlViewArray[0] + "' WHERE SongTitle = '" + LevGrab.problemViewArray[0] + "' "; UpdateMySQL(Update.Sql); } else if (checkBox2.Checked) { debugLabel1.Visible = false; Update.Sql = "UPDATE " + TablePass.chosentable + " SET SongTitle= '" + LevGrab.controlViewArray[1] + "' WHERE SongTitle = '" + LevGrab.problemViewArray[1] + "' "; UpdateMySQL(Update.Sql); } else if (checkBox3.Checked) { debugLabel1.Visible = false; Update.Sql = "UPDATE " + TablePass.chosentable + " SET SongTitle= '" + LevGrab.controlViewArray[2] + "' WHERE SongTitle = '" + LevGrab.problemViewArray[2] + "' "; UpdateMySQL(Update.Sql); } //Reset all checkboxes to be Enabled and unchecked. checkboxReset(); System.Drawing.Color backcolor2 = System.Drawing.ColorTranslator.FromHtml("#AADAFF"); generateMatches.BackColor = backcolor2; System.Drawing.Color transcolor2 = System.Drawing.ColorTranslator.FromHtml("#000000"); updateSQLButton.BackColor = transcolor2; }
void Achieve() // 일정 수를 넘으면 포인트 획득하는걸로 { if (a_time > 3600) { Tb.SetActive(true); } if (a_time > 7200) { Ts.SetActive(true); } if (a_time > 10800) { Tg.SetActive(true); } if (a_UsedItem > 50) { Ub.SetActive(true); } if (a_UsedItem > 150) { Us.SetActive(true); } if (a_UsedItem > 350) { Ug.SetActive(true); } if (a_Score > 1000) { Sb.SetActive(true); } if (a_Score > 3000) { Ss.SetActive(true); } if (a_Score > 5000) { Sg.SetActive(true); } }
private static void VerifyStructWithValueArrayWithUShortSize(ushort size) { // generate the expression Expression<Func<Ss[]>> e = Expression.Lambda<Func<Ss[]>>( Expression.NewArrayBounds(typeof(Ss), Expression.Constant(size, typeof(ushort))), Enumerable.Empty<ParameterExpression>()); Func<Ss[]> f = e.Compile(); // get the array Ss[] result = null; Exception creationEx = null; try { result = f(); } catch (Exception ex) { creationEx = ex; } // generate expected array Ss[] expected = null; Exception expectedEx = null; try { expected = new Ss[(long)size]; } catch (Exception ex) { expectedEx = ex; } // if one failed, verify the other did, too if (creationEx != null || expectedEx != null) { Assert.NotNull(creationEx); Assert.NotNull(expectedEx); Assert.Equal(expectedEx.GetType(), creationEx.GetType()); } else { // otherwise, verify the contents array Assert.Equal(expected.Length, result.Length); for (int i = 0; i < result.Length; i++) { Assert.Equal(expected[i], result[i]); } } }
private async void btnControlsConfigure_Click(object sender, RoutedEventArgs e) { // get button name Button button = (Button)sender; string name = button.Name; // remove beginning and end name = name.Replace("btn", "").Replace("Configure", ""); // get the relevant combox ComboBox cb = (ComboBox)this.FindName("cmb" + name); // get the virtual port number string selectedString = cb.SelectionBoxItem.ToString(); int portNum = Convert.ToInt32(selectedString.Replace("Virtual Port ", "")); DeviceDefinition dev = new DeviceDefinition(); switch (name) { case "SsGamepad": dev = Ss.GamePad(portNum); break; case "Ss3DGamepad": dev = Ss.ThreeD(portNum); break; case "SsMission": dev = Ss.Mission(portNum); break; case "SsDualMission": dev = Ss.DMission(portNum); break; case "SsWheel": dev = Ss.Wheel(portNum); break; case "SsGun": dev = Ss.Gun(portNum); break; case "SsMouse": dev = Ss.Mouse(portNum); break; default: return; } mw.ControllerDefinition = dev; // launch controller configuration window Grid RootGrid = (Grid)mw.FindName("RootGrid"); await mw.ShowChildWindowAsync(new ConfigureController() { IsModal = true, AllowMove = false, Title = "Controller Configuration", CloseOnOverlay = false, CloseByEscape = false, ShowCloseButton = false }, RootGrid); }
public SsPage() { try { ss = new Ss(Globals.handleModem0); } catch (Exception ex) { Log.Debug(Globals.LogTag, "Ss constructor throws exception = " + ex.ToString()); } var setCfBtn = new Button { Text = "Set SS call forward", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand }; setCfBtn.Clicked += setCfBtn_Clicked; var getCfBtn = new Button { Text = "Get SS call forward status", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand }; getCfBtn.Clicked += getCfBtn_Clicked; var setcwBtn = new Button { Text = "Set SS call waiting", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand }; setcwBtn.Clicked += setcwBtn_Clicked; var getcwBtn = new Button { Text = "Get SS call waiting status", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand }; getcwBtn.Clicked += getcwBtn_Clicked; var setCliBtn = new Button { Text = "Set SS CLI status", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand }; setCliBtn.Clicked += setCliBtn_Clicked; var getCliBtn = new Button { Text = "Get SS CLI status", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand }; getCliBtn.Clicked += getCliBtn_Clicked; var setBarringBtn = new Button { Text = "Set SS barring", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand }; setBarringBtn.Clicked += setBarringBtn_Clicked; var getBarringBtn = new Button { Text = "Get SS barring status", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand }; getBarringBtn.Clicked += getBarringBtn_Clicked; var changeBarringPwBtn = new Button { Text = "Change SS barring password", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand }; changeBarringPwBtn.Clicked += changeBarringPwBtn_Clicked; var sendUssdBtn = new Button { Text = "Ss send USSD request", VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.FillAndExpand }; sendUssdBtn.Clicked += sendUssdBtn_Clicked; Content = new StackLayout { VerticalOptions = LayoutOptions.Center, Children = { setCfBtn, getCfBtn, setcwBtn, getcwBtn, setCliBtn, getCliBtn, setBarringBtn, getBarringBtn, changeBarringPwBtn, sendUssdBtn } }; }