当前位置: 首页>>代码示例>>C#>>正文


C# ITask类代码示例

本文整理汇总了C#中ITask的典型用法代码示例。如果您正苦于以下问题:C# ITask类的具体用法?C# ITask怎么用?C# ITask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ITask类属于命名空间,在下文中一共展示了ITask类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Add

        public void Add(ITask task)
        {
            if (task == null)
                throw new ArgumentNullException();

            Add(new EnumerableTask(task));
        }
开发者ID:adahera222,项目名称:TaskRunner,代码行数:7,代码来源:Tasks.cs

示例2: TaskLoggingHelperExtension

 /// <summary>
 /// public constructor
 /// </summary>
 public TaskLoggingHelperExtension(ITask taskInstance, ResourceManager primaryResources, ResourceManager sharedResources, string helpKeywordPrefix) :
     base(taskInstance)
 {
     this.TaskResources = primaryResources;
     this.TaskSharedResources = sharedResources;
     this.HelpKeywordPrefix = helpKeywordPrefix;
 }
开发者ID:cameron314,项目名称:msbuild,代码行数:10,代码来源:TaskLoggingHelperExtension.cs

示例3: TaskViewModel

        protected TaskViewModel(ILogger logger, ITask task, string name, string description, object icon)
        {
            if (logger == null)
                throw new ArgumentNullException("logger");
            if (task == null)
                throw new ArgumentNullException("task");
            if (name == null)
                throw new ArgumentNullException("name");
            if (description == null)
                throw new ArgumentNullException("description");
            if (icon == null)
                throw new ArgumentNullException("icon");

            this.logger = logger;
            this.task = task;
            this.name = name;
            this.description = description;
            this.icon = icon;

            task.AddStoppedCallback(() => OnStopped());
            task.AddCancelledCallback(() => OnCancelled());
            task.AddCompletedCallback(() => OnCompleted());
            task.AddErrorCallback(error => OnError(error));
            task.AddFailedCallback(() => OnFailed());
            task.AddPausedCallback(() => OnPaused());
            task.AddProgressCallback(progress => OnProgressChanged(progress));
            task.AddItemChangedCallback(item => OnItemChanged(item));
            task.AddResumedCallback(() => OnResumed());
            task.AddStartedCallback(() => OnStarted());
        }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:30,代码来源:TaskViewModel.cs

示例4: GetV1Path

 internal static string GetV1Path(ITask v1Task)
 {
     var ppszFileName = string.Empty;
     try { ((IPersistFile)v1Task).GetCurFile(out ppszFileName); }
     catch (Exception ex) { throw ex; }
     return ppszFileName;
 }
开发者ID:BclEx,项目名称:AdamsyncEx,代码行数:7,代码来源:Task.cs

示例5: FillTask

 private void FillTask(ITask task)
 {
     questionSpelling.Content = task.Question.Spelling;
     questionTranscription.Content = task.Question.Transcription;
     answers.ItemsSource = task.Answers;
     answers.ItemContainerStyleSelector = BuildStyleSelector(false);
 }
开发者ID:EugeneSqr,项目名称:VocabExt.Desktop,代码行数:7,代码来源:TaskPanel.xaml.cs

示例6: ContainsTask

 public bool ContainsTask(ITask task)
 {
     if(task.Category is DummyCategory)
         return (task.Category.Name.CompareTo(name) == 0);
     else
         return false;
 }
开发者ID:nolith,项目名称:tasque,代码行数:7,代码来源:DummyCategory.cs

示例7: ContainsTask

 public bool ContainsTask(ITask task)
 {
     if(task.Category is RtmCategory)
         return ((task.Category as RtmCategory).ID.CompareTo(ID) == 0);
     else
         return false;
 }
开发者ID:nolith,项目名称:tasque,代码行数:7,代码来源:RtmCategory.cs

示例8: LogTaskState

        public void LogTaskState(ITaskExecuteClient client, ITask task, TaskMessage message)
        {
            //��������Լ�¼��־

            if (this.Storage != null)
                this.Storage.SaveTaskChangedState(task, message);
        }
开发者ID:ReinhardHsu,项目名称:devfw,代码行数:7,代码来源:TaskLogProvider.cs

示例9: Execute

        public IResponse Execute(ITask task)
        {
            Debug.WriteLine(string.Format("{0}: Received task", DateTime.Now));

            bool successful = true;
            Exception exception = null;
            IResult result = null;
            try
            {
                ITaskExecutor taskExecutor = taskExecuterFactory.CreateExecuterFor(task);
                Debug.WriteLine(string.Format("{0}: Executing {1}", DateTime.Now, task.GetType().Name));
                result = taskExecutor.Execute(task);
            }
            catch(Exception e)
            {
                Debug.WriteLine(string.Format("{0}: Error in {1}, {2} ({3})", DateTime.Now, task.GetType().Name, e.GetType().Name, e.Message));
                successful = false;
                exception = e;
                logger.LogException(LogLevel.Debug, "Exception when executing task: " + task.GetType().Name, e);
            }

            var resultType = task.GetType().GetInterfaces().Single(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof (ITask<>)).GetGenericArguments()[0];

            return CreateResponse(resultType, result, successful, exception);
        }
开发者ID:larsudengaard,项目名称:deploy-commander,代码行数:25,代码来源:SoldierService.cs

示例10: Execute

        public TaskContext Execute(ITask task, object associatedData = null)
        {
            var context = new TaskContext(task, associatedData);

            _dispatcher.BeginInvoke(() =>
            {
                _all.Add(task);
                _contexts.Add(context);
                UpdateBusy();
            });


            task.Execute(context).ContinueWith((p, d) =>
            {
                _dispatcher.BeginInvoke(() =>
                {
                    _all.Remove(task);
                    _contexts.Remove(context);
                    UpdateBusy();
                });
            }).Failed((p, d) =>
            {

            });

            return context;
        }
开发者ID:LenFon,项目名称:Bifrost,代码行数:27,代码来源:Tasks.cs

示例11: Compare

        /// <summary>
        /// This is the same as CompareTo above but should use completion date
        /// instead of due date.  This is used to sort items in the
        /// CompletedTaskGroup.
        /// </summary>
        /// <returns>
        /// whether the task has lower, equal or higher sort order.
        /// </returns>
        public override int Compare(ITask x, ITask y)
        {
            bool isSameDate = true;
            if (x.CompletionDate.Year != y.CompletionDate.Year
                || x.CompletionDate.DayOfYear != y.CompletionDate.DayOfYear)
                isSameDate = false;

            if (!isSameDate) {
                if (x.CompletionDate == DateTime.MinValue) {
                    // No completion date set for some reason.  Since we already
                    // tested to see if the dates were the same above, we know
                    // that the passed-in task has a CompletionDate set, so the
                    // passed-in task should be "higher" in the sort.
                    return 1;
                } else if (y.CompletionDate == DateTime.MinValue) {
                    // "this" task has a completion date and should evaluate
                    // higher than the passed-in task which doesn't have a
                    // completion date.
                    return -1;
                }

                return x.CompletionDate.CompareTo (y.CompletionDate);
            }

            // The completion dates are the same, so no sort based on other
            // things.
            return CompareByPriorityAndName (x, y);
        }
开发者ID:GNOME,项目名称:tasque,代码行数:36,代码来源:TaskCompletionDateComparer.cs

示例12: AssertExecutableIs

        public TaskDefinitionAssertions AssertExecutableIs(ITask<object> task)
        {
            AssertDefined();
            Assert.That(TaskWithBehaviors.Task, Is.EqualTo(task));

            return this;
        }
开发者ID:rosaliafx,项目名称:Rosalia,代码行数:7,代码来源:TaskDefinitionsMapExtensions.cs

示例13: Send

        public void Send(ITask task)
        {
            if (!this.running)
                this.Start();

            this.queue.Enqueue(task);
        }
开发者ID:ajlopez,项目名称:AjActors,代码行数:7,代码来源:BaseActor.cs

示例14: Process

 public void Process(object o, ITask task)
 {
     string path = BasePath + "/" + task.Identify + "/";
     try
     {
         string filename;
         var key = o as IHasKey;
         if (key != null)
         {
             filename = path + key.Key + ".json";
         }
         else
         {
             //check
             filename = path + Encrypt.Md5Encrypt(o.ToString()) + ".json";
         }
         FileInfo file = GetFile(filename);
         using (StreamWriter printWriter = new StreamWriter(file.OpenWrite(), Encoding.UTF8))
         {
             printWriter.WriteLine(JsonConvert.SerializeObject(o));
         }
     }
     catch (Exception e)
     {
         _logger.Warn("write file error", e);
         throw;
     }
 }
开发者ID:hwpayg,项目名称:DotnetSpider,代码行数:28,代码来源:JsonFilePageModelPipeline.cs

示例15: QueueTask

 public void QueueTask(ITask task)
 {
     Task newTask = new Task(delegate () {
         task.Execute();
     });
     newTask.RunSynchronously(this);
 }
开发者ID:maxrogoz,项目名称:COSystemArchitect,代码行数:7,代码来源:TaskQueue.cs


注:本文中的ITask类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。