Ejemplo n.º 1
0
        private void mnuFileNewProject_Click(object sender, RoutedEventArgs e)
        {
            var filePath = sharedServices.CreateNewProject(NavigationService);

            if (filePath != null)
            {
                persistor.AddRecentProject(filePath);
            }
        }
Ejemplo n.º 2
0
        public void OpenProject(NavigationService navigationService)
        {
            var dlg = new OpenFileDialog
            {
                AddExtension = true,
                DefaultExt   = Persistor.ProjectFileExtension,
                Filter       = ""
            };

            if (dlg.ShowDialog() == true)
            {
                try
                {
                    var xml     = File.ReadAllText(dlg.FileName);
                    var project = Serialization.ParseXml <Project>(xml);
                    persistor.AddRecentProject(dlg.FileName);
                    navigationService.Navigate(new ProjectPage(project));
                }
                catch (Exception ex)
                {
                    ShowErrorMessage("Loading failed", ex);
                }
            }
        }