mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Fix hub method call.
This commit is contained in:
parent
5417e87a93
commit
b4bb9a08e6
@ -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
54
Tests/CaptureTests.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user