private void btnCreate_Click(object sender, System.EventArgs e) { if (!DuplicateProjectNameCheck(this.projectInfoControl.ProjectName, true)) { this.projectInfoControl.FocusProjectName(); return; } if (this.executeCreate) { MOG_Project proj = CreateProject(true); if (proj == null) { // If project creation failed, return return; } MOG_ControllerProject.LoginProject(proj.GetProjectName(), ""); try { Hide(); ConfigureProjectWizardForm wiz = new ConfigureProjectWizardForm(proj); wiz.ShowDialog(this); } catch (Exception ex) { MOG_Prompt.PromptResponse("Configure Error", ex.Message, ex.StackTrace, MOGPromptButtons.OK, MOG_ALERT_LEVEL.CRITICAL); } } this.DialogResult = DialogResult.OK; Hide(); }
static public bool SetLoginProject(string name, string branch) { // Initialize users on the Asset Manager page if (mainForm.mAssetManager != null) { mainForm.mAssetManager.DeInitialize(); } if (MOG_ControllerProject.ProjectExists(name)) { if (MOG_ControllerProject.LoginProject(name, branch) != null) { // Initialize branches MainMenuProjectsClass.MOGGlobalBranchesInit(true); UpdateGuiBranch(MOG_ControllerProject.GetBranchName()); // Initialize the project icons (clear them first) MogUtil_AssetIcons.ClassIconsClear(); MogUtil_AssetIcons.ClassIconInitialize(); // Initialize users on the Asset Manager page if (mainForm.mAssetManager != null) { //mainForm.mAssetManager.DeInitialize(); mainForm.mAssetManager.Initialize(); List <string> departments = guiStartup.GetDepartments(name); mainForm.AssetManagerActiveUserDepartmentsComboBox.Items.Clear(); mainForm.AssetManagerActiveUserDepartmentsComboBox.Items.AddRange(departments.ToArray()); } // Load web tabs if (mainForm.mWebTabManager != null) { mainForm.mWebTabManager.LoadTabs(); } // Update the project related gui stuff UpdateGuiProject(name); // Check if we passed in a valid branch if (branch.Length != 0) { UpdateGuiBranch(MOG_ControllerProject.GetBranchName()); } // Save our prefs file guiUserPrefs.SaveStatic_ProjectPrefs(); return(true); } } return(false); }
private void LoadProjects(TreeNode root) { // Clear all the projects //this.lvProjects.Items.Clear(); // Get all the projects listed in the mog system foreach (string projectName in MOG_ControllerSystem.GetSystem().GetProjectNames()) { MOG_Project pProject = MOG_ControllerProject.LoginProject(projectName, ""); if (pProject != null) { root.Nodes.Add(CreateProjectNode(pProject)); } } }
public PriviledgesForm() { // // Required for Windows Form Designer support // InitializeComponent(); this.OldWidth = this.Width; MOG_Main.Init_Client(""); mMogProcess = new Thread(new ThreadStart(this.MogProcess)); mMogProcess.Start(); MOG_ControllerProject.LoginProject("BlackJupiter", "CURRENT"); MOG_ControllerProject.LoginUser("Admin"); mPriviledges = MOG_ControllerProject.GetPriviledges(); InitializeMainTreeView(mPriviledges); }
public static bool SetOffline(MogMainForm mainForm, bool offline) { if (offline) { // TODO KIER How do we go offline now? // string targetPath = string.Concat(MOG_ControllerProject.GetGameData().GetGameDataPath(), "\\MOG\\Offline"); // if (MOG_ControllerProject.GetProject().Offline(targetPath)) // { // // Disconnect from the server // MOG_ControllerSystem.GoOffline(); // // if (MOG_ControllerSystem.GetSystem().Load(MOG_Main.BuildDefaultConfigFile(targetPath, "", ""))) // { // // Reload the project // MOG_ControllerProject.LoginProject(MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName()); // // // Set our gui // guiStartup.ConnectionStatus(mainForm, false); // } // } } else { // Connect to the server MOG_ControllerSystem.GoOnline(); if (MOG_ControllerSystem.GetSystem().Load(MOG_Main.BuildDefaultConfigFile())) { // Reload the project MOG_ControllerProject.LoginProject(MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName()); // Login user MOG_ControllerProject.LoginUser(MOG_ControllerProject.GetUser().GetUserName()); // Set our gui guiStartup.ConnectionStatus(mainForm, true); } } return(true); }
static public bool SetLoginBranch(string branch) { if (string.Compare(MOG_ControllerProject.GetBranchName(), branch, true) != 0) { if (MOG_ControllerProject.LoginProject(MOG_ControllerProject.GetProjectName(), branch) != null && string.Compare(MOG_ControllerProject.GetBranchName(), branch, true) == 0) { MessageBox.Show("You have been switched to a different branch of the project.\n" + "Please keep this in mind as you bless assets, browse project trees or configure project settings.\n\n" + " BRANCH: " + branch + "\n", "Changing Project Branch", MessageBoxButtons.OK); UpdateGuiBranch(MOG_ControllerProject.GetBranchName()); // Check if we have a current workspace? if (MOG_ControllerProject.GetCurrentSyncDataController() != null) { // Check if this branch is different than our workspace's branch? if (string.Compare(branch, MOG_ControllerProject.GetCurrentSyncDataController().GetBranchName(), true) != 0) { // Switch the associated branch of the current workspace WorkspaceManager.SwitchCurrentWorkspaceBranch(branch); } } // Update the project manager if it has been initialized if (mainForm.mProjectManager != null) { mainForm.mProjectManager.BuildRepositoryTrees(true); } return(true); } MOG_Prompt.PromptMessage("Login Branch", "Could not login to selected branch!\nProject:" + MOG_ControllerProject.GetProjectName() + "\nBranch:" + branch, Environment.StackTrace); return(false); } return(true); }
private void CreateProject_Worker(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; MOG_Project project = new MOG_Project(); try { MOG_System sys = MOG_ControllerSystem.GetSystem(); if (sys != null) { project = sys.ProjectCreate(this.projectInfoControl.ProjectName); if (project != null) { worker.ReportProgress(0, "Setting project info..."); // project info project.SetProjectPath(this.projectInfoControl.ProjectPath); project.SetProjectToolsPath(this.projectInfoControl.ProjectPath + "\\Tools"); project.SetProjectUsersPath(this.projectInfoControl.ProjectPath + "\\Users"); worker.ReportProgress(0, "Copying tools..."); worker.ReportProgress(0, "Saving and logging in..."); // create project and login project.Save(); MOG_ControllerProject.LoginProject(this.projectInfoControl.ProjectName, ""); worker.ReportProgress(0, "Creating current branch..."); // create default branch MOG_ControllerProject.BranchCreate("", "Current"); worker.ReportProgress(0, "Creating classification tree..."); // platforms MOG_Platform pcPlatform = new MOG_Platform(); pcPlatform.mPlatformName = "PC"; project.PlatformAdd(pcPlatform); // create classifications MogUtil_ClassificationLoader classLoader = new MogUtil_ClassificationLoader(); classLoader.ProjectName = this.projectInfoControl.ProjectName; foreach (MOG_Properties props in classLoader.GetClassPropertiesListFromFiles()) { if (props.Classification.ToLower() == project.GetProjectName().ToLower()) { // create only project name root class node project.ClassificationAdd(props.Classification); MOG_Properties properties = project.GetClassificationProperties(props.Classification); properties.SetImmeadiateMode(true); properties.SetProperties(props.GetPropertyList()); break; } } project.Save(); } else { throw new Exception("Failed to create the project."); } } else { throw new Exception("System not initialized."); } } catch (Exception ex) { MOG_Report.ReportMessage("Project Creation Failed", ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.CRITICAL); } e.Result = project; }