Beispiel #1
0
        private void mnuNewFile_Click(object sender, EventArgs e)
        {
            var createProjectDialog = new CreateProjectDialog();

            if (createProjectDialog.ShowDialog() == DialogResult.OK)
            {
                string clientDataPath = Path.GetFullPath(createProjectDialog.ClientDataPath);
                string serverDataPath = Path.GetFullPath(createProjectDialog.ServerDataPath);

                if (Directory.Exists(clientDataPath) && Directory.Exists(serverDataPath))
                {
                    var fileBrowserDialog = new SaveFileDialog();
                    fileBrowserDialog.Filter       = @"Project Files (*.lproj)|*.lproj";
                    fileBrowserDialog.DefaultExt   = ".lproj";
                    fileBrowserDialog.AddExtension = true;

                    if (fileBrowserDialog.ShowDialog() == DialogResult.OK)
                    {
                        _project = Project.Create(fileBrowserDialog.FileName, serverDataPath, clientDataPath);

                        _dockTilesetTools.SetProject(_project);

                        this.PopulateProjectTree();
                    }
                }
            }
        }
Beispiel #2
0
        private void openStack()
        {
            refreshSession();
            StatusText = "Neuer Workspace wird erstellt";
            CreateProjectDialog createProjectDialog = new CreateProjectDialog();

            if (createProjectDialog.DialogResult.HasValue && createProjectDialog.DialogResult.Value)
            {
                try
                {
                    Workspace = new Workspace(createProjectDialog.NewProjectName);
                    Workspace.createFromPictureStack(createProjectDialog.StackPath);
                    Project = new HausarbeitAPProjectCT(createProjectDialog.NewProjectName);
                    Project.description = createProjectDialog.NewProjectDescription;
                    Project.initFileListFromStack(Workspace.TempFolder);
                    Project.SaveToFile(Workspace.TempFolder + @"\project.xml");
                    ProjectText = Project.description;
                    stackSlider.Maximum = Project.totalLayers - 1;
                    stackSlider.Value = 0;
                    loadPicture(0);
                    StackIsLoaded = true;
                    SectionView = false;
                    this.Title = System.IO.Path.GetFileNameWithoutExtension(Project.name);
                }
                catch (Exception exc)
                {
                    System.Windows.MessageBox.Show("Das Projekt konnte nicht erstellt werden\n" + exc.Message + exc.StackTrace);
                    refreshSession();
                }
            }
            else
            {
                refreshSession();
            }
        }
        /// <summary>
        /// Shows the create project dialog, deleting the project if the dialog result was true.
        /// </summary>
        /// <param name="projectName">The project name to potentially create.</param>
        public Boolean ShowDialog(Window owner)
        {
            CreateProjectDialog createProjectDialog = new CreateProjectDialog()
            {
                Owner = owner
            };

            this.ProjectName = String.Empty;

            if (createProjectDialog.ShowDialog() == true && this.IsProjectNameValid)
            {
                try
                {
                    String newProjectPath = Path.Combine(SettingsViewModel.GetInstance().ProjectRoot, this.NewProjectName);
                    Directory.CreateDirectory(newProjectPath);

                    return(true);
                }
                catch (Exception ex)
                {
                    Logger.Log(LogLevel.Error, "Error creating project folder", ex);
                }
            }

            return(false);
        }
Beispiel #4
0
        public static void CreateNewProject()
        {
            CreateProjectDialog dig = new CreateProjectDialog();

            if (dig.ShowDialog(FlowDesign) == DialogResult.OK)
            {
                FlowProject Project = new FlowProject();
                Project.Title        = dig.ProjectTitle;
                Project.Password     = dig.Password;
                Project.ProjectID    = GUIDTo16.GuidToLongID().ToString();
                Project.FileFullName = dig.FileFullName;
                Mediator.ToolForm.InitTreeView(Project);
                Mediator.ToolForm.InitTreeUser(Project);
                Mediator.ToolForm.InitTreeConnections(Project);

                Projects.Add(Project);
            }
        }
Beispiel #5
0
    private void PromptCreateProject(string type)
    {
        var create = new CreateProjectDialog(this, type);

        create.Modal = true;
        if ((ResponseType)create.Run() == ResponseType.Ok)
        {
            string error;
            if (!this.CreateProject(create.ProjectName, type, out error))
            {
                var errorDialog = new MessageDialog(
                    this,
                    DialogFlags.Modal,
                    MessageType.Error,
                    ButtonsType.Ok,
                    "Unable to create project: " + error);
                errorDialog.Run();
                errorDialog.Destroy();
            }
            else
            {
                this.Update();
                if (type != "Module")
                {
                    Process.Start("monodevelop", System.IO.Path.Combine("Build", "Projects", create.ProjectName + ".definition"));
                }
                else
                {
                    var info = new ProcessStartInfo
                    {
                        FileName         = System.IO.Path.Combine(create.ProjectName, "Protobuild.exe"),
                        WorkingDirectory = System.IO.Path.Combine(Environment.CurrentDirectory, create.ProjectName)
                    };
                    var p = Process.Start(info);
                    p.EnableRaisingEvents = true;
                    p.Exited += (object sender, EventArgs e) => this.Update();
                }
            }
        }
        create.Destroy();
    }
Beispiel #6
0
 // MARK: Project Creation Methods
 private void NewProjectClicked(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("Are you planning to do Gait Analysis (rodents, bottom view)? If so you won't be able to use custom markers (we need specific bodyparts tracked to calculate gait metrics correctly). ", "Gait Project?", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         CreateProjectDialog newProjectDialog = new CreateProjectDialog(true);
         if (newProjectDialog.ShowDialog() == true)
         {
             BarInteraction();
             CreateNewProject(newProjectDialog, true);
         }
     }
     else
     {
         CreateProjectDialog newProjectDialog = new CreateProjectDialog(false);
         if (newProjectDialog.ShowDialog() == true)
         {
             BarInteraction();
             CreateNewProject(newProjectDialog, false);
         }
     }
 }
Beispiel #7
0
        private void mnuNewFile_Click(object sender, EventArgs e)
        {
            var createProjectDialog = new CreateProjectDialog();

            if (createProjectDialog.ShowDialog() == DialogResult.OK)
            {
                // Make sure they've actually entered something.
                if (string.IsNullOrEmpty(createProjectDialog.ClientDataPath) || string.IsNullOrEmpty(createProjectDialog.ServerDataPath))
                {
                    DarkMessageBox.ShowError("At least one project directory path is missing!", "Error Creating Project!", DarkDialogButton.Ok);
                    return;
                }

                string clientDataPath = Path.GetFullPath(createProjectDialog.ClientDataPath);
                string serverDataPath = Path.GetFullPath(createProjectDialog.ServerDataPath);

                // Make sure these directories actually exist.
                if (Directory.Exists(clientDataPath) && Directory.Exists(serverDataPath))
                {
                    var fileBrowserDialog = new SaveFileDialog();
                    fileBrowserDialog.Filter       = @"Project Files (*.lproj)|*.lproj";
                    fileBrowserDialog.DefaultExt   = ".lproj";
                    fileBrowserDialog.AddExtension = true;

                    if (fileBrowserDialog.ShowDialog() == DialogResult.OK)
                    {
                        _project = Project.Create(fileBrowserDialog.FileName, serverDataPath, clientDataPath);

                        _dockTilesetTools.SetProject(_project);

                        this.PopulateProjectTree();
                    }
                }
                else
                {
                    DarkMessageBox.ShowError("Invalid project directories specified!", "Error Creating Project!", DarkDialogButton.Ok);
                    return;
                }
            }
        }
Beispiel #8
0
        /// <summary>
        /// Displays the 'create project' dialog and creates a new project
        /// </summary>
        public void CreateProject()
        {
            // Create dialog
            var dialog = new CreateProjectDialog(this);

            dialog.Owner = OwnerWindow;

            // Display
            bool?res = dialog.ShowDialog();

            if (!res.HasValue || !res.Value)
            {
                return;
            }

            string           selectedName     = dialog.SelectedName;
            string           selectedPath     = dialog.SelectedPath;
            IProjectTemplate selectedTemplate = dialog.SelectedTemplate;

            // Call manager
            Manager.CreateProject(selectedName, selectedPath, selectedTemplate);
        }
Beispiel #9
0
        private void ShowCreateProject(string projectName)
        {
            this.Text = projectName;
            var result    = new CreateProjectDialog().ShowDialog();
            int projectId = SaveProject(projectName);

            if (result.Item1 == ProjectResult.Simple)
            {
                SetUpSimpleProject(projectId, projectName);
                return;
            }

            if (result.Item1 == ProjectResult.Complex)
            {
                SetupComplexProject(projectId, projectName);
                return;
            }

            if (result.Item1 == ProjectResult.Empty)
            {
                SetUpEmptyProject(projectId, projectName);
            }
        }
Beispiel #10
0
        protected bool GetNewProjectData()
        {
            IProjectManager     projectManager      = this.ProjectManager();
            CreateProjectDialog createProjectDialog = new CreateProjectDialog(projectManager.TemplateManager.ProjectTemplates, projectManager.TemplateManager, this.DisplayName, this.NewProjectPath, this.CreateNewSolution, base.Services)
            {
                IsCategoryTreeVisible    = (bool)this.configurationObject.GetProperty(BaseNewProjectCommand.LastProjectCategoryTreeVisible, true),
                SelectedCategoryFullName = (string)this.configurationObject.GetProperty(BaseNewProjectCommand.LastProjectCategoryTreeItem, "")
            };
            string property = (string)this.configurationObject.GetProperty(BaseNewProjectCommand.LastProjectLanguageCreated, "");

            if (!string.IsNullOrEmpty(property))
            {
                createProjectDialog.Filter = property;
            }
            IProjectTemplate projectTemplate = projectManager.TemplateManager.ProjectTemplates.FirstOrDefault <IProjectTemplate>((IProjectTemplate template) => template.Identifier == (string)this.configurationObject.GetProperty(BaseNewProjectCommand.LastProjectTemplateCreated, ""));

            if (projectTemplate == null)
            {
                createProjectDialog.ProjectTemplateListBox.Items.MoveCurrentToFirst();
            }
            else
            {
                createProjectDialog.ProjectTemplate = projectTemplate;
            }
            string str = (string)this.configurationObject.GetProperty(BaseNewProjectCommand.LastProjectTargetFrameworkCreated, "");

            if (!string.IsNullOrEmpty(str))
            {
                createProjectDialog.TargetFrameworkVersion = ProjectPropertyInfo.CreatePropertyValue("TargetFrameworkVersion", str);
            }
            bool?nullable = createProjectDialog.ShowDialog();

            this.configurationObject.SetProperty(BaseNewProjectCommand.LastProjectCategoryTreeVisible, createProjectDialog.IsCategoryTreeVisible);
            this.configurationObject.SetProperty(BaseNewProjectCommand.LastProjectCategoryTreeItem, createProjectDialog.SelectedCategoryFullName);
            if (!nullable.GetValueOrDefault(false))
            {
                return(false);
            }
            string str1 = null;

            if (createProjectDialog.ProjectTemplate == null || createProjectDialog.ProjectTemplate.IsPlatformSupported(out str1))
            {
                this.projectTemplate        = createProjectDialog.ProjectTemplate;
                this.targetFrameworkVersion = createProjectDialog.TargetFrameworkVersion;
                this.projectFolder          = createProjectDialog.ProjectPath;
                this.projectName            = createProjectDialog.ProjectName;
                this.projectFilter          = createProjectDialog.Filter;
                return(true);
            }
            MessageBoxArgs messageBoxArg = new MessageBoxArgs()
            {
                Message      = str1,
                Button       = MessageBoxButton.OK,
                Image        = MessageBoxImage.Hand,
                AutomationId = "UnknownProjectTypeErrorDialog"
            };
            MessageBoxArgs messageBoxArg1 = messageBoxArg;

            base.Services.MessageDisplayService().ShowMessage(messageBoxArg1);
            return(false);
        }
Beispiel #11
0
        private void CreateNewProject(CreateProjectDialog dialog, bool gaitOnly) //call create_new_project function from DeepLabCut
        {
            // Create new Project
            Project newProject = new Project(
                gaitOnly,
                dialog.projectNameTextBox.Text,
                dialog.authorTextBox.Text,
                dialog.bodyParts);

            // Config Path
            string filePath       = EnvDirectory + "\\vdlc_create_new_project.py";
            string copyVideosBool = "True";

            newProject.ConfigPath = WorkingDirectory + "\\" + newProject.Name + "-" + newProject.Scorer + "-" + newProject.DateIdentifier + "\\" + "config.yaml";

            // Create DLC project
            if (!ProjectExists(newProject))
            {
                FileSystemUtils.MurderPython();
                FileSystemUtils.RenewScript(filePath, AllScripts.CreateProject); //prepare the script for creating a new project
                FileSystemUtils.ReplaceStringInFile(filePath, "project_name_identifier", newProject.Name);
                FileSystemUtils.ReplaceStringInFile(filePath, "scorer_identifier", newProject.Scorer);
                FileSystemUtils.ReplaceStringInFile(filePath, "working_directory_identifier", WorkingDirectory);
                FileSystemUtils.ReplaceStringInFile(filePath, "copy_videos_identifier", copyVideosBool);

                Process          p    = new Process(); //prepare the process to run the script
                ProcessStartInfo info = new ProcessStartInfo();
                info.FileName = "cmd.exe";
                info.RedirectStandardInput = true;
                info.UseShellExecute       = false;
                info.Verb           = "runas";
                info.CreateNoWindow = !ReadShowDebugConsole(); //if show debug console = true, then create no window has to be false

                p.EnableRaisingEvents = true;
                p.Exited += (sender1, e1) => //once finished, update bodyparts, update training split, vdlc config and sync ui
                {
                    CurrentProject = newProject;
                    this.Dispatcher.Invoke(() => {
                        TrainButton.Visibility     = Visibility.Visible;
                        TrainingAddDock.Visibility = Visibility.Visible;
                    });
                    SetBodyParts(CurrentProject);
                    UpdateTrainingSplitInConfig();
                    UpdateVGLConfig();
                    SyncUI();
                    EnableInteraction();
                };

                p.StartInfo = info;
                p.Start();

                using (StreamWriter sw = p.StandardInput) {
                    if (sw.BaseStream.CanWrite)
                    {
                        sw.WriteLine(Drive);
                        sw.WriteLine("cd " + EnvDirectory);
                        sw.WriteLine(FileSystemUtils.CONDA_ACTIVATE_PATH);
                        sw.WriteLine("conda activate " + EnvName);
                        sw.WriteLine("ipython vdlc_create_new_project.py");

                        if (info.CreateNoWindow == false)   //for debug purposes
                        {
                            sw.WriteLine("ECHO WHEN YOU'RE DONE, CLOSE THIS WINDOW");
                            p.WaitForExit();
                            sw.WriteLine("Done, exiting.");
                        }
                    }
                }
            }
            else
            {
                EnableInteraction();
                MessageBox.Show("Your project cannot be created because a project with that name already exists. Go to \\Program Files (x86)\\VDLC\\Projects and delete the old project folder.", "Cannot Create Project", MessageBoxButton.OK);
            }
        }
Beispiel #12
0
 private void newProjectToolStripMenuItem_Click(object sender, EventArgs e)
 {
     CreateProjectDialog.UserCreateProject(_extensionHost);
 }