我有一个网络摄像头的流 URL,它返回“multipart/x-mixed-replace;boundary=myboundary”的内容类型,假设可以通过http://mywebcam/livrestream.cgi访问它
我想在 ASP.NET CORE 中创建一个可以返回相同流的代理。
我创建了一条获取流的路线:
[Route("api/test")]
[HttpGet]
public async Task<HttpResponseMessage> Test()
{
var client = new HttpClient();
var inputStream = await client.GetStreamAsync("http://mywebcam/livrestream.cgi");
var response = new HttpResponseMessage();
response.Content = new PushStreamContent((stream, httpContent, transportContext) =>
{
// what to do ?
}, "video/mp4");
return response;
}
Run Code Online (Sandbox Code Playgroud)
看来我得用PushStreamContent了。但我该怎么办呢?定期查询流的无限 while 循环?还有别的事吗?
当我处于设计模式时,我想将我的silverlight视图绑定到另一个datacontext.使用定位器模式,我可以执行以下操作:
<UserControl or Window Or Else
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
DataContext="{Binding MyViewModelStatic, Source={StaticResource Locator}}"
d:DataContext="{Binding Path=MyViewModelDesign, Source={StaticResource Locator}}">
Run Code Online (Sandbox Code Playgroud)
如果我没有使用这种模式并使用这样的声明方式:
<UserControl.DataContext>
<local:MyViewModel />
</UserControl.DataContext>
Run Code Online (Sandbox Code Playgroud)
如何将d:设置为另一个视图模型?
在此先感谢您的帮助
我以为这段代码剪掉了:
var appTile = ShellTile.ActiveTiles.First();
if (appTile != null)
{
// is pinned
}
Run Code Online (Sandbox Code Playgroud)
会告诉我我的wp7应用程序是否已被固定,但appTile永远不会为空,即使应用程序没有固定.
有任何想法吗 ?
在此先感谢您的帮助
Why have theses 2 codes different behaviour ?
decimal test = 53M;
var label = "Some thing " + test + " other thing";
Console.WriteLine(label);
test = 53.00M;
label = "Some thing " + test + " other thing";
Console.WriteLine(label);
Run Code Online (Sandbox Code Playgroud)
Displays :
Some thing 53 other thing
Some thing 53,00 other thing
我正在尝试为画布中的图像的左侧属性设置动画.
当我在做的时候:
image.SetValue(Canvas.LeftProperty, destX[i]);
Run Code Online (Sandbox Code Playgroud)
这是有效的.但是当我在做的时候:
Animate(image, lastValue, destX[i], 500);
Run Code Online (Sandbox Code Playgroud)
同
private void Animate(Image image, double val1, double val2, double miliseconds)
{
DoubleAnimation myDoubleAnimation = new DoubleAnimation { From = val1, To = val2, Duration = new Duration(TimeSpan.FromMilliseconds(miliseconds)) };
TranslateTransform ts = new TranslateTransform();
image.RenderTransform = ts;
Storyboard.SetTarget(myDoubleAnimation, ts);
Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(TranslateTransform.XProperty));
Storyboard myMovementStoryboard = new Storyboard();
myMovementStoryboard.Children.Add(myDoubleAnimation);
myMovementStoryboard.Begin();
myMovementStoryboard.Completed += (s, e) =>
{
image.SetValue(Canvas.LeftProperty, val2);
};
}
Run Code Online (Sandbox Code Playgroud)
它不起作用
我的Animate功能有什么问题?即使动画可能做得不好,完成的事件也应该将好的值重置为canvas.leftproperty.
但就我而言,出了点问题.
你将如何完成Animate功能?
在此先感谢您的帮助