internal void HandleUpdate(UpdateData data) { if (this.InvokeRequired) { Action<UpdateData> handler = new Action<UpdateData>(UpdateStatus); this.BeginInvoke(handler, data); } else { UpdateStatus(data); } }
private void UpdateStatus(UpdateData data) { switch (data.EventType) { case EventType.Start: ToggleUI(false); AddStatusEntry(data.Message); break; case EventType.Completed: ToggleUI(true); AddStatusEntry(data.Message); break; case EventType.ItemUpdate: if (string.IsNullOrEmpty(data.ImageName)) { AddStatusEntry(data.Message); } else { string itemKey = startTime + data.ImageName; string message = string.Format("{0, -60}{1}", data.ImageName.Length > 55 ? data.ImageName.Substring(0, 55) : data.ImageName, GetStatusString(data.ImageStatus)); if (statusIndex.ContainsKey(itemKey)) { //Enstry already exisits statusListBox.Items[statusIndex[itemKey]] = message; } else { //Add entry and keep index in dictionary statusIndex.Add(itemKey, AddStatusEntry(message)); } } break; default: break; } }