public void DisplayUpdateExistingConnections() { //first let's kill the existing ones. foreach (ListViewItem item in mForm.lviewMonitor.Items) { mForm.lviewMonitor.Items.Remove(item); } //this needs to walk the connections and add all the connected computers. MOG_CommandServer commandServer = (MOG_CommandServer)mForm.gMog.GetCommandManager(); ArrayList slavesArray = commandServer.GetRegisteredSlaves(); ArrayList clientsArray = commandServer.GetRegisteredClients(); //show the server first. DislayAddConnection(mForm.gMog.GetComputerName(), mForm.gMog.GetComputerIP(), 1, 0); foreach (Object item in clientsArray) { MOG_Command connection = (MOG_Command)item; DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient); } foreach (Object item in slavesArray) { MOG_Command connection = (MOG_Command)item; DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave); } }
public void LoadCommand(MOG_Command command) { tbComputer.Text = command.GetComputerName(); tbDate.Text = MogUtils_StringVersion.VersionToString(command.GetCommandTimeStamp()); tbIp.Text = command.GetComputerIP(); tbID.Text = command.GetCommandID().ToString(); tbProject.Text = command.GetProject(); tbType.Text = command.GetCommandType().ToString(); tbUser.Text = command.GetUserName(); tbBranch.Text = command.GetBranch(); tbJobId.Text = command.GetJobLabel(); tbBlocking.Text = command.IsBlocking().ToString(); tbSlaveID.Text = command.mAssignedSlaveID.ToString(); tbCompleted.Text = command.IsCompleted().ToString(); tbValidSlaves.Text = command.GetValidSlaves(); if (command.GetAssetFilename() != null) { tbAssetName.Text = command.GetAssetFilename().GetAssetFullName(); } }
private ListViewItem InitNewRequestItem(MOG_Command command) { if ((command.GetCommandType() == MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest) || (command.GetCommandType() == MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest)) { ListViewItem item = new ListViewItem(); MOG_Time time = new MOG_Time(); time.SetTimeStamp(command.GetCommandTimeStamp()); item.Text = command.ToString(); item.SubItems.Add(command.GetAssetFilename().GetOriginalFilename()); item.SubItems.Add(command.GetComputerIP()); item.SubItems.Add(time.FormatString("")); item.SubItems.Add(command.GetComputerName()); item.SubItems.Add(command.GetUserName()); item.SubItems.Add(Convert.ToString(command.GetNetworkID())); item.SubItems.Add(command.GetDescription()); item.SubItems.Add(command.ToString()); switch (command.GetCommandType()) { case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest: item.Text = "Read Lock"; item.ForeColor = Color.Green; item.ImageIndex = 0; break; case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest: item.Text = "Write Lock"; item.ForeColor = Color.Red; item.ImageIndex = 0; break; } return(item); } return(null); }
public void DisplayUpdateExistingConnections() { //first let's kill the existing ones. foreach (ListViewItem item in mainForm.lviewMonitor.Items) { mainForm.lviewMonitor.Items.Remove(item); } //this needs to walk the connections and add all the connected computers. MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager(); if (commandServer == null) { return; } ArrayList slavesArray = new ArrayList(commandServer.GetRegisteredSlaves()); ArrayList clientsArray = new ArrayList(commandServer.GetRegisteredClients()); ArrayList editorsArray = new ArrayList(commandServer.GetRegisteredEditors()); //show the server first. DislayAddConnection(MOG_ControllerSystem.GetComputerName(), MOG_ControllerSystem.GetComputerIP(), 1, 0, ""); foreach (Object item in clientsArray) { MOG_Command connection = (MOG_Command)item; // Describe the current command of this connection string description = FilterDesiredCommand(connection); if (description != null) { DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient, description); } } foreach (Object item in editorsArray) { MOG_Command connection = (MOG_Command)item; // Describe the current command of this connection string description = FilterDesiredCommand(connection); if (description != null) { DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor, description); } } foreach (Object item in slavesArray) { MOG_Command connection = (MOG_Command)item; string description; // Check if this Slave is actively assigned anything? MOG_Command workingCommand = connection.GetCommand(); if (workingCommand == null) { // Describe the current command of this connection description = FilterDesiredCommand(connection); } else { // Describe the current command of this connection's command description = FilterDesiredCommand(workingCommand); } if (description != null) { DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave, description); } } }
public void DisplayUpdateExistingConnections(MOG_Command command) { ListViewItem item; // Construct the command description string description = FilterDesiredCommand(command); if (description == null) { return; } // Check if this command was assigned to a slave? if (command.GetAssignedSlaveID() != 0) { // Find the connection by the assigned slave's network id item = LocateListViewItem(mainForm.lviewMonitor, command.GetAssignedSlaveID()); } else { // Find the connection by network id item = LocateListViewItem(mainForm.lviewMonitor, command.GetNetworkID()); } switch (command.GetCommandType()) { // Delete connection? case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionKill: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownClient: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownEditor: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownCommandLine: if (item != null) { item.Remove(); } break; // Add connection? case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterCommandLine: if (item == null) { // This is a new connection, add it item = new ListViewItem(); // Construct the new item item.Text = command.GetComputerName(); item.SubItems.Add(command.GetComputerIP()); item.SubItems.Add(command.GetNetworkID().ToString()); item.SubItems.Add(command.GetDescription()); item.SubItems.Add(command.ToString()); item.SubItems[(int)MONITOR_TABS.INFORMATION].Text = description; item.ForeColor = Color.Black; // Add the new item mainForm.lviewMonitor.Items.Add(item); } break; default: // Always update the command desription if (item != null && item.SubItems.Count >= (int)MONITOR_TABS.INFORMATION) { item.SubItems[(int)MONITOR_TABS.INFORMATION].Text = description; } break; } }
public void RefreshWindow(MOG_Command command) { if (command == null) { GetCommandSnapShot(); } else { ListViewItem item = null; switch (command.GetCommandType()) { // Eat these commands, we don't need to show them in this window case MOG_COMMAND_TYPE.MOG_COMMAND_None: case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionKill: case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionLost: case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionNew: case MOG_COMMAND_TYPE.MOG_COMMAND_InstantMessage: case MOG_COMMAND_TYPE.MOG_COMMAND_LockCopy: case MOG_COMMAND_TYPE.MOG_COMMAND_LockMove: 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: case MOG_COMMAND_TYPE.MOG_COMMAND_LoginProject: case MOG_COMMAND_TYPE.MOG_COMMAND_LoginUser: case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkBroadcast: case MOG_COMMAND_TYPE.MOG_COMMAND_NewBranch: case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveCommand: case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveConnection: case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveLock: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterCommandLine: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_RemoveAssetFromProject: case MOG_COMMAND_TYPE.MOG_COMMAND_RequestActiveCommands: case MOG_COMMAND_TYPE.MOG_COMMAND_RequestActiveConnections: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownClient: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownCommandLine: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownEditor: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshApplication: case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshTools: case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshProject: case MOG_COMMAND_TYPE.MOG_COMMAND_ViewConnection: case MOG_COMMAND_TYPE.MOG_COMMAND_ViewLock: case MOG_COMMAND_TYPE.MOG_COMMAND_ActiveViews: case MOG_COMMAND_TYPE.MOG_COMMAND_ViewUpdate: case MOG_COMMAND_TYPE.MOG_COMMAND_AssetProcessed: break; default: string commandString = command.ToString(); if (command.IsCompleted()) { item = LocateItem(command, mainForm.CommandspendingListView); while (item != null) { item.Remove(); item = LocateItem(command, mainForm.CommandspendingListView); } } else { // See if it already exists if (LocateItem(command, mainForm.CommandspendingListView) == null) { item = new ListViewItem(); item.Text = command.ToString(); item.SubItems.Add(command.GetAssetFilename().GetOriginalFilename()); item.SubItems.Add(command.GetComputerName().ToString()); item.SubItems.Add(command.GetComputerIP().ToString()); item.SubItems.Add(command.GetNetworkID().ToString()); item.SubItems.Add(command.GetCommandID().ToString()); item.SubItems.Add(command.GetCommandTimeStamp()); item.SubItems.Add(command.GetComputerName()); item.SubItems.Add(command.GetAssetFilename().GetOriginalFilename()); item.ImageIndex = GetImageIndex(command.GetCommandType()); // Assign the Key for this listViewItem item.Name = command.GetCommandID().ToString(); mainForm.CommandspendingListView.Items.Add(item); } } break; } } }
private ListViewItem InitNewLockItem(MOG_Command command) { if (command != null) { if ((command.GetCommandType() == MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest) || (command.GetCommandType() == MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest)) { ListViewItem item = new ListViewItem(); MOG_Time time = new MOG_Time(); time.SetTimeStamp(command.GetCommandTimeStamp()); // Gather appropriate lock info from the command's MOG_Filename string label = ""; string classification = ""; // Check if this is an asset? if (command.GetAssetFilename().GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset) { // Get the label and classifciation of the asset label = command.GetAssetFilename().GetAssetLabel(); classification = command.GetAssetFilename().GetAssetClassification(); // Obtain the proper icon item.ImageIndex = MogUtil_AssetIcons.GetAssetIconIndex(command.GetAssetFilename().GetOriginalFilename()); } // Check if this is a classification-level by seeing if it ends with a '*'? else if (command.GetAssetFilename().GetOriginalFilename().EndsWith("*")) { // Do our best to illustrate a classification-level lock label = "*"; classification = command.GetAssetFilename().GetOriginalFilename().Trim("*".ToCharArray()); // Obtain the proper icon item.ImageIndex = MogUtil_AssetIcons.GetClassIconIndex(classification); } //LOCK_COLUMNS {LABEL, CLASSIFICATION, USER, DESCRIPTION, MACHINE, IP, ID, TIME, FULLNAME, TYPE}; item.Text = label; item.SubItems.Add(classification); item.SubItems.Add(command.GetUserName()); item.SubItems.Add(command.GetDescription()); item.SubItems.Add(command.GetComputerName()); item.SubItems.Add(command.GetComputerIP()); item.SubItems.Add(Convert.ToString(command.GetNetworkID())); item.SubItems.Add(time.FormatString("")); item.SubItems.Add(command.GetAssetFilename().GetOriginalFilename()); switch (command.GetCommandType()) { case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest: item.SubItems.Add("Read Lock"); item.ForeColor = Color.Green; break; case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest: item.SubItems.Add("Write Lock"); item.ForeColor = Color.Red; break; } return(item); } } return(null); }
public void UpdateCommands(MOG_Command command) { ListViewItem item; MOG_Command action = command.GetCommand(); if (action != null) { bool bAdd = false; bool bRemove = false; switch (action.GetCommandType()) { case MOG_COMMAND_TYPE.MOG_COMMAND_None: case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionKill: case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionLost: case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionNew: case MOG_COMMAND_TYPE.MOG_COMMAND_InstantMessage: case MOG_COMMAND_TYPE.MOG_COMMAND_LaunchSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_LockCopy: case MOG_COMMAND_TYPE.MOG_COMMAND_LockMove: 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: case MOG_COMMAND_TYPE.MOG_COMMAND_LoginProject: case MOG_COMMAND_TYPE.MOG_COMMAND_LoginUser: case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkBroadcast: case MOG_COMMAND_TYPE.MOG_COMMAND_NewBranch: case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveCommand: case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveConnection: case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveLock: case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemAlert: case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemError: case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemException: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterCommandLine: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor: case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_RequestActiveCommands: case MOG_COMMAND_TYPE.MOG_COMMAND_RequestActiveConnections: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownClient: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownCommandLine: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownEditor: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshApplication: case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshTools: case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshProject: case MOG_COMMAND_TYPE.MOG_COMMAND_ViewConnection: case MOG_COMMAND_TYPE.MOG_COMMAND_ViewLock: case MOG_COMMAND_TYPE.MOG_COMMAND_ActiveViews: case MOG_COMMAND_TYPE.MOG_COMMAND_ViewUpdate: // Eat these commands, we don't need to show them in this window break; case MOG_COMMAND_TYPE.MOG_COMMAND_Complete: // Drill one more level into this Complete command action = action.GetCommand(); bRemove = true; break; // All other commands can simply be added default: bAdd = true; break; } // Check if we are removing the command? if (bRemove) { // Strip out any matching commands do { // Find it using specific information // item = LocateItem((int)CommandsColumns.COMMANDID, action.GetCommandID().ToString(), mainForm.ConnectionManagerCommandsListView); item = LocateCommandItem(action); if (item != null) { item.Remove(); } } while(item != null); } // Check if we are adding the command? if (bAdd) { // Find it using a generic approach item = LocateCommandItem(action); if (item != null) { // Check if this could replace an existing command? if (action.IsRemoveDuplicateCommands()) { // Remove the duplicate item.Remove(); item = null; } } // Check if the item already exists if (item == null) { //It doesn't already exist, so let's make a new one item = new ListViewItem(); MOG_Time time = new MOG_Time(); time.SetTimeStamp(command.GetCommandTimeStamp()); string assetFullName = "PROJECT: " + action.GetProject() + " ASSET: " + action.GetAssetFilename().GetAssetOriginalFullName(); if (string.Compare(action.GetProject(), MOG_ControllerProject.GetProjectName(), true) == 0) { assetFullName = action.GetAssetFilename().GetAssetFullName(); } item.Text = action.ToString(); item.SubItems.Add(assetFullName); item.SubItems.Add(action.GetPlatform()); item.SubItems.Add(action.IsCompleted() ? "Working" : ""); item.SubItems.Add(action.GetJobLabel()); item.SubItems.Add(action.GetComputerName().ToString()); item.SubItems.Add(action.GetComputerIP().ToString()); item.SubItems.Add(action.GetNetworkID().ToString()); item.SubItems.Add(action.GetCommandID().ToString()); item.Tag = action; item.ImageIndex = GetImageIndex(action.GetCommandType()); mainForm.ConnectionManagerCommandsListView.Items.Add(item); } } } }
public void UpdateConnections(MOG_Command command) { if (mainForm.ConnectionsListView != null) { MOG_Command action = command.GetCommand(); if (action != null) { // Check if this item already exist in our list? ListViewItem item = LocateItem((int)ConnectionsColumns.ID, action.GetNetworkID().ToString(), mainForm.ConnectionsListView); if (item == null) { // Create a new item item = new ListViewItem(); item.Text = action.GetComputerName(); item.SubItems.Add(action.GetComputerIP()); item.SubItems.Add(action.GetNetworkID().ToString()); item.SubItems.Add(action.GetDescription()); item.SubItems.Add("N/A"); item.SubItems.Add(action.GetNetworkID().ToString()); // Add the new item to our list mainForm.ConnectionsListView.Items.Add(item); mGroups.UpdateGroupItem(mainForm.ConnectionsListView, item, "Type"); } // Make sure we have a valid item if (item != null) { // Update the item's information item.SubItems[(int)ConnectionsColumns.INFO].Text = GetClientStatusDescription(action); } // Identify the desired icon & colors switch (action.GetCommandType()) { case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor: item.ImageIndex = (int)MOGImagesImages.EDITOR; item.ForeColor = Color.SlateGray; break; case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave: item.ImageIndex = (int)MOGImagesImages.SLAVE; item.ForeColor = Color.BlueViolet; break; case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient: case MOG_COMMAND_TYPE.MOG_COMMAND_ActiveViews: // Check what kind of client? if (action.GetDescription().Contains("Client")) { item.ImageIndex = (int)MOGImagesImages.CLIENT; item.ForeColor = Color.DarkBlue; } else if (action.GetDescription().Contains("Server Manager")) { item.ImageIndex = (int)MOGImagesImages.SERVER; item.ForeColor = Color.Firebrick; } else { item.ImageIndex = (int)MOGImagesImages.CLIENT; item.ForeColor = Color.SteelBlue; } break; case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterCommandLine: item.ImageIndex = (int)MOGImagesImages.COMMANDLINE; item.ForeColor = Color.Black; break; case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownSlave: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownClient: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownEditor: case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownCommandLine: case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionKill: case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionLost: item.Remove(); break; } } } }