Example #1
0
        public override void AddRow(Workshare.Reports.MailMessage.Message messageItem)
        {
            ListViewItem[] itemCollection = CreateRow(messageItem);
            if (null == itemCollection)
                return;

            foreach (ListViewItem item in itemCollection)
            {
                string groupName = null == item.Group ? "" : item.Group.Name;
                ViewRecord record = new ViewRecord(Name, groupName, item);
                AddItemToList(record);
            }
        }
Example #2
0
 /// <summary>
 /// This method will override the base add row command
 /// </summary>
 /// <param name="item">The item to be added</param>
 public override void AddRow(Workshare.Reports.MailMessage.Message item)
 {
     ListViewItem[] lvis = CreateRow(item);
     if (lvis != null)
     {
         foreach (ListViewItem lvi in lvis)
         {
             string groupName = "";
             if (lvi.Group != null)
                 groupName = lvi.Group.Name;
             ViewRecord vr = new ViewRecord(Name, groupName, lvi);
             AddItemToList(vr);
         }
     }
 }
Example #3
0
        protected static void AddItemToList(ViewRecord item )
		{
            lock (m_items)
            {
                if (m_items.Contains(item) == false)
                {
                    m_items.Add(item);
                }
            }
            if (IsLoading == false)
                //ddToQueue(item);
                ThreadPool.QueueUserWorkItem(new WaitCallback(AddToQueue), item);
		}
Example #4
0
        private void CreateView(object state)
        {
            IsRebuilding = true;
            IScannerClient client = state as IScannerClient;
            if (client != null && IsLoading == false &&
                     IsScanning == false)
            {
                client.SetProgressMax(TraceScans.MessageCount);
                client.SetProgressVisible(true);
                client.SetProgressStyle(System.Windows.Forms.ProgressBarStyle.Marquee);
                client.SetStatusbarCountText(Properties.Resources.REBUILD_TEXT);
                client.SetViewEnable(false);
                client.SetFileMenu(false);
            }
            Application.DoEvents();
            lock (m_queue)
            {
                m_queue.Clear();
                m_items.Clear();
                ClearItems();
                ClearGroups();
                DisableColumnSorting(!Sortable);
                ShowGroup(ShowGroups);
                View.ListViewItemSorter = null;
                Application.DoEvents();
            }
            //if (View.Columns.Count == 0)
            {
                lvColumnAddRange lvc = new lvColumnAddRange(View.Columns.AddRange);
                ColumnHeader[] columns = (ColumnHeader[])Columns.ToArray();
                View.Invoke(lvc, new object[] { columns });
            }
            List<Workshare.Reports.MailMessage.Message> list = new List<Workshare.Reports.MailMessage.Message>();
            if (client != null && IsLoading == false && IsScanning == false)
            {
                client.SetStatusbarTimerText(Properties.Resources.REBUILD_COPY);
            }

            lock (this)
            {
                list.AddRange(TraceScans.GetMessages());
            }
            if (client != null && IsLoading == false && IsScanning == false)
            {
                client.SetProgressStyle(System.Windows.Forms.ProgressBarStyle.Continuous);
            }
            int count = 0;

            // Check to see if the list of messages is the same as list of items for this view
            foreach (Workshare.Reports.MailMessage.Message item in list)
            {
                if (client != null && IsLoading == false &&
                     IsScanning == false)
                {
                    client.SetProgress(++count);
                    StringBuilder sb = new StringBuilder();
                    sb.AppendFormat(Properties.Resources.REBUILD_COUNT,
                        count, list.Count);
                    client.SetStatusbarTimerText(sb.ToString());
                    Application.DoEvents();
                }
                ListViewItem[] lvis = CreateRow(item);
                if (lvis != null)
                {
                    foreach (ListViewItem lvi in lvis)
                    {
                        string groupName = "";
                        if (lvi.Group != null)
                            groupName = lvi.Group.Name;
                        ViewRecord vr = new ViewRecord(Name, groupName, lvi);
                        lock (m_items)
                        {
                            if (m_items.Contains(vr) == false)
                                m_items.Add(vr);
                        }
                    }
                }
            }
            //ThreadPool.QueueUserWorkItem(new WaitCallback(DisplayItems), m_items.GetItemsSortedByGroup(Name));
            DisplayItems(m_items.GetItemsSortedByGroup(Name));
            if ( client != null && IsLoading == false &&
                 IsScanning == false)
            {
                client.SetProgressVisible(false);
                client.SetStatusbarCountText(Properties.Resources.STATUS_READY);
                client.SetStatusbarTimerText(String.Empty);
                client.SetViewEnable(true);
                client.SetFileMenu(true);
                Application.DoEvents();
            }

            IsRebuilding = false;
        }