Ejemplo n.º 1
0
        private void UpdatePromoteButton()
        {
            MOG_Privileges privileges = MOG_ControllerProject.GetPrivileges();

            if (privileges.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.ConfigureUpdateFilterPromotions))
            {
                SyncPromoteButton.Enabled = true;
            }
            else
            {
                SyncPromoteButton.Enabled = false;
            }

            ComboBoxItem filter = SyncFilterComboBox.SelectedItem as ComboBoxItem;

            if (filter != null)
            {
                string filterFileName = filter.FullPath;
                if (filterFileName.Contains(MOG_ControllerProject.GetUserPath()))
                {
                    // This is a user tool and can be promoted
                    SyncPromoteButton.Image = Properties.Resources.Up;
                    SyncToolTips.SetToolTip(SyncPromoteButton, "Promote this filter to the team");
                }
                else
                {
                    // This is a project tool and can be demoted
                    SyncPromoteButton.Image = Properties.Resources.Down;
                    SyncToolTips.SetToolTip(SyncPromoteButton, "Demote this filter");
                }
            }
        }
        private void PackageNewClassificationMenuItem_Click(object sender, EventArgs e)
        {
            MOG_Privileges privs = MOG_ControllerProject.GetPrivileges();

            if (privs.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.AddClassification))
            {
                ToolStripMenuItem item = sender as ToolStripMenuItem;
                if (item != null)
                {
                    ContextMenuStrip contextMenu = item.Owner as ContextMenuStrip;
                    if (contextMenu != null)
                    {
                        MogControl_BaseTreeView treeview = contextMenu.SourceControl as MogControl_BaseTreeView;
                        if (treeview != null)
                        {
                            TreeNode node = treeview.SelectedNode;
                            if (node != null)
                            {
                                ClassificationCreateForm form = new ClassificationCreateForm(node.FullPath);
                                if (form.ShowDialog(treeview.TopLevelControl) == DialogResult.OK)
                                {
                                    treeview.DeInitialize();
                                    treeview.LastNodePath = form.FullClassificationName;
                                    treeview.Initialize();
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                MOG_Prompt.PromptResponse("Insufficient Privileges", "Your privileges do not allow you to add classifications to the project.");
            }
        }
Ejemplo n.º 3
0
        private void SyncConfigureButton_Click(object sender, EventArgs e)
        {
            MOG_Privileges privileges = MOG_ControllerProject.GetPrivileges();

            if (privileges.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.ConfigureUpdateFilterPromotions))
            {
                if (SyncConfigureButton.Visible)
                {
                    SyncFilterLabel.Visible        = true;
                    SyncAddButton.Visible          = true;
                    SyncDelButton.Visible          = true;
                    SyncSaveButton.Visible         = true;
                    SyncPromoteButton.Visible      = true;
                    SyncConfigureButton.Visible    = false;
                    ClassificationTreeView.Visible = true;
                    SyncShowAssetsCheckBox.Visible = true;
                    SyncFilterComboBox.Enabled     = true;
                    CloseButton.Visible            = true;
                    SyncFilterComboBox.Width      -= (SyncAddButton.Width * 3) + 6;

                    ClassificationTreeView.Initialize();

                    if (ConfigureFilter != null)
                    {
                        ConfigureFilter(sender, true);
                    }
                }
            }
            else
            {
                MOG_Prompt.PromptResponse("Insufficient Privileges", "Your privileges do not allow you to configure sync filters.");
            }
        }
Ejemplo n.º 4
0
        private void AddBranch()
        {
            MOG_Privileges privs = MOG_ControllerProject.GetPrivileges();

            if (privs.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.CreateBranch))
            {
                CreateBranchForm newBranch = new CreateBranchForm();
                newBranch.BranchSourceTextBox.Text = MOG_ControllerProject.GetBranchName();

                if (newBranch.ShowDialog() == DialogResult.OK)
                {
                    // Create the branch
                    if (MOG_ControllerProject.BranchCreate(MOG_ControllerProject.GetBranchName(), newBranch.BranchNameTextBox.Text))
                    {
                        MOG_DBBranchInfo branch = MOG_DBProjectAPI.GetBranch(newBranch.BranchNameTextBox.Text);

                        AddBranchListViewItem(branch);

                        MOG_Prompt.PromptMessage("Create Branch", "New branch successfully created.\n" +
                                                 "BRANCH: " + newBranch.BranchNameTextBox.Text);
                    }
                }
            }
            else
            {
                MOG_Prompt.PromptResponse("Insufficient Privileges", "Your privileges do not allow you to create branches.");
            }
        }
Ejemplo n.º 5
0
        public void Initialize_Control(MOG_Privileges privileges)
        {
            // Set our privileges object
            this.mPrivileges = privileges;

            // Initialize our Groups node with groups and users
            InitializeMainTreeView(mPrivileges);
        }
        /// <summary>
        /// Create a new Privileges Change Form, given our MOG_Privileges
        /// </summary>
        /// <param name="privileges">Privileges from which to populate our MainTreeView</param>
        public MogControl_PrivilegesForm(MOG_Privileges privileges)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            mPrivileges = privileges;
        }
Ejemplo n.º 7
0
        public EditUserForm(MOGUserManager userManager, MOG_Project project, MOG_Privileges privileges, MOG_User user)
        {
            mProject     = project;
            mUserManager = userManager;
            mUser        = user;
            mPrivileges  = privileges;

            InitializeComponent();
        }
Ejemplo n.º 8
0
        // Enable the mainForm's MOGGlobalFileMOGRepositoryMenuItem (set MOG repository) if userName is in the Admin group, otherwise disable it
        static public void MOGGlobalSetFileMOGRepositoryMenuItemEnabled(string userName)
        {
            MOG_Privileges privileges = new MOG_Privileges();

            if (privileges.ValidateUser(userName) && privileges.GetUserGroup(userName).ToLower() == "admin")
            {
                mainForm.setMOGRepositoryToolStripMenuItem.Enabled = true;
            }
            else
            {
                mainForm.setMOGRepositoryToolStripMenuItem.Enabled = false;
            }
        }
Ejemplo n.º 9
0
        // Enable the mainForm's MOGGlobalToolsConfigureProjectMenuItem (configure project) if userName is in the Admin group, otherwise disable it
        static public void MOGGlobalSetToolsConfigureProjectMenuItemEnabled(string userName)
        {
            MOG_Privileges privileges = new MOG_Privileges();

            if (privileges.ValidateUser(userName) && privileges.GetUserGroup(userName).ToLower() == "admin")
            {
                mainForm.configureProjectToolStripMenuItem.Enabled = true;
            }
            else
            {
                mainForm.configureProjectToolStripMenuItem.Enabled = false;
            }
        }
Ejemplo n.º 10
0
        public void SetUserInbox(string name)
        {
            if (MOG_ControllerProject.GetProject() != null)
            {
                // Is this user valid?
                if (MOG_ControllerProject.GetProject().GetUser(name) != null)
                {
                    // Is this user different from the current user?
                    if (string.Compare(name, mCurrentUsersBox, true) != 0)
                    {
                        MOG_Privileges privs = MOG_ControllerProject.GetPrivileges();

                        if (privs.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.ViewOtherUsersInbox) ||
                            String.Compare(MOG_ControllerProject.GetUserName(), name, true) == 0)
                        {
                            mInboxAssetsDirectory  = "";
                            mOutboxAssetsDirectory = "";
                            mCurrentUsersBox       = name;

                            // Set the active user
                            guiUser user = new guiUser(mainForm);
                            user.SetActiveUser(name);

                            // Are we in our inbox or another teammate
                            Color formBackColor = SystemColors.Window;
                            if (string.Compare(name, MOG_ControllerProject.GetUserName(), true) != 0)
                            {
                                // We are not in our boxes, so lets color them
                                formBackColor = Color.LavenderBlush;
                            }

                            mainForm.AssetManagerInboxListView.BackColor  = formBackColor;
                            mainForm.AssetManagerSentListView.BackColor   = formBackColor;
                            mainForm.AssetManagerTrashListView.BackColor  = formBackColor;
                            mainForm.AssetManagerDraftsListView.BackColor = formBackColor;

                            RefreshAllWindows();
                        }
                        else
                        {
                            MOG_Prompt.PromptResponse("Insufficient Privileges", "Your privileges do not allow you to view other users' inboxes.");
                        }
                    }
                    else
                    {
                        // User is the same, so just update our gui to show correct department and user
                        SetActiveUser(mCurrentUsersBox);
                    }
                }
            }
        }
Ejemplo n.º 11
0
        static public void PopupVerificationForRights(MogMainForm mainForm)
        {
            MOG_Privileges privilidges = new MOG_Privileges();

            if (privilidges.GetUserPrivilege(MOG_ControllerProject.GetUser().GetUserName(), MOG_PRIVILEGE.AccessAdminTools))
            {
                mainForm.serverManagerToolStripMenuItem.Enabled = true;
                mainForm.eventViewerToolStripMenuItem.Enabled   = true;
            }
            else
            {
                mainForm.serverManagerToolStripMenuItem.Enabled = false;
                mainForm.eventViewerToolStripMenuItem.Enabled   = false;
            }
        }
Ejemplo n.º 12
0
        private void btnAddUser_Click(object sender, EventArgs e)
        {
            MOG_Privileges privs = MOG_ControllerProject.GetPrivileges();

            if (privs != null)
            {
                if (!privs.GetUserPrivilege(MOG_ControllerProject.GetUserName_DefaultAdmin(), MOG_PRIVILEGE.AddNewUser))
                {
                    MOG_Prompt.PromptResponse("Insufficient Privileges", "Your privileges do not allow you to add users.");
                    return;
                }
            }

            EditUserForm form = new EditUserForm(this, mProject, mPrivileges, null);

            form.ShowDialog(this);
        }
Ejemplo n.º 13
0
        private void InitializeMainTreeView(MOG_Privileges privileges)
        {
            if (this.MainTreeView.Nodes.Count > 0)
            {
                MainTreeView.Nodes.Clear();
            }

            this.GridMessage = new MessageObject("Nothing selected.");

            // Create our groupNode and set our global groupNode
            TreeNode groupNode = this.MainTreeView.Nodes.Add("Groups");

            this.mGroupNode = groupNode;
            groupNode.Tag   = NodeType.Other;

            TreeNode userNode = this.MainTreeView.Nodes.Add("Users");

            userNode.Tag = NodeType.Other;

            // Get a list of all valid users for verification with the privileges.ini
            ArrayList projectUsers = MOG_ControllerProject.GetProject().GetUsers();
            SortedList <string, MOG_User> sortedProjectUsers = new SortedList <string, MOG_User>();

            foreach (MOG_User user in projectUsers)
            {
                sortedProjectUsers.Add(user.GetUserName().ToLower(), user);
            }

            SortedList users  = privileges.UsersList;
            ArrayList  groups = privileges.GroupsList;

            foreach (string groupName in groups)
            {
                TreeNode groupNameNode = groupNode.Nodes.Add(groupName);
                groupNameNode.Tag = NodeType.Group;

                foreach (DictionaryEntry user in users)
                {
                    if (sortedProjectUsers.ContainsKey(user.Key.ToString().ToLower()))
                    {
                        string userGroupName = user.Value.ToString();
                        if (userGroupName == groupName)
                        {
                            TreeNode usersGroupNode = groupNameNode.Nodes.Add(user.Key.ToString());
                            usersGroupNode.Tag = NodeType.User;
                        }
                    }
                }
            }

            groupNode.Expand();

            // Add all our users under the userNode
            foreach (DictionaryEntry user in users)
            {
                string userName = user.Key.ToString();
                if (sortedProjectUsers.ContainsKey(userName.ToLower()))
                {
                    TreeNode userNameNode = userNode.Nodes.Add(userName);
                    userNameNode.Tag = NodeType.UserSpecific;

                    if (mPrivileges.UserHasCustomPrivileges(userName))
                    {
                        userNameNode.ForeColor = Color.Blue;
                    }
                }
                else
                {
                    privileges.RemoveUser(userName);
                }
            }

            MainTreeView.ExpandAll();
        }
Ejemplo n.º 14
0
        void CommandEventCallBack_Invoked(MOG_Command command)
        {
            switch (command.GetCommandType())
            {
            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemAlert:
            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemError:
            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemException:
                #region MOG_COMMAND_NotifySystemException
                MOG_ALERT_LEVEL level = MOG_ALERT_LEVEL.ALERT;
                switch (command.GetCommandType())
                {
                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemAlert:
                    level = MOG_ALERT_LEVEL.ALERT;
                    break;

                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemError:
                    level = MOG_ALERT_LEVEL.ERROR;
                    break;

                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemException:
                    level = MOG_ALERT_LEVEL.CRITICAL;
                    break;
                }
                MOG_Prompt.PromptMessage(command.GetTitle(), command.GetDescription(), command.GetSource(), level);
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_LockPersistentNotify:
                #region MOG_COMMAND_LockPersistentNotify
                // Check if this is the same project?
                MOG_Command lockInfo = command.GetCommand();
                if (lockInfo != null)
                {
                    // Check if we are on the locks tab?
                    if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Locks", true) == 0)
                    {
                        if (mainForm.mLibraryManager != null)
                        {
                            mainForm.mLibraryManager.RefreshItem(command);
                        }
                    }

                    // Check if this lock is related to our project?
                    if (MOG_Filename.IsClassificationValidForProject(lockInfo.GetAssetFilename().GetOriginalFilename(), MOG_ControllerProject.GetProjectName()))
                    {
                        // Check if we are on the workspace tab?
                        if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Workspace", true) == 0)
                        {
                            if (mainForm.mAssetManager != null)
                            {
                                mainForm.mAssetManager.RefreshLockStatus(command);
// JohnRen - Removed because this is just too slow when the server sends us a ton of locks at startup
//								mainForm.LocalBranchMogControl_GameDataDestinationTreeView.RefreshFileLockStatus(command);
                                mainForm.mAssetManager.mLocal.RefreshLockStatus(command);
                            }
                        }
                        // Check if we are on the project tab?
                        else if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Project", true) == 0)
                        {
                            if (mainForm.mProjectManager != null)
                            {
                                mainForm.mProjectManager.UpdateAsset(command);
                            }
                        }
                        // Check if we are on the library tab?
                        else if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Library", true) == 0)
                        {
                            if (mainForm.mLibraryManager != null)
                            {
                                mainForm.mLibraryManager.RefreshItem(command);
                            }
                        }

                        // Check if this notify just got processed?
                        if (command.GetOptions().Contains("{Processed}"))
                        {
                            // Check if we have a local workspace defined?
                            MOG_ControllerSyncData workspace = MOG_ControllerProject.GetCurrentSyncDataController();
                            if (workspace != null)
                            {
                                // Time to check if this was our lock that just got released?
                                if (string.Compare(lockInfo.GetUserName(), MOG_ControllerProject.GetUserName(), true) == 0 &&
                                    string.Compare(lockInfo.GetComputerName(), MOG_ControllerSystem.GetComputerName(), true) == 0)
                                {
                                    // Is this lockInfo for an asset?
                                    if (lockInfo.GetAssetFilename().GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset)
                                    {
                                        // Check the user's privilege
                                        MOG_Privileges privileges = MOG_ControllerProject.GetPrivileges();
                                        if (!privileges.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.IgnoreSyncAsReadOnly))
                                        {
                                            MOG_Filename bestAssetFilename = lockInfo.GetAssetFilename();

                                            // Check if there is a better inbox asset that can be substituted?
                                            MOG_Filename inboxAssetFilename = MOG_ControllerInbox.LocateBestMatchingAsset(bestAssetFilename);
                                            if (inboxAssetFilename != null)
                                            {
                                                bestAssetFilename = inboxAssetFilename;
                                            }

                                            // Check if this asset has it's files synced as read only?
                                            MOG_Properties properties = new MOG_Properties(bestAssetFilename);
                                            if (properties.SyncAsReadOnly)
                                            {
                                                switch (lockInfo.GetCommandType())
                                                {
                                                case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest:
                                                    workspace.SetLocalFileAttributes(lockInfo.GetAssetFilename(), FileAttributes.Normal);
                                                    break;

                                                case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRelease:
                                                    workspace.SetLocalFileAttributes(lockInfo.GetAssetFilename(), FileAttributes.ReadOnly);
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_ViewUpdate:
                #region MOG_COMMAND_ViewUpdate

                // Make sure this is relevant to our active project?
                if (string.Compare(command.GetProject(), MOG_ControllerProject.GetProjectName(), true) != 0)
                {
                    break;
                }

                if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Project", true) == 0)
                {
                    // Process the auto process and package commands
                    switch (MOG_AssetStatus.GetType(command.GetDescription()))
                    {
                    case MOG_AssetStatusType.Modified:
                    case MOG_AssetStatusType.Unprocessed:
                        // Check to see if this command comes from us
                        if (string.Compare(command.GetComputerName(), MOG_ControllerSystem.GetComputerName(), true) != 0)
                        {
                            break;
                        }

                        // Check for Auto Process
                        if (mainForm.AssetManagerAutoProcessCheckBox.Checked &&
                            string.Compare(command.GetUserName(), MOG_ControllerProject.GetUser().GetUserName(), true) == 0)
                        {
                            guiAssetController.Process(command.GetDestination());
                        }
                        break;

                    //KLK - This may be overkill because we are on the Project tab and why do we want to change their local package button
                    case MOG_AssetStatusType.Packaged:
                        break;

                    case MOG_AssetStatusType.Unpackaged:
                    case MOG_AssetStatusType.Repackage:
                    case MOG_AssetStatusType.PackageError:
                    case MOG_AssetStatusType.Unpackage:
                        // We just got a new asset.  Make sure we inform the gui that a package is now required
                        if (mainForm.mAssetManager != null)
                        {
                            mainForm.mAssetManager.RefreshWindowsBoth(command);
                        }
                        break;
                    }
                }

                //if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Workspace", true) == 0)
                if (true)
                {
                    if (string.Compare(command.GetDescription(), "UnGrouped", true) == 0)
                    {
                        command.SetDestination("");
                    }

                    try
                    {
                        // Filter out updates to other computers that share our username and project
                        if ((string.Compare(command.GetComputerName(), MOG_ControllerSystem.GetComputerName(), true) != 0) &&
                            (string.Compare(command.GetDescription(), MOG_AssetStatus.GetText(MOG_AssetStatusType.Copied), true) == 0 ||
                             string.Compare(command.GetDescription(), MOG_AssetStatus.GetText(MOG_AssetStatusType.Unpackaged), true) == 0 ||
                             string.Compare(command.GetDescription(), MOG_AssetStatus.GetText(MOG_AssetStatusType.Repackage), true) == 0 ||
                             string.Compare(command.GetDescription(), MOG_AssetStatus.GetText(MOG_AssetStatusType.Packaged), true) == 0 ||
                             string.Compare(command.GetDescription(), MOG_AssetStatus.GetText(MOG_AssetStatusType.PackageError), true) == 0 ||
                             string.Compare(command.GetDescription(), MOG_AssetStatus.GetText(MOG_AssetStatusType.Unpackage), true) == 0))
                        {
                            return;
                        }
                        else
                        {
                            mainForm.mAssetManager.RefreshWindowsBoth(command);
                        }
                    }
                    catch (Exception e)
                    {
                        Debug.Write(e.ToString());
                    }

                    // JohnRen - Changed...
                    // The ViewUpdate command contains the computer name of who generated the view command...not the computer name of the originator of the rip
                    // Because of this, AutoUpdate local would not work anytime somebody else's slave performed the rip.
                    // Changed the AutoUpdate events to respect the login user instead of the computer name because this will be 100% correct...
                    // However, multiple users will experience the event if they are logged in as the same user.
                    //					// Process the auto process and package commands
                    //					// only do this code if the command came from us
                    //					if (string.Compare(command.GetComputerName(), MOG_ControllerSystem.GetComputerName(), true) == 0)
                    MOG_Filename destinationFilename = new MOG_Filename(command.GetDestination());
                    if (string.Compare(destinationFilename.GetUserName(), MOG_ControllerProject.GetUserName(), true) == 0)
                    {
                        switch (MOG_AssetStatus.GetType(command.GetDescription()))
                        {
                        case MOG_AssetStatusType.Modified:
                        case MOG_AssetStatusType.Unprocessed:
                            // Check for Auto Process
                            if (mainForm.AssetManagerAutoProcessCheckBox.Checked)
                            {
                                // Only auto-process this if it is in the drafts folder
                                if (destinationFilename.IsDrafts())
                                {
                                    // Make sure we are the ones that requested it
                                    if (string.Compare(command.GetUserName(), MOG_ControllerProject.GetUser().GetUserName(), true) == 0 &&
                                        (string.Compare(command.GetComputerName(), MOG_ControllerSystem.GetComputerName(), true) == 0))
                                    {
                                        guiAssetController.Process(command.GetDestination());
                                    }
                                }
                            }
                            break;

                        case MOG_AssetStatusType.Imported:
                            // Only auto-process this if it is in the drafts folder
                            if (destinationFilename.IsDrafts())
                            {
                                // Make sure we are the ones that requested it
                                if (string.Compare(command.GetUserName(), MOG_ControllerProject.GetUser().GetUserName(), true) == 0 &&
                                    (string.Compare(command.GetComputerName(), MOG_ControllerSystem.GetComputerName(), true) == 0))
                                {
                                    guiAssetController.UpdateLocal(command.GetDestination(), false);
                                }
                            }
                            break;

                        case MOG_AssetStatusType.Processed:
                        case MOG_AssetStatusType.Sent:
                            // Check if the MainForm's AutoUpdate button is checked?
                            if (mainForm.AssetManagerAutoUpdateLocalCheckBox.Checked)
                            {
                                // Only auto-process this if it is in the drafts folder
                                if (destinationFilename.IsDrafts())
                                {
                                    // Make sure we are the ones that requested it
                                    if (string.Compare(command.GetUserName(), MOG_ControllerProject.GetUser().GetUserName(), true) == 0 &&
                                        (string.Compare(command.GetComputerName(), MOG_ControllerSystem.GetComputerName(), true) == 0))
                                    {
                                        // Check if we have a current workspace?
                                        if (MOG_ControllerProject.GetCurrentSyncDataController() != null)
                                        {
                                            guiAssetController.UpdateLocal(command.GetDestination(), false);
                                        }
                                    }
                                }
                            }
                            break;

                        case MOG_AssetStatusType.Rebuilt:
                            if (mainForm.mAssetManager != null)
                            {
                                mainForm.mAssetManager.RefreshActiveWindow();
                            }
                            break;

                        case MOG_AssetStatusType.Deleted:
                            MOG_Filename assetName = new MOG_Filename(command.GetSource());
                            if (assetName.IsTrash() && mainForm.mAssetManager != null && mainForm.mAssetManager.mTrash != null && mainForm.AssetManagerInboxTabControl.SelectedTab.Name == "AssetManagerTrashTabPage")
                            {
                                mainForm.mAssetManager.mTrash.RefreshRemove(command);
                            }
                            else if (assetName.IsLocal() && mainForm.mAssetManager != null)
                            {
                                MOG_Filename tempAssetName = new MOG_Filename(command.GetSource());
                            }
                            break;
                        }
                    }
                }

                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor:
                #region MOG_COMMAND_RegisterEditor
                // We just lost an Editor
                WorkspaceManager.RegisterEditor(command.GetWorkingDirectory());
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownEditor:
                #region MOG_COMMAND_ShutdownEditor
                // We just lost an Editor
                WorkspaceManager.ShutdownEditor(command.GetWorkingDirectory());
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionLost:
                #region MOG_COMMAND_ConnectionLost
                // The server was shutdown
                Bitmap DisconnectedIcon = new Bitmap(mainForm.StatusBarImageList.Images[1]);
                mainForm.MOGStatusBarConnectionStatusBarPanel.Icon        = System.Drawing.Icon.FromHandle(DisconnectedIcon.GetHicon());
                mainForm.MOGStatusBarConnectionStatusBarPanel.Text        = "Disconnected";
                mainForm.MOGStatusBarConnectionStatusBarPanel.ToolTipText = "Server is disconnected!";
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionNew:
                #region MOG_COMMAND_ConnectionNew
                Bitmap ConnectedIcon = new Bitmap(mainForm.StatusBarImageList.Images[0]);
                mainForm.MOGStatusBarConnectionStatusBarPanel.Icon        = System.Drawing.Icon.FromHandle(ConnectedIcon.GetHicon());
                mainForm.MOGStatusBarConnectionStatusBarPanel.Text        = "Connected";
                mainForm.MOGStatusBarConnectionStatusBarPanel.ToolTipText = mainForm.RefreshConnectionToolText();
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_Complete:
                #region MOG_COMMAND_Complete
                // Make sure this contains an encapsulated command?
                if (command.GetCommand() != null)
                {
                    // Determin the type of encapsulated command
                    switch (command.GetCommand().GetCommandType())
                    {
                    case MOG_COMMAND_TYPE.MOG_COMMAND_Post:
                        #region MOG_COMMAND_PostComplete
                        if (mainForm != null)
                        {
                            // Check if we are on a tab that cares about this event?
                            if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Connections", true) == 0)
                            {
                                if (mainForm.mConnectionManager != null)
                                {
                                    // Only listen for the final Post w/o any assetFilename listed or else we would cause too many full refreshes
                                    if (command.GetCommand().GetAssetFilename().GetOriginalFilename().Length == 0)
                                    {
                                        // Refresh the pending package listview
                                        mainForm.mConnectionManager.RefreshMerging();
                                        // Refresh the pending post listview
                                        mainForm.mConnectionManager.RefreshPosting();
                                    }
                                }
                            }

                            // Check if this remove was successful?
                            if (command.GetCommand().IsCompleted())
                            {
// Someday this would be nice, but the library tab does refresh when it gets reselected so we need to process this event even though we are on another tab
//								// Check if we are on a tab that cares about this event?
//								if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Library", true) == 0)
//								{
                                if (command.GetCommand().GetAssetFilename().IsLibrary())
                                {
                                    if (mainForm.mLibraryManager != null)
                                    {
                                        mainForm.mLibraryManager.RefreshItem(command);
                                    }
                                }
//								}
                                // Check if we are on a tab that cares about this event?
                                if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Project", true) == 0)
                                {
                                    if (mainForm.mProjectManager != null)
                                    {
                                        mainForm.mProjectManager.MakeAssetCurrent(command.GetCommand().GetAssetFilename());
                                    }
                                }
                            }
                        }
                        #endregion
                        break;

                    case MOG_COMMAND_TYPE.MOG_COMMAND_ReinstanceAssetRevision:
                        #region MOG_COMMAND_ReinstanceAssetRevision
                        // Check if this remove was successful?
                        if (command.GetCommand().IsCompleted())
                        {
                            if (mainForm.mProjectManager != null)
                            {
                                mainForm.mProjectManager.RemoveAssetFromProject(new MOG_Filename(command.GetCommand().GetSource()));
                                mainForm.mProjectManager.MakeAssetCurrent(command.GetCommand().GetAssetFilename());
                            }
                            if (mainForm.LibraryExplorer != null)
                            {
                                mainForm.LibraryExplorer.LibraryListView.RefreshItem(command);
                            }
                        }
                        #endregion
                        break;

                    case MOG_COMMAND_TYPE.MOG_COMMAND_RemoveAssetFromProject:
                        #region MOG_COMMAND_RemoveAssetFromProject
                        // Check if this remove was successful?
                        if (command.GetCommand().IsCompleted())
                        {
                            if (mainForm.mProjectManager != null)
                            {
                                mainForm.mProjectManager.RemoveAssetFromProject(command.GetCommand().GetAssetFilename());
                            }
                            if (mainForm.LibraryExplorer != null)
                            {
                                mainForm.LibraryExplorer.LibraryListView.RefreshItem(command);
                            }
                        }
                        #endregion
                        break;

                    case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageMerge:
                    case MOG_COMMAND_TYPE.MOG_COMMAND_LocalPackageMerge:
                    case MOG_COMMAND_TYPE.MOG_COMMAND_EditorPackageMergeTask:
                    case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkPackageRebuild:
                        WorkspaceManager.EndPackaging(command.GetCommand().GetWorkingDirectory());
                        break;
                    }
                }
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveConnection:
                #region MOG_COMMAND_NotifyActiveConnection
                if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Connections", true) == 0)
                {
                    if (mainForm.mConnectionManager != null)
                    {
                        mainForm.mConnectionManager.UpdateConnections(command);
                    }
                }
                #endregion
                break;

            // These are the all around locks requested commands from the server
            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveLock:
                #region MOG_COMMAND_NotifyActiveLock
                switch (command.GetCommand().GetCommandType())
                {
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRelease:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRelease:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest:
                    if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Locks", true) == 0)
                    {
                        if (mainForm.mLockManager != null)
                        {
                            mainForm.mLockManager.RefreshLockWindows(command);
                        }
                    }
                    break;
                }
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshProject:
                #region MOG_COMMAND_RefreshProject
                MainMenuProjectsClass.MOGGlobalRefreshProject(mainForm);
                #endregion
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshApplication:
                break;

            case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshTools:
                break;

            // These are the all around general commands from the server
            case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveCommand:
                #region MOG_COMMAND_NotifyActiveCommand
                // The command manager needs to know about all commands
                if (string.Compare(MOG_ControllerProject.GetActiveTabName(), "Connections", true) == 0)
                {
                    if (mainForm.mConnectionManager != null)
                    {
                        mainForm.mConnectionManager.UpdateCommands(command);
                    }
                }
                #endregion
                break;
            }
        }
        /// <summary>
        /// We need to make sure the users does not create a new group under an object
        /// </summary>
        private void PackageTreeContextMenu_Popup(object sender, CancelEventArgs e)
        {
            ContextMenuStrip contextMenu = sender as ContextMenuStrip;

            // Get our tree, then get our selected node, so we can then get our NodeType (which is defaulted to Class)
            MogControl_PackageTreeView tree = contextMenu.SourceControl as MogControl_PackageTreeView;

            if (tree != null)
            {
                TreeNode node = tree.SelectedNode;
                // If we actually have a node selected...
                if (node != null && node.Tag != null)
                {
                    PackageNodeTypes nodeType = ((Mog_BaseTag)node.Tag).PackageNodeType;

                    // Enable all our MenuItems
                    foreach (ToolStripItem item in contextMenu.Items)
                    {
                        item.Enabled = true;
                    }

                    // Depending on our NodeType, decide which MenuItems will be available to the user
                    switch (nodeType)
                    {
                    // For package and group, we should not be able to create a sub-package
                    case PackageNodeTypes.Asset:
                    case PackageNodeTypes.Package:
                        this.PackageNewClassificationMenuItem.Enabled = false;
                        this.PackageNewPackageMenuItem.Enabled        = false;
                        this.PackageNewPackageSubMenu.Enabled         = false;
                        this.PackageRemoveMenuItem.Enabled            = true;
                        break;

                    case PackageNodeTypes.Group:
                        this.PackageNewClassificationMenuItem.Enabled = false;
                        this.PackageNewPackageMenuItem.Enabled        = false;
                        this.PackageNewPackageSubMenu.Enabled         = false;
                        this.PackageRemoveMenuItem.Enabled            = true;
                        break;

                    // For object, we should not be able to create a package or a sub-group
                    case PackageNodeTypes.Object:
                        this.PackageNewClassificationMenuItem.Enabled = false;
                        this.PackageNewPackageMenuItem.Enabled        = false;
                        this.PackageNewPackageSubMenu.Enabled         = false;
                        this.PackageNewGroupMenuItem.Enabled          = false;
                        this.PackageRemoveMenuItem.Enabled            = true;
                        break;

                    // For class, we should only be able to add a package or remove a package
                    default:                     // PackageNodeTypes.Class:
                        this.PackageNewClassificationMenuItem.Enabled = true;
                        this.PackageNewPackageMenuItem.Enabled        = true;
                        this.PackageNewPackageSubMenu.Enabled         = true;
                        this.PackageNewGroupMenuItem.Enabled          = false;
                        this.PackageNewObjectMenuItem.Enabled         = false;
                        this.PackageRemoveMenuItem.Enabled            = false;
                        break;
                    }

                    // Disable menu items we don't have privileges for
                    MOG_Privileges privileges            = MOG_ControllerProject.GetPrivileges();
                    bool           bCanAddClassification = privileges.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.AddClassification);
                    if (!bCanAddClassification)
                    {
                        PackageNewClassificationMenuItem.Enabled = false;
                    }
                    bool bCanCreatePackage = privileges.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.CreatePackage);
                    if (!bCanCreatePackage)
                    {
                        PackageNewPackageMenuItem.Enabled = false;
                        PackageNewPackageSubMenu.Enabled  = false;
                        PackageRemoveMenuItem.Enabled     = false;
                    }
                    bool bCanCreatePackageGroup = privileges.GetUserPrivilege(MOG_ControllerProject.GetUserName(), MOG_PRIVILEGE.AddPackageGroup);
                    if (!bCanCreatePackageGroup)
                    {
                        PackageNewObjectMenuItem.Enabled = false;
                        PackageNewGroupMenuItem.Enabled  = false;
                        PackageRemoveMenuItem.Enabled    = false;
                    }

                    // Substitute the create package submenu in the place of the create package option depending on the ShowPlatformSpecific option
                    PackageNewPackageMenuItem.Visible = !tree.ShowPlatformSpecific;
                    PackageNewPackageSubMenu.Visible  = tree.ShowPlatformSpecific;
                }
                else
                {
                    foreach (ToolStripItem item in contextMenu.Items)
                    {
                        item.Enabled = false;
                    }
                }
                // Now the ContextMenu will display properly
            }
        }