private static void CreateMeddlingActionForTask(Task task)
        {
            // If AppliesTo is set, then the client that created this task knows about our scheme for passing
            // info between clients.  We give the client a window (AwareClientHeuristic) to set this field
            // before deciding that it's a non-aware client.  Having decided that it's one of those two cases,
            // we make a MeddlingAction.

            MeddlingAction a = new MeddlingAction(task);

            UnmatchedTasks.Remove(task.opaque_ref);
            MatchedTasks[task.opaque_ref] = a;
        }
示例#2
0
        public static void Task_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            Task task = (Task)sender;

            lock (DictionaryLock)
            {
                if (UnmatchedTasks.Contains(task.opaque_ref))
                {
                    if (MeddlingAction.IsTaskUnwanted(task))
                    {
                        task.PropertyChanged -= Task_PropertyChanged;
                        UnmatchedTasks.Remove(task.opaque_ref);
                    }
                    else if (MeddlingAction.IsTaskSuitable(task))
                    {
                        var a = new MeddlingAction(task);
                        UnmatchedTasks.Remove(task.opaque_ref);
                        MatchedTasks[task.opaque_ref] = a;
                    }
                    else
                    {
                        log.DebugFormat("Unmatched meddling task skipped -- " + task.opaque_ref);
                    }
                }
                else if (MatchedTasks.TryGetValue(task.opaque_ref, out MeddlingAction a))
                {
                    if (task.status == task_status_type.success)
                    {
                        task.PropertyChanged -= Task_PropertyChanged;
                        a.Update(task, true);
                        MatchedTasks.Remove(task.opaque_ref);
                    }
                    else
                    {
                        a.Update(task, false);
                    }
                }
                else
                {
                    // else - it is a hidden (etc..) task that has called already and been removed from unmatched
                    //(and not put into matched) - so ignore it
                    log.DebugFormat("Uncategorised meddling task skipped -- " + task.opaque_ref);
                }
            }
        }
        private static void CreateMeddlingActionForTask(Task task)
        {
            // If AppliesTo is set, then the client that created this task knows about our scheme for passing
            // info between clients.  We give the client a window (AwareClientHeuristic) to set this field
            // before deciding that it's a non-aware client.  Having decided that it's one of those two cases,
            // we make a MeddlingAction.

            MeddlingAction a = new MeddlingAction(task);
            UnmatchedTasks.Remove(task.opaque_ref);
            MatchedTasks[task.opaque_ref] = a;
        }