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


C# CodeActivityContext.GetValue方法代码示例

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


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

示例1: Execute

        /// <summary>
        /// Execute Activity
        /// </summary>
        /// <param name="context">code activity context </param>
        protected override void Execute(CodeActivityContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            var directoryInfo = context.GetValue(this.BaseDirectory);
            if (!directoryInfo.Exists)
            {
                return;
            }

            var searchDescription = context.GetValue(this.SearchDescription);
            var fileExtensions = context.GetValue(this.FileExtensions);

            var searchStrings = context.GetValue(this.SearchStrings);
            if (searchStrings == null || searchStrings.Length == 0)
            {
                return;
            }

            var matches = directoryInfo.Search(fileExtensions, searchStrings);

            // Write to build outputs log
            context.TrackBuildMessage(string.Format("{0}: {1} items found.", searchDescription, matches.Count), BuildMessageImportance.High);
            foreach (var match in matches)
            {
                var fileAndLine = string.Format("{0} ({1})", match.File.Name, match.LineNumber);
                context.TrackBuildMessage(string.Format("{0,-50} {1}", fileAndLine, match.LineText.Trim()), BuildMessageImportance.High);
            }

            // Set output
            this.MatchCount.Set(context, matches.Count);
        }
开发者ID:modulexcite,项目名称:CustomActivities,代码行数:39,代码来源:FilesTextSearch.cs

示例2: Execute

        /// <summary>
        /// Processes the conversion of the version number
        /// </summary>
        /// <param name="context"></param>
        protected override void Execute(CodeActivityContext context)
        {
            // Get the values passed in
            var versionPattern = context.GetValue(VersionPattern);
            var buildNumber = context.GetValue(BuildNumber);
            var buildNumberPrefix = context.GetValue(BuildNumberPrefix);

            var version = new StringBuilder();
            var addDot = false;

            // Validate the version pattern
            if (string.IsNullOrEmpty(versionPattern))
            {
                throw new ArgumentException("VersionPattern must contain the versioning pattern.");
            }

            var versionPatternArray = versionPattern.Split(new[] {'.'}, StringSplitOptions.RemoveEmptyEntries);

            // Go through each pattern and convert it
            foreach (var conversionItem in versionPatternArray)
            {
                if (addDot) { version.Append("."); }

                version.Append(VersioningHelper.ReplacePatternWithValue(conversionItem, buildNumber, buildNumberPrefix, DateTime.Now));

                addDot = true;
            }

            // Return the value back to the workflow
            context.SetValue(ConvertedVersionNumber, version.ToString());
        }
开发者ID:Bjornej,项目名称:TfsVersioning,代码行数:35,代码来源:ConvertVersionPattern.cs

示例3: Execute

        /// <summary>
        /// Processes the conversion of the version number
        /// </summary>
        /// <param name="context"></param>
        protected override void Execute(CodeActivityContext context)
        {
            // Get the values passed in
            string propertyPattern = context.GetValue(PropertyPattern);
            IBuildDetail buildDetail = context.GetValue(BuildDetail);
            DateTime buildDate = context.GetValue(BuildDate);
            int buildNumberPrefix = context.GetValue(BuildNumberPrefix);

            // Validate the version pattern
            if (string.IsNullOrEmpty(propertyPattern))
            {
                throw new ArgumentException("PropertyPattern must contain a valid property replacement pattern.");
            }

            // Validate the version pattern
            if (buildDetail == null)
            {
                throw new ArgumentNullException("BuildDetail", "BuildDetail must contain a valid IBuildDetail value.");
            }

            string convertedValue = VersioningHelper.ReplacePatternWithValue(propertyPattern, buildDetail, buildDetail.BuildNumber, buildNumberPrefix, buildDate);

            // Return the value back to the workflow
            context.SetValue(ConvertedVersionNumber, convertedValue);
        }
开发者ID:Bjornej,项目名称:TfsVersioning,代码行数:29,代码来源:ConvertAssemblyPropertyPattern.cs

示例4: Execute

        protected override void Execute(CodeActivityContext context)
        {
            TrackMessage(context, "Starting SVN action");

            string destinationPath = context.GetValue(this.DestinationPath);
            string svnPath = context.GetValue(this.SvnPath);
            string svnToolPath = context.GetValue(this.SvnToolPath);
            string svnCommandArgs = context.GetValue(this.SvnCommandArgs);
            SvnCredentials svnCredentials = context.GetValue(this.SvnCredentials);

            string svnCommand = Regex.Replace(svnCommandArgs, "{uri}", svnPath);
            svnCommand = Regex.Replace(svnCommand, "{destination}", destinationPath);
            svnCommand = Regex.Replace(svnCommand, "{username}", svnCredentials.Username);
            TrackMessage(context, "svn command: " + svnCommand);

            // Never reveal the password!
            svnCommand = Regex.Replace(svnCommand, "{password}", svnCredentials.Password);

            if (File.Exists(svnToolPath))
            {
                var process = Process.Start(svnToolPath, svnCommand);
                if (process != null)
                {
                    process.WaitForExit();
                    process.Close();
                }
            }

            TrackMessage(context, "End SVN action");
        }
开发者ID:napramirez,项目名称:build-process,代码行数:30,代码来源:SvnActivity.cs

示例5: Execute

        /// <summary>
        /// You need to put this activity in a different agent that write the diagnostics log that you want to change.
        /// </summary>
        /// <param name="context"></param>
        protected override void Execute(CodeActivityContext context)
        {
            Thread.Sleep(30000);

            var findAndReplace = context.GetValue(FindAndReplaceStrings);
            _teamProjectUri = context.GetValue(TeamProjectUri);
            _buildUri = context.GetValue(BuildUri);

            var vssCredential = new VssCredentials(true);
            _fcClient = new FileContainerHttpClient(_teamProjectUri, vssCredential);
            var containers = _fcClient.QueryContainersAsync(new List<Uri>() { _buildUri }).Result;

            if (!containers.Any())
                return;

            var agentLogs = GetAgentLogs(containers);

            if (agentLogs == null)
                return;

            using (var handler = new HttpClientHandler() { UseDefaultCredentials = true })
            {
                var reader = DownloadAgentLog(agentLogs, handler);

                using (var ms = new MemoryStream())
                {
                    ReplaceStrings(findAndReplace, reader, ms);
                    var response = UploadDocument(containers, agentLogs, ms);
                }
            }
        }
开发者ID:GersonDias,项目名称:OpenSource,代码行数:35,代码来源:ReplaceDiagnosticsInfo.cs

示例6: ExecuteOperation

        protected override string ExecuteOperation(CodeActivityContext context)
        {
            var status = context.GetValue(Status);
            var hostedServiceName = context.GetValue<string>(HostedServiceName);
            var slot = context.GetValue(Slot).Description();

            var updateDeploymentStatus = new UpdateDeploymentStatusInput()
            {
                Status = status
            };

            using (new OperationContextScope((IContextChannel)channel))
            {
                try
                {
                    this.RetryCall(s => this.channel.UpdateDeploymentStatusBySlot(
                        s,
                        hostedServiceName,
                        slot,
                        updateDeploymentStatus));
                }
                catch (CommunicationException ex)
                {
                    throw new CommunicationExceptionEx(ex);
                }

                return RetrieveOperationId();
            }
        }
开发者ID:chandermani,项目名称:deployToAzureTFS2013,代码行数:29,代码来源:SetDeploymentStatus.cs

示例7: Execute

        protected override void Execute(CodeActivityContext context)
        {
            DynamicValue taskdata = context.GetValue(this.Data);

            DynamicValue MessageId = new DynamicValue();
            taskdata.TryGetValue("MessageId", out MessageId);

            IMessageStore messageStore = strICT.InFlow.Db.StoreHandler.getMessageStore(context.GetValue(cfgSQLConnectionString));
            M_Message message = messageStore.getMessageBymsgId(Convert.ToInt32(MessageId.ToString()));

            //store message-type in GlobalTransition
            context.SetValue(GlobalTransition, message.Sender_SubjectName + "|" + message.Message_Type);


            DynamicValue data = DynamicValue.Parse(message.Data);
            DynamicValue variables = context.GetValue(GlobalVariables);

            //write message data to GlobalVariables
            foreach (string i in data.Keys)
            {
                DynamicValue value = new DynamicValue();
                data.TryGetValue(i, out value);
                if (variables.ContainsKey(i))
                {
                    variables.Remove(i);
                }
                variables.Add(i, value);
            }
            context.SetValue(GlobalVariables, variables);

            //mark message in message-store as received
            messageStore.markMessageAsReceived(message.Id);      
        }
开发者ID:InFlowBPM,项目名称:InFlow-BPMS,代码行数:33,代码来源:GetMessage.cs

示例8: Execute

 // If your activity returns a value, derive from CodeActivity<TResult>
 // and return the value from the Execute method.
 protected override void Execute(CodeActivityContext context) {
     // Obtain the runtime value of the Text input argument
     StringBuilder salesMessage = new StringBuilder();
     salesMessage.AppendLine("*** Message To Sales ***");
     salesMessage.AppendLine("Please order the following ASAP!");
     salesMessage.AppendFormat("1 {0} {1}\n", context.GetValue(Color), context.GetValue(Make));
     System.IO.File.WriteAllText("SalesMemo.txt", salesMessage.ToString());
 }
开发者ID:Geronimobile,项目名称:DotNetExamIntro,代码行数:10,代码来源:CreateSalesMemoActivity.cs

示例9: Execute

        protected override void Execute(CodeActivityContext context)
        {
            string ticketId = context.GetValue(this.TicketId);
            var comment = context.GetValue(this.Comment);
            var approve = context.GetValue(this.Approve);

            Console.WriteLine(string.Format("\n[Review]> ticketid: {0}, {1} by leader, comment: {2}", ticketId, approve ? "approved" : "rejected", comment));
        }
开发者ID:caoyue,项目名称:WorkflowDemo,代码行数:8,代码来源:LongLeaveReview.cs

示例10: Execute

        protected override void Execute(CodeActivityContext context)
        {
            var ticketId = context.GetValue(this.TicketId);
            var userId = context.GetValue(this.UserId);
            var start = context.GetValue(this.Start);
            var end = context.GetValue(this.End);

            Console.WriteLine(string.Format("\n> ticket {0} expired, userId: {1}, start: {2}, end: {3}.", ticketId, userId, start.ToShortDateString(), end.ToShortDateString()));
        }
开发者ID:caoyue,项目名称:WorkflowDemo,代码行数:9,代码来源:LeaveExpired.cs

示例11: Execute

        protected override void Execute(CodeActivityContext context)
        {
            transform = new XslCompiledTransform();

            String input = context.GetValue(this.InputXmlName);
            String output = context.GetValue(this.OutputXmlName);
            analyze(input, output);
            Console.Out.WriteLine(output);
        }
开发者ID:perfoon,项目名称:JavaScript-analyser,代码行数:9,代码来源:XmlAnalyzerActivity.cs

示例12: Execute

        protected override void Execute(CodeActivityContext context)
        {
            var a = context.GetValue(A);
            var b = context.GetValue(B);

            var result = Calculator.Add(a, b);

            Result.Set(context, result);
        }
开发者ID:glombard,项目名称:Unity.WF,代码行数:9,代码来源:FirstCalculatorActivity.cs

示例13: Execute

        protected override void Execute(CodeActivityContext context)
        {
            #region Workflow Arguments

            // The TFS source location of the file to get
            var fileToGet = context.GetValue(FileToGet);

            // The current workspace - used to create a new workspace for the get
            var workspace = context.GetValue(Workspace);

            // The local build directory
            var buildDirectory = context.GetValue(BuildDirectory);

            var destinationSubfolderName = context.GetValue(DestinationSubfolderName);

            #endregion

            // File and path
            var versionFileDirectory = string.Format("{0}\\{1}", buildDirectory, destinationSubfolderName);
            var filename = Path.GetFileName(fileToGet);

            if (filename == null)
            {
                throw new ArgumentException("Filename must not be null");
            }

            var fullPathToFile = Path.Combine(versionFileDirectory, filename);

            // Write to the log
            context.WriteBuildMessage(string.Format("Getting file from Source: {0}", fileToGet), BuildMessageImportance.High);

            // Create workspace and working folder
            var tempWorkspace = workspace.VersionControlServer.CreateWorkspace("NuGetterTemp");
            var workingFolder = new WorkingFolder(fileToGet, fullPathToFile);

            // Map the workspace
            tempWorkspace.CreateMapping(workingFolder);

            // Get the file
            var request = new GetRequest(new ItemSpec(fileToGet, RecursionType.None), VersionSpec.Latest);
            var status = tempWorkspace.Get(request, GetOptions.GetAll | GetOptions.Overwrite);

            if (!status.NoActionNeeded)
            {
                foreach (var failure in status.GetFailures())
                {
                    context.WriteBuildMessage(string.Format("Failed to get file from source: {0} - {1}", fileToGet, failure.GetFormattedMessage()), BuildMessageImportance.High);
                }
            }

            // Return the value back to the workflow
            context.SetValue(FullPathToFile, fullPathToFile);

            // Get rid of the workspace
            tempWorkspace.Delete();
        }
开发者ID:Blackbaud-JohnYeager,项目名称:NuGetter,代码行数:56,代码来源:GetFile.cs

示例14: Execute

        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.
        protected override void Execute(CodeActivityContext context)
        {
            // Obtain the runtime value of the Text input argument

            bool doFlush = context.GetValue(this.DoFlush);
            List<string> text = context.GetValue(this.Text);
            if (doFlush)
                context.GetExtension<List<string>>().Clear();
            context.GetExtension<List<string>>().AddRange(text);
        }
开发者ID:blel,项目名称:WpfWithWf,代码行数:12,代码来源:AssignToExtensionActivity.cs

示例15: Execute

        protected override void Execute(CodeActivityContext context)
        {
            // Obtain the runtime value of the Text input argument
            Expense expense = context.GetValue(this.Expense);
            ExpenseReview review = context.GetValue(this.ExpenseReview);

            //expense.WorkflowID = this.WorkflowInstanceId;
            ExpenseComponent bc = new ExpenseComponent();
            context.SetValue(this.Expense, bc.Reject(expense, review));
        }
开发者ID:netusers2014,项目名称:ExpenseSample,代码行数:10,代码来源:RejectExpense.cs


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