/// <summary>Called when the form is submitted through onsubmit="FormExampleHandler.OnSubmit".</summary> /// <param name="form">A simple object holding the values of all your form inputs by name.</param> public static void OnSubmit(FormEvent form) { Debug.Log("Form submitted!"); // Usage is simply form["fieldName"], or form.Checked("fieldName") for easily checking if a checkbox is ticked. // You can alternatively use e.g. UI.document.getElementById("aFieldsID").value and manage radio inputs manually. Debug.Log("handling a form with C#."); // Give a feedback message to show something's happened: UI.document.getElementById("csMessage").innerHTML = "Please check the console!"; // And simply log all the fields of the form: Debug.Log("Your name: " + form["yourName"]); Debug.Log("Awesome? " + form.Checked("awesome")); Debug.Log("Epic? " + form.Checked("epic")); Debug.Log("Pretty? " + form.Checked("purdy")); Debug.Log("Unique? " + form.Checked("unique")); Debug.Log("Wonderful? " + form.Checked("wonderful")); Debug.Log("Your dropdown selection: " + form["favourite"]); Debug.Log("Your Bio: " + form["myBio"]); // Block the default (so it doesn't actually submit it) form.preventDefault(); }
public async void AddList(object sender, FormEvent args) { var obj = args.Object as PaymentModel; payments.Add(new PaymentViewModel(obj)); await Navigation.PopAsync(); }
private void buttonAddEvent_Click(object sender, EventArgs e) { Event ev = new Event(); FormEvent form = new FormEvent(ev, versions, history); if (form.ShowDialog() == DialogResult.OK) { history.Add(ev); DrawHistory(); RefreshOthers(); } }
private void buttonChangeEvent_Click(object sender, EventArgs e) { if (listViewHistory.SelectedIndices.Count == 1) { Event ev = (Event)listViewHistory.SelectedItems[0].Tag; FormEvent form = new FormEvent(ev, versions, history); if (form.ShowDialog() == DialogResult.OK) { DrawHistory(); RefreshOthers(); } } }
/// <summary> /// 登陆事件处理函数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void Login(object sender, FormEvent e) { if (e.UserName == "admin" && e.Password == "1234") { (sender as LoginForm).BackColor = Color.Green; MessageBox.Show("登陆成功!"); } else { (sender as LoginForm).BackColor = Color.Red; MessageBox.Show("登陆失败!"); } }
public async void AddList(object sender, FormEvent args) { var obj = args.Object as PlacesModel; var isSuccessful = await PlacesModel.AddToList(obj); if (isSuccessful) { places.Add(new PlacesViewModel(obj)); } else { await DisplayAlert("Oops", "Something went wrong", "Try again"); } await Navigation.PopAsync(); }
public async void AddList(object sender, FormEvent args) { var obj = args.Object as PlacesModel; var isSuccessful = await PlacesModel.AddToList(obj); if (isSuccessful) { appointmentRequest.Place = PlacesModel.PlacesList.FirstOrDefault(); await Navigation.PopAsync(); } else { await DisplayAlert("Oops", "Something went wrong", "Try again"); } }
public async void OnClick(object sender, EventArgs a) { var placename = PlaceName.Text; var streetaddress = StreetAddress.Text; var barangay = BarangayText.Text; var city = CityText.Text; var isValid = true; foreach (var field in Fields) { if (field.Text == "" || field.Text == null) { field.PlaceholderColor = Color.Red; isValid = false; } } if (!isValid) { await DisplayAlert("Invalid input", "Fields cannot be empty", "Got it"); return; } if (places != null) { places.PlaceName = placename; places.StreetName = streetaddress; places.Barangay = barangay; places.City = city; } else { places = new PlacesModel(placename, streetaddress, barangay, city); } var args = new FormEvent() { Object = places }; DataSender(sender, args); }
public async void UpdateList(object sender, FormEvent args) { placesViewModel.Places = args.Object as PlacesModel; await Navigation.PopAsync(); }
/// <summary> /// 注册事件处理函数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void Register(object sender, FormEvent e) { MessageBox.Show("注册"); }
private void DeployThread(object state) { while (start) { foreach (var item in userEntity) { int rowNumber = item.Key; object[] entity = userEntity[item.Key]; DataGridViewRow row = userRow[item.Key]; int dotimes = (int)row.Cells[4].Value; int left = (int)row.Cells[3].Value; int duration = (int)row.Cells[3].Value; string usrname = entity[1] as string; string password = entity[2] as string; if (!userRun.ContainsKey(item.Key) || !userRun[item.Key]) { //标橙色 row.Cells[5].Style.BackColor = Color.Orange; row.Cells[5].Value = "不再运行"; continue; } //标绿色 row.Cells[5].Style.BackColor = Color.LawnGreen; row.Selected = false; try { //登陆 row.Cells[5].Value = "登陆中"; Processor processor = new Processor(usrname, password); Dictionary <string, string> keyValuePairs = processor.Login(); while (userRun.ContainsKey(item.Key) && userRun[item.Key]) { if (left == 0) { row.Cells[5].Value = "寻找受理中"; WorkTaskAcceptExecutor workTaskAccept = new WorkTaskAcceptExecutor(keyValuePairs); Task <bool> b = workTaskAccept.Login(); if (b.Result)//二次登陆成功 { List <WorkTask> workTasks = workTaskAccept.FetchTaskList().Result; if (workTasks.Count > 0) { List <WorkTask> needAccept = workTaskAccept.FetchPendingTaskList(workTasks); if (needAccept.Count > 0) {// Debug.WriteLine("受理" + needAccept.Count + "个"); foreach (var task in needAccept) { if (workTaskAccept.AcceptOneTask(task).Result) { Debug.WriteLine("受理成功"); row.Cells[5].Style.BackColor = Color.Green; row.Cells[5].Value = "受理成功"; dotimes++; Thread.Sleep(3000); row.Cells[5].Style.BackColor = Color.LawnGreen; /** * 带着break只说明这个账户只受理一个 */ break; } else { Debug.WriteLine("受理失败"); } } row.Cells[4].Value = dotimes; //通知入库 FormEvent?.Invoke(rowNumber, row, 4, null); //下一个账户 break; } else { Debug.WriteLine("没有待受理任务"); row.Cells[5].Value = "无待受理任务"; Thread.Sleep(1000); } } else { Debug.WriteLine("没有任何任务"); row.Cells[5].Value = "无任务"; Thread.Sleep(1000); } } left = duration + 1; } left--; row.Cells[5].Value = left;//通知更改 Debug.WriteLine("DO:" + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString()); Thread.Sleep(1000); } //运行结束 row.Cells[5].Style.BackColor = Color.Yellow; row.Cells[5].Value = "等待运行"; } catch (AggregateException e) { e.Handle((err) => { switch (err.GetType().ToString()) { case "Exception": MessageEvent?.Invoke(rowNumber, row, err.Message, WorkerMessageType.ERROR); row.ErrorText = err.Message; userRun[rowNumber] = false; row.Cells[5].Value = "错误"; row.Cells[5].Style.BackColor = Color.Red; break; default: Debug.WriteLine(err.GetType().ToString()); MessageEvent?.Invoke(rowNumber, row, err.Message, WorkerMessageType.ERROR); row.ErrorText = err.Message; userRun[rowNumber] = false; row.Cells[5].Value = "错误"; row.Cells[5].Style.BackColor = Color.Red; break; } return(true); }); } } //主循环 //Thread.Sleep(3000); } if (!start) { foreach (var i in userRow) { i.Value.Cells[5].Value = "停止执行"; i.Value.Cells[5].Style.BackColor = Color.Red; } } }
public async void UpdateList(object sender, FormEvent args) { paymentViewModel.Payment = args.Object as PaymentModel; await Navigation.PopAsync(); }