Exemplo n.º 1
0
 private void switchProject(LoadedProject project)
 {
     if (currentProject != null)
     {
         currentProject.save();
     }
     CurrentFile = null;
     if (project == null)
     {
         currentProject     = null;
         ProjectHeader.Text = "Project";
         return;
     }
     if (!project.loaded)
     {
         MessageBox.Show("Error loading project:\n" + project.loadError, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
     currentProject     = project;
     ProjectHeader.Text = $"Project '{currentProject.ProjectName}'";
     Title = "ZeroDev - " + project.ProjectName;
     FileView.ItemsSource = currentProject.files;
     CurrentFile          = currentProject.files.FirstOrDefault();
     Logger.log($"[Editor] Switched to project '{currentProject.ProjectName}'");
 }
Exemplo n.º 2
0
        private void OpenProjectEvent(object sender, ExecutedRoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.FileName = Directory.GetCurrentDirectory();
            dialog.Filter   = "Zeroth Project Files (*.zproj)|*.zproj";
            if (dialog.ShowDialog() == true && File.Exists(dialog.FileName))
            {
                Logger.log($"[Editor] Loading project from '{dialog.FileName}'");
                LoadedProject newProject = LoadedProject.loadProject(dialog.FileName);
                switchProject(newProject);
            }
        }
Exemplo n.º 3
0
        private void NewProjectEvent(object sender, ExecutedRoutedEventArgs e)
        {
            NewProjectDialog popup = new NewProjectDialog();

            popup.File = Directory.GetCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + "NewZerothProject.zproj";
            popup.ShowDialog();
            if (popup.cancelled || popup.invalid)
            {
                return;
            }
            Logger.log($"[Editor] Creating new project '{popup.ProjectName}' at '{popup.File}'");
            LoadedProject newProject = LoadedProject.newProject(popup.File, popup.ProjectName);

            switchProject(newProject);
        }
Exemplo n.º 4
0
        public static LoadedProject loadProject(String path)
        {
            LoadedProject project = new LoadedProject(path);

            return(project);
        }