Merge
authorcavaliet
Wed, 04 Nov 2009 13:23:51 +0100
changeset 183 026018ce69e5
parent 182 25b49d4f1635 (current diff)
parent 180 1c4ad413c837 (diff)
child 184 08d773b6ea30
Merge
src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs
--- a/src/FingersDance.Control.UserPanel/FingersDance.Control.UserPanel.csproj	Wed Oct 28 17:07:27 2009 +0100
+++ b/src/FingersDance.Control.UserPanel/FingersDance.Control.UserPanel.csproj	Wed Nov 04 13:23:51 2009 +0100
@@ -69,9 +69,15 @@
     </Reference>
     <Reference Include="System.Data" />
     <Reference Include="System.Xml" />
-    <Reference Include="WindowsBase" />
-    <Reference Include="PresentationCore" />
-    <Reference Include="PresentationFramework" />
+    <Reference Include="WindowsBase">
+      <RequiredTargetFramework>3.0</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="PresentationCore">
+      <RequiredTargetFramework>3.0</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="PresentationFramework">
+      <RequiredTargetFramework>3.0</RequiredTargetFramework>
+    </Reference>
     <Reference Include="Microsoft.Surface" />
     <Reference Include="Microsoft.Surface.Presentation" />
     <Reference Include="Microsoft.Surface.Presentation.Generic" />
@@ -107,6 +113,9 @@
     <Compile Include="SurfaceUserPanelTest.xaml.cs">
       <DependentUpon>SurfaceUserPanelTest.xaml</DependentUpon>
     </Compile>
+    <Compile Include="TagVisuSoundControl.xaml.cs">
+      <DependentUpon>TagVisuSoundControl.xaml</DependentUpon>
+    </Compile>
     <AppDesigner Include="Properties\" />
   </ItemGroup>
   <ItemGroup>
@@ -126,6 +135,10 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="TagVisuSoundControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\FingersDance.Control.Menu\FingersDance.Control.Menu.csproj">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance.Control.UserPanel/TagVisuSoundControl.xaml	Wed Nov 04 13:23:51 2009 +0100
@@ -0,0 +1,10 @@
+<s:TagVisualization x:Class="FingersDance.Control.UserPanel.TagVisuSoundControl"
+    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"
+    Loaded="TagVisuSoundControl_Loaded"
+   Height="100" Width="100">
+    <Canvas Background="LightBlue">
+        <Label Name="cameraModel" Content="VolumeControl"/>
+    </Canvas>
+</s:TagVisualization>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance.Control.UserPanel/TagVisuSoundControl.xaml.cs	Wed Nov 04 13:23:51 2009 +0100
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Microsoft.Surface;
+using Microsoft.Surface.Presentation;
+using Microsoft.Surface.Presentation.Controls;
+
+namespace FingersDance.Control.UserPanel
+{
+    /// <summary>
+    /// Interaction logic for TagVisuSoundControl.xaml
+    /// </summary>
+    public partial class TagVisuSoundControl : TagVisualization
+    {
+        public TagVisuSoundControl()
+        {
+            InitializeComponent();
+        }
+
+        private void TagVisuSoundControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            //TODO: customize TagVisuSoundControl's UI based on this.VisualizedTag here
+            Label l = new Label();
+            l.Content = "Detected!";
+            //grid.Children.Add(l);
+        }
+    }
+}
--- a/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml	Wed Oct 28 17:07:27 2009 +0100
+++ b/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml	Wed Nov 04 13:23:51 2009 +0100
@@ -3,21 +3,27 @@
 	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:s="http://schemas.microsoft.com/surface/2008"
 	mc:Ignorable="d"
 	x:Class="FingersDance.Control.UserPanel.UserControlUserPanel"
 	x:Name="UserControl"
-	d:DesignWidth="640" d:DesignHeight="480" 
+	d:DesignWidth="640" d:DesignHeight="480"
     xmlns:FingersDance_Control_SyncSource="clr-namespace:FingersDance.Control.SyncSource;assembly=FingersDance.Control.SyncSource"
     xmlns:FingersDance_Control_Menu="clr-namespace:FingersDance.Control.Menu;assembly=FingersDance.Control.Menu">
 
 
     <Grid x:Name="LayoutRoot" Background="{x:Null}">
+        <s:TagVisualizer 
+            x:Name="tagVisualizer" 
+            Background="#00000000" 
+            Height="Auto" 
+            Width="Auto" 
+            VisualizationAdded="OnVisualizationAdded"/>
         <Grid x:Name="GridSyncSource" Margin="174,0,0,0" Background="{x:Null}">
         	<FingersDance_Control_SyncSource:UserControlSyncSource x:Name="UserControlSyncSource" HorizontalAlignment="Left" VerticalAlignment="Top" Width="{Binding Path=ActualWidth, ElementName=GridSyncSource, Mode=Default}" Margin="0,0,0,0" Height="{Binding Path=ActualHeight, ElementName=GridSyncSource, Mode=Default}"/>
         </Grid>
         <Grid HorizontalAlignment="Left" Width="170" x:Name="GridMenu" Background="{x:Null}" Margin="0,49,0,0">
             <FingersDance_Control_Menu:UserControlMenu x:Name="UserControlMenu" Width="{Binding Path=ActualWidth, ElementName=GridMenu, Mode=Default}" Height="{Binding Path=ActualHeight, ElementName=GridMenu, Mode=Default}" Margin="0,0,0,0"/>
         </Grid>
-
     </Grid>
 </UserControl>
\ No newline at end of file
--- a/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs	Wed Oct 28 17:07:27 2009 +0100
+++ b/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs	Wed Nov 04 13:23:51 2009 +0100
@@ -8,6 +8,10 @@
 using System.Windows.Media.Animation;
 using System.Windows.Navigation;
 using FingersDance.Data;
+using Microsoft.Surface.Presentation;
+using System.Globalization;
+using Microsoft.Surface.Presentation.Controls;
+using System.Reflection;
 using FingersDance.ViewModels;
 
 namespace FingersDance.Control.UserPanel
@@ -16,6 +20,7 @@
 	{
         #region Variables
 
+        //public ContactEventHandler ContactDown;
         public event EventHandler OnSuccessAnnotation;  //Event to display ColorAnnotation from different Users        
         public int id = 0;
         public uint idcolor = 0;    //The color of the Pivot Button
@@ -55,6 +60,54 @@
             //_Project = p;
             this.UserControlSyncSource.Load(path, col, cut);
             UserControlSyncSource.OnSuccessAnnotation+=new EventHandler(UserControlSyncSource_OnSuccessAnnotation);
+            //SAR -Contact Down event for TAG Control
+            InitializeDefinitions();
+        }
+
+        private void InitializeDefinitions() 
+        { 
+            for (byte k = 1; k <= 5; k++)
+            { 
+                ByteTagVisualizationDefinition tagDef = new ByteTagVisualizationDefinition(); 
+                // The tag value that this definition will respond to. 
+                tagDef.Value = k; 
+                // The .xaml file for the UI. 
+                tagDef.Source = new Uri("FingersDance.Control.UserPanel;Component/TagVisuSoundControl.xaml", UriKind.Relative);
+
+                // The maximum number for this tag value. tagDef.MaxCount = 2; 
+                // The visualization stays for 2 seconds after the tag is lifted. 
+                tagDef.LostTagTimeout = 2000.0; 
+                // The orientation offset (default). 
+                tagDef.OrientationOffsetFromTag = 0.0; 
+                // The physical offset (horizontal inches, vertical inches). 
+                tagDef.PhysicalCenterOffsetFromTag = new Vector(0.5, 0.25); 
+                // The tag removal behavior (default). 
+                tagDef.TagRemovedBehavior = TagRemovedBehavior.Fade; 
+                // Orient UI to tag? (default). 
+                tagDef.UsesTagOrientation = true; 
+                // Add the definition to the collection. 
+                this.tagVisualizer.Definitions.Add(tagDef); 
+            } 
+        }
+
+        private void OnVisualizationAdded(object sender, TagVisualizerEventArgs e) 
+        { 
+            TagVisuSoundControl camera = (TagVisuSoundControl)e.TagVisualization; 
+            switch (camera.VisualizedTag.Byte.Value) 
+            { 
+                case 1: camera.cameraModel.Content = "Fabrikam, Inc. ABC-12"; 
+                break; 
+                case 2: camera.cameraModel.Content = "Fabrikam, Inc. DEF-34"; 
+                break; 
+                case 3: camera.cameraModel.Content = "Fabrikam, Inc. GHI-56"; 
+                break; 
+                case 4: camera.cameraModel.Content = "Fabrikam, Inc. JKL-78"; 
+                break; 
+                case 5: camera.cameraModel.Content = "Fabrikam, Inc. MNO-90"; 
+                break; 
+                default: camera.cameraModel.Content = "UNKNOWN MODEL"; 
+                break; 
+            } 
         }
         #endregion
 
@@ -73,5 +126,34 @@
         {
             UserControlSyncSource.UserControlPlayer_DisplayAnnotation(id, b);
         }
-	}
+
+        //SAR
+        public void UserControlUserPanel_ContactDown(object sender, ContactEventArgs e)
+        {
+            Contact c = e.Contact;
+            string type = "";
+            if (c.Tag.Type == TagType.Byte)
+            {
+                type = "Byte Tag";
+                type += (" Value: " + c.Tag.Byte.Value.ToString("X", CultureInfo.InvariantCulture));
+            }
+            else if (c.Tag.Type == TagType.Identity)
+            {
+                type = "Identity Tag";
+                type += (" Value: " + c.Tag.Byte.Value.ToString("X", CultureInfo.InvariantCulture));
+            }
+        }
+
+        private void tagVisualizer_VisualizationAdded(object sender, Microsoft.Surface.Presentation.Controls.TagVisualizerEventArgs e)
+        {
+
+        }
+
+        private void v(object sender, Microsoft.Surface.Presentation.Controls.TagVisualizerEventArgs e)
+        {
+
+        }
+
+        
+    }
 }
\ No newline at end of file