Пример #1
0
        private void UpdateListItem(WorkflowInstance workflowInstance, string workflowState, string workflowStatus)
        {
            if (this.listViewOrders.InvokeRequired)
            {
                // This code is executing on a different thread than the one that
                // ...created the ListView, so we need to use the Invoke method.

                // Create an instance of the delegate for invoking this method
                UpdateListItemDelegate updateListViewItem =
                    new UpdateListItemDelegate(this.UpdateListItem);

                // Create the array of parameters for this method
                object[] args = new object[3] {
                    workflowInstance, workflowState, workflowStatus
                };

                // Invoke this method on the UI thread
                this.listViewOrders.Invoke(updateListViewItem, args);
            }
            else
            {
                // Get the ListViewItem for the specified WorkflowInstance
                string       instanceId = workflowInstance.InstanceId.ToString();
                ListViewItem itemOrder  = listViewOrders.Items[instanceId];

                if (itemOrder == null)
                {
                    return;
                }

                // Update the Workflow State & Status column values
                itemOrder.SubItems[OrderStateColumnIndex].Text     = workflowState;
                itemOrder.SubItems[WorkflowStatusColumnIndex].Text = workflowStatus;
            }
        }
Пример #2
0
        private void UpdateListItem(WorkflowInstance workflowInstance, string workflowState, string workflowStatus)
        {
            if (this.listViewOrders.InvokeRequired)
            {
                // This code is executing on a different thread than the one that
                // ...created the ListView, so we need to use the Invoke method.
                
                // Create an instance of the delegate for invoking this method
                UpdateListItemDelegate updateListViewItem =
                    new UpdateListItemDelegate(this.UpdateListItem);

                // Create the array of parameters for this method
                object[] args = new object[3] { workflowInstance, workflowState, workflowStatus };

                // Invoke this method on the UI thread
                this.listViewOrders.Invoke(updateListViewItem, args);
            }
            else
            {
                // Get the ListViewItem for the specified WorkflowInstance
                string instanceId = workflowInstance.InstanceId.ToString();
                ListViewItem itemOrder = listViewOrders.Items[instanceId];

                if (itemOrder == null)
                {
                    return;
                }

                // Update the Workflow State & Status column values
                itemOrder.SubItems[OrderStateColumnIndex].Text = workflowState;
                itemOrder.SubItems[WorkflowStatusColumnIndex].Text = workflowStatus;
            }
        }