internal static System.Activities.ActivityInstance CreateCompletedInstance(System.Activities.Activity activity) { return(new System.Activities.ActivityInstance(activity) { state = ActivityInstanceState.Closed }); }
void ActivityInstanceMap.IActivityReference.Load(System.Activities.Activity activity, ActivityInstanceMap instanceMap) { if (activity.GetType().Name != this.OwnerName) { throw FxTrace.Exception.AsError(new ValidationException(System.Activities.SR.ActivityTypeMismatch(activity.DisplayName, this.OwnerName))); } this.Activity = activity; }
public void AddActivity(System.Activities.Activity a, string Name) { var aa = new System.Activities.ActivityAction <ImageElement>(); var da = new System.Activities.DelegateInArgument <ImageElement>(); da.Name = Name; aa.Handler = a; ((GetElement)Activity).Body = aa; aa.Argument = da; }
public System.Activities.Activity Activity() { if (string.IsNullOrEmpty(Xaml)) { return(null); } if (_activity != null) { return(_activity); } var activitySettings = new System.Activities.XamlIntegration.ActivityXamlServicesSettings { CompileExpressions = true }; if (!string.IsNullOrEmpty(culture)) { try { _activity = Task.Run(() => { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(culture); var xamlReaderSettings = new System.Xaml.XamlXmlReaderSettings { LocalAssembly = typeof(Workflow).Assembly }; var xamlReader = new System.Xaml.XamlXmlReader(new System.IO.StringReader(Xaml), xamlReaderSettings); return(System.Activities.XamlIntegration.ActivityXamlServices.Load(xamlReader, activitySettings)); }).Result; } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } throw ex; } } else { var xamlReaderSettings = new System.Xaml.XamlXmlReaderSettings { LocalAssembly = typeof(Workflow).Assembly }; var xamlReader = new System.Xaml.XamlXmlReader(new System.IO.StringReader(Xaml), xamlReaderSettings); _activity = System.Activities.XamlIntegration.ActivityXamlServices.Load(xamlReader, activitySettings); } return(_activity); }
//解析Flowchart private System.Activities.Statements.Flowchart ParseWF4Flowchart(string xaml) { var bytes = Encoding.UTF8.GetBytes(xaml); System.Activities.Activity wf_Activity = null; try { using (var memoryStream = new MemoryStream(bytes)) wf_Activity = ActivityXamlServices.Load(memoryStream); } catch { throw new InvalidOperationException("无法加载Xaml字符串,请检查Xaml是否符合规则"); } if (wf_Activity == null) { throw new InvalidOperationException("Xaml字符串无法转换为WF4的活动树"); } if (!(wf_Activity is System.Activities.DynamicActivity)) { throw new InvalidOperationException("非DynamicActivity"); } var wf_dynamicActivity = wf_Activity as System.Activities.DynamicActivity; if (wf_dynamicActivity.Implementation == null) { throw new InvalidOperationException("Implementation为空"); } var bodyActivity = wf_dynamicActivity.Implementation(); if (!(bodyActivity is System.Activities.Statements.Flowchart)) { throw new InvalidOperationException("根活动请使用Flowchart"); } return(bodyActivity as System.Activities.Statements.Flowchart); }
public System.Activities.Activity Activity() { if (string.IsNullOrEmpty(Xaml)) { return(null); } if (_activity != null) { return(_activity); } var activitySettings = new System.Activities.XamlIntegration.ActivityXamlServicesSettings { CompileExpressions = true }; var xamlReaderSettings = new System.Xaml.XamlXmlReaderSettings { LocalAssembly = typeof(Workflow).Assembly }; var xamlReader = new System.Xaml.XamlXmlReader(new System.IO.StringReader(Xaml), xamlReaderSettings); _activity = System.Activities.XamlIntegration.ActivityXamlServices.Load(xamlReader, activitySettings); return(_activity); }
protected virtual System.ServiceModel.Activities.WorkflowServiceHost CreateWorkflowServiceHost(System.Activities.Activity activity, System.Uri[] baseAddresses) { throw null; }
public ActionResult ExecuteTestPlan(IEnumerable <GuidelineViewModel> data) { try { ActivityLibrary.LuceneService.InitialiseLucene(); ActivityLibrary.LuceneService.BuildIndex(); int TotalPassed = 0; int TotalFailed = 0; //string searchText = "setOnClickListener(new View.OnClickListener() \n" + "public void onClick(View paramAnonymousView)"; //var responseData = ActivityLibrary.LuceneService.Search(searchText); var guidelines = GetGuidelines(); ActivityLibrary.Results.Clear(); var resultHTMLResponse = ""; ResultsInPrintFormat = ""; int i = 1; string _results = @"<p> <span style='font-size: 11pt;'><span style='color: #008080;'><strong>Guideline# {9}: </strong></span>{0}</span><br /> <span style='font-size: 9pt;'><span style='color: #008080;'><strong>Usability Category:</strong></span> {1}</span><br /> <span style='color: #808080; font-size: 9pt;'>{2}</span><br /><br /><span style='color: #ff0000;'><strong>{3}</strong> Failed Matches</span> | <span style='color: #339966;'>{4} Success Matches</span> | Success Rate {5} % | <span style='text-decoration: underline;'><span style='color: #0000ff; text-decoration: underline;'><a href='javascript:void(0)' onclick='toggelDetailedResults(""detailedResults{6}"")'>View Results</a></span></span> <span style='text-decoration: underline;'><span style='color: #0000ff; text-decoration: underline;'><a href='javascript:void(0)' onclick='toggelDetailedResults(""codeSnippet{6}"")'>View Code Snippets</a></span></span> <div id='detailedResults{7}' style='display:none;'> {8} </div> <div id='codeSnippet{7}' style='display:none;align=left'> <pre class='prettyprint'> {10} </pre> </div> </p> <hr />"; string _results_print = @"<p> <span style='font-size: 11pt;'><span style='color: #008080;'><strong>Guideline# {8}: </strong></span>{0}</span><br /> <span style='font-size: 9pt;'><span style='color: #008080;'><strong>Usability Category:</strong></span> {1}</span><br /> <span style='color: #808080; font-size: 9pt;'>{2}</span><br /><br /><span style='color: #ff0000;'><strong>{3}</strong> Failed Matches</span> | <span style='color: #339966;'>{4} Success Matches</span> | Success Rate {5} % | <span style='text-decoration: underline;'><span style='color: #0000ff; text-decoration: underline;'></span></span> <div id='detailedResults{6}' > {7} </div> </p> <hr />"; string output = ""; foreach (var guideline in guidelines) { if (guideline.Execute) { int passed = 0; int failed = 0; double passedRate = 0; var testResultsPassed = ""; var testResultsFailed = ""; //execute each test case inside the test plan foreach (var testcase in guideline.TestCases) { System.Activities.Activity workflow = System.Activities.XamlIntegration.ActivityXamlServices.Load(Path.Combine(Server.MapPath("~/App_Data/TestCases/"), testcase.Name)); var result = System.Activities.WorkflowInvoker.Invoke(workflow); var results = ActivityLibrary.Results.Get(); foreach (var res in results) { passed = res.IsPassed ? passed + 1 : passed; failed = res.IsPassed ? failed : failed + 1; if (res.IsPassed) { testResultsPassed += "<li> <span style='color: #339966; font-size: 11pt;'>Passed : " + res.ResponseStr + " </span> </li>"; } else { testResultsFailed += "<li> <span style='color: #ff0000; font-size: 11pt;'> Failed : " + res.ResponseStr + " </span> </li>"; } } } TotalPassed += passed; TotalFailed += failed; if (passed > 0) { output += passed + "P"; } if (failed > 0) { output += failed + "F"; } output += ","; var CodeSnippet = GetCodeSnippetRecomendations(guideline); passedRate = (Convert.ToDouble(passed) / Convert.ToDouble(passed + failed)) * 100; string passedRateStr = passedRate > 0 ? passedRate.ToString("##.##") : passedRate.ToString(); resultHTMLResponse += String.Format(_results, guideline.Name, guideline.Categories, guideline.Description, failed, passed, passedRateStr, i, i, "<ul>" + testResultsFailed + testResultsPassed + "</ul>", i, CodeSnippet); ResultsInPrintFormat += String.Format(_results_print, guideline.Name, guideline.Categories, guideline.Description, failed, passed, passedRateStr, i, "<ul>" + testResultsFailed + testResultsPassed + "</ul>", i); i++; } } output += TotalPassed.ToString() + "," + TotalFailed.ToString(); resultHTMLResponse = string.Format("<h3>Total Passed: {0} , Total Failed: {1} , Success Rate: {2:N2}%</h3>", TotalPassed, TotalFailed, (Convert.ToDouble(TotalPassed) / (TotalPassed + TotalFailed) * 100)) + resultHTMLResponse; ResultsInPrintFormat = " <br/>" + string.Format("<h3>Total Passed: {0} , Total Failed: {1} , Success Rate: {2:N2}%</h3>", TotalPassed, TotalFailed, (Convert.ToDouble(TotalPassed) / (TotalPassed + TotalFailed) * 100)) + ResultsInPrintFormat; //System.Activities.Activity workflow = System.Activities.XamlIntegration.ActivityXamlServices.Load(Path.Combine(Server.MapPath("~/App_Data/TestCases/"), "CheckFaceBookLogin.xaml")); //var result = System.Activities.WorkflowInvoker.Invoke(workflow); //var results = ActivityLibrary.Results.Get(); ViewBag.Results = resultHTMLResponse; } catch (Exception e) { ViewBag.Results = e.Message + "<br/>" + e.StackTrace; } return(View("Results")); }
public ChildActivity(System.Activities.Activity activity, bool canBeExecuted) { this = new ActivityUtilities.ChildActivity(); this.Activity = activity; this.CanBeExecuted = canBeExecuted; }
internal ActivityInstance(System.Activities.Activity activity) { this.activity = activity; this.state = ActivityInstanceState.Executing; this.substate = Substate.Created; }
public WorkflowService(System.Activities.Activity workflow, IDictionary <string, object> inputs) { _wizardHostHelper = new WizardHostHelper(workflow, inputs); }
public WorkflowService(System.Activities.Activity workflow) : this(workflow, new Dictionary <string, object> { }) { }
private void btnExecuteTestPlan_Click(object sender, RoutedEventArgs e) { try { List <Guideline> guildeines = GetGuidelines(); ActivityLibrary.Results.Clear(); var resultHTMLResponse = ""; int i = 1; foreach (var guildeine in guildeines) { int passed = 0; int failed = 0; double passedRate = 0; var testResultsPassed = ""; var testResultsFailed = ""; //execute each test case inside the test plan foreach (var testcase in guildeine.TestCases) { System.Activities.Activity workflow = ActivityXamlServices.Load(@"TestCases\" + testcase.Name); var result = System.Activities.WorkflowInvoker.Invoke(workflow); var results = ActivityLibrary.Results.Get(); foreach (var res in results) { passed = res.IsPassed ? passed + 1 : passed; failed = res.IsPassed ? failed : failed + 1; if (res.IsPassed) { testResultsPassed += "<li> <span style='color: #339966; font-size: 11pt;'>Passed : " + res.ResponseStr + " </span> </li>"; } else { testResultsFailed += "<li> <span style='color: #ff0000; font-size: 11pt;'> Failed : " + res.ResponseStr + " </span> </li>"; } } } passedRate = (Convert.ToDouble(passed) / Convert.ToDouble(passed + failed)) * 100; resultHTMLResponse += String.Format(_results, guildeine.Name, "Categories", guildeine.Description, failed, passed, passedRate.ToString("##.##"), i, i, "<ul>" + testResultsFailed + testResultsPassed + "</ul>", i); i++; } var resultHTMLBody = @"<html> <title>UMETRIX - Usability Report</title> <head> <script> function toggelDetailedResults(id) { var x = document.getElementById(id); if (x.style.display === 'none') { x.style.display = 'block'; } else { x.style.display = 'none'; } } </script> </head> <body style='font-family: Verdana, Geneva, Tahoma, sans-serif;'>" + "UMETRIX - Usability Report for " + "APK File :" + txtFilePath.Text + "</br>" + resultHTMLResponse + @" </body></html>"; System.IO.File.WriteAllText("Result.html", resultHTMLBody); System.Diagnostics.Process.Start("Result.html"); } catch (Exception ex) { throw ex; } }