public void InitializeUsers() { if (MOG_ControllerProject.IsUser()) { // Set the current active users box mCurrentUsersBox = MOG_ControllerProject.GetActiveUser().GetUserName(); } else { mCurrentUsersBox = "Login to project..."; } }
public void Refresh() { if (mInitialized) { //Refresh everything mainForm.LibraryExplorer.Refresh(); } else if (MOG_ControllerProject.IsProject() && MOG_ControllerProject.IsUser()) { Initialize(); } }
public void LatentInitialize() { mainForm.AssetManagerInboxListView.ContextMenuStrip = mInboxContextMenu.InitializeContextMenu("{Inbox}"); mainForm.AssetManagerDraftsListView.ContextMenuStrip = mDraftsContextMenu.InitializeContextMenu("{Inbox}"); mainForm.AssetManagerSentListView.ContextMenuStrip = mOutboxContextMenu.InitializeContextMenu("{Outbox}"); mainForm.AssetManagerTrashListView.ContextMenuStrip = mTrashContextMenu.InitializeContextMenu("{Trash}"); if (!MOG_ControllerProject.IsProject() || !MOG_ControllerProject.IsUser()) { return; } RefreshAllWindows(); guiUserPrefs.LoadDynamic_LayoutPrefs("AssetManager", mainForm); mLocal.InitialiseLocalView(); mainForm.AssetManagerLocalDataExplorerSplitter.SplitPosition = mLocalExplorer.Width; mainForm.myLocalExplorerToolStripMenuItem.Checked = mLocalExplorer.Opened; mainForm.AssetManagerTasksSplitter.SplitPosition = mToDo.Width; MainMenuViewClass.bChangeLocalBranchRightPanelWidth = true; mainForm.AssetManagerLocalDataSplitter.SplitPosition = mTools.Width; MainMenuViewClass.bChangeLocalBranchRightPanelWidth = false; mainForm.myToolboxToolStripMenuItem.Checked = mTools.Opened; // Initialize our users toolBox MOG_ControllerSyncData sync = MOG_ControllerProject.GetCurrentSyncDataController(); if (sync != null) { // Initialize the local tools window mainForm.CustomToolsBox.Initialize(sync.GetPlatformName()); // DVC } else { mainForm.CustomToolsBox.Visible = false; } mInitialized = true; }
public void Initialize() { if (!MOG_ControllerProject.IsProject() || !MOG_ControllerProject.IsUser()) { return; } MogControl_AssetContextMenu classificationTreeContextMenu = new MogControl_AssetContextMenu(mainForm.ProjectManagerClassificationTreeView); MogControl_AssetContextMenu packageTreeContextMenu = new MogControl_AssetContextMenu(mainForm.ProjectManagerPackageTreeView); MogControl_AssetContextMenu syncTargetContextMenu = new MogControl_AssetContextMenu(mainForm.ProjectManagerSyncTargetTreeView); MogControl_AssetContextMenu archiveContextMenu = new MogControl_AssetContextMenu(mainForm.ProjectManagerArchiveTreeView); // Add context menus for our ProjMgr Explorer TreeViews mainForm.ProjectManagerClassificationTreeView.ContextMenuStrip = classificationTreeContextMenu.InitializeContextMenu("{Project}"); mainForm.ProjectManagerPackageTreeView.ContextMenuStrip = packageTreeContextMenu.InitializeContextMenu("{Project}"); mainForm.ProjectManagerSyncTargetTreeView.ContextMenuStrip = syncTargetContextMenu.InitializeContextMenu("{SyncTargetTreeView}"); mainForm.ProjectManagerArchiveTreeView.ContextMenuStrip = archiveContextMenu.InitializeContextMenu("{Project}"); // Make sure we show all of the packages mainForm.ProjectManagerClassificationTreeView.ShowPlatformSpecific = true; mainForm.ProjectManagerPackageTreeView.ShowPlatformSpecific = true; // Build (or rebuild) our trees BuildRepositoryTrees(true); // Re-apply our current tree sort if (mLoaded) { ResetPackageTreeSort(); } #if MOG_LIBRARY ProjectTreeButtonClick(mainForm.ProjectTreeArchiveViewtoolStripButton, mainForm.ProjectManagerArchiveTreeView, "Archive"); #endif // Initialize task tree //mainForm.ProjectManagerTaskWindow.InitializeForProject(); }
public static void BlessAssets_Worker(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; List <object> parameters = e.Argument as List <object>; List <MOG_Filename> filenames = parameters[0] as List <MOG_Filename>; string comment = parameters[1] as string; bool maintainLock = (bool)parameters[2]; bool bUserAltered = false; string loginUser = MOG_ControllerProject.GetUser().GetUserName(); string activeUser = MOG_ControllerProject.GetActiveUser().GetUserName(); // Make sure the inbox that we are in matches the logged in user if (string.Compare(MOG_ControllerProject.GetUser().GetUserName(), MOG_ControllerProject.GetActiveUser().GetUserName(), true) != 0) { // Login as this user so that his bless targets will be respected during this bless! MOG_ControllerProject.LoginUser(MOG_ControllerProject.GetActiveUser().GetUserName()); bUserAltered = true; } // Obtain a unique bless jobLabel string timestamp = MOG_Time.GetVersionTimestamp(); string jobLabel = "Bless." + MOG_ControllerSystem.GetComputerName() + "." + timestamp; // Changed to a for-loop to facilitate the loop breakout box on bless failure below for (int assetIndex = 0; assetIndex < filenames.Count; assetIndex++) { MOG_Filename asset = filenames[assetIndex] as MOG_Filename; if (asset != null) { string message = "Blessing:\n" + " " + asset.GetAssetClassification() + "\n" + " " + asset.GetAssetName(); worker.ReportProgress(assetIndex * 100 / filenames.Count, message); // Try to bless each asset and report if there is a failure try { if (MOG_ControllerInbox.BlessAsset(asset, comment, maintainLock, jobLabel, worker)) { WorkspaceManager.MarkLocalAssetBlessed(asset, timestamp); } else { // If there are more assets to bless, ask the user how to proceed if (assetIndex < filenames.Count - 1) { MOGPromptResult result = MOG_Prompt.PromptResponse("Bless Error", "An error has occurred while blessing " + asset.GetAssetFullName() + "\nWould you like to continue blessing assets?", MOGPromptButtons.YesNo); if (result == MOGPromptResult.Yes) { // continue with the next asset continue; } else if (result == MOGPromptResult.No) { // bail return; } } } } catch (Exception ex) { // Send this Exception back to the server MOG_Report.ReportMessage("Bless", ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.CRITICAL); // Check if we are logged in an anyone? if (MOG_ControllerProject.IsUser()) { // Send a notification to the ofending user MOG_Report.ReportMessage("Bless", ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.CRITICAL); } } } } // Start the job MOG_ControllerProject.StartJob(jobLabel); // Restore user if changed if (bUserAltered) { MOG_ControllerProject.LoginUser(loginUser); MOG_ControllerProject.SetActiveUserName(activeUser); } }
static public void MOGGlobalLaunchProjectLogin(string projectName, bool forceLogin) { // Launch the login dialog LoginForm login = new LoginForm(projectName); mainForm.Enabled = false; Login: // Show the dialog if (login.ShowDialog(mainForm) == DialogResult.OK) { try { // Login to the specified Project if (guiProject.SetLoginProject(login.LoginProjectsComboBox.Text, login.LoginBranchesComboBox.Text)) { // Set the login user guiUser guiUsers = new guiUser(mainForm); if ((string.Compare(login.LoginUsersComboBox.Text, "Choose Valid User", true) == 0) || (login.LoginUsersComboBox.Text.Length == 0)) { MessageBox.Show("A valid user must be selected!", "Missing User"); goto Login; } if (guiUsers.SetLoginUser(login.LoginUsersComboBox.Text)) { mainForm.Enabled = true; // Disable the Change SQL Server menu item if the logged in user is not an administrator MOGGlobalSetSQLConnectionMenuItemEnabled(login.LoginUsersComboBox.Text); // Disable the Configure Project menu item if the logged in user is not an administrator MOGGlobalSetToolsConfigureProjectMenuItemEnabled(login.LoginUsersComboBox.Text); // Disable the Set MOG Repository menu item if the logged in user is not an administrator MOGGlobalSetFileMOGRepositoryMenuItemEnabled(login.LoginUsersComboBox.Text); } else { MessageBox.Show("A valid user must be selected!", "Login Error"); goto Login; } } else { MessageBox.Show("A valid project and branch must be selected!", "Login Error"); goto Login; } } catch (Exception e) { MOG_Report.ReportMessage("Login Project", e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.ERROR); goto Login; } } else if (login.DialogResult == DialogResult.Cancel && forceLogin) { if (MessageBox.Show(mainForm, "Do you wish to exit MOG?", "Exit?", MessageBoxButtons.YesNo) == DialogResult.Yes) { mainForm.Close(); mainForm.Shutdown(); } else { goto Login; } } else { if (!MOG_ControllerProject.IsProject() || !MOG_ControllerProject.IsUser()) { MessageBox.Show("A valid project and user must be selected!", "Missing Project or User"); goto Login; } mainForm.Enabled = true; } // Always initialize our Database before leaving because the dialog loads projects that will leave us in a dirty state MOG_ControllerSystem.InitializeDatabase("", MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName()); }
public void UpdateControl(MOG_Ini pIni, ToolBox toolBox) { try { // Do we need to load this file? if (pIni == null) { string currentIniFilename = toolBox.GetCurrentIniFilenameFromLocation(Location); pIni = new MOG_Ini(currentIniFilename); } string type = ""; // If we can, get the ToolBoxControlType of this control... if (pIni.KeyExist(ControlGuid, Type_Key)) { type = pIni.GetString(ControlGuid, Type_Key); } // Get the ToolBoxControlType from the ini ControlType = (ToolBoxControlType)Enum.Parse(ToolBoxControlType.Button.GetType(), type, true); // If we can, get our ToolBoxControlLocation for this control... if (pIni.KeyExist(ControlGuid, Location_Key)) { // Get the location from the ini Location = (ToolBoxControlLocation)Enum.Parse(ToolBoxControlLocation.Project.GetType(), pIni.GetString(ControlGuid, Location_Key), true); } // If we can, get the HideWindow value... if (pIni.KeyExist(ControlGuid, HideWindow_Key)) { HideOutput = pIni.GetBool(ControlGuid, HideWindow_Key); } // Get all of our default values: (see ControlDefinition for what these identifiers mean) // If we can, get the ControlName... if (pIni.KeyExist(ControlGuid, ControlName_Key)) { ControlName = pIni.GetString(ControlGuid, ControlName_Key); // Should this control have it's text updated? bool bUpdateControlText = false; switch (this.ControlType) { case ToolBoxControlType.Button: bUpdateControlText = true; break; case ToolBoxControlType.ParameterButton: bUpdateControlText = true; break; case ToolBoxControlType.Label: bUpdateControlText = true; break; case ToolBoxControlType.LinkLabel: bUpdateControlText = true; break; case ToolBoxControlType.IniCombo: bUpdateControlText = false; break; case ToolBoxControlType.FileCombo: bUpdateControlText = false; break; case ToolBoxControlType.CheckBox: bUpdateControlText = true; break; case ToolBoxControlType.RadioButton: bUpdateControlText = true; break; } if (bUpdateControlText) { DefButton.Text = ControlName; } } // If we can, get the Command... if (pIni.KeyExist(ControlGuid, Command_Key)) { Command = pIni.GetString(ControlGuid, Command_Key); } // If we can, get the Arguments... if (pIni.KeyExist(ControlGuid, Arguments_Key)) { Arguments = pIni.GetString(ControlGuid, Arguments_Key); } // If we can, get the ArgumentTrue... if (pIni.KeyExist(ControlGuid, ArgumentsTrue_Key)) { ArgumentTrue = pIni.GetString(ControlGuid, ArgumentsTrue_Key); } // If we can, get the ArgumentFalse... if (pIni.KeyExist(ControlGuid, ArgumentsFalse_Key)) { ArgumentFalse = pIni.GetString(ControlGuid, ArgumentsFalse_Key); } // If we can, get the TagName... if (pIni.KeyExist(ControlGuid, TagName_Key)) { TagName = pIni.GetString(ControlGuid, TagName_Key); } // If we can, get the ToolTipString... if (pIni.KeyExist(ControlGuid, ToolTip_Key)) { ToolTipString = pIni.GetString(ControlGuid, ToolTip_Key); } // If we can, get the FolderName... if (pIni.KeyExist(ControlGuid, FolderName_Key)) { FolderName = pIni.GetString(ControlGuid, FolderName_Key); } // If we can, get the ComboBoxDepth... if (pIni.KeyExist(ControlGuid, ComboBoxDepth_Key)) { ComboBoxDepth = int.Parse(pIni.GetString(ControlGuid, ComboBoxDepth_Key)); } // If we can, get our Pattern if (pIni.KeyExist(ControlGuid, Pattern_Key)) { Pattern = pIni.GetString(ControlGuid, Pattern_Key); } // If we can, get our ini filename path if (pIni.KeyExist(ControlGuid, IniFilename_Key)) { IniFilename = pIni.GetString(ControlGuid, IniFilename_Key); } // If we can, get our ini section name if (pIni.KeyExist(ControlGuid, IniSection_Key)) { IniSectionName = pIni.GetString(ControlGuid, IniSection_Key); } // If we can, get our DialogStartPath if (pIni.KeyExist(ControlGuid, DialogStartPath_Key)) { DialogStartPath = pIni.GetString(ControlGuid, DialogStartPath_Key); } // If we can, set our LastSelectedIndex // By adding the scope of the user's name to the section key we can retain a user's own settings seperatly from the rest of the team string usersLastIndex_Key = MOG_ControllerProject.IsUser() ? LastIndex_Key + SubSectionIndicator_Text + MOG_ControllerProject.GetUserName(): LastIndex_Key; if (pIni.KeyExist(ControlGuid, usersLastIndex_Key)) { LastSelectedIndex = int.Parse(pIni.GetString(ControlGuid, usersLastIndex_Key)); } if (pIni.KeyExist(ControlGuid, ShowFullPaths_Key)) { ShowFullPaths = Convert.ToBoolean(pIni.GetString(ControlGuid, ShowFullPaths_Key)); } if (pIni.KeyExist(ControlGuid, ShowWorkspaceRelativePaths_Key)) { ShowWorkspaceRelativePaths = Convert.ToBoolean(pIni.GetString(ControlGuid, ShowWorkspaceRelativePaths_Key)); } if (pIni.KeyExist(ControlGuid, ShowFolderRelativePaths_Key)) { ShowFolderRelativePaths = Convert.ToBoolean(pIni.GetString(ControlGuid, ShowFolderRelativePaths_Key)); } if (pIni.KeyExist(ControlGuid, ShowBasePaths_Key)) { ShowBasePaths = Convert.ToBoolean(pIni.GetString(ControlGuid, ShowBasePaths_Key)); } if (pIni.KeyExist(ControlGuid, VisisbleIndex_Key)) { VisibleIndex = Convert.ToInt32(pIni.GetString(ControlGuid, VisisbleIndex_Key)); } if (pIni.KeyExist(ControlGuid, FullPaths_Key)) { TagFullPaths = Convert.ToBoolean(pIni.GetString(ControlGuid, FullPaths_Key)); } if (pIni.KeyExist(ControlGuid, WorkspaceRelativePaths_Key)) { TagWorkspaceRelativePaths = Convert.ToBoolean(pIni.GetString(ControlGuid, WorkspaceRelativePaths_Key)); } if (pIni.KeyExist(ControlGuid, FolderRelativePaths_Key)) { TagFolderRelativePaths = Convert.ToBoolean(pIni.GetString(ControlGuid, FolderRelativePaths_Key)); } if (pIni.KeyExist(ControlGuid, BasePaths_Key)) { TagBasePaths = Convert.ToBoolean(pIni.GetString(ControlGuid, BasePaths_Key)); } if (pIni.KeyExist(ControlGuid, RecurseFolders_Key)) { RecurseFolders = Convert.ToBoolean(pIni.GetString(ControlGuid, RecurseFolders_Key)); } // If we can, get the ComboBoxItems // By adding the scope of the user's name to the section key we can retain a user's own settings seperatly from the rest of the team string usersSection = MOG_ControllerProject.IsUser() ? ControlGuid + ComboItems_Section + SubSectionIndicator_Text + MOG_ControllerProject.GetUserName(): ControlGuid + ComboItems_Section; if (pIni.SectionExist(usersSection)) { ComboBoxItems = LoadComboBoxItems(usersSection, pIni); } // If we can, get our RadioButtons if (pIni.SectionExist(ControlGuid + RadioButton_Section)) { RadioButtons = LoadRadioButtons(ControlGuid + RadioButton_Section, pIni); } } catch (Exception e) { e.ToString(); } }
public void Save(MOG_Ini pIni, string section) { // Write the type out to the INI pIni.PutString(section, Type_Key, ControlType.ToString()); // Write our location out to the INI pIni.PutString(section, Location_Key, Location.ToString()); // Write the name of the control out to our INI pIni.PutString(section, ControlName_Key, ControlName); // Write our TagName pIni.PutString(section, TagName_Key, TagName); // Write our Command pIni.PutString(section, Command_Key, Command); // Write whether or not we will be hiding output window pIni.PutBool(section, HideWindow_Key, HideOutput); // (ADD_HERE): Any new Controls must be added here... pIni.PutString(section, VisisbleIndex_Key, VisibleIndex.ToString()); // Write our arguments pIni.PutString(section, Arguments_Key, Arguments); pIni.PutString(section, ArgumentsTrue_Key, ArgumentTrue); pIni.PutString(section, ArgumentsFalse_Key, ArgumentFalse); // Write our ToolTipString pIni.PutString(section, ToolTip_Key, ToolTipString); // Write the folder path we will start at for dialogs pIni.PutString(section, FolderName_Key, FolderName); // Write out the depth we will support for this def's ComboBox pIni.PutString(section, ComboBoxDepth_Key, ComboBoxDepth.ToString()); // Write out the show full paths bool pIni.PutString(section, ShowFullPaths_Key, ShowFullPaths.ToString()); pIni.PutString(section, ShowWorkspaceRelativePaths_Key, ShowWorkspaceRelativePaths.ToString()); pIni.PutString(section, ShowFolderRelativePaths_Key, ShowFolderRelativePaths.ToString()); pIni.PutString(section, ShowBasePaths_Key, ShowBasePaths.ToString()); // Write out the relative paths bool pIni.PutString(section, FullPaths_Key, TagFullPaths.ToString()); pIni.PutString(section, WorkspaceRelativePaths_Key, TagWorkspaceRelativePaths.ToString()); pIni.PutString(section, FolderRelativePaths_Key, TagFolderRelativePaths.ToString()); pIni.PutString(section, BasePaths_Key, TagBasePaths.ToString()); pIni.PutString(section, RecurseFolders_Key, RecurseFolders.ToString()); // Write our IniSectionName pIni.PutString(section, IniSection_Key, IniSectionName); // Write out our IniFilename pIni.PutString(section, IniFilename_Key, IniFilename); // Write out our GUID pIni.PutString(section, GUID_Key, section); // Write out our ComboBoxDepth pIni.PutString(section, ComboBoxDepth_Key, ComboBoxDepth.ToString()); // By adding the scope of the user's name to the section key we can retain a user's own settings seperatly from the rest of the team string usersLastIndex_Key = MOG_ControllerProject.IsUser() ? LastIndex_Key + SubSectionIndicator_Text + MOG_ControllerProject.GetUserName(): LastIndex_Key; pIni.PutString(section, usersLastIndex_Key, LastSelectedIndex.ToString()); // If we are a fileComboBox write out our items if (ControlType == ToolBoxControlType.FileCombo) { // By adding the scope of the user's name to the section key we can retain a user's own settings seperatly from the rest of the team string usersSection = MOG_ControllerProject.IsUser() ? section + ComboItems_Section + SubSectionIndicator_Text + MOG_ControllerProject.GetUserName(): section + ComboItems_Section; int count = 0; foreach (MogTaggedString item in DefComboBox.Items) { pIni.PutString(usersSection, ComboItems_Key + count++, (string)item.AttachedItem); } } // Write out the fileComboBox patterns pIni.PutString(section, Pattern_Key, Pattern); // If we are a ToolBoxGroupBox, write out our radio buttons if (ControlType == ToolBoxControlType.RadioButton) { foreach (DictionaryEntry button in RadioButtons) { pIni.PutString(section + RadioButton_Section, (string)button.Key, (string)button.Value); } } }