Exemplo n.º 1
0
        public TaskInformationForm(ITask <T> task, String subtitle)
            : this()
        {
            this.Text = task.Name + " on " + subtitle;
            this.btnErrorTrace.Click += new EventHandler(delegate(Object sender, EventArgs e)
            {
                TaskErrorTraceForm <T> errorTrace = new TaskErrorTraceForm <T>(task, subtitle);
                errorTrace.MdiParent = this.MdiParent;
                errorTrace.Show();
            });
            this.ShowInformation(task);

            task.StateChanged += new TaskStateChanged(delegate()
            {
                this.ShowInformation(task);
            });

            if (task is CancellableTask <T> )
            {
                this.btnCancel.Click += new EventHandler(delegate(Object sender, EventArgs e)
                {
                    ((CancellableTask <T>)task).Cancel();
                });
            }
        }
Exemplo n.º 2
0
        private void mnuViewErrors_Click(object sender, EventArgs e)
        {
            if (this.lvwTasks.SelectedItems.Count > 0)
            {
                ListViewItem item = this.lvwTasks.SelectedItems[0];
                Object       tag  = item.Tag;

                if (tag is QueryTask)
                {
                    TaskErrorTraceForm <Object> queryInfo = new TaskErrorTraceForm <object>((ITask <Object>)tag, this._manager.ToString());
                    queryInfo.MdiParent = this.MdiParent;
                    queryInfo.Show();
                }
                else if (tag is ListGraphsTask)
                {
                    TaskErrorTraceForm <IEnumerable <Uri> > listInfo = new TaskErrorTraceForm <IEnumerable <Uri> >((ITask <IEnumerable <Uri> >)tag, this._manager.ToString());
                    listInfo.MdiParent = this.MdiParent;
                    listInfo.Show();
                }
                else if (tag is ITask <IGraph> )
                {
                    TaskErrorTraceForm <IGraph> graphInfo = new TaskErrorTraceForm <IGraph>((ITask <IGraph>)tag, this._manager.ToString());
                    graphInfo.MdiParent = this.MdiParent;
                    graphInfo.Show();
                }
                else if (tag is ITask <TaskResult> )
                {
                    TaskErrorTraceForm <TaskResult> simpleInfo = new TaskErrorTraceForm <TaskResult>((ITask <TaskResult>)tag, this._manager.ToString());
                    simpleInfo.MdiParent = this.MdiParent;
                    simpleInfo.Show();
                }
                else
                {
                    MessageBox.Show("Task Information cannot be shown as the Task type is unknown", "Task Information Unavailable", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }