/// <summary> /// Модификация от 6 октября 2015 года /// Заложен 6 октября 2015 года /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GridBtn_Click(object sender, RoutedEventArgs e) { pgWoka paro = (pgWoka)Mano.DataContext; vLGamo gl1 = new vLGamo(paro.Listo); var winda = new GridoGamo(); winda.ManoDP.DataContext = gl1; winda.GamoGrido.ItemsSource = gl1.Listo; winda.Show(); }
private void SavoXMLListo_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); // Set filter for file extension and default file extension dlg.InitialDirectory = Properties.Settings.Default.GamoPGNStartDir; dlg.Filter = "Стандартный (*.xml)|*.xml|All files (*.*)|*.*"; dlg.FilterIndex = 1; dlg.RestoreDirectory = true; try { // Display OpenFileDialog by calling ShowDialog method Nullable <bool> result = dlg.ShowDialog(); if (result == true) { string filename = dlg.FileName; vLGamo aa = (vLGamo)ManoDP.DataContext; aa.SavoInXmlFilo(filename); } } catch (Exception ex) { MessageBox.Show("Error: Could not wtite file on the disk. Original error: " + ex.Message); } }
/// <summary> /// Модификация от 11 октября 2015 года /// Заложен 11 октября 2015 года /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GamoLoadFromXMLFile_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); // Set filter for file extension and default file extension dlg.InitialDirectory = Properties.Settings.Default.GamoPGNStartDir; dlg.Filter = "Стандартный (*.xml)|*.xml|All files (*.*)|*.*"; dlg.FilterIndex = 1; dlg.RestoreDirectory = true; try { // Display OpenFileDialog by calling ShowDialog method Nullable <bool> result = dlg.ShowDialog(); if (result == true) { string filename = dlg.FileName; vLGamo wrk = new vLGamo(filename); var winda = new GridoGamo(); winda.ManoDP.DataContext = wrk; winda.GamoGrido.ItemsSource = wrk.Listo; winda.Show(); } } catch (Exception ex) { MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message); } }