Fix hub method call.

This commit is contained in:
Jared Goodwin 2020-04-08 16:40:08 -07:00
parent 5417e87a93
commit b4bb9a08e6
3 changed files with 56 additions and 1 deletions

View File

@ -58,7 +58,7 @@ namespace Remotely.Agent.Services
var device = await DeviceInformation.Create(ConnectionInfo.DeviceID, ConnectionInfo.OrganizationID);
var result = await HubConnection.SendAsync<bool>("DeviceCameOnline", device);
var result = await HubConnection.InvokeAsync<bool>("DeviceCameOnline", device);
if (!result)
{

54
Tests/CaptureTests.cs Normal file
View File

@ -0,0 +1,54 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Remotely.ScreenCast.Core.Utilities;
using Remotely.ScreenCast.Win.Services;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing.Imaging;
using System.IO;
using System.Text;
using System.Threading.Tasks;
namespace Remotely.Tests
{
[TestClass]
public class CaptureTests
{
[TestMethod]
[Ignore("Debug only.")]
public async Task Capture()
{
var capturer = new ScreenCapturerWin();
capturer.GetNextFrame();
Process.Start("msg", "* test");
await Task.Delay(500);
capturer.GetNextFrame();
var diffArea = ImageUtils.GetDiffArea(capturer.CurrentFrame, capturer.PreviousFrame, false);
if (diffArea.IsEmpty)
{
return;
}
using (var newImage = capturer.CurrentFrame.Clone(diffArea, PixelFormat.Format32bppArgb))
{
if (capturer.CaptureFullscreen)
{
capturer.CaptureFullscreen = false;
}
newImage.Save(Path.Combine(Path.GetTempPath(), "!ImageDiff.jpg"), ImageFormat.Jpeg);
capturer.CurrentFrame.Save(Path.Combine(Path.GetTempPath(), "!Current.jpg"), ImageFormat.Jpeg);
capturer.PreviousFrame.Save(Path.Combine(Path.GetTempPath(), "!Previous.jpg"), ImageFormat.Jpeg);
}
}
private double MeasureCommand(Action command)
{
var stopwatch = Stopwatch.StartNew();
command.Invoke();
stopwatch.Stop();
Console.WriteLine($"Command time: {stopwatch.Elapsed.TotalMilliseconds}");
return stopwatch.Elapsed.TotalMilliseconds;
}
}
}

View File

@ -26,6 +26,7 @@
<ItemGroup>
<ProjectReference Include="..\Agent.Installer.Win\Agent.Installer.Win.csproj" />
<ProjectReference Include="..\ScreenCast.Win\ScreenCast.Win.csproj" />
<ProjectReference Include="..\Server\Server.csproj" />
</ItemGroup>