小编Md.*_*man的帖子

如何从Awesomium web控件复制Html?

我使用Awesomium Web控件来查看我的WPF应用程序中的网页.我想复制HTML表单,但我找不到任何方法.我搜索谷歌有关它,但不幸的是我只找到一个结果这对我不起作用.

我跟随此链接与awesominum webcontrol交互但它不起作用.

我正在尝试以下代码:

private void Button_Click(object sender, RoutedEventArgs e)
 {
    Clipboard.Clear();
    MyWebControl.SelectAll();
    MyWebControl.CopyHTML();
    var html = Clipboard.GetText();
    MessageBox.Show(html);
 }

<Custom:WebControl x:Name="MyWebControl"   HorizontalAlignment="Left" Source="www.google.com" Margin="32,83,0,0" VerticalAlignment="Top" Width="425"/>
Run Code Online (Sandbox Code Playgroud)

我设定平台目标:86x

我在用 :

awesomium_1_7_2_sdk_win

Visual Studio 2012

.NET 4.5

谢谢你提前.

.net c# wpf awesomium

5
推荐指数
1
解决办法
1704
查看次数

如何使用JustMock模拟EF 6异步方法?

我正在尝试使用JustMock模拟实体框架6.0.2异步方法.我正在使用异步查询进行测试,但它是使用Moq编写的我试图在Mock Multiple Interfaces的帮助下将其转换为JustMock 但是获得异常:

源IQueryable的提供程序未实现IDbAsyncQueryProvider.只有实现IDbAsyncQueryProvider的提供程序才能用于Entity Framework异步操作.有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkId=287068.

这是我的代码:

var dummyData = GetEmployeeSkills();
var mockSet = Mock.Create<DbSet<EmployeeSkill>>();
(mockSet as IDbAsyncEnumerable<EmployeeSkill>).Arrange(x => x.GetAsyncEnumerator())
         .Returns(new TestDbAsyncEnumerator<EmployeeSkill>(dummyData.GetEnumerator()));

(mockSet as IQueryable<EmployeeSkill>).Arrange(x => x.Provider).Returns(new TestDbAsyncQueryProvider<EmployeeSkill>(dummyData.Provider));

(mockSet as IQueryable<EmployeeSkill>).Arrange(x => x.Expression).Returns(dummyData.Expression);
(mockSet as IQueryable<EmployeeSkill>).Arrange(x => x.ElementType).Returns(dummyData.ElementType);
(mockSet as IQueryable<EmployeeSkill>).Arrange(x => x.GetEnumerator()).Returns(dummyData.GetEnumerator());

var mockContext = Mock.Create<TimeSketchContext>();
mockContext.Arrange(x => x.Set<EmployeeSkill>()).Returns(mockSet);

baseRepository = new BaseRepository<EmployeeSkill>(mockContext);

private EmployeeSkill GetEmployeeSkill()
    {
        return new EmployeeSkill
        {
            SkillDescription = "SkillDescription",
            SkillName = "SkillName",
            Id = 1
        };
    }

    private …
Run Code Online (Sandbox Code Playgroud)

.net c# asynchronous entity-framework moq

5
推荐指数
1
解决办法
1344
查看次数

为什么我在Fluent API中找不到IsIndependent()?

我试着按照这篇文章来解决我的问题.但在我的代码中我找不到

.IsIndependent()
Run Code Online (Sandbox Code Playgroud)

扩展方法.

这是我的代码:

using System.Data.Entity;
modelBuilder.Entity<UnitInformation>()
.HasOptional(x => x.SectionInformations)
.WithMany()
.IsIndependent()  
Run Code Online (Sandbox Code Playgroud)

.IsIndependent() 不包含'IsIndependent'的定义,并且没有可以找到接受类型的第一个参数的扩展方法'IsIndependent'(你是否缺少using指令或程序集引用?

我错过了任何装配参考吗?

我在用

Entity Framework 5.0
.Net 4.5
Visual Studio 2012
Run Code Online (Sandbox Code Playgroud)

.net c# entity-framework

2
推荐指数
1
解决办法
650
查看次数

如何在Web Api中发布自定义命名方法?

我是Web Api的新手.我正在创建一个带有自定义命名操作的Web Api控制器.我是使用HttpClient从WPF客户端调用它的.但我收到错误 响应状态代码并不表示成功404(未找到)

这是我的Web Api控制器:

public class ActivationController : ApiController
{
    private readonly IActivationUnit _activationUnit;

    public ActivationController()
    {
        _activationUnit = new ActivationUnit();
    }

    //  api/activation/GetAllActivisionInformations
    public HttpResponseMessage GetAllActivationInformations(string username)
    {
        return Request.CreateResponse(HttpStatusCode.OK, _activationUnit.ActivationRepository.GetActivationInformations(username));
    }

    // api/activation/NewLicense
    [HttpPost]
    public HttpResponseMessage PostNewLicense(LicenseMetadata licenseMetadata)
    {
        bool isSuccess = _activationUnit.ActivationRepository.NewLicense(licenseMetadata.Username, licenseMetadata.ActivisionInformation);
        if (isSuccess)
        {
            try
            {
                _activationUnit.Save();
            }
            catch (Exception)
            {
                isSuccess = false;
            }
        }
        return Request.CreateResponse(isSuccess ? HttpStatusCode.OK : HttpStatusCode.BadRequest, isSuccess);
    }
}
Run Code Online (Sandbox Code Playgroud)

我的路由是:

 //   Route for POST method
 config.Routes.MapHttpRoute(
 name: …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net-mvc-4 asp.net-web-api visual-studio-2012

1
推荐指数
1
解决办法
4586
查看次数