Exemple #1
0
        public ProjectModel OpenProject()
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter =
                string.Format(
                    "{0} (*.{1})|*.{1}",
                    ProjectWriter.ExtensionDescription,
                    ProjectWriter.FileExtension);

            dlg.Multiselect = false;
            dlg.Title       = "Open Race Track Project";

            var keepGoing = dlg.ShowDialog(Application.Current.MainWindow) == true;

            if (!keepGoing)
            {
                return(null);
            }

            var result = ProjectReader.OpenProject(dlg.FileName);

            CurrentProject = result;
            return(result);
        }
Exemple #2
0
        private void Open_Click(object sender, RoutedEventArgs e)
        {
            var reader = new ProjectReader();
            var dlg    = new Microsoft.Win32.OpenFileDialog();

            dlg.FileName   = "Word-Game-Project";                                  // Default file name
            dlg.DefaultExt = ".wggproj";                                           // Default file extension
            dlg.Filter     = "Word Game Generator Project (.wggproj) | *.wggproj"; // Filter files by extension
            var success = dlg.ShowDialog();

            if (success.HasValue && success.Value)
            {
                ErrorService.Instance.ClearErrors();
                ErrorService.Instance.ClearWarnings();
                SetModel(reader.OpenProject(dlg.FileName));
                VerifyAllModel();
            }
        }