private async void button4_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; PointProxy pointProxy = new PointProxy() { X = Convert.ToInt32(XTextBox.Text), Y = Convert.ToInt32(YTextBox.Text), Argb = ColorButton.BackColor.ToArgb(), PointListId = (comboBox1.SelectedItem as PointListProxy).Id }; await PointAdapter.SaveItemAsync(pointProxy); this.DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.StackTrace, ex.Message); } finally { this.Cursor = Cursors.Arrow; } }
private async Task <PointListProxy> CreatePoints() { PointListProxy pointListProxy = new PointListProxy() { Name = "Random" + DateTime.Now.ToString(), Points = new List <PointProxy>() }; PointList pointList = await PointListAdapter.SaveItemAsync(pointListProxy); pointListProxy.Id = pointList.PointListId; for (int i = 0; i < _settings.PointsCount; i++) { PointProxy pointProxy = new PointProxy() { X = _random.Next(1, 100), Y = _random.Next(1, 100), Width = 20, Height = 20, PointListId = pointList.PointListId, Argb = Color.Yellow.ToArgb() }; pointListProxy.Points.Add(pointProxy); await PointAdapter.SaveItemAsync(pointProxy); } await PointListAdapter.SaveItemAsync(pointListProxy); return(pointListProxy); }