public void RefreshInbox(MOG_Command asset, MOG_Filename source, MOG_Filename destination) { // Skip this if we don't have an active project if (!mParent.mMog.IsProject()) { return; } // Check for remove if (destination.GetFullFilename().Length == 0) { // We are removing int index = mParent.ListViewItemFindItem(source.GetFilename(), mParent.mainForm.AssetManagerInboxMessagesListViewFilter); if (index != -1) { // Remove it from our list mParent.mainForm.AssetManagerInboxAssetListView.Items[index].Remove(); } } // Check for new message else if (source.GetFullFilename().Length == 0) { // We are importing MOG_Controller assetController = MOG_Controller.CreateController(mParent.mMog, destination.GetFullFilename()); if (!assetController.Open(destination.GetFullFilename())) { return; } // Check if this message is to go to the outbox or inbox if (string.Compare(destination.GetBoxName(), "Outbox", true) == 0) { // Create the newly added node ListViewItem item = mParent.CreateListViewNode(assetController.GetPropertiesFile().GetString("MESSAGE", "SUBJECT"), assetController.GetPropertiesFile().GetString("MESSAGE", "FROM"), assetController.GetPropertiesFile().GetString("ASSET", "TIME"), "ATTACHMENTS", assetController.GetPropertiesFile().GetString("MESSAGE", "CC"), "", assetController.GetAssetFilename().GetFullFilename(), assetController.GetAssetFilename().GetBoxName(), Color.Black); // Add it to our listView mParent.mainForm.AssetManagerOutboxMessagesListViewFilter.Items.Add(item); } else { // Create the newly added node ListViewItem item = mParent.CreateListViewNode(assetController.GetPropertiesFile().GetString("MESSAGE", "SUBJECT"), assetController.GetPropertiesFile().GetString("MESSAGE", "TO"), assetController.GetPropertiesFile().GetString("ASSET", "TIME"), "ATTACHMENTS", assetController.GetPropertiesFile().GetString("MESSAGE", "CC"), "", assetController.GetAssetFilename().GetFullFilename(), assetController.GetAssetFilename().GetBoxName(), Color.Blue); // Add it to our listView mParent.mainForm.AssetManagerInboxMessagesListViewFilter.Items.Add(item); } assetController.Close(); } }
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); }