我一直在搜索stackoverflow,以便将数据从一个线程编组回到UI线程,并在3.5中找到了各种方法.
对我来说更优雅的解决方案之一; 虽然我还在学习lambdas和闭包,但这个解决方案Control.Invoke带有输入参数.
我不完全理解代码,但我确实理解如何使用它,它并没有完全解决我的问题.
我想调用invoke并将字符串传递给另一个方法(DisplayStatusUpdate(msg)).任何指针将不胜感激.
private void FireEventAppender_OnMessageLogged(object sender, MessageLoggedEventArgs e)
{
DisplayStatusUpdate(e.LoggingEvent.RenderedMessage);
}
private void DisplayStatusUpdate(string text)
{
_StatusTextBox.Text = _StatusTextBox.Text + text;
_StatusTextBox.Text = String.Format("{0}\r\n", _StatusTextBox.Text);
_StatusTextBox.SelectionStart = _StatusTextBox.Text.Length - 1;
_StatusTextBox.ScrollToCaret();
}
Run Code Online (Sandbox Code Playgroud) 有点坚持这一点,只是无法理解如何做到这一点.
如果我使用硬编码数组的数据,它按预期工作,但如果我发出一个调用端点,数据永远不会绑定到网格,虽然我可以通过fiddler看到json调用.
谢谢你,斯蒂芬
<script type="text/javascript">
var grid;
var data = [];
var columns = [
{ id: "#", name: "", width: 40, behavior: "selectAndMove", selectable: false, resizable: false, cssClass: "cell-reorder dnd" },
{ id: "id", name: "id", field: "id", sortable: true },
{ id: "FoodGroupId", name: "FoodGroupId", field: "FoodGroupId", editor: TextCellEditor, sortable: true },
{ id: "Description", name: "Description", field: "Description", editor: TextCellEditor, sortable: true },
{ id: "FdGrp_Cd", name: "FdGrp_Cd", field: "FdGrp_Cd", editor: TextCellEditor, sortable: true },
{ id: …Run Code Online (Sandbox Code Playgroud) 在阅读了关于这个主题的几个不同的SO帖子和文档后,我仍然感到困惑,无法通过我的服务端点上的RequestBindingException.例如,我想使用POSTMAN将以下xml发布到服务.
<LeadApplications>
<LeadApplication>
<Email>daffy.duck@example.com</Email>
<FirstName>Joey</FirstName>
<MiddleName>Disney</MiddleName>
<LastName>Duck</LastName>
<Street1>1 Disneyland Street</Street1>
<Street2>2 Disneyland Street</Street2>
<City>PAUMA VALLEY</City>
<State>CA</State>
<Zip>92503</Zip>
</LeadApplication>
</LeadInformations>
[Restrict(RequestAttributes.Xml)]
public class LeadData : IRequiresRequestStream
{
public Stream RequestStream { get; set; }
}
public object Post(ServiceModel.Types.DirectApi.Legacy.LeadData request)
{
return null;
}
Routes.Add<ServiceModel.Types.DirectApi.Legacy.LeadData>("/Leads/LeadData/", "POST", "LMS - DirectApi")
Run Code Online (Sandbox Code Playgroud)
我希望这将是克服.NET反序列化属性排序问题的最佳方法.
原始请求/响应
POST http://localhost/LO.Leads.Receiver/api/Leads/LeadData/ HTTP/1.1
Host: localhost
Connection: keep-alive
Content-Length: 381
Origin: chrome-extension://aejoelaoggembcahagimdiliamlcdmfm
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2289.0 Safari/537.36
Content-Type: application/xml
Accept: …Run Code Online (Sandbox Code Playgroud) 我正在阅读最新的Prism 4 drop的源代码,我有兴趣解决这个问题.ViewModels有一个基类,它实现了INotifyPropertyChanged和INotifyDataErrorInfo,并提供了一些重构友好的更改通知.
protected void RaisePropertyChanged<T>(Expression<Func<T>> propertyExpresssion)
{
var propertyName = ExtractPropertyName(propertyExpresssion);
this.RaisePropertyChanged(propertyName);
}
private string ExtractPropertyName<T>(Expression<Func<T>> propertyExpresssion)
{
if (propertyExpresssion == null)
{
throw new ArgumentNullException("propertyExpression");
}
var memberExpression = propertyExpresssion.Body as MemberExpression;
if (memberExpression == null)
{
throw new ArgumentException("The expression is not a member access expression.", "propertyExpression");
}
var property = memberExpression.Member as PropertyInfo;
if (property == null)
{
throw new ArgumentException("The member access expression does not access property.","propertyExpression");
}
if (!property.DeclaringType.IsAssignableFrom(this.GetType()))
{
throw new ArgumentException("The referenced …Run Code Online (Sandbox Code Playgroud) 我们有一个内部框架来处理日志记录,数据访问,加密。我想开始比较性能,例如日志记录功能与其他主流系统,例如nlog,log4net,serilog。显然,我将从所有系统的功能入手,例如登录文件或控制台。
将BenchmarkDotNet适用于这样的情况?我阅读的大多数示例和论文都在非常紧密的循环中指出了使用场景,并且大多数使用IO,例如内存和CPU,而不是磁盘。
作为练习,我编写了一个xunit测试,以使用Baseline功能对控制台进行基准测试,但是测试从未完成,最终导致了该过程的终止,这使我陷入了SO上的这一职位。
如果我使用BenchmarkDotNet的方式错误,是否还有另一种测试套件与我要完成的工作更加一致?
谢谢斯蒂芬