private void cmAddPunkt_Click(object sender, RoutedEventArgs e) { CreatePunkt crPunkt = new CreatePunkt(); crPunkt.tbPunktX.Text = MainWindow.NewMarker.Position.Lng.ToString(); crPunkt.tbPunktY.Text = MainWindow.NewMarker.Position.Lat.ToString(); if (crPunkt.ShowDialog().Value == false) { MainWindow.AddDefaultMarker(crPunkt, MainWindow.NewMarker); MainWindow.NewMarker.Clear(); } }
private void cmEditPunkt_Click(object sender, RoutedEventArgs e) { ContextDb dbContext = new ContextDb(@"Data Source=(localdb)\v11.0;initial catalog = BanksDB.mdf;Integrated Security=True"); CreatePunkt crPunkt = new CreatePunkt(); CreateBank crBank = new CreateBank(); Label label = (Label)Popup.Child; List <Punkt> punkts = dbContext.Punkt.Where(p => p.NamePunkt == label.Content.ToString()).Select(s => s).ToList(); crPunkt.DataContext = punkts; crPunkt.btAddBank.Content = "Изменить курс"; crPunkt.btCreatePunktOk.Visibility = System.Windows.Visibility.Collapsed; crPunkt.btEditPunkt.Visibility = System.Windows.Visibility.Visible; if (crPunkt.ShowDialog().HasValue) { crPunkt.Close(); } }