Skip to content

Commit

Permalink
Fix hub method call.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Apr 8, 2020
1 parent 5417e87 commit b4bb9a0
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Agent/Services/DeviceSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async Task Connect()

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)
{
Expand Down
54 changes: 54 additions & 0 deletions Tests/CaptureTests.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
1 change: 1 addition & 0 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down

0 comments on commit b4bb9a0

Please sign in to comment.