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


C# NativeActivityContext.GetValue方法代码示例

本文整理汇总了C#中NativeActivityContext.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# NativeActivityContext.GetValue方法的具体用法?C# NativeActivityContext.GetValue怎么用?C# NativeActivityContext.GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NativeActivityContext的用法示例。


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

示例1: Execute

        // Wenn durch die Aktivität ein Wert zurückgegeben wird, erfolgt eine Ableitung von CodeActivity<TResult>
        // und der Wert von der Ausführmethode zurückgegeben.
        protected override void Execute(NativeActivityContext context)
        {
            List<string> sourcefiles = context.GetValue<List<string>>(SourceFiles);

            if (sourcefiles != null && sourcefiles.Any())
            {
                foreach (var file in sourcefiles)
                {
                    File.Delete(file);
                }
            }
        }
开发者ID:zimmybln,项目名称:Workflow,代码行数:14,代码来源:FileDelete.cs

示例2: Execute

        protected override void Execute(NativeActivityContext context)
        {
            var filename = context.GetValue<string>(FileName);

            if (!File.Exists(filename))
            {
                throw new FileNotFoundException(filename);
            }

            context.SetValue(Extension, Path.GetExtension(filename));
            context.SetValue(Directory, Path.GetDirectoryName(filename));
            context.SetValue(FileNameWithoutExtension, Path.GetFileNameWithoutExtension(filename));

            var fileinfo = new System.IO.FileInfo(filename);

            context.SetValue(Created, fileinfo.CreationTime);
            context.SetValue(Length, fileinfo.Length);
            context.SetValue(IsReadOnly, fileinfo.IsReadOnly);
            context.SetValue(Modified, fileinfo.LastWriteTime);
        }
开发者ID:zimmybln,项目名称:Workflow,代码行数:20,代码来源:FileInfo.cs

示例3: Execute

        protected override void Execute(NativeActivityContext context)
        {
            FileInfo source = new FileInfo(context.GetValue<string>(this.Source));
            FileInfo target = new FileInfo(context.GetValue<string>(this.Target));

            if (target.Attributes.HasFlag(FileAttributes.Directory))
                target = new FileInfo(Path.Combine(target.FullName, source.Name));

            this.noPersistHandle.Get(context).Enter(context);

            // Set a bookmark for progress callback resuming
            string bookmarkName = String.Format("FileCopy_{0:X}", source.FullName.GetHashCode());
            var bookmark = context.CreateBookmark(bookmarkName, this.bookmarkProgressCallback, BookmarkOptions.MultipleResume);
            bookmarkProgress.Set(context, bookmark);

            var extension = context.GetExtension<Hosting.FileCopyExtension>();
            extension.Resume(bookmark, source, target, this.Option, this.StepIncrement);
        }
开发者ID:miguelhasse,项目名称:Workflow-Activities,代码行数:18,代码来源:FileCopy.cs

示例4: Execute

        /// <summary>
        /// Execute the activity returning the service query and entity properties
        /// </summary>
        /// <param name="context"></param>
        protected override void Execute(NativeActivityContext context)
        {
            List<List<EntityProperty>> properties = null;
            XNamespace mxmlns = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata";
            XNamespace xmlns = "http://www.w3.org/2005/Atom";

            string serviceQuery = this.QualifiedFilterQueryString
                (this.Uri.RemoveQuotes(), this.Resource.RemoveQuotes(), context.GetValue<int>(this.Top), context.GetValue<int>(this.Skip), 
                this.SelectProperties, this.OrderBy);

            try
            {
                IEnumerable<XElement> entries = from element in XElement.Load(serviceQuery).Descendants(xmlns.GetName("entry")) select element;

                properties =
                    (from property in entries.Descendants(mxmlns.GetName("properties"))
                     select (from e in property.Descendants()
                             select new EntityProperty
                             {
                                 Name = e.Name.LocalName,
                                 Value = e.Value,
                                 Type = e.HasAttributes ? (e.Attribute(mxmlns.GetName("type")) != null ? e.Attribute(mxmlns.GetName("type")).Value.ToString() : string.Empty) : "Edm.String"
                             }).ToList()).ToList();

                //NEXT: Join properties and links using a single LINQ statement
                IEnumerable<IEnumerable<EntityProperty>> namedResources = from entry in entries
                    select from l in entry.Descendants(xmlns.GetName("link"))
                            where l.Attribute("type") != null
                            select new EntityProperty
                            {
                                Name = l.Attribute("title").Value.ToString(),
                                Value = l.Attribute("href").Value.ToString(),
                                Type = "Edm.Stream"
                            };

                var entityIds = from e in entries.Descendants(xmlns.GetName("id"))
                            select
                                new EntityProperty
                                {
                                    Name = "id",
                                    Value = e.Value,
                                    Type = "Edm.String"
                                };

                //Add namedResources to properties
                IEnumerable<EntityProperty> entityPropertyEnum;
                int i = -1;
                foreach (List<EntityProperty> p in properties)
                {
                    i++;
                    //Get the link properties
                    entityPropertyEnum = namedResources.ElementAt(i);
                    foreach (var item in entityPropertyEnum)
                    {
                        p.Add(item);
                    }
                    //Add in entity id
                    p.Add(entityIds.ElementAt(i));
                }
            }
            catch 
            { 
                // Catch exception in a production application
            }

            ServiceQueryString.Set(context, serviceQuery);
            EntityProperties.Set(context, properties);
        }
开发者ID:EdiCarlos,项目名称:MyPractices,代码行数:72,代码来源:QueryFeed.cs

示例5: OnGetStatusCompleted

        /// <summary>
        /// Respond to the completion callback of the status polling activity.
        /// </summary>
        /// <param name="context">The activity context.</param>
        /// <param name="instance">The current instance of the activity.</param>
        /// <param name="result">The result of the status inquiry.</param>
        private void OnGetStatusCompleted(NativeActivityContext context, ActivityInstance instance, string result)
        {
            // Check to see if the operation faulted
            if (this.AzureActivityExceptionCaught.Get(context))
            {
                context.ScheduleActivity(this.Failure);
                return;
            }

            // Determine what to do based on the status of the Azure operation.
            switch (result)
            {
                case OperationState.Succeeded:
                    context.ScheduleActivity(this.Success);
                    break;

                case OperationState.Failed:
                    context.ScheduleActivity(this.Failure);
                    break;

                case OperationState.InProgress:
                    // Test to see if we are within the timeout
                    if (context.GetValue(this.PollingEndTime).CompareTo(DateTime.UtcNow) <= 0)
                    {
                        context.ScheduleActivity(this.Failure);
                    }

                    // Otherwise delay for the requested interval
                    context.ScheduleAction(
                        this.DelayBody, 
                        this.PollingInterval,
                        this.OnDelayCompleted);
                    break;
            }            
        }
开发者ID:modulexcite,项目名称:CustomActivities,代码行数:41,代码来源:AzureAsyncOperation.cs

示例6: Execute

        protected override void Execute(NativeActivityContext context)
        {
            var subscriptionHandle = this.SubscriptionHandle.Get(context);

            string folder = context.GetValue(this.WatchFolder);

            if (!System.IO.Directory.Exists(folder))
                throw new OperationCanceledException(String.Format("The path \"{0}\" is not a directory or does not exist.", folder));

            var extension = context.GetExtension<Hosting.FolderWatcherExtension>();

            var bookmark = context.CreateBookmark(String.Format("SubscribeFileChanges_{0:N}", Guid.NewGuid()));
            this.bookmark.Set(context, bookmark);

            subscriptionHandle.Initialize(extension, bookmark, folder,
                context.GetValue(this.WatchPattern), this.WatchSubfolders, base.DisplayName);
        }
开发者ID:miguelhasse,项目名称:Workflow-Activities,代码行数:17,代码来源:SubscribeFileChanges.cs

示例7: Execute

 protected override void Execute(NativeActivityContext context)
 {
     string bookmark = context.GetValue(bookmarkName);
     context.CreateBookmark(bookmark, new BookmarkCallback(bookmarkCallback));
     System.Console.WriteLine("创建bookmark:{0}", bookmark);
 }
开发者ID:ThinerZQ,项目名称:CrowdSourcingWithWWF,代码行数:6,代码来源:SetBookmark.cs


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