コード例 #1
0
 private void Save_Click(object sender, RoutedEventArgs e)
 {
     Microsoft.Win32.SaveFileDialog dialog = new Microsoft.Win32.SaveFileDialog();
     if ((bool)dialog.ShowDialog())
     {
         mainCollection.Save(dialog.FileName);
     }
     MessageError();
 }
コード例 #2
0
        private void SaveClick(object sender, RoutedEventArgs e)
        {
            SaveFileDialog SaveDialog = new SaveFileDialog {
                Filter      = "Binary data|*.dat|All|*.*",
                FilterIndex = 1
            };

            if (SaveDialog.ShowDialog() == true)
            {
                MainCollection.Save(SaveDialog.FileName);
                MainCollection.IsSave = true;
            }
        }
コード例 #3
0
        private bool UnsavedChanges()
        {
            MessageBoxResult mes = MessageBox.Show("Do you want save records?", "Save", MessageBoxButton.YesNoCancel);

            if (mes == MessageBoxResult.Yes)
            {
                Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
                dlg.FileName   = "Inf";
                dlg.DefaultExt = ".txt";
                dlg.Filter     = "TXTFiles(.txt)|*.txt";
                if ((bool)dlg.ShowDialog())
                {
                    mainCollection.Save(dlg.FileName);
                }
            }
            else if (mes == MessageBoxResult.Cancel)
            {
                return(true);
            }
            return(false);
        }