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


C# WorkflowInvoker类代码示例

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


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

示例1: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                // Use calculator by simulating clicks.
                String digitOne = this.comboBox1.SelectedItem.ToString();
                String digitTwo = this.comboBox2.SelectedItem.ToString();
                String operation = this.comboBox3.SelectedItem.ToString();

                WorkflowInvoker invoker = new WorkflowInvoker(ActivityXamlServices.Load(@"calc.uiwf"));
                var arguments = new Dictionary<string, object>();
                arguments.Add("digitOne", digitOne);
                arguments.Add("digitTwo", digitTwo);
                arguments.Add("op", operation);

                IDictionary<string, object> outArgs = invoker.Invoke(arguments);

                String sResult = (String)outArgs["calcResult"];
                this.textBox1.Text = sResult;
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "ERROR: " + ex.Message);
            }
        }
开发者ID:TylerHaigh,项目名称:SDK,代码行数:25,代码来源:Form1.cs

示例2: RunTestExtractAndConvertWorkflow_WhenRunningFullWorkflowShouldReplaceCorrectVersionNumbers

        public void RunTestExtractAndConvertWorkflow_WhenRunningFullWorkflowShouldReplaceCorrectVersionNumbers()
        {
            // Create an instance of our test workflow
            var workflow = new TestExtractAndConvertWorkflowWrapper();

            // Create the workflow run-time environment
            var workflowInvoker = new WorkflowInvoker(workflow);

            var minuteCount = (int)DateTime.Now.TimeOfDay.TotalMinutes;

            workflowInvoker.Extensions.Add(new BuildDetailStub(minuteCount));

            // Set the workflow arguments
            workflow.ForceCreateVersion = true;
            workflow.AssemblyFileVersionReplacementPattern = "YYYY.MM.DD.B";
            workflow.BuildNumber = "TestCodeActivity - 2_20110310.3";
            workflow.AssemblyVersionReplacementPattern = "1.2.3.4";
            workflow.FolderToSearch = TestContext.DeploymentDirectory;
            workflow.FileSearchPattern = "AssemblyInfo.*";
            workflow.BuildNumberPrefix = 0;

            // Invoke the workflow and capture the outputs
            workflowInvoker.Invoke();

            var file = TestContext.DataRow[0].ToString();
            var versionName = TestContext.DataRow[1].ToString();

            var fileData = File.ReadAllText(file);
            var regexPattern = string.Format(SearchPatternShell, versionName);
            var regex = new Regex(regexPattern);
            var matches = regex.Matches(fileData);

            Assert.AreEqual(1, matches.Count);
        }
开发者ID:jricke,项目名称:TfsVersioning,代码行数:34,代码来源:RunTestExtractAndConvertWorkflow.cs

示例3: GetVersionTestElapsed

        public void GetVersionTestElapsed()
        {
            // Initialise Instance
            var target = new TfsVersion { Action = TfsVersionAction.GetVersion, VersionTemplateFormat = "0.0.1000.0", StartDate = Convert.ToDateTime("1 Mar 2009"), VersionFormat = TfsVersionVersionFormat.Elapsed, UseUtcDate = true };

            // Declare additional parameters
            var parameters = new Dictionary<string, object>
            {
                { "Major", "3" },
                { "Minor", "1" },
            };

            // Create a WorkflowInvoker and add the IBuildDetail Extension
            WorkflowInvoker invoker = new WorkflowInvoker(target);
            IBuildDetail t = new MockIBuildDetail { BuildNumber = "MyBuild_" + DateTime.Now.ToString("yyyyMMdd") + ".2" };
            t.BuildDefinition.Name = "MyBuild";
            invoker.Extensions.Add(t);

            var actual = invoker.Invoke(parameters);

            // Test the result
            DateTime d = Convert.ToDateTime("1 Mar 2009");
            TimeSpan ts = DateTime.Now - d;
            string days = ts.Days.ToString();
            Assert.AreEqual("3.1.1" + days + ".2", actual["Version"].ToString());
        }
开发者ID:modulexcite,项目名称:CustomActivities,代码行数:26,代码来源:TfsVersionTests.cs

示例4: Main

 /// <summary>
 /// The Main program
 /// </summary>
 private static void Main()
 {
     var invoker = new WorkflowInvoker(Workflow1Definition);
     invoker.Extensions.Add(new WriteLineTracker());
     invoker.Extensions.Add(new FileTracker("Tracking.txt"));
     invoker.Invoke();
 }
开发者ID:IcodeNet,项目名称:cleansolution,代码行数:10,代码来源:Program.cs

示例5: Can_choose_to_list_a_file_added_in_the_build_log

        public void Can_choose_to_list_a_file_added_in_the_build_log()
        {
            // arrange
            var monitor = new DebugMonitor("Adding file to check");
            Trace.Listeners.Add(monitor);

            // create the activity
            var target = new StyleCop();

            // create a parameter set
            Dictionary<string, object> args = new Dictionary<string, object>
            {
                { "SourceFiles", new string[] { @"TestFiles\FileWith6Errors.cs" } },
                { "SettingsFile", @"TestFiles\AllSettingsEnabled.StyleCop" },
                { "ShowOutput", true }
            };

            // Create a WorkflowInvoker and add the IBuildDetail Extension
            WorkflowInvoker invoker = new WorkflowInvoker(target);

            // act
            var results = invoker.Invoke(args);

            // assert
            Assert.AreEqual(1, monitor.Writes);
        }
开发者ID:KjartanThor,项目名称:CustomActivities,代码行数:26,代码来源:LoggingTests.cs

示例6: Check_a_file_with_no_issues_and_defaults_rules_will_not_create_a_text_logfile

        public void Check_a_file_with_no_issues_and_defaults_rules_will_not_create_a_text_logfile()
        {
            // arrange
            var fileName = "LogFile.Txt";
            System.IO.File.Delete(fileName);

            // create the activity
            var target = new StyleCop();

            // create a parameter set
            Dictionary<string, object> args = new Dictionary<string, object>
            {
                 { "SourceFiles", new string[] { @"TestFiles\FileWith0Errors.cs" } },
                 { "SettingsFile", @"TestFiles\AllSettingsEnabled.StyleCop" },
                 { "LogFile", fileName }
            };

            // Create a WorkflowInvoker and add the IBuildDetail Extension
            WorkflowInvoker invoker = new WorkflowInvoker(target);

            // act
            var results = invoker.Invoke(args);

            // assert
            Assert.IsFalse(System.IO.File.Exists(fileName));
        }
开发者ID:KjartanThor,项目名称:CustomActivities,代码行数:26,代码来源:LoggingTests.cs

示例7: EmailTest

        public void EmailTest()
        {
            // Initialise Instance
            var target = new TfsBuildExtensions.Activities.Communication.Email
                {
                    Action = EmailAction.Send,
                    EnableSsl = true,
                    FailBuildOnError = false,
                    Format = "HTML",
                    LogExceptionStack = true,
                    MailFrom = "YOUREMAIL",
                    Port = 587,
                    Priority = "Normal",
                    SmtpServer = "smtp.gmail.com",
                    Subject = "hi 2",
                    TreatWarningsAsErrors = false,
                    UseDefaultCredentials = false,
                    UserName = "YOUREMAIL",
                    UserPassword = "YOURPASSWORD"
                };
                
                // Declare additional parameters
            var parameters = new Dictionary<string, object>
            {
                { "MailTo", new[] { "YOURRECIPIENT" } },
            };

            // Create a WorkflowInvoker and add the IBuildDetail Extension
            WorkflowInvoker invoker = new WorkflowInvoker(target);
            var actual = invoker.Invoke(parameters);

            // note this unit test is for debugging rather than testing so just return a true assertion
            Assert.IsTrue(1 == 1);
        }
开发者ID:modulexcite,项目名称:CustomActivities,代码行数:34,代码来源:EmailTests.cs

示例8: Execute

        public override bool Execute()
        {
            var url = GetCollectionUri();
            var binDir = GetBinariesDirectory();
            var teamBuildWorkflowAssemblyPath = GetTeamBuildWorkflowAssemblyDirectory();
            var pdbStrToolDirectory = GetPdbStrToolDirectory();

            LoadBuildWorkflowAssembly(teamBuildWorkflowAssemblyPath);

            LoadDbgHelpLibrary();
            ExtractPdbSrcExe(pdbStrToolDirectory);

            var collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(url));

            var inputParameters = new Dictionary<string, object> { { "BinariesDirectory", binDir } };

            using (new IndexSourcesToolPathOverrideScope(pdbStrToolDirectory))
            {
                var workflow = new RunIndexSources();
                var invoker = new WorkflowInvoker(workflow);
                invoker.Extensions.Add(collection);
                invoker.Invoke(inputParameters);
            }

            return true;
        }
开发者ID:jstangroome,项目名称:IndexTeamFoundationSources,代码行数:26,代码来源:IndexTeamFoundationSources.cs

示例9: ConvertVersionPattern_WhenUsingBuildPrefixShouldConvertIntoProperVersion

        public void ConvertVersionPattern_WhenUsingBuildPrefixShouldConvertIntoProperVersion()
        {
            var totalHours = (int)DateTime.Now.TimeOfDay.TotalHours;
            const int prefixVal = 100;

            // Create an instance of our test workflow
            var workflow = new Tests.ConvertVersionPatternTestWorkflow();

            // Create the workflow run-time environment
            var workflowInvoker = new WorkflowInvoker(workflow);

            workflowInvoker.Extensions.Add(new BuildDetailStub(totalHours));

            workflow.VersionPattern = "1.0.0.B";

            workflow.BuildNumberPrefix = prefixVal;

            // Invoke the workflow and capture the outputs
            var outputs = workflowInvoker.Invoke();

            // Retrieve the out arguments to do our verification
            var convertedVersionNumber = (String)outputs["ConvertedVersionNumber"];

            // Verify that we captured the version component of the build number
            Assert.AreEqual(string.Format("1.0.0.{0}", totalHours + prefixVal), convertedVersionNumber);
        }
开发者ID:jricke,项目名称:TfsVersioning,代码行数:26,代码来源:ConvertVersionPatternTests.cs

示例10: SmsTest

        public void SmsTest()
        {
            // Initialise Instance
            var target = new TfsBuildExtensions.Activities.Communication.Sms
            {
                Action = SmsAction.Send,
                From = "YOUREMAIL",
                Body = "YOURBODY",
                AccountSid = "YOURSID",
                AuthToken = "YOURTOKEN"
            };

            // Declare additional parameters
            var parameters = new Dictionary<string, object>
            {
                { "To", new[] { "YOURRECIPIENT" } },
            };

            // Create a WorkflowInvoker and add the IBuildDetail Extension
            WorkflowInvoker invoker = new WorkflowInvoker(target);
            var actual = invoker.Invoke(parameters);

            // note this unit test is for debugging rather than testing so just return a true assertion
            Assert.IsTrue(1 == 1);
        }
开发者ID:KjartanThor,项目名称:CustomActivities,代码行数:25,代码来源:SmsTests.cs

示例11: FileReplaceTest

        public void FileReplaceTest()
        {
            // Initialise Instance
            var target = new TfsBuildExtensions.Activities.FileSystem.File { Action = FileAction.Replace, RegexPattern = "Michael", Replacement = "Mike" };

            // Create a temp file and write some dummy attribute to it
            FileInfo f = new FileInfo(System.IO.Path.GetTempFileName());
            System.IO.File.WriteAllLines(f.FullName, new[] { "Michael" });

            // Declare additional parameters
            var parameters = new Dictionary<string, object>
            {
                { "Files", new[] { f.FullName } },
            };

            // Create a WorkflowInvoker and add the IBuildDetail Extension
            WorkflowInvoker invoker = new WorkflowInvoker(target);
            var actual = invoker.Invoke(parameters);

            // read the updated file back.
            using (System.IO.StreamReader file = new System.IO.StreamReader(f.FullName))
            {
                // Test the result
                Assert.AreEqual("Mike", file.ReadLine());
            }
        }
开发者ID:modulexcite,项目名称:CustomActivities,代码行数:26,代码来源:FileTests.cs

示例12: AsyncInvokeContext

 public AsyncInvokeContext(object userState, WorkflowInvoker invoker)
 {
     this.UserState = userState;
     SynchronizationContext syncContext = SynchronizationContext.Current ?? System.Activities.WorkflowApplication.SynchronousSynchronizationContext.Value;
     this.Operation = new AsyncInvokeOperation(syncContext);
     this.Invoker = invoker;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:AsyncInvokeContext.cs

示例13: Setting_the_cache_option_causes_the_results_to_be_cached_in_the_default_directory

        public void Setting_the_cache_option_causes_the_results_to_be_cached_in_the_default_directory()
        {
            // arrange
            var resultsFile = "StyleCop.Cache";
            System.IO.File.Delete(resultsFile);

            // create the activity
            var target = new StyleCop();

            // create a parameter set
            Dictionary<string, object> args = new Dictionary<string, object>
            {
                 { "SourceFiles", new string[] { @"TestFiles\FileWith6Errors.cs" } },
                 { "SettingsFile", @"TestFiles\AllSettingsEnabled.StyleCop" },
                 { "CacheResults", true },
            };

            // Create a WorkflowInvoker and add the IBuildDetail Extension
            WorkflowInvoker invoker = new WorkflowInvoker(target);

            // act
            var results = invoker.Invoke(args);

            // assert
            Assert.IsTrue(System.IO.File.Exists(resultsFile));
            var document = new XPathDocument(resultsFile);
            var nav = document.CreateNavigator();
            Assert.AreEqual(6d, nav.Evaluate("count(/stylecopresultscache/sourcecode/violations/violation)"));
        }
开发者ID:modulexcite,项目名称:CustomActivities,代码行数:29,代码来源:CacheTests.cs

示例14: RunWorkflow

        public virtual WorkflowResult RunWorkflow(string workflowName, Dictionary<string, object> parameters, object[] extensions = null)
        {
            var retVal = new WorkflowResult();
            parameters["ResultArgument"] = retVal;

            var activity = _activityProvider.GetWorkflowActivity(workflowName);
            if (activity == null)
            {
                throw new ArgumentException("Activity (workflow) not found by name: " + workflowName);
            }

            //var validationResults = ActivityValidationServices.Validate(activity);
            //if (validationResults.Errors.Count() == 0)
            //{
            var invoker = new WorkflowInvoker(activity);
            if (extensions != null)
            {
                foreach (var ext in extensions)
                {
                    invoker.Extensions.Add(ext);
                }
            }

            invoker.Invoke(parameters);

            //}
            //else
            //{
            //    throw new ValidationException();
            //}

            //ActivityInvoker.Invoke(activity, parameters, extensions);
            return retVal;
        }
开发者ID:Wdovin,项目名称:vc-community,代码行数:34,代码来源:WFWorkflowService.cs

示例15: XmlFile_ValidateXmlTest

        public void XmlFile_ValidateXmlTest()
        {
            // Arrange
            var target = new TfsBuildExtensions.Activities.Xml.Xml { Action = XmlAction.Transform };

            // Define activity arguments
            var arguments = new Dictionary<string, object>
            {
                { "XmlText", @"<?xml version=""1.0""?>
                    <catalog>
                       <book id=""bk101"">
                          <author>Gambardella, Matthew</author>
                          <title>XML Developer's Guide</title>
                          <genre>Computer</genre>
                          <price>44.95</price>
                          <publish_date>2000-10-01</publish_date>
                          <description>An in-depth look at creating applications 
                          with XML.</description>
                       </book>
                    </catalog>
                    " },
                { "XslTransform", @"<xsl:transform version=""1.0"" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform""/>" },
            };

            // Act
            WorkflowInvoker invoker = new WorkflowInvoker(target);
            var result = invoker.Invoke(arguments);

            // Assert
            Assert.IsFalse((bool)result["IsValid"]);
        }
开发者ID:modulexcite,项目名称:CustomActivities,代码行数:31,代码来源:XmlTests.cs


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