Esempio n. 1
0
        private void SaveDat(object sender, RoutedEventArgs e)
        {
            if (DatManager.Items.Count < 1)
            {
                MessageBox.Show("Nothing to save");
                return;
            }

            var saveFileDialog = new VistaSaveFileDialog
            {
                Title            = "Save dat file",
                DefaultExt       = ".dat",
                CheckFileExists  = false,
                RestoreDirectory = true,
                Filter           = "dat files (*.dat)|*.dat",
            };

            if (saveFileDialog.ShowDialog() == true)
            {
                if (DatManager.SaveDat(saveFileDialog.FileName))
                {
                    MessageBox.Show("Dat saved.", "Success");
                }
                else
                {
                    MessageBox.Show("Dat failed to save.", "Fail");
                }
            }
        }
Esempio n. 2
0
        private void LoadDat(object sender, RoutedEventArgs e)
        {
            DatManager.Items.Clear();

            OpenFileDialog openFileDialog1 = new OpenFileDialog
            {
                Title = "Browse Dat File",

                CheckFileExists = true,
                CheckPathExists = true,

                DefaultExt       = "dat",
                Filter           = "dat files (*.dat)|*.dat",
                FilterIndex      = 2,
                RestoreDirectory = true,

                ReadOnlyChecked = true,
                ShowReadOnly    = true
            };

            if (openFileDialog1.ShowDialog() == true)
            {
                if (DatManager.ParseDat(openFileDialog1.FileName))
                {
                    MessageBox.Show("Dat loaded.", "Success");
                    UpdateUi();
                }
                else
                {
                    MessageBox.Show("Dat failed to load.", "Fail");
                    UpdateUi();
                }
            }
        }