private void UpdateAssetVerifyIcon(MOG_Filename verifyFile) { if (verifyFile.GetType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset) { if (MOG_ControllerSystem.GetDB() != null && MOG_DBAssetAPI.GetAssetVersion(verifyFile) != null && MOG_DBAssetAPI.GetAssetVersion(verifyFile).Length != 0) { // This is a perfect asset that has a prior version this.AssetValidPictureBox.Image = new Bitmap(AssetValidImageList.Images[2]); } else { // good asset with no prior version this.AssetValidPictureBox.Image = new Bitmap(AssetValidImageList.Images[1]); } } else { // Bad Asset name this.AssetValidPictureBox.Image = new Bitmap(AssetValidImageList.Images[0]); } }
/// <summary> SetAssetIcon /// Searches through mAssetTypes to find the matching key with /// that of the filename. Then returns the index /// </summary> /// <param name="filename"></param> /// <returns>index of icon in the mAssetTypeImages list</returns> static public int SetAssetIcon(String filename) { // Construct a filename MOG_Filename file = null; try { file = new MOG_Filename(filename); } catch (Exception e) { e.ToString(); return(0); } string classification; switch (file.GetType()) { case MOG_FILENAME_TYPE.MOG_FILENAME_Asset: classification = file.GetAssetClassification(); break; case MOG_FILENAME_TYPE.MOG_FILENAME_Group: classification = "group"; break; default: classification = filename; break; } // Check for locks on this asset if (!guiAssetSourceLock.QueryPersistentLock(file.GetAssetFullName(), true)) { // Check if this asset is locked by our current user if (guiAssetSourceLock.OkToBless(file.GetAssetFullName(), true)) { // Look for an icon type of _readLocked int y = mAssetTypes.IndexOf(classification + "_readlocked"); if (y == -1) { // Can't find it, use default return(0); } else { // Return the location of the _readLocked icon return(y); } } else { // Look for an icon type of _locked int y = mAssetTypes.IndexOf(classification + "_locked"); if (y == -1) { // Can't find it, use default return(0); } else { // Return the location of the _locked icon return(y); } } } else { // Get the index of the key in the types array int x = mAssetTypes.IndexOf(classification); // If the asset was not found, return 0 for first icon in the list if (x == -1) { return(0); } // Return the index of the icon return(x); } }
public void RefreshBox(MOG_Filename add, MOG_Filename del, MOG_Command command) { Color textColorAdd = Color.Black; Color textColorDel = Color.Black; ListView currentViewAdd = mParent.IsolateListView(add.GetBoxName(), add.GetType(), add.GetUserName(), ref textColorAdd); ListView currentViewDel = mParent.IsolateListView(del.GetBoxName(), del.GetType(), del.GetUserName(), ref textColorDel); if (currentViewAdd == currentViewDel) { // Check to see if this item already exists? int index = ListViewItemMessagesFindItem(add.GetFullFilename(), currentViewAdd); if (index != -1) { currentViewAdd.Items[index].SubItems[(int)guiAssetManager.MessageBoxColumns.STATUS].Text = command.GetDescription(); currentViewAdd.Items[index].SubItems[(int)guiAssetManager.MessageBoxColumns.BOX].Text = add.GetBoxName(); currentViewAdd.Items[index].SubItems[(int)guiAssetManager.MessageBoxColumns.FULLNAME].Text = add.GetFullFilename(); currentViewAdd.Items[index].ForeColor = textColorAdd; for (int x = 0; x < currentViewAdd.Items[index].SubItems.Count; x++) { currentViewAdd.Items[index].SubItems[x].ForeColor = textColorAdd; } } } else { if (currentViewDel != null) { int index = ListViewItemMessagesFindItem(del.GetFullFilename(), currentViewDel); if (index != -1) { currentViewDel.Items[index].Remove(); } } if (currentViewAdd != null) { // Check to see if this item already exists? int index = ListViewItemMessagesFindItem(add.GetFullFilename(), currentViewAdd); if (index != -1) { currentViewAdd.Items[index].SubItems[(int)guiAssetManager.MessageBoxColumns.STATUS].Text = command.GetDescription(); currentViewAdd.Items[index].SubItems[(int)guiAssetManager.MessageBoxColumns.FULLNAME].Text = add.GetFullFilename(); currentViewAdd.Items[index].ForeColor = textColorAdd; for (int x = 0; x < currentViewAdd.Items[index].SubItems.Count; x++) { currentViewAdd.Items[index].SubItems[x].ForeColor = textColorAdd; } } else { MOG_ControllerMessage assetController = new MOG_ControllerMessage(mParent.mMog); if (!assetController.Open(add.GetFullFilename())) { return; } // Create the newly added node ListViewItem item = mParent.CreateListViewNode(assetController.GetSubject(), assetController.GetFrom(), assetController.GetFileInfo().LastWriteTime.ToString(), assetController.GetTo(), assetController.GetStatus(), "", assetController.GetAssetFilename().GetFullFilename(), assetController.GetAssetFilename().GetBoxName(), Color.Black); currentViewAdd.Items.Add(item); assetController.Close(); } } } // Update the Tab RefreshTab(command); }
public void RefreshBox(MOG_Filename add, MOG_Filename del, MOG_Command command) { Color textColorAdd = Color.Black; Color textColorDel = Color.Black; // Dont add if we dont have a valid box if (add.GetBoxName().Length == 0 && del.GetBoxName().Length == 0) { return; } ListView currentViewAdd = mParent.IsolateListView(add.GetBoxName(), add.GetType(), add.GetUserName(), ref textColorAdd); ListView currentViewDel = mParent.IsolateListView(del.GetBoxName(), del.GetType(), del.GetUserName(), ref textColorDel); if (currentViewAdd == currentViewDel) { // Check to see if this item already exists? int index = mParent.ListViewItemFindItem(add.GetFilename(), currentViewAdd); if (index != -1) { currentViewAdd.Items[index].SubItems[(int)guiAssetManager.TaskBoxColumns.STATUS].Text = command.GetDescription(); currentViewAdd.Items[index].SubItems[(int)guiAssetManager.TaskBoxColumns.FULLNAME].Text = add.GetFullFilename(); currentViewAdd.Items[index].ForeColor = textColorAdd; for (int x = 0; x < currentViewAdd.Items[index].SubItems.Count; x++) { currentViewAdd.Items[index].SubItems[x].ForeColor = textColorAdd; } } } else { if (currentViewDel != null) { int index = mParent.ListViewItemFindItem(del.GetFilename(), currentViewDel); if (index != -1) { currentViewDel.Items[index].Remove(); } } if (currentViewAdd != null) { // Check to see if this item already exists? int index = mParent.ListViewItemFindItem(add.GetFilename(), currentViewAdd); if (index != -1) { currentViewAdd.Items[index].SubItems[(int)guiAssetManager.TaskBoxColumns.STATUS].Text = command.GetDescription(); currentViewAdd.Items[index].SubItems[(int)guiAssetManager.TaskBoxColumns.FULLNAME].Text = add.GetFullFilename(); currentViewAdd.Items[index].ForeColor = textColorAdd; for (int x = 0; x < currentViewAdd.Items[index].SubItems.Count; x++) { currentViewAdd.Items[index].SubItems[x].ForeColor = textColorAdd; } } else { MOG_ControllerTask assetController = new MOG_ControllerTask(mParent.mMog); if (!assetController.Open(add.GetFullFilename())) { return; } ListViewItem item = new ListViewItem(); item.Text = assetController.GetTitle(); MOG_Time t = new MOG_Time(); t.SetTimeStamp(assetController.GetDueDate()); item.SubItems.Add(t.ToDateTime().ToString()); item.SubItems.Add(assetController.GetFileInfo().LastWriteTime.ToString()); item.SubItems.Add(assetController.GetCreator()); item.SubItems.Add(assetController.GetPriority()); item.SubItems.Add(assetController.GetStatus()); item.SubItems.Add(assetController.GetAsset()); item.SubItems.Add(assetController.GetAssetFilename().GetFullFilename()); item.SubItems.Add(assetController.GetAssetFilename().GetBoxName()); item.ForeColor = Color.Black; for (int x = 0; x < item.SubItems.Count; x++) { item.SubItems[x].ForeColor = textColorAdd; } item.ImageIndex = 0; //SetAssetIcon(String.Concat(mParent.mMog.GetActiveUser().GetUserPath(), "\\", box, "\\", assetName)); currentViewAdd.Items.Add(item); assetController.Close(); } } } // Update the tab RefreshTab(command); }