Пример #1
0
 private void mnuTasks_Opening(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (this.lvwTasks.SelectedItems.Count > 0)
     {
         ListViewItem item = this.lvwTasks.SelectedItems[0];
         Object       tag  = item.Tag;
         if (tag != null)
         {
             if (tag is QueryTask)
             {
                 QueryTask qTask = (QueryTask)tag;
                 this.mnuViewErrors.Enabled  = qTask.Error != null;
                 this.mnuViewResults.Enabled = (qTask.State == TaskState.Completed && qTask.Result != null);
                 this.mnuCancel.Enabled      = qTask.IsCancellable;
             }
             else if (tag is BaseImportTask)
             {
                 BaseImportTask importTask = (BaseImportTask)tag;
                 this.mnuViewErrors.Enabled  = importTask.Error != null;
                 this.mnuViewResults.Enabled = false;
                 this.mnuCancel.Enabled      = importTask.IsCancellable;
             }
             else if (tag is ListGraphsTask)
             {
                 ListGraphsTask graphsTask = (ListGraphsTask)tag;
                 this.mnuViewErrors.Enabled  = graphsTask.Error != null;
                 this.mnuViewResults.Enabled = false;
                 this.mnuCancel.Enabled      = graphsTask.IsCancellable;
             }
             else if (tag is CountTriplesTask)
             {
                 CountTriplesTask countTask = (CountTriplesTask)tag;
                 this.mnuViewErrors.Enabled  = countTask.Error != null;
                 this.mnuViewResults.Enabled = false;
                 this.mnuCancel.Enabled      = countTask.IsCancellable;
             }
             else if (tag is ITask <IGraph> )
             {
                 ITask <IGraph> graphTask = (ITask <IGraph>)tag;
                 this.mnuViewErrors.Enabled  = graphTask.Error != null;
                 this.mnuViewResults.Enabled = (graphTask.State == TaskState.Completed && graphTask.Result != null);
                 this.mnuCancel.Enabled      = graphTask.IsCancellable;
             }
             else if (tag is ITask <TaskResult> )
             {
                 ITask <TaskResult> basicTask = (ITask <TaskResult>)tag;
                 this.mnuViewErrors.Enabled  = basicTask.Error != null;
                 this.mnuViewResults.Enabled = false;
                 this.mnuCancel.Enabled      = basicTask.IsCancellable;
             }
             else
             {
                 e.Cancel = true;
             }
         }
         else
         {
             e.Cancel = true;
         }
     }
     else
     {
         e.Cancel = true;
     }
 }
Пример #2
0
        private void CountTriples(String graphUri)
        {
            CountTriplesTask task = new CountTriplesTask(this._manager, graphUri);

            this.AddTask <TaskValueResult <int> >(task, this.CountTriplesCallback);
        }