Skip to content

Commit f3a8737

Browse files
committed
updated ui selection for monitors and supported dragging pointer
1 parent cf8f616 commit f3a8737

14 files changed

Lines changed: 125 additions & 33 deletions

PointerApplication/App.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
</runtime>
1414
<appSettings>
1515
<add key="rootFolder" value="./www" />
16+
<add key="pointerImage" value="green-triangle-arrow.png"/>
1617
</appSettings>
1718
</configuration>

PointerApplication/MainWindow.xaml.cs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
using System;
2+
using System.Configuration;
23
using System.Drawing;
4+
using System.Globalization;
35
using System.IO;
46
using System.Linq;
57
using System.Windows;
68
using System.Windows.Forms;
79
using System.Windows.Media.Imaging;
8-
using Microsoft.AspNet.SignalR.Client;
910
using Microsoft.Owin.Hosting;
11+
using Microsoft.AspNet.SignalR.Client;
1012
using Image = System.Windows.Controls.Image;
1113

1214
namespace PointerApplication
@@ -17,6 +19,7 @@ public partial class MainWindow : Window
1719
private const double CLIENT_DISPLAY_HEIGHT = 480;
1820
private const double CLIENT_DISPLAY_WIDTH = 640;
1921
private const string REMOTE_URL_PATH = "http://{0}:8181";
22+
2023
public MainWindow()
2124
{
2225
InitializeComponent();
@@ -49,9 +52,14 @@ public MainWindow()
4952
this.Show();
5053
this.Activate();
5154
});
52-
}
55+
}
56+
57+
58+
59+
5360
});
5461
hubPointerConnection.Start();
62+
5563
}
5664

5765
private PositionData ParsePositionData(string data)
@@ -60,16 +68,28 @@ private PositionData ParsePositionData(string data)
6068
return new PositionData()
6169
{
6270
ScreenPosition = int.Parse(items[0]),
63-
HorizontalPosition = int.Parse(items[1]),
64-
VerticalPosition = int.Parse(items[2])
71+
HorizontalPosition = GetIntegerValue(items[1]),
72+
VerticalPosition = GetIntegerValue(items[2])
6573
};
6674
}
6775

76+
private int GetIntegerValue(string value)
77+
{
78+
var integerValue = 0.0;
79+
if (double.TryParse(value, out integerValue))
80+
{
81+
return (int)integerValue;
82+
}
83+
84+
return 0;
85+
}
86+
6887
private void Image_Loaded(object sender, RoutedEventArgs e)
6988
{
89+
var imageName = ConfigurationManager.AppSettings["pointerImage"];
7090
BitmapImage b = new BitmapImage();
7191
b.BeginInit();
72-
var imagePath = Path.Combine(Environment.CurrentDirectory, "lookhere.png");
92+
var imagePath = Path.Combine(Environment.CurrentDirectory, "images",imageName);
7393
b.UriSource = new Uri(imagePath);
7494
b.EndInit();
7595

PointerApplication/PointerHub.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.AspNet.SignalR;
1+
using System.Windows.Forms;
2+
using Microsoft.AspNet.SignalR;
23

34
namespace PointerApplication
45
{
@@ -8,5 +9,10 @@ public void Send(string name, string message)
89
{
910
Clients.All.addMessage(name, message);
1011
}
12+
13+
public int GetMonitorCount()
14+
{
15+
return Screen.AllScreens.Length;
16+
}
1117
}
1218
}

PointerApplication/PointerServer.csproj

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,19 +189,28 @@
189189
</None>
190190
</ItemGroup>
191191
<ItemGroup>
192+
<None Include="images\lookhere.png">
193+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
194+
</None>
195+
<None Include="images\green-triangle-arrow.png">
196+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
197+
</None>
192198
<Content Include="www\css\index.css">
193199
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
194200
</Content>
201+
<None Include="www\images\monitor.png">
202+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
203+
</None>
204+
<None Include="www\images\monitor_gray.png">
205+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
206+
</None>
195207
<Content Include="www\index.html">
196208
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
197209
</Content>
198210
<Content Include="www\scripts\index.js">
199211
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
200212
</Content>
201-
<None Include="www\small_red_dot.png">
202-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
203-
</None>
204-
<None Include="lookhere.png">
213+
<None Include="www\images\small_red_dot.png">
205214
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
206215
</None>
207216
</ItemGroup>
16.3 KB
Loading
-288 Bytes
Binary file not shown.

PointerApplication/www/css/index.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,35 @@
1111
overflow: hidden;
1212
background-color: #F2F2F2;
1313
cursor: pointer;
14+
float: left;
15+
position: relative;
1416
}
1517

1618
.lookHereImage {
1719
position: relative;
1820
left: 50px;
1921
top: 50px;
2022
}
23+
24+
.activeMonitor {
25+
height: 60px;
26+
width: 90px;
27+
background-repeat: no-repeat;
28+
background-image: url('/images/monitor.png');
29+
position: relative;
30+
float: left;
31+
}
32+
33+
34+
.inactiveMonitor {
35+
height: 60px;
36+
width: 90px;
37+
background-repeat: no-repeat;
38+
background-image: url('/images/monitor_gray.png');
39+
position: relative;
40+
float: left;
41+
}
42+
43+
.hidden {
44+
visibility: hidden;
45+
}
1.31 KB
Loading
1.26 KB
Loading

0 commit comments

Comments
 (0)