小编Mal*_*ngo的帖子

仅获取 odata expand 属性的计数

我有一个带有 WebAPI OData 6.0.0 的 OData 服务,它支持这样的查询:

/Customers?$expand=Projects($count=true)
Run Code Online (Sandbox Code Playgroud)

这将返回一个客户列表,其中包含每个客户下的所有项目,以及这些项目的计数。

我现在想要的是一个查询,它将获取客户列表,并且对于每个客户,仅获取其项目的计数,而不是项目列表。

有没有办法创建这样的查询?

我试过

/Customers?$select=Name,Projects/$count
Run Code Online (Sandbox Code Playgroud)

但这不起作用。

odata asp.net-web-api asp.net-web-api2

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

使用单击动画以编程方式推进Powerpoint幻灯片放映

我想要做的是从我的WPF应用程序控制一个Powerpoint演示文稿.使用此问题的代码: C# - 以编程方式推进Powerpoint幻灯片放映的方式? 它适用于普通幻灯片.

但是一旦我看到带有鼠标点击触发的动画的幻灯片,它就不会像我期望的那样工作.当进入这样的幻灯片时,它将按预期显示,但是当我调用objPres.SlideShowWindow.View.Next()时,它什么都不做,并且在第二次或第三次单击后,它直接进入下一张幻灯片,没有动画.

奇怪的是:当我通过Timer调用objPres.SlideShowWindow.View.Next()时,它可以工作!动画正在按预期运行.

这是我的代码:

Microsoft.Office.Interop.PowerPoint.Application oPPT;
Microsoft.Office.Interop.PowerPoint.Presentations objPresSet;
Microsoft.Office.Interop.PowerPoint.Presentation objPres;
Microsoft.Office.Interop.PowerPoint.SlideShowView oSlideShowView;
Timer slidetest;

private void OpenPPT(object sender, RoutedEventArgs e)
{
    //Create an instance of PowerPoint.
    oPPT = new Microsoft.Office.Interop.PowerPoint.Application();
    // Show PowerPoint to the user.
    oPPT.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
    objPresSet = oPPT.Presentations;


    OpenFileDialog Opendlg = new OpenFileDialog();

    Opendlg.Filter = "Powerpoint|*.ppt;*.pptx|All files|*.*";

    // Open file when user  click "Open" button  
    if (Opendlg.ShowDialog() == true)
    {
        string pptFilePath = Opendlg.FileName;
        //open the presentation
        objPres = objPresSet.Open(pptFilePath, MsoTriState.msoFalse,
        MsoTriState.msoTrue, …
Run Code Online (Sandbox Code Playgroud)

c# animation powerpoint office-interop

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

WCF服务 - 支持Range:bytes支持的流文件?

我有一个WCF服务,可以通过WebGet返回流.到目前为止工作正常.但是我想要实现的是对Range标头的支持,以便只返回部分文件.这是我的代码:

public System.IO.Stream GetStream(string mElementID)
{
        // build the filePath
        FileInfo file = GetFile(mElementID);
        try
        {
            FileStream videoStream = File.OpenRead(file.FullName);

            if (request.Headers.AllKeys.Contains("Range"))
            {
                long startRange = ...; // get the start range from the header
                long endRange = ...; // get the end range from the header
                videoStream.Position = startRange;
                // how can I set the end of the range?
                //TODO: Don't forget to add the Content-Range header to the response!
            }

            WebOperationContext.Current.OutgoingResponse.ContentType = GetMimeType(file);
            WebOperationContext.Current.OutgoingResponse.Headers.Add("Accept-Ranges", "bytes");
            return videoStream;
        } …
Run Code Online (Sandbox Code Playgroud)

.net c# wcf http

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