Skip to content
Browse files

Updates and bug fixes

  • Loading branch information...
1 parent 105bc65 commit de8f72af5fb6640f828c5e7fd909a5eb328e33e1 Steven Houben committed
Showing with 4,090 additions and 3,952 deletions.
  1. +830 −830 NooSphere/ActivityBar/Xaml/ActivityBar.xaml.cs
  2. +2 −2 NooSphere/ActivityDesk/Desk.xaml.cs
  3. +193 −191 NooSphere/ActivityTablet/ActivityTablet.csproj
  4. +22 −0 NooSphere/ActivityTablet/DisplayMode.cs
  5. +230 −231 NooSphere/ActivityTablet/Xaml/Tablet.xaml
  6. +372 −280 NooSphere/ActivityTablet/Xaml/Tablet.xaml.cs
  7. BIN NooSphere/ActivityTablet/Xaml/blue.jpg
  8. +0 −1 NooSphere/NooSphere.ActivitySystem/Base/Client/ActivityClient.cs
  9. +50 −50 NooSphere/NooSphere.ActivitySystem/Base/Client/IActivityNetEvent.cs
  10. +29 −29 NooSphere/NooSphere.ActivitySystem/Base/Client/IComNetEvent.cs
  11. +41 −41 NooSphere/NooSphere.ActivitySystem/Base/Client/IDeviceNetEvent.cs
  12. +40 −40 NooSphere/NooSphere.ActivitySystem/Base/Client/IFileNetEvent.cs
  13. +21 −11 NooSphere/NooSphere.ActivitySystem/Base/Client/INetEventHandler.cs
  14. +52 −52 NooSphere/NooSphere.ActivitySystem/Base/Client/IUserNetEvent.cs
  15. +365 −368 NooSphere/NooSphere.ActivitySystem/Base/Client/NetEventHandler.cs
  16. +26 −14 NooSphere/NooSphere.ActivitySystem/Base/Controller/Configuration.cs
  17. +21 −9 NooSphere/NooSphere.ActivitySystem/Base/Controller/IActivityProxy.cs
  18. +44 −46 NooSphere/NooSphere.ActivitySystem/Base/EventTypeConverter.cs
  19. +311 −316 NooSphere/NooSphere.ActivitySystem/Base/Service/ActivityCloudConnector.cs
  20. +627 −621 NooSphere/NooSphere.ActivitySystem/Base/Service/ActivityManager.cs
  21. +23 −23 NooSphere/NooSphere.ActivitySystem/Base/Service/ActivityStore.cs
  22. +30 −30 NooSphere/NooSphere.ActivitySystem/Base/Service/CloudEvents.cs
  23. +33 −33 NooSphere/NooSphere.ActivitySystem/Base/Service/ConnectedClient.cs
  24. +80 −81 NooSphere/NooSphere.ActivitySystem/Base/Service/IActivityManager.cs
  25. +23 −23 NooSphere/NooSphere.ActivitySystem/Base/Service/ParticipantStore.cs
  26. +43 −45 NooSphere/NooSphere.ActivitySystem/Base/Service/Syncer.cs
  27. +148 −149 NooSphere/NooSphere.ActivitySystem/Discovery/BroadcastService.cs
  28. +190 −190 NooSphere/NooSphere.ActivitySystem/Helpers/Rest.cs
  29. +151 −153 NooSphere/NooSphere.ActivitySystem/NooSphere.ActivitySystem.csproj
  30. +29 −28 NooSphere/NooSphere.ActivitySystem/PubSub/Registry.cs
  31. +64 −65 NooSphere/NooSphere.ActivitySystem/PubSub/RestSubscriber.cs
View
1,660 NooSphere/ActivityBar/Xaml/ActivityBar.xaml.cs
830 additions, 830 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
4 NooSphere/ActivityDesk/Desk.xaml.cs
@@ -325,8 +325,8 @@ private void VisualizeResouce(Resource res, string path)
{
try
{
- Image i = new Image();
- BitmapImage src = new BitmapImage();
+ var i = new Image();
+ var src = new BitmapImage();
src.BeginInit();
src.UriSource = new Uri(path, UriKind.Relative);
src.CacheOption = BitmapCacheOption.OnLoad;
View
384 NooSphere/ActivityTablet/ActivityTablet.csproj
@@ -1,192 +1,194 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{B6356A30-18D3-4B74-8608-B855B2C7BFD7}</ProjectGuid>
- <OutputType>WinExe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>ActivityTablet</RootNamespace>
- <AssemblyName>ActivityTablet</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <TargetFrameworkProfile>
- </TargetFrameworkProfile>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <WarningLevel>4</WarningLevel>
- <SccProjectName>Svn</SccProjectName>
- <SccLocalPath>Svn</SccLocalPath>
- <SccAuxPath>Svn</SccAuxPath>
- <SccProvider>SubversionScc</SccProvider>
- <IsWebBootstrapper>false</IsWebBootstrapper>
- <PublishUrl>publish\</PublishUrl>
- <Install>true</Install>
- <InstallFrom>Disk</InstallFrom>
- <UpdateEnabled>false</UpdateEnabled>
- <UpdateMode>Foreground</UpdateMode>
- <UpdateInterval>7</UpdateInterval>
- <UpdateIntervalUnits>Days</UpdateIntervalUnits>
- <UpdatePeriodically>false</UpdatePeriodically>
- <UpdateRequired>false</UpdateRequired>
- <MapFileExtensions>true</MapFileExtensions>
- <ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
- <UseApplicationTrust>false</UseApplicationTrust>
- <BootstrapperEnabled>true</BootstrapperEnabled>
- <Utf8Output>true</Utf8Output>
- <ExpressionBlendVersion>4.0.20525.0</ExpressionBlendVersion>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
- <RestorePackages>true</RestorePackages>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <PlatformTarget>x86</PlatformTarget>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Microsoft.Surface, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
- <Reference Include="Microsoft.Surface.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
- <Reference Include="Microsoft.Surface.Presentation, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
- <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
- <HintPath>..\packages\Newtonsoft.Json.4.5.7\lib\net40\Newtonsoft.Json.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Configuration" />
- <Reference Include="System.Data" />
- <Reference Include="System.Drawing" />
- <Reference Include="System.ServiceModel" />
- <Reference Include="System.Windows.Forms" />
- <Reference Include="System.Xml" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="System.Xaml">
- <RequiredTargetFramework>4.0</RequiredTargetFramework>
- </Reference>
- <Reference Include="UIAutomationProvider" />
- <Reference Include="UIAutomationTypes" />
- <Reference Include="WindowsBase" />
- <Reference Include="PresentationCore" />
- <Reference Include="PresentationFramework" />
- </ItemGroup>
- <ItemGroup>
- <ApplicationDefinition Include="App.xaml">
- <Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
- </ApplicationDefinition>
- <Page Include="Xaml\Tablet.xaml">
- <Generator>MSBuild:Compile</Generator>
- <SubType>Designer</SubType>
- </Page>
- <Compile Include="Xaml\ActivityButton.cs" />
- <Compile Include="App.xaml.cs">
- <DependentUpon>App.xaml</DependentUpon>
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Proxy.cs" />
- <Compile Include="Xaml\Tablet.xaml.cs">
- <DependentUpon>Tablet.xaml</DependentUpon>
- <SubType>Code</SubType>
- </Compile>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Properties\AssemblyInfo.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Properties\Resources.Designer.cs">
- <AutoGen>True</AutoGen>
- <DesignTime>True</DesignTime>
- <DependentUpon>Resources.resx</DependentUpon>
- </Compile>
- <Compile Include="Properties\Settings.Designer.cs">
- <AutoGen>True</AutoGen>
- <DependentUpon>Settings.settings</DependentUpon>
- <DesignTimeSharedInput>True</DesignTimeSharedInput>
- </Compile>
- <EmbeddedResource Include="Properties\Resources.resx">
- <Generator>ResXFileCodeGenerator</Generator>
- <LastGenOutput>Resources.Designer.cs</LastGenOutput>
- </EmbeddedResource>
- <None Include="app.config" />
- <None Include="back.png">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="packages.config" />
- <None Include="Properties\Settings.settings">
- <Generator>SettingsSingleFileGenerator</Generator>
- <LastGenOutput>Settings.Designer.cs</LastGenOutput>
- </None>
- <AppDesigner Include="Properties\" />
- </ItemGroup>
- <ItemGroup>
- <Content Include="Resources\icon.png">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- <Content Include="ActivityTablet.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- </ItemGroup>
- <ItemGroup>
- <BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
- <Visible>False</Visible>
- <ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
- <Visible>False</Visible>
- <ProductName>.NET Framework 3.5 SP1</ProductName>
- <Install>false</Install>
- </BootstrapperPackage>
- <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
- <Visible>False</Visible>
- <ProductName>Windows Installer 3.1</ProductName>
- <Install>true</Install>
- </BootstrapperPackage>
- </ItemGroup>
- <ItemGroup>
- <Resource Include="Images\activity.PNG" />
- <Resource Include="activity1.PNG" />
- <Resource Include="activity_trans.png" />
- <Resource Include="logo.PNG" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\NooSphere.ActivitySystem\NooSphere.ActivitySystem.csproj">
- <Project>{5CD6DD93-3EA1-425F-89D7-A80FD23BBC71}</Project>
- <Name>NooSphere.ActivitySystem</Name>
- </ProjectReference>
- <ProjectReference Include="..\NooSphere.Core\NooSphere.Core.csproj">
- <Project>{03C072A4-5960-4A5D-B0CC-98EBD854E970}</Project>
- <Name>NooSphere.Core</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{B6356A30-18D3-4B74-8608-B855B2C7BFD7}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>ActivityTablet</RootNamespace>
+ <AssemblyName>ActivityTablet</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>
+ </TargetFrameworkProfile>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <WarningLevel>4</WarningLevel>
+ <SccProjectName>Svn</SccProjectName>
+ <SccLocalPath>Svn</SccLocalPath>
+ <SccAuxPath>Svn</SccAuxPath>
+ <SccProvider>SubversionScc</SccProvider>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ <Utf8Output>true</Utf8Output>
+ <ExpressionBlendVersion>4.0.20525.0</ExpressionBlendVersion>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <PlatformTarget>x86</PlatformTarget>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.Surface, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
+ <Reference Include="Microsoft.Surface.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
+ <Reference Include="Microsoft.Surface.Presentation, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
+ <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <HintPath>..\packages\Newtonsoft.Json.4.5.7\lib\net40\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Configuration" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.ServiceModel" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Xaml">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="UIAutomationProvider" />
+ <Reference Include="UIAutomationTypes" />
+ <Reference Include="WindowsBase" />
+ <Reference Include="PresentationCore" />
+ <Reference Include="PresentationFramework" />
+ </ItemGroup>
+ <ItemGroup>
+ <ApplicationDefinition Include="App.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </ApplicationDefinition>
+ <Page Include="Xaml\Tablet.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ <Compile Include="DisplayMode.cs" />
+ <Compile Include="Xaml\ActivityButton.cs" />
+ <Compile Include="App.xaml.cs">
+ <DependentUpon>App.xaml</DependentUpon>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Proxy.cs" />
+ <Compile Include="Xaml\Tablet.xaml.cs">
+ <DependentUpon>Tablet.xaml</DependentUpon>
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Properties\AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ <None Include="app.config" />
+ <None Include="back.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ <None Include="packages.config" />
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ <AppDesigner Include="Properties\" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Resources\icon.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="ActivityTablet.xml">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
+ <Visible>False</Visible>
+ <ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\activity.PNG" />
+ <Resource Include="activity1.PNG" />
+ <Resource Include="activity_trans.png" />
+ <Resource Include="logo.PNG" />
+ <Resource Include="Xaml\blue.jpg" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\NooSphere.ActivitySystem\NooSphere.ActivitySystem.csproj">
+ <Project>{5CD6DD93-3EA1-425F-89D7-A80FD23BBC71}</Project>
+ <Name>NooSphere.ActivitySystem</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\NooSphere.Core\NooSphere.Core.csproj">
+ <Project>{03C072A4-5960-4A5D-B0CC-98EBD854E970}</Project>
+ <Name>NooSphere.Core</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
</Project>
View
22 NooSphere/ActivityTablet/DisplayMode.cs
@@ -0,0 +1,22 @@
+/****************************************************************************
+ (c) 2012 Steven Houben(shou@itu.dk) and Søren Nielsen(snielsen@itu.dk)
+
+ Pervasive Interaction Technology Laboratory (pIT lab)
+ IT University of Copenhagen
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU GENERAL PUBLIC LICENSE V3 or later,
+ as published by the Free Software Foundation. Check
+ http://www.gnu.org/licenses/gpl.html for details.
+****************************************************************************/
+
+namespace ActivityTablet
+{
+ public enum ViewMode
+ {
+ ControllerView,
+ ResourceView,
+ ReadingView,
+ InputView
+ }
+}
View
461 NooSphere/ActivityTablet/Xaml/Tablet.xaml
@@ -1,231 +1,230 @@
-<Window x:Class="ActivityTablet.Xaml.Tablet"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:s="http://schemas.microsoft.com/surface/2008"
- Title="ActivityTablet" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:Height="1024" d:Width="687
-
- " SizeToContent="WidthAndHeight" WindowStyle="None" WindowState="Maximized" Width="978" Height="624" ResizeMode="NoResize">
- <Window.Resources>
- <Style x:Key="Success" TargetType="{x:Type Button}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <ControlTemplate.Resources>
- <Storyboard x:Key="OnMouseEnter1">
- <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
- <EasingColorKeyFrame KeyTime="0" Value="#FF3ECC0E"/>
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- <Storyboard x:Key="OnMouseLeave1">
- <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
- <EasingColorKeyFrame KeyTime="0" Value="#FF80E25F"/>
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- <Storyboard x:Key="OnMouseDown1">
- <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
- <EasingColorKeyFrame KeyTime="0" Value="#FF33A50B"/>
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- </ControlTemplate.Resources>
- <Grid>
- <Rectangle x:Name="rectangle" RadiusY="3.5" RadiusX="3.5" Stroke="#FF428700">
- <Rectangle.Fill>
- <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
- <GradientStop Color="#FF4B9F2C" Offset="1"/>
- <GradientStop Color="#FF80E25F" Offset="0.289"/>
- </LinearGradientBrush>
- </Rectangle.Fill>
- </Rectangle>
- <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
- </Grid>
- <ControlTemplate.Triggers>
- <EventTrigger RoutedEvent="Mouse.PreviewMouseUp">
- <BeginStoryboard Storyboard="{StaticResource OnMouseEnter1}"/>
- </EventTrigger>
- <EventTrigger RoutedEvent="Mouse.PreviewMouseDown">
- <BeginStoryboard x:Name="OnMouseDown1_BeginStoryboard" Storyboard="{StaticResource OnMouseDown1}"/>
- </EventTrigger>
- <EventTrigger RoutedEvent="Mouse.MouseEnter">
- <BeginStoryboard x:Name="OnMouseEnter1_BeginStoryboard" Storyboard="{StaticResource OnMouseEnter1}"/>
- </EventTrigger>
- <EventTrigger RoutedEvent="Mouse.MouseLeave">
- <BeginStoryboard x:Name="OnMouseLeave1_BeginStoryboard" Storyboard="{StaticResource OnMouseLeave1}"/>
- </EventTrigger>
- <Trigger Property="IsFocused" Value="True"/>
- <Trigger Property="IsDefaulted" Value="True"/>
- <Trigger Property="IsMouseOver" Value="True"/>
- <Trigger Property="IsPressed" Value="True"/>
- <Trigger Property="IsEnabled" Value="False"/>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="Danger" TargetType="{x:Type Button}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <ControlTemplate.Resources>
- <Storyboard x:Key="OnMouseEnter1">
- <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
- <EasingColorKeyFrame KeyTime="0" Value="#FFCC0E0E"/>
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- <Storyboard x:Key="OnMouseLeave1">
- <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
- <EasingColorKeyFrame KeyTime="0" Value="#FFE25F5F"/>
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- <Storyboard x:Key="OnMouseDown1">
- <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
- <EasingColorKeyFrame KeyTime="0" Value="#FFA50B0B"/>
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- </ControlTemplate.Resources>
- <Grid>
- <Rectangle x:Name="rectangle" RadiusY="3.5" RadiusX="3.5" Stroke="#FF870000">
- <Rectangle.Fill>
- <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
- <GradientStop Color="#FF9F2C2C" Offset="1"/>
- <GradientStop Color="#FFE25F5F" Offset="0.289"/>
- </LinearGradientBrush>
- </Rectangle.Fill>
- </Rectangle>
- <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
- </Grid>
- <ControlTemplate.Triggers>
- <EventTrigger RoutedEvent="Mouse.PreviewMouseUp">
- <BeginStoryboard Storyboard="{StaticResource OnMouseEnter1}"/>
- </EventTrigger>
- <EventTrigger RoutedEvent="Mouse.PreviewMouseDown">
- <BeginStoryboard x:Name="OnMouseDown1_BeginStoryboard" Storyboard="{StaticResource OnMouseDown1}"/>
- </EventTrigger>
- <EventTrigger RoutedEvent="Mouse.MouseEnter">
- <BeginStoryboard x:Name="OnMouseEnter1_BeginStoryboard" Storyboard="{StaticResource OnMouseEnter1}"/>
- </EventTrigger>
- <EventTrigger RoutedEvent="Mouse.MouseLeave">
- <BeginStoryboard x:Name="OnMouseLeave1_BeginStoryboard" Storyboard="{StaticResource OnMouseLeave1}"/>
- </EventTrigger>
- <Trigger Property="IsFocused" Value="True"/>
- <Trigger Property="IsDefaulted" Value="True"/>
- <Trigger Property="IsMouseOver" Value="True"/>
- <Trigger Property="IsPressed" Value="True"/>
- <Trigger Property="IsEnabled" Value="False"/>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="Action" TargetType="{x:Type Button}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <ControlTemplate.Resources>
- <Storyboard x:Key="OnMouseEnter1">
- <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
- <EasingColorKeyFrame KeyTime="0" Value="#FF0E71CC"/>
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- <Storyboard x:Key="OnMouseLeave1">
- <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
- <EasingColorKeyFrame KeyTime="0" Value="#FF5F85E2"/>
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- <Storyboard x:Key="OnMouseDown1">
- <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
- <EasingColorKeyFrame KeyTime="0" Value="#FF0B2AA5"/>
- </ColorAnimationUsingKeyFrames>
- </Storyboard>
- </ControlTemplate.Resources>
- <Grid>
- <Rectangle x:Name="rectangle" RadiusY="3.5" RadiusX="3.5" Stroke="#FF100C8D">
- <Rectangle.Fill>
- <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
- <GradientStop Color="#FF2C389F" Offset="1"/>
- <GradientStop Color="#FF5F85E2" Offset="0.289"/>
- </LinearGradientBrush>
- </Rectangle.Fill>
- </Rectangle>
- <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
- </Grid>
- <ControlTemplate.Triggers>
- <EventTrigger RoutedEvent="Mouse.PreviewMouseDown">
- <BeginStoryboard x:Name="OnMouseDown1_BeginStoryboard" Storyboard="{StaticResource OnMouseDown1}"/>
- </EventTrigger>
- <EventTrigger RoutedEvent="Mouse.MouseEnter">
- <BeginStoryboard x:Name="OnMouseEnter1_BeginStoryboard" Storyboard="{StaticResource OnMouseEnter1}"/>
- </EventTrigger>
- <EventTrigger RoutedEvent="Mouse.MouseLeave">
- <BeginStoryboard x:Name="OnMouseLeave1_BeginStoryboard" Storyboard="{StaticResource OnMouseLeave1}"/>
- </EventTrigger>
- <Trigger Property="IsFocused" Value="True"/>
- <Trigger Property="IsDefaulted" Value="True"/>
- <Trigger Property="IsMouseOver" Value="True"/>
- <Trigger Property="IsPressed" Value="True"/>
- <Trigger Property="IsEnabled" Value="False"/>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="ActivityTouchButton" TargetType="{x:Type Button}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <Grid>
- <Rectangle Fill="#57F4F4F5" RadiusY="10" RadiusX="10" Stroke="Black" StrokeThickness="4"/>
- <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsFocused" Value="True"/>
- <Trigger Property="IsDefaulted" Value="True"/>
- <Trigger Property="IsMouseOver" Value="True"/>
- <Trigger Property="IsPressed" Value="True"/>
- <Trigger Property="IsEnabled" Value="False"/>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Window.Resources>
- <Grid Name="grid" Background="White" d:LayoutOverrides="HorizontalMargin">
- <Image Source="pack://siteoforigin:,,,/back.png" Stretch="None" d:IsLocked="True"/>
- <Canvas x:Name="cvLogin" d:IsLocked="True" d:IsHidden="True">
- <Canvas x:Name="pnlLogin" Height="383.757" Width="468" Background="White" Canvas.Left="272.5" Canvas.Top="98.673" d:IsHidden="True">
- <Rectangle Fill="Black" Height="36.666" Stroke="Black" Width="468" Canvas.Top="285.664" d:IsHidden="True"/>
- <Label Content="Username" Height="35.782" x:Name="lblName" Canvas.Left="15" Canvas.Top="148" Width="99" FontSize="17" FontFamily="Segoe360" d:IsHidden="True" />
- <Label Content="Email" Height="35.783" x:Name="lblEmail" Canvas.Left="15" Canvas.Top="191" Width="86" FontSize="17" FontFamily="Segoe360" d:IsHidden="True" />
- <s:SurfaceTextBox Height="29.392" x:Name="txtUsername" Canvas.Left="131" Canvas.Top="146.964" Width="310" d:IsHidden="True" />
- <s:SurfaceTextBox Height="29.393" x:Name="txtEmail" Canvas.Left="130" Canvas.Top="187.858" Width="310" d:IsHidden="True" />
- <s:SurfaceTextBox Height="29.393" x:Name="txtDevicename" Canvas.Left="131" Canvas.Top="230.03" Width="310" d:IsHidden="True" />
- <Image Height="120.127" x:Name="image1" Stretch="Fill" Width="175.748" Source="/ActivityTablet;component/activity1.PNG" Canvas.Left="4" Canvas.Top="4" d:IsHidden="True" />
- <s:SurfaceButton Content="Go" Style="{DynamicResource Success}" Foreground="White" FontSize="13.333" Width="98.858" RenderTransformOrigin="-0.037,0.75" Height="38.338" x:Name="btnGo" Click="BtnGoClick" ToolTip="Start the application and connect to the cloud." Canvas.Left="355.614" Canvas.Top="332.783" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Margin="0" d:IsHidden="True" />
- <Label Content="Device name" Height="35.783" Width="111" Canvas.Left="13" Canvas.Top="233" FontSize="17" FontFamily="Segoe360" d:IsHidden="True" />
- <Image Height="60.064" x:Name="imgLogo" Stretch="None" Source="/ActivityTablet;component/logo.PNG" Canvas.Left="130.591" Canvas.Top="44.728" Width="334.409" d:IsHidden="True" />
- <s:SurfaceRadioButton Canvas.Left="362.913" Canvas.Top="285.664" Content="Client" Height="16" x:Name="chkClient" GroupName="start" Margin="0" Background="#00000000" Foreground="#CCFFFFFF" d:IsHidden="True" />
- <s:SurfaceRadioButton Canvas.Left="179.579" Canvas.Top="285.664" Content="Host and Client" Height="16" x:Name="chkHostClient" GroupName="start" Margin="0" Background="#00000000" Foreground="#CCFFFFFF" IsChecked="True" d:IsHidden="True" />
- <s:SurfaceRadioButton Canvas.Left="24.579" Canvas.Top="285.664" Content="I don't know" Height="17" x:Name="chkNo" GroupName="start" Margin="0" Background="#00000000" Foreground="#CCFFFFFF" d:IsHidden="True" />
-
- </Canvas>
- <Border BorderBrush="Black" BorderThickness="8" Height="399" Width="482.333" Canvas.Left="265.167" Canvas.Top="91.5" CornerRadius="10" d:IsHidden="True"/>
- </Canvas>
- <Canvas x:Name="cvActivityManager" Margin="8">
- <s:SurfaceScrollViewer x:Name="activityDockScroller" Height="558"
- Width="158" VerticalContentAlignment="Center"
- HorizontalContentAlignment="Center" VerticalScrollBarVisibility="Hidden" Background="#FF006DFF" >
- <StackPanel Orientation="Vertical" x:Name="ActivityDock"/>
- </s:SurfaceScrollViewer>
- <s:SurfaceScrollViewer x:Name="ContentScroller" Height="436"
- Width="800" VerticalContentAlignment="Center"
- HorizontalContentAlignment="Center" VerticalScrollBarVisibility="Hidden" Canvas.Left="162" Canvas.Top="122" Background="Red" />
- <s:SurfaceScrollViewer x:Name="resourceScroller" Height="118"
- Width="800" VerticalContentAlignment="Center"
- HorizontalContentAlignment="Center" VerticalScrollBarVisibility="Hidden" Canvas.Left="162" Background="#FFE6FF00" >
- <StackPanel Orientation="Horizontal" x:Name="ActivityDock_Copy"/>
- </s:SurfaceScrollViewer>
- </Canvas>
- <s:SurfaceButton Content="Quit" Style="{DynamicResource Danger}" Foreground="White" FontSize="13.333" Width="98.858" RenderTransformOrigin="-0.037,0.75" Height="38.338" ToolTip="Stop the login process and exit the application." x:Name="btnQuit" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Click="BtnQuitClick" HorizontalAlignment="Right" Margin="0,0,8,8" VerticalAlignment="Bottom" />
- <s:SurfaceButton Content="Add Activity" FontSize="13.333" Foreground="White" Height="38.338" RenderTransformOrigin="-0.037,0.75" Style="{DynamicResource Success}" Width="98.858" ToolTip="Adds a new empty activity" x:Name="btnAdd" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" HorizontalAlignment="Left" Margin="8,0,0,8" VerticalAlignment="Bottom" />
- </Grid>
-</Window>
+<Window x:Class="ActivityTablet.Xaml.Tablet"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:s="http://schemas.microsoft.com/surface/2008"
+ Title="ActivityTablet" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:Height="1024" d:Width="687"
+ WindowStyle="None" Width="978" Height="624" ResizeMode="NoResize" WindowState="Maximized">
+ <Window.Resources>
+ <Style x:Key="Success" TargetType="{x:Type Button}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type Button}">
+ <ControlTemplate.Resources>
+ <Storyboard x:Key="OnMouseEnter1">
+ <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
+ <EasingColorKeyFrame KeyTime="0" Value="#FF3ECC0E"/>
+ </ColorAnimationUsingKeyFrames>
+ </Storyboard>
+ <Storyboard x:Key="OnMouseLeave1">
+ <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
+ <EasingColorKeyFrame KeyTime="0" Value="#FF80E25F"/>
+ </ColorAnimationUsingKeyFrames>
+ </Storyboard>
+ <Storyboard x:Key="OnMouseDown1">
+ <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
+ <EasingColorKeyFrame KeyTime="0" Value="#FF33A50B"/>
+ </ColorAnimationUsingKeyFrames>
+ </Storyboard>
+ </ControlTemplate.Resources>
+ <Grid>
+ <Rectangle x:Name="rectangle" RadiusY="3.5" RadiusX="3.5" Stroke="#FF428700">
+ <Rectangle.Fill>
+ <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
+ <GradientStop Color="#FF4B9F2C" Offset="1"/>
+ <GradientStop Color="#FF80E25F" Offset="0.289"/>
+ </LinearGradientBrush>
+ </Rectangle.Fill>
+ </Rectangle>
+ <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+ </Grid>
+ <ControlTemplate.Triggers>
+ <EventTrigger RoutedEvent="Mouse.PreviewMouseUp">
+ <BeginStoryboard Storyboard="{StaticResource OnMouseEnter1}"/>
+ </EventTrigger>
+ <EventTrigger RoutedEvent="Mouse.PreviewMouseDown">
+ <BeginStoryboard x:Name="OnMouseDown1_BeginStoryboard" Storyboard="{StaticResource OnMouseDown1}"/>
+ </EventTrigger>
+ <EventTrigger RoutedEvent="Mouse.MouseEnter">
+ <BeginStoryboard x:Name="OnMouseEnter1_BeginStoryboard" Storyboard="{StaticResource OnMouseEnter1}"/>
+ </EventTrigger>
+ <EventTrigger RoutedEvent="Mouse.MouseLeave">
+ <BeginStoryboard x:Name="OnMouseLeave1_BeginStoryboard" Storyboard="{StaticResource OnMouseLeave1}"/>
+ </EventTrigger>
+ <Trigger Property="IsFocused" Value="True"/>
+ <Trigger Property="IsDefaulted" Value="True"/>
+ <Trigger Property="IsMouseOver" Value="True"/>
+ <Trigger Property="IsPressed" Value="True"/>
+ <Trigger Property="IsEnabled" Value="False"/>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ <Style x:Key="Danger" TargetType="{x:Type Button}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type Button}">
+ <ControlTemplate.Resources>
+ <Storyboard x:Key="OnMouseEnter1">
+ <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
+ <EasingColorKeyFrame KeyTime="0" Value="#FFCC0E0E"/>
+ </ColorAnimationUsingKeyFrames>
+ </Storyboard>
+ <Storyboard x:Key="OnMouseLeave1">
+ <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
+ <EasingColorKeyFrame KeyTime="0" Value="#FFE25F5F"/>
+ </ColorAnimationUsingKeyFrames>
+ </Storyboard>
+ <Storyboard x:Key="OnMouseDown1">
+ <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
+ <EasingColorKeyFrame KeyTime="0" Value="#FFA50B0B"/>
+ </ColorAnimationUsingKeyFrames>
+ </Storyboard>
+ </ControlTemplate.Resources>
+ <Grid>
+ <Rectangle x:Name="rectangle" RadiusY="3.5" RadiusX="3.5" Stroke="#FF870000">
+ <Rectangle.Fill>
+ <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
+ <GradientStop Color="#FF9F2C2C" Offset="1"/>
+ <GradientStop Color="#FFE25F5F" Offset="0.289"/>
+ </LinearGradientBrush>
+ </Rectangle.Fill>
+ </Rectangle>
+ <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+ </Grid>
+ <ControlTemplate.Triggers>
+ <EventTrigger RoutedEvent="Mouse.PreviewMouseUp">
+ <BeginStoryboard Storyboard="{StaticResource OnMouseEnter1}"/>
+ </EventTrigger>
+ <EventTrigger RoutedEvent="Mouse.PreviewMouseDown">
+ <BeginStoryboard x:Name="OnMouseDown1_BeginStoryboard" Storyboard="{StaticResource OnMouseDown1}"/>
+ </EventTrigger>
+ <EventTrigger RoutedEvent="Mouse.MouseEnter">
+ <BeginStoryboard x:Name="OnMouseEnter1_BeginStoryboard" Storyboard="{StaticResource OnMouseEnter1}"/>
+ </EventTrigger>
+ <EventTrigger RoutedEvent="Mouse.MouseLeave">
+ <BeginStoryboard x:Name="OnMouseLeave1_BeginStoryboard" Storyboard="{StaticResource OnMouseLeave1}"/>
+ </EventTrigger>
+ <Trigger Property="IsFocused" Value="True"/>
+ <Trigger Property="IsDefaulted" Value="True"/>
+ <Trigger Property="IsMouseOver" Value="True"/>
+ <Trigger Property="IsPressed" Value="True"/>
+ <Trigger Property="IsEnabled" Value="False"/>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ <Style x:Key="Action" TargetType="{x:Type Button}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type Button}">
+ <ControlTemplate.Resources>
+ <Storyboard x:Key="OnMouseEnter1">
+ <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
+ <EasingColorKeyFrame KeyTime="0" Value="#FF0E71CC"/>
+ </ColorAnimationUsingKeyFrames>
+ </Storyboard>
+ <Storyboard x:Key="OnMouseLeave1">
+ <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
+ <EasingColorKeyFrame KeyTime="0" Value="#FF5F85E2"/>
+ </ColorAnimationUsingKeyFrames>
+ </Storyboard>
+ <Storyboard x:Key="OnMouseDown1">
+ <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="rectangle">
+ <EasingColorKeyFrame KeyTime="0" Value="#FF0B2AA5"/>
+ </ColorAnimationUsingKeyFrames>
+ </Storyboard>
+ </ControlTemplate.Resources>
+ <Grid>
+ <Rectangle x:Name="rectangle" RadiusY="3.5" RadiusX="3.5" Stroke="#FF100C8D">
+ <Rectangle.Fill>
+ <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
+ <GradientStop Color="#FF2C389F" Offset="1"/>
+ <GradientStop Color="#FF5F85E2" Offset="0.289"/>
+ </LinearGradientBrush>
+ </Rectangle.Fill>
+ </Rectangle>
+ <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+ </Grid>
+ <ControlTemplate.Triggers>
+ <EventTrigger RoutedEvent="Mouse.PreviewMouseDown">
+ <BeginStoryboard x:Name="OnMouseDown1_BeginStoryboard" Storyboard="{StaticResource OnMouseDown1}"/>
+ </EventTrigger>
+ <EventTrigger RoutedEvent="Mouse.MouseEnter">
+ <BeginStoryboard x:Name="OnMouseEnter1_BeginStoryboard" Storyboard="{StaticResource OnMouseEnter1}"/>
+ </EventTrigger>
+ <EventTrigger RoutedEvent="Mouse.MouseLeave">
+ <BeginStoryboard x:Name="OnMouseLeave1_BeginStoryboard" Storyboard="{StaticResource OnMouseLeave1}"/>
+ </EventTrigger>
+ <Trigger Property="IsFocused" Value="True"/>
+ <Trigger Property="IsDefaulted" Value="True"/>
+ <Trigger Property="IsMouseOver" Value="True"/>
+ <Trigger Property="IsPressed" Value="True"/>
+ <Trigger Property="IsEnabled" Value="False"/>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ <Style x:Key="ActivityTouchButton" TargetType="{x:Type Button}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type Button}">
+ <Grid>
+ <Rectangle Fill="#57F4F4F5" RadiusY="10" RadiusX="10" Stroke="Black" StrokeThickness="4"/>
+ <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+ </Grid>
+ <ControlTemplate.Triggers>
+ <Trigger Property="IsFocused" Value="True"/>
+ <Trigger Property="IsDefaulted" Value="True"/>
+ <Trigger Property="IsMouseOver" Value="True"/>
+ <Trigger Property="IsPressed" Value="True"/>
+ <Trigger Property="IsEnabled" Value="False"/>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ </Window.Resources>
+ <Grid Name="grid" Background="White" d:LayoutOverrides="HorizontalMargin">
+ <Image Source="blue.jpg" Stretch="None"/>
+ <Canvas x:Name="cvLogin" d:IsLocked="True" d:IsHidden="True">
+ <Canvas x:Name="pnlLogin" Height="383.757" Width="468" Background="White" Canvas.Left="272.5" Canvas.Top="98.673" d:IsHidden="True">
+ <Rectangle Fill="Black" Height="36.666" Stroke="Black" Width="468" Canvas.Top="285.664" d:IsHidden="True"/>
+ <Label Content="Username" Height="35.782" x:Name="lblName" Canvas.Left="15" Canvas.Top="148" Width="99" FontSize="17" FontFamily="Segoe360" d:IsHidden="True" />
+ <Label Content="Email" Height="35.783" x:Name="lblEmail" Canvas.Left="15" Canvas.Top="191" Width="86" FontSize="17" FontFamily="Segoe360" d:IsHidden="True" />
+ <s:SurfaceTextBox Height="29.392" x:Name="txtUsername" Canvas.Left="131" Canvas.Top="146.964" Width="310" d:IsHidden="True" />
+ <s:SurfaceTextBox Height="29.393" x:Name="txtEmail" Canvas.Left="130" Canvas.Top="187.858" Width="310" d:IsHidden="True" />
+ <s:SurfaceTextBox Height="29.393" x:Name="txtDevicename" Canvas.Left="131" Canvas.Top="230.03" Width="310" d:IsHidden="True" />
+ <Image Height="120.127" x:Name="image1" Stretch="Fill" Width="175.748" Source="/ActivityTablet;component/activity1.PNG" Canvas.Left="4" Canvas.Top="4" d:IsHidden="True" />
+ <s:SurfaceButton Content="Go" Style="{DynamicResource Success}" Foreground="White" FontSize="13.333" Width="98.858" RenderTransformOrigin="-0.037,0.75" Height="38.338" x:Name="btnGo" Click="BtnGoClick" ToolTip="Start the application and connect to the cloud." Canvas.Left="355.614" Canvas.Top="332.783" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Margin="0" d:IsHidden="True" />
+ <Label Content="Device name" Height="35.783" Width="111" Canvas.Left="13" Canvas.Top="233" FontSize="17" FontFamily="Segoe360" d:IsHidden="True" />
+ <Image Height="60.064" x:Name="imgLogo" Stretch="None" Source="/ActivityTablet;component/logo.PNG" Canvas.Left="130.591" Canvas.Top="44.728" Width="334.409" d:IsHidden="True" />
+ <s:SurfaceRadioButton Canvas.Left="362.913" Canvas.Top="285.664" Content="Client" Height="16" x:Name="chkClient" GroupName="start" Margin="0" Background="#00000000" Foreground="#CCFFFFFF" d:IsHidden="True" />
+ <s:SurfaceRadioButton Canvas.Left="179.579" Canvas.Top="285.664" Content="Host and Client" Height="16" x:Name="chkHostClient" GroupName="start" Margin="0" Background="#00000000" Foreground="#CCFFFFFF" IsChecked="True" d:IsHidden="True" />
+ <s:SurfaceRadioButton Canvas.Left="24.579" Canvas.Top="285.664" Content="I don't know" Height="17" x:Name="chkNo" GroupName="start" Margin="0" Background="#00000000" Foreground="#CCFFFFFF" d:IsHidden="True" />
+
+ </Canvas>
+ <Border BorderBrush="Black" BorderThickness="8" Height="399" Width="482.333" Canvas.Left="265.167" Canvas.Top="91.5" CornerRadius="10" d:IsHidden="True"/>
+ </Canvas>
+ <Canvas x:Name="cvActivityManager" Margin="8" Visibility="Hidden">
+ <s:SurfaceScrollViewer x:Name="activityDockScroller" Height="558"
+ Width="158" VerticalContentAlignment="Center"
+ HorizontalContentAlignment="Center" VerticalScrollBarVisibility="Hidden" >
+ <StackPanel Orientation="Vertical" x:Name="ActivityDock"/>
+ </s:SurfaceScrollViewer>
+ <s:SurfaceScrollViewer x:Name="ContentScroller" Height="451"
+ Width="800" VerticalContentAlignment="Center"
+ HorizontalContentAlignment="Center" VerticalScrollBarVisibility="Hidden" Canvas.Left="162" Canvas.Top="107" />
+ <s:SurfaceScrollViewer x:Name="resourceScroller" Height="100"
+ Width="800" VerticalContentAlignment="Center"
+ HorizontalContentAlignment="Center" VerticalScrollBarVisibility="Hidden" Canvas.Left="162" >
+ <StackPanel Orientation="Horizontal" x:Name="resourceDock"/>
+ </s:SurfaceScrollViewer>
+ </Canvas>
+ <s:SurfaceButton Content="Quit" Style="{DynamicResource Danger}" Foreground="White" FontSize="13.333" Width="98.858" RenderTransformOrigin="-0.037,0.75" Height="38.338" ToolTip="Stop the login process and exit the application." x:Name="btnQuit" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Click="BtnQuitClick" HorizontalAlignment="Right" Margin="0,0,8,8" VerticalAlignment="Bottom" />
+ <s:SurfaceButton Content="Add Activity" FontSize="13.333" Foreground="White" Height="38.338" RenderTransformOrigin="-0.037,0.75" Style="{DynamicResource Success}" Width="98.858" ToolTip="Adds a new empty activity" x:Name="btnAdd" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" HorizontalAlignment="Left" Margin="8,0,0,8" VerticalAlignment="Bottom" Click="BtnAddClick" />
+ </Grid>
+</Window>
View
652 NooSphere/ActivityTablet/Xaml/Tablet.xaml.cs
@@ -1,281 +1,373 @@
-/****************************************************************************
- (c) 2012 Steven Houben(shou@itu.dk) and Søren Nielsen(snielsen@itu.dk)
-
- Pervasive Interaction Technology Laboratory (pIT lab)
- IT University of Copenhagen
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU GENERAL PUBLIC LICENSE V3 or later,
- as published by the Free Software Foundation. Check
- http://www.gnu.org/licenses/gpl.html for details.
-****************************************************************************/
-
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Input;
-using System.Windows.Threading;
-using System.Threading;
-using NooSphere.ActivitySystem.Base;
-using NooSphere.ActivitySystem.Base.Client;
-using NooSphere.ActivitySystem.Base.Service;
-using NooSphere.ActivitySystem.Helpers;
-using NooSphere.ActivitySystem.Host;
-using NooSphere.Core.ActivityModel;
-using Newtonsoft.Json;
-using ActivityTablet.Properties;
-using NooSphere.Core.Devices;
-using NooSphere.ActivitySystem.Discovery;
-
-namespace ActivityTablet.Xaml
-{
- public partial class Tablet
- {
- #region Private Members
- private ActivityClient _client;
- private GenericHost _host;
- private User _user;
- private Device _device;
- private readonly Dictionary<Guid, Proxy> proxies = new Dictionary<Guid, Proxy>();
-
- //private PointerNode _pNode = new PointerNode(PointerRole.Controller);
- #endregion
-
- #region Constructor
- public Tablet()
- {
- //Initializes design-time components
- InitializeComponent();
- LoadSettings();
- }
- #endregion
-
- #region Private Methods
- private void LogIn()
- {
- try
- {
- string baseUrl = Settings.Default.ENVIRONMENT_BASE_URL;
- string result = Rest.Get(baseUrl + "Users?email=" + txtEmail.Text);
- User u = JsonConvert.DeserializeObject<User>(result);
- if (u != null)
- this._user = u;
- else
- CreateUser(baseUrl);
-
- this._device = new Device();
- this._device.Name = txtDevicename.Text;
-
- if (chkClient.IsChecked == true)
- FindClient();
- else
- StartActivityManager();
- SaveSettings();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.ToString());
- }
- }
- private void FindClient()
- {
- RunDiscovery();
- }
- private void RunDiscovery()
- {
- try
- {
- Thread t = new Thread(() =>
- {
- DiscoveryManager disc = new DiscoveryManager();
- disc.DiscoveryAddressAdded += new DiscoveryManager.DiscoveryAddressAddedHandler(DiscDiscoveryAddressAdded);
- disc.Find();
- });
- t.IsBackground = true;
- t.Start();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.ToString());
-
- }
-
- }
- private void StartActivityManager()
- {
- Task.Factory.StartNew(
- delegate {
- _host = new GenericHost();
- _host.HostLaunched += new HostLaunchedHandler(HostHostLaunched);
- _host.Open(new ActivityManager(_user, "c:/files/"), typeof(IActivityManager), "Tablet manager");
- _host.StartBroadcast(DiscoveryType.WSDiscovery, "Tablet", "205");
- });
- }
- private void BuildUI()
- {
- this.Dispatcher.Invoke(DispatcherPriority.Background, new System.Action(() =>
- {
- cvLogin.Visibility = System.Windows.Visibility.Hidden;
- cvActivityManager.Visibility = System.Windows.Visibility.Visible;
- //contentBrowser.Navigate(@"http://itu.dk/people/shou/pubs/SituatedActivityModelMODIQUITOUS2012.pdf");
- }));
-
-
-
- }
- private void AddActivityUI(Activity ac)
- {
- Dispatcher.Invoke(DispatcherPriority.Background, new System.Action(() =>
- {
- var p = new Proxy {Activity = ac};
-
- var b = new ActivityButton(new Uri("pack://application:,,,/Images/activity.PNG"), ac.Name)
- {RenderMode = RenderMode.Image};
- b.TouchDown += new EventHandler<TouchEventArgs>(b_TouchDown);
- b.Click += new RoutedEventHandler(BClick);
- b.Height = b.Width = 100;
- b.ActivityId = p.Activity.Id;
- b.VerticalContentAlignment = System.Windows.VerticalAlignment.Center;
- b.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
- b.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
- b.Padding = new Thickness(10);
- b.Style = (Style)FindResource("ActivityTouchButton");
-
- p.Button = b;
-
- ActivityDock.Children.Add(b);
- proxies.Add(p.Activity.Id, p);
- }));
- }
- private void RemoveActivityUI(Guid id)
- {
- Dispatcher.Invoke(DispatcherPriority.Background, new System.Action(() =>
- {
- ActivityDock.Children.Remove(proxies[id].Button);
- proxies.Remove(id);
- }));
- }
-
- private void LoadSettings()
- {
- txtUsername.Text = Settings.Default.USER_NAME;
- txtEmail.Text = Settings.Default.USER_EMAIL;
- txtDevicename.Text = Settings.Default.USER_DEVICENAME;
- }
- private void SaveSettings()
- {
- Settings.Default.USER_NAME = txtUsername.Text;
- Settings.Default.USER_EMAIL = txtEmail.Text;
- Settings.Default.USER_DEVICENAME = txtDevicename.Text;
- Settings.Default.Save();
- }
- private void CreateUser(string baseUrl)
- {
- User user = new User();
- user.Email = txtEmail.Text;
- user.Name = txtUsername.Text;
- string added = Rest.Post(baseUrl + "Users", user);
- if (JsonConvert.DeserializeObject<bool>(added))
- {
- var result = Rest.Get(baseUrl + "Users?email=" + txtEmail.Text);
- var u = JsonConvert.DeserializeObject<User>(result);
- this._user = u;
- }
- }
- private void StartClient(string addr)
- {
- if (_client != null)
- return;
- try
- {
- _client = new ActivityClient(@"c:/abc/", _device) { CurrentUser = new User() };
- _client.MessageReceived += ClientMessageReceived;
- _client.ActivityAdded += ClientActivityAdded;
- _client.ActivityRemoved += ClientActivityRemoved;
- _client.ConnectionEstablished += ClientConnectionEstablished;
- _client.FileAdded += _client_FileAdded;
- _client.Open(addr);
- }
- catch (Exception ex)
- {
-
- MessageBox.Show(ex.ToString());
- }
- }
-
- void _client_FileAdded(object sender, FileEventArgs e)
- {
- try
- {
- var image = new BadImageFormatException()
- }
- catch (Exception)
- {
- //not an image -> do better implementation here
- }
- }
-
- private void ClientActivityRemoved(object sender, ActivityRemovedEventArgs e)
- {
- RemoveActivityUI(e.Id);
- }
- private void ClientMessageReceived(object sender, ComEventArgs e)
- {
- HandleMessage(e.Message);
- }
- private void ClientConnectionEstablished(object sender, EventArgs e)
- {
- BuildUI();
- }
- private void BtnQuitClick(object sender, RoutedEventArgs e)
- {
- ExitApplication();
- }
-
- private void HandleMessage(Message message)
- {
- if(message.Type==MessageType.Connect)
- {
- _client = null;
- StartClient(message.Content);
- }
- }
- #endregion
-
- #region Public Methods
-
- private void ClientActivityAdded(object obj, ActivityEventArgs e)
- {
- AddActivityUI(e.Activity);
- }
- private void BClick(object sender, RoutedEventArgs e)
- {
- _client.SwitchActivity(proxies[((ActivityButton)sender).ActivityId].Activity);
- }
- private void b_TouchDown(object sender, TouchEventArgs e)
- {
- throw new NotImplementedException();
- }
- private void DiscDiscoveryAddressAdded(object o, DiscoveryAddressAddedEventArgs e)
- {
- StartClient(e.ServiceInfo.Address);
- }
- private void BtnGoClick(object sender, RoutedEventArgs e)
- {
- LogIn();
- }
- private void HostHostLaunched(object sender, EventArgs e)
- {
- StartClient(_host.Address);
- }
- private void ExitApplication()
- {
- if (_client != null)
- _client.Close();
- Environment.Exit(0);
- }
- #endregion
-
- }
+/****************************************************************************
+ (c) 2012 Steven Houben(shou@itu.dk) and Søren Nielsen(snielsen@itu.dk)
+
+ Pervasive Interaction Technology Laboratory (pIT lab)
+ IT University of Copenhagen
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU GENERAL PUBLIC LICENSE V3 or later,
+ as published by the Free Software Foundation. Check
+ http://www.gnu.org/licenses/gpl.html for details.
+****************************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Threading;
+using NooSphere.ActivitySystem.Base;
+using NooSphere.ActivitySystem.Base.Client;
+using NooSphere.ActivitySystem.Base.Service;
+using NooSphere.ActivitySystem.Helpers;
+using NooSphere.ActivitySystem.Host;
+using NooSphere.Core.ActivityModel;
+using Newtonsoft.Json;
+using ActivityTablet.Properties;
+using NooSphere.Core.Devices;
+using NooSphere.ActivitySystem.Discovery;
+
+namespace ActivityTablet.Xaml
+{
+ public partial class Tablet
+ {
+ #region Private Members
+ private ActivityClient _client;
+ private GenericHost _host;
+ private User _user;
+ private Device _device;
+ private readonly Dictionary<Guid, Proxy> _proxies = new Dictionary<Guid, Proxy>();
+ private Activity _currentActivity;
+
+ //private PointerNode _pNode = new PointerNode(PointerRole.Controller);
+ #endregion
+
+ #region Constructor
+ public Tablet()
+ {
+ //Initializes design-time components
+ InitializeComponent();
+ LoadSettings();
+ }
+ #endregion
+
+ #region Private Methods
+ private void LogIn()
+ {
+ try
+ {
+ string baseUrl = Settings.Default.ENVIRONMENT_BASE_URL;
+ string result = Rest.Get(baseUrl + "Users?email=" + txtEmail.Text);
+ User u = JsonConvert.DeserializeObject<User>(result);
+ if (u != null)
+ this._user = u;
+ else
+ CreateUser(baseUrl);
+
+ this._device = new Device();
+ this._device.Name = txtDevicename.Text;
+
+ if (chkClient.IsChecked == true)
+ FindClient();
+ else
+ StartActivityManager();
+ SaveSettings();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.ToString());
+ }
+ }
+ private void FindClient()
+ {
+ RunDiscovery();
+ }
+ private void RunDiscovery()
+ {
+ try
+ {
+ Task.Factory.StartNew(delegate {
+ var disc = new DiscoveryManager();
+ disc.DiscoveryAddressAdded += new DiscoveryManager.DiscoveryAddressAddedHandler(DiscDiscoveryAddressAdded);
+ disc.Find();
+ });
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.ToString());
+
+ }
+
+ }
+ private void StartActivityManager()
+ {
+ Task.Factory.StartNew(
+ delegate {
+ _host = new GenericHost();
+ _host.HostLaunched += HostHostLaunched;
+ _host.Open(new ActivityManager(_user, "c:/files/"), typeof(IActivityManager), "Tablet manager");
+ _host.StartBroadcast(DiscoveryType.WSDiscovery, "Tablet", "205");
+ });
+ }
+ private void BuildUI()
+ {
+ Dispatcher.Invoke(DispatcherPriority.Background, new System.Action(() =>
+ {
+ cvLogin.Visibility = System.Windows.Visibility.Hidden;
+ cvActivityManager.Visibility = System.Windows.Visibility.Visible;
+ //contentBrowser.Navigate(@"http://itu.dk/people/shou/pubs/SituatedActivityModelMODIQUITOUS2012.pdf");
+ }));
+ }
+ private void AddActivityUI(Activity ac)
+ {
+ Dispatcher.Invoke(DispatcherPriority.Background, new System.Action(() =>
+ {
+ var p = new Proxy {Activity = ac};
+ var b = new ActivityButton(new Uri("pack://application:,,,/Images/activity.PNG"), ac.Name)
+ {RenderMode = RenderMode.Image};
+ b.TouchDown += new EventHandler<TouchEventArgs>(b_TouchDown);
+ b.Click += new RoutedEventHandler(BClick);
+ b.Height = b.Width = 100;
+ b.ActivityId = p.Activity.Id;
+ b.VerticalContentAlignment = System.Windows.VerticalAlignment.Center;
+ b.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center;
+ b.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
+ b.Padding = new Thickness(10);
+ b.Style = (Style)FindResource("ActivityTouchButton");
+
+ p.Button = b;
+
+ ActivityDock.Children.Add(b);
+ _proxies.Add(p.Activity.Id, p);
+ }));
+ }
+ private void RemoveActivityUI(Guid id)
+ {
+ Dispatcher.Invoke(DispatcherPriority.Background, new System.Action(() =>
+ {
+ ActivityDock.Children.Remove(_proxies[id].Button);
+ _proxies.Remove(id);
+ }));
+ }
+ private void LoadSettings()
+ {
+ txtUsername.Text = Settings.Default.USER_NAME;
+ txtEmail.Text = Settings.Default.USER_EMAIL;
+ txtDevicename.Text = Settings.Default.USER_DEVICENAME;
+ }
+ private void SaveSettings()
+ {
+ Settings.Default.USER_NAME = txtUsername.Text;
+ Settings.Default.USER_EMAIL = txtEmail.Text;
+ Settings.Default.USER_DEVICENAME = txtDevicename.Text;
+ Settings.Default.Save();
+ }
+ private void CreateUser(string baseUrl)
+ {
+ User user = new User();
+ user.Email = txtEmail.Text;
+ user.Name = txtUsername.Text;
+ string added = Rest.Post(baseUrl + "Users", user);
+ if (JsonConvert.DeserializeObject<bool>(added))
+ {
+ var result = Rest.Get(baseUrl + "Users?email=" + txtEmail.Text);
+ var u = JsonConvert.DeserializeObject<User>(result);
+ this._user = u;
+ }
+ }
+ private void StartClient(string addr)
+ {
+ if (_client != null)
+ return;
+ try
+ {
+ _client = new ActivityClient(@"c:/abc/", _device) { CurrentUser = new User() };
+ _client.MessageReceived += ClientMessageReceived;
+ _client.ActivityAdded += ClientActivityAdded;
+ _client.ActivityRemoved += ClientActivityRemoved;
+ _client.ConnectionEstablished += ClientConnectionEstablished;
+ _client.FileAdded += ClientFileAdded;
+ _client.ActivitySwitched += ClientActivitySwitched;
+ _client.Open(addr);
+ }
+ catch (Exception ex)
+ {
+
+ MessageBox.Show(ex.ToString());
+ }
+ }
+
+ private void PopulateResource(Activity activity)
+ {
+ Dispatcher.Invoke(DispatcherPriority.Background, new System.Action(() =>
+ {
+ resourceDock.Children.Clear();
+ ContentScroller.Content = null;
+ foreach (
+ var resource in
+ activity.Resources)
+ {
+ AddResource(resource,
+ _client.
+ LocalPath +
+ resource.
+ RelativePath);
+ }
+ }));
+ }
+
+ private void AddResource(Resource resource,string path)
+ {
+ Dispatcher.Invoke(DispatcherPriority.Background, new System.Action(() =>
+ {
+ try
+ {
+ var i = new Image();
+ i.Width = i.Height = 100;
+ var src = new BitmapImage();
+ src.BeginInit();
+ src.UriSource =
+ new Uri(path,
+ UriKind.
+ Relative);
+ src.CacheOption =
+ BitmapCacheOption.
+ OnLoad;
+ src.EndInit();
+ i.Source = src;
+ i.Stretch = Stretch.Uniform;
+ i.MouseDown += IMouseDown;
+ i.TouchDown += ITouchDown;
+
+ resourceDock.Children.Add(i);
+ }
+ catch (Exception)
+ {
+ //not an image -> do better implementation here
+ }
+
+ }));
+ }
+
+
+ private void HandleMessage(Message message)
+ {
+ if(message.Type==MessageType.Connect)
+ {
+ _client = null;
+ StartClient(message.Content);
+ }
+ }
+ #endregion
+
+ #region Public Methods
+ private void ITouchDown(object sender, TouchEventArgs e)
+ {
+ ShowResource(sender);
+ }
+ private void ClientActivitySwitched(object sender, ActivityEventArgs e)
+ {
+ _currentActivity = e.Activity;
+ PopulateResource(e.Activity);
+ }
+ private void ClientFileAdded(object sender, FileEventArgs e)
+ {
+ if (e.Resource.ActivityId != _currentActivity.Id)
+ return;
+ AddResource(e.Resource, e.LocalPath);
+ }
+
+ private void IMouseDown(object sender, MouseButtonEventArgs e)
+ {
+ ShowResource(sender);
+ }
+
+ private void ShowResource(object sender)
+ {
+ try
+ {
+ ContentScroller.Content = new Image
+ {
+ Source = ((Image) sender).Source,
+ MaxHeight = ContentScroller.Height,
+ MaxWidth = ContentScroller.Width
+ };
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.ToString());
+ }
+ }
+
+ private void ClientActivityRemoved(object sender, ActivityRemovedEventArgs e)
+ {
+ RemoveActivityUI(e.Id);
+ }
+ private void ClientMessageReceived(object sender, ComEventArgs e)
+ {
+ HandleMessage(e.Message);
+ }
+ private void ClientConnectionEstablished(object sender, EventArgs e)
+ {
+ BuildUI();
+ }
+ private void BtnQuitClick(object sender, RoutedEventArgs e)
+ {
+ ExitApplication();
+ }
+ private void ClientActivityAdded(object obj, ActivityEventArgs e)
+ {
+ AddActivityUI(e.Activity);
+ _currentActivity = e.Activity;
+ }
+ private void BClick(object sender, RoutedEventArgs e)
+ {
+ _client.SwitchActivity(_proxies[((ActivityButton)sender).ActivityId].Activity);
+ }
+ private void b_TouchDown(object sender, TouchEventArgs e)
+ {
+ throw new NotImplementedException();
+ }
+ private void DiscDiscoveryAddressAdded(object o, DiscoveryAddressAddedEventArgs e)
+ {
+ StartClient(e.ServiceInfo.Address);
+ }
+ private void BtnGoClick(object sender, RoutedEventArgs e)
+ {
+ LogIn();
+ }
+ private void HostHostLaunched(object sender, EventArgs e)
+ {
+ StartClient(_host.Address);
+ }
+ private void ExitApplication()
+ {
+ if (_client != null)
+ _client.Close();
+ Environment.Exit(0);
+ }
+ #endregion
+
+ private void BtnAddClick(object sender, RoutedEventArgs e)
+ {
+ _client.AddActivity(GetInitializedActivity());
+ }
+ public Activity GetInitializedActivity()
+ {
+ var ac = new Activity
+ {
+ Name = "test activity - " + DateTime.Now,
+ Description = "This is the description of the test activity - " + DateTime.Now
+ };
+ ac.Uri = "http://tempori.org/" + ac.Id;
+ ac.Participants.Add(new User() { Email = " snielsen@itu.dk" });
+ ac.Meta.Data = "added meta data";
+ ac.Owner = _user;
+ return ac;
+ }
+
+ }
}
View
BIN NooSphere/ActivityTablet/Xaml/blue.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1 NooSphere/NooSphere.ActivitySystem/Base/Client/ActivityClient.cs
@@ -26,7 +26,6 @@
using NooSphere.ActivitySystem.FileServer;
#if !ANDROID
using NooSphere.ActivitySystem.Host;
-using NooSphere.ActivitySystem.Contracts.Client;
using System.Net;
#endif
View
100 NooSphere/NooSphere.ActivitySystem/Base/Client/IActivityNetEvent.cs
@@ -1,51 +1,51 @@
-/****************************************************************************
- (c) 2012 Steven Houben(shou@itu.dk) and Søren Nielsen(snielsen@itu.dk)
-
- Pervasive Interaction Technology Laboratory (pIT lab)
- IT University of Copenhagen
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU GENERAL PUBLIC LICENSE V3 or later,
- as published by the Free Software Foundation. Check
- http://www.gnu.org/licenses/gpl.html for details.
-****************************************************************************/
-
-using System;
-using System.ServiceModel;
-using System.ServiceModel.Web;
-using NooSphere.Core.ActivityModel;
-
-namespace NooSphere.ActivitySystem.Contracts.Client
-{
- [ServiceContract]
- public interface IActivityNetEvent
- {
- [OperationContract]
- [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json,
- UriTemplate = "ActivityAdded", Method = "POST")]
- void ActivityNetAdded(Activity act);
-
- [OperationContract]
- [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json,
- UriTemplate = "ActivityRemoved", Method = "POST")]
- void ActivityNetRemoved(Guid id);
-
- [OperationContract]
- [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json,
- UriTemplate = "ActivityChanged", Method = "POST")]
- void ActivityNetChanged(Activity act);
-
- [OperationContract]
- [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json,
- UriTemplate = "ActivitySwitched", Method = "POST")]
- void ActivityNetSwitched(Activity act);
- }
-
- public enum ActivityEvent
- {
- ActivityAdded,
- ActivityRemoved,
- ActivityChanged,
- ActivitySwitched
- }
+/****************************************************************************
+ (c) 2012 Steven Houben(shou@itu.dk) and Søren Nielsen(snielsen@itu.dk)
+
+ Pervasive Interaction Technology Laboratory (pIT lab)
+ IT University of Copenhagen
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU GENERAL PUBLIC LICENSE V3 or later,
+ as published by the Free Software Foundation. Check
+ http://www.gnu.org/licenses/gpl.html for details.
+****************************************************************************/
+
+using System;
+using System.ServiceModel;
+using System.ServiceModel.Web;
+using NooSphere.Core.ActivityModel;
+
+namespace NooSphere.ActivitySystem.Base.Client
+{
+ [ServiceContract]
+ interface IActivityNetEvent
+ {
+ [OperationContract]
+ [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json,
+ UriTemplate = "ActivityAdded", Method = "POST")]
+ void ActivityNetAdded(Activity act);
+
+ [OperationContract]
+ [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json,
+ UriTemplate = "ActivityRemoved", Method = "POST")]
+ void ActivityNetRemoved(Guid id);
+
+ [OperationContract]
+ [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json,
+ UriTemplate = "ActivityChanged", Method = "POST")]
+ void ActivityNetChanged(Activity act);
+
+ [OperationContract]
+ [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json,
+ UriTemplate = "ActivitySwitched", Method = "POST")]
+ void ActivityNetSwitched(Activity act);
+ }
+
+ public enum ActivityEvent
+ {
+ ActivityAdded,
+ ActivityRemoved,
+ ActivityChanged,
+ ActivitySwitched
+ }
}
View
58 NooSphere/NooSphere.ActivitySystem/Base/Client/IComNetEvent.cs
@@ -1,29 +1,29 @@
-/****************************************************************************
- (c) 2012 Steven Houben(shou@itu.dk) and Søren Nielsen(snielsen@itu.dk)
-
- Pervasive Interaction Technology Laboratory (pIT lab)
- IT University of Copenhagen
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU GENERAL PUBLIC LICENSE V3 or later,
- as published by the Free Software Foundation. Check
- http://www.gnu.org/licenses/gpl.html for details.
-****************************************************************************/
-
-using System.ServiceModel;
-using System.ServiceModel.Web;
-
-namespace NooSphere.ActivitySystem.Base.Client
-{
- [ServiceContract]
- public interface IComNetEvent
- {
- [OperationContract]
- [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "MessageReceived", Method = "POST")]
- void MessageNetReceived(Message msg);
- }
- public enum ComEvent
- {
- MessageReceived
- }
-}
+/****************************************************************************
+ (c) 2012 Steven Houben(shou@itu.dk) and Søren Nielsen(snielsen@itu.dk)
+
+ Pervasive Interaction Technology Laboratory (pIT lab)
+ IT University of Copenhagen
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU GENERAL PUBLIC LICENSE V3 or later,
+ as published by the Free Software Foundation. Check
+ http://www.gnu.org/licenses/gpl.html for details.
+****************************************************************************/
+
+using System.ServiceModel;
+using System.ServiceModel.Web;
+
+namespace NooSphere.ActivitySystem.Base.Client
+{
+ [ServiceContract]
+ interface IComNetEvent
+ {
+ [OperationContract]
+ [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "MessageReceived", Method = "POST")]
+ void MessageNetReceived(Message msg);
+ }
+ public enum ComEvent
+ {
+ MessageReceived
+ }
+}
View
82 NooSphere/NooSphere.ActivitySystem/Base/Client/IDeviceNetEvent.cs
@@ -1,41 +1,41 @@
-/****************************************************************************
- (c) 2012 Steven Houben(shou@itu.dk) and Søren Nielsen(snielsen@itu.dk)
-
- Pervasive Interaction Technology Laboratory (pIT lab)
- IT University of Copenhagen
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU GENERAL PUBLIC LICENSE V3 or later,
- as published by the Free Software Foundation. Check
- http://www.gnu.org/licenses/gpl.html for details.
-****************************************************************************/
-
-using System.ServiceModel;
-using NooSphere.Core.Devices;
-using System.ServiceModel.Web;
-
-namespace NooSphere.ActivitySystem.Base.Client
-{
- [ServiceContract]
- public interface IDeviceNetEvent
- {
- [OperationContract]
- [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "DeviceAdded", Method = "POST")]
- void DeviceNetAdded(Device dev);
-
- [OperationContract]
- [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "DeviceRemoved", Method = "POST")]
- void DeviceNetRemoved(string id);
-
- [OperationContract]
- [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "DeviceRoleChanged", Method = "POST")]
- void DeviceNetRoleChanged(Device dev);
- }
-
- public enum DeviceEvent
- {
- DeviceAdded,
- DeviceRemoved,
- DeviceRoleChanged
- }
-}
+/****************************************************************************
+ (c) 2012 Steven Houben(shou@itu.dk) and Søren Nielsen(snielsen@itu.dk)
+
+ Pervasive Interaction Technology Laboratory (pIT lab)
+ IT University of Copenhagen
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU GENERAL PUBLIC LICENSE V3 or later,
+ as published by the Free Software Foundation. Check
+ http://www.gnu.org/licenses/gpl.html for details.
+****************************************************************************/
+
+using System.ServiceModel;
+using NooSphere.Core.Devices;
+using System.ServiceModel.Web;
+
+namespace NooSphere.ActivitySystem.Base.Client
+{
+ [ServiceContract]
+ interface IDeviceNetEvent
+ {
+ [OperationContract]
+ [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "DeviceAdded", Method = "POST")]
+ void DeviceNetAdded(Device dev);
+
+ [OperationContract]
+ [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "DeviceRemoved", Method = "POST")]
+ void DeviceNetRemoved(string id);
+
+ [OperationContract]
+ [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "DeviceRoleChanged", Method = "POST")]
+ void DeviceNetRoleChanged(Device dev);
+ }
+
+ public enum DeviceEvent
+ {
+ DeviceAdded,
+ DeviceRemoved,
+ DeviceRoleChanged
+ }
+}
View
80 NooSphere/NooSphere.ActivitySystem/Base/Client/IFileNetEvent.cs
@@ -1,40 +1,40 @@
-/****************************************************************************
- (c) 2012 Steven Houben(shou@itu.dk) and Søren Nielsen(snielsen@itu.dk)
-
- Pervasive Interaction Technology Laboratory (pIT lab)
- IT University of Copenhagen
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU GENERAL PUBLIC LICENSE V3 or later,
- as published by the Free Software Foundation. Check
- http://www.gnu.org/licenses/gpl.html for details.
-****************************************************************************/
-
-using System.ServiceModel;
-using System.ServiceModel.Web;
-using NooSphere.Core.ActivityModel;
-
-namespace NooSphere.ActivitySystem.Base.Client
-{
- [ServiceContract]
- public interface IFileNetEvent
- {
- [OperationContract]
- [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "FileDownloadRequest", Method = "POST")]
- void FileNetDownloadRequest(Resource resource);
-
- [OperationContract]
- [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "FileDeleteRequest", Method = "POST")]
- void FileNetDeleteRequest(Resource resource);
-
- [OperationContract]
- [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "FileUploadRequest", Method = "POST")]
- void FileNetUploadRequest(Resource resource);
- }
- public enum FileEvent
- {
- FileDownloadRequest,
- FileUploadRequest,
- FileDeleteRequest
- }
-}
+/****************************************************************************
+ (c) 2012 Steven Houben(shou@itu.dk) and Søren Nielsen(snielsen@itu.dk)
+
+ Pervasive Interaction Technology Laboratory (pIT lab)
+ IT University of Copenhagen
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU GENERAL PUBLIC LICENSE V3 or later,
+ as published by the Free Software Foundation. Check
+ http://www.gnu.org/licenses/gpl.html for details.
+****************************************************************************/
+
+using System.ServiceModel;
+using System.ServiceModel.Web;
+using NooSphere.Core.ActivityModel;
+
+namespace NooSphere.ActivitySystem.Base.Client
+{
+ [ServiceContract]
+ interface IFileNetEvent
+ {
+ [OperationContract]
+ [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "FileDownloadRequest", Method = "POST")]
+ void FileNetDownloadRequest(Resource resource);
+
+ [OperationContract]
+ [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "FileDeleteRequest", Method = "POST")]
+ void FileNetDeleteRequest(Resource resource);
+
+ [OperationContract]
+ [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "FileUploadRequest", Method = "POST")]
+ void FileNetUploadRequest(Resource resource);
+ }
+ public enum FileEvent
+ {
+ FileDownloadRequest,
+ FileUploadRequest,
+ FileDeleteRequest
+ }
+}
View
32 NooSphere/NooSphere.ActivitySystem/Base/Client/INetEventHandler.cs
@@ -1,11 +1,21 @@
-using System.ServiceModel;
-using NooSphere.ActivitySystem.Contracts;
-using NooSphere.ActivitySystem.Contracts.Client;
-
-namespace NooSphere.ActivitySystem.Base.Client
-{
- [ServiceContract]
- interface INetEventHandler : IServiceBase, IActivityNetEvent, IComNetEvent, IDeviceNetEvent, IFileNetEvent, IUserEvent
- {
- }
-}
+/****************************************************************************
+ (c) 2012 Steven Houben(shou@itu.dk) and Søren Nielsen(snielsen@itu.dk)
+
+ Pervasive Interaction Technology Laboratory (pIT lab)
+ IT University of Copenhagen
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU GENERAL PUBLIC LICENSE V3 or later,
+ as published by the Free Software Foundation. Check
+ http://www.gnu.org/licenses/gpl.html for details.
+****************************************************************************/
+
+using System.ServiceModel;
+
+namespace NooSphere.ActivitySystem.Base.Client
+{
+ [ServiceContract]
+ interface INetEventHandler : IServiceBase, IActivityNetEvent, IComNetEvent, IDeviceNetEvent, IFileNetEvent, IUserEvent
+ {
+ }
+}
View
104 NooSphere/NooSphere.ActivitySystem/Base/Client/IUserNetEvent.cs
@@ -1,52 +1,52 @@
-/****************************************************************************
- (c) 2012 Steven Houben(shou@itu.dk) and Søren Nielsen(snielsen@itu.dk)
-
- Pervasive Interaction Technology Laboratory (pIT lab)
- IT University of Copenhagen
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU GENERAL PUBLIC LICENSE V3 or later,
- as published by the Free Software Foundation. Check
- http://www.gnu.org/licenses/gpl.html for details.
-****************************************************************************/
-
-using System;
-using System.ServiceModel;
-using System.ServiceModel.Web;
-using NooSphere.Core.ActivityModel;
-
-namespace NooSphere.ActivitySystem.Base.Client
-{
- [ServiceContract]
- public interface IUserEvent
- {
- [OperationContract]
- [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "FriendAdded", Method = "POST")]
- void FriendNetAdded(User u);
-
- [OperationContract]
- [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "FriendRequest", Method = "POST")]
- void FriendNetRequest(User u);
-
- [OperationContract]
- [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "FriendRemoved", Method = "POST")]
- void FriendNetRemoved(Guid i);
-
- [OperationContract]
- [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "ParticipantAdded", Method = "POST")]
- void ParticipantNetAdded(User u, Guid activityId);
-
- [OperationContract]
- [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "ParticipantRemoved", Method = "POST")]
- void ParticipantNetRemoved(User u, Guid activityId);
-
- }
- public enum UserEvents
- {
- FriendAdded,
- FriendRequest,
- FriendRemoved,
- ParticipantAdded,
- ParticipantRemoved
- }
-}
+/****************************************************************************
+ (c) 2012 Steven Houben(shou@itu.dk) and Søren Nielsen(snielsen@itu.dk)
+
+ Pervasive Interaction Technology Laboratory (pIT lab)
+ IT University of Copenhagen
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU GENERAL PUBLIC LICENSE V3 or later,
+ as published by the Free Software Foundation. Check
+ http://www.gnu.org/licenses/gpl.html for details.
+****************************************************************************/
+
+using System;
+using System.ServiceModel;
+using System.ServiceModel.Web;
+using NooSphere.Core.ActivityModel;
+
+namespace NooSphere.ActivitySystem.Base.Client
+{
+ [ServiceContract]
+ interface IUserEvent
+ {
+ [OperationContract]
+ [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "FriendAdded", Method = "POST")]
+ void FriendNetAdded(User u);
+
+ [OperationContract]
+ [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "FriendRequest", Method = "POST")]
+ void FriendNetRequest(User u);
+
+ [OperationContract]
+ [WebInvoke(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "FriendRemoved", Method = "POST")]
+ void FriendNetRemoved(Guid i);
+
+ [OperationContract]
+ [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "ParticipantAdded", Method = "POST")]
+ void ParticipantNetAdded(User u, Guid activityId);
+
+ [OperationContract]
+ [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "ParticipantRemoved", Method = "POST")]
+ void ParticipantNetRemoved(User u, Guid activityId);
+
+ }
+ public enum UserEvents
+ {
+ FriendAdded,
+ FriendRequest,
+ FriendRemoved,
+ ParticipantAdded,
+ ParticipantRemoved
+ }
+}
View
733 NooSphere/NooSphere.ActivitySystem/Base/Client/NetEventHandler.cs
@@ -1,368 +1,365 @@
-/****************************************************************************
- (c) 2012 Steven Houben(shou@itu.dk) and Søren Nielsen(snielsen@itu.dk)
-
- Pervasive Interaction Technology Laboratory (pIT lab)
- IT University of Copenhagen
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU GENERAL PUBLIC LICENSE V3 or later,
- as published by the Free Software Foundation. Check
- http://www.gnu.org/licenses/gpl.html for details.
-****************************************************************************/
-
-using System;
-using System.IO;
-using System.Net;
-using System.Threading;
-using NooSphere.Core.ActivityModel;
-using System.ServiceModel;
-using NooSphere.Core.Devices;
-using NooSphere.ActivitySystem.Contracts.Client;
-#if ANDROID
-using System.Text;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using NooSphere.Helpers;
-
-#endif
-#if !ANDROID
-#endif
-
-namespace NooSphere.ActivitySystem.Base.Client
-{
- #if !ANDROID
- [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.Single,
- UseSynchronizationContext = false)]
-#endif
- public class NetEventHandler : INetEventHandler
- {
-#if ANDROID
- #region Private Members
- private readonly HttpListener _httpListener;
- private static readonly AutoResetEvent ListenForNextRequest = new AutoResetEvent(false);
- #endregion
-
- #region Protected Members
- protected string BaseUrl;
- #endregion
-
- #region Constructor
- public NetEventHandler()
- {
- BaseUrl = Net.GetUrl(Net.GetIp(IPType.All), Net.FindPort(), "").ToString();
- ServicePointManager.DefaultConnectionLimit = 100;
- _httpListener = new HttpListener();
- _httpListener.Prefixes.Add(BaseUrl);
-
- _httpListener.Start();
- ThreadPool.QueueUserWorkItem(Listen);
- }
- #endregion
-
- #region HttpHandlers
- private void Listen(object state)
- {
- while(_httpListener.IsListening)
- {
- _httpListener.BeginGetContext(HandleRequest, _httpListener);
- ListenForNextRequest.WaitOne();
- }
- }
- private void HandleRequest(IAsyncResult result)
- {
- var listener = result.AsyncState as HttpListener;
- HttpListenerContext context;
-
- if (listener == null) return;
-
- try
- {
- context = listener.EndGetContext(result);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- return;
- }
- finally
- {
- ListenForNextRequest.Set();
- }
-
- if (context == null) return;
-