src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs
changeset 180 1c4ad413c837
parent 162 0b9f989bcb37
child 181 a5b708a9e066
child 183 026018ce69e5
equal deleted inserted replaced
179:97ef988c92c2 180:1c4ad413c837
     6 using System.Windows.Data;
     6 using System.Windows.Data;
     7 using System.Windows.Media;
     7 using System.Windows.Media;
     8 using System.Windows.Media.Animation;
     8 using System.Windows.Media.Animation;
     9 using System.Windows.Navigation;
     9 using System.Windows.Navigation;
    10 using FingersDance.Data;
    10 using FingersDance.Data;
       
    11 using Microsoft.Surface.Presentation;
       
    12 using System.Globalization;
       
    13 using Microsoft.Surface.Presentation.Controls;
       
    14 using System.Reflection;
    11 
    15 
    12 namespace FingersDance.Control.UserPanel
    16 namespace FingersDance.Control.UserPanel
    13 {
    17 {
    14 	public partial class UserControlUserPanel
    18 	public partial class UserControlUserPanel
    15 	{
    19 	{
    16         #region Variables
    20         #region Variables
    17 
    21 
       
    22         //public ContactEventHandler ContactDown;
    18         public event EventHandler OnSuccessAnnotation;  //Event to display ColorAnnotation from different Users        
    23         public event EventHandler OnSuccessAnnotation;  //Event to display ColorAnnotation from different Users        
    19         public int id = 0;
    24         public int id = 0;
    20         public uint idcolor = 0;    //The color of the Pivot Button
    25         public uint idcolor = 0;    //The color of the Pivot Button
    21         Project _Project = new Project();
    26         Project _Project = new Project();
    22         #endregion
    27         #endregion
    42             this.InitializeComponent();
    47             this.InitializeComponent();
    43             id = idPar;
    48             id = idPar;
    44             _Project = p;
    49             _Project = p;
    45             this.UserControlSyncSource.Load(path, col, _Project.Cutting);
    50             this.UserControlSyncSource.Load(path, col, _Project.Cutting);
    46             UserControlSyncSource.OnSuccessAnnotation+=new EventHandler(UserControlSyncSource_OnSuccessAnnotation);
    51             UserControlSyncSource.OnSuccessAnnotation+=new EventHandler(UserControlSyncSource_OnSuccessAnnotation);
       
    52             //SAR -Contact Down event for TAG Control
       
    53             InitializeDefinitions();
       
    54         }
       
    55 
       
    56         private void InitializeDefinitions() 
       
    57         { 
       
    58             for (byte k = 1; k <= 5; k++)
       
    59             { 
       
    60                 ByteTagVisualizationDefinition tagDef = new ByteTagVisualizationDefinition(); 
       
    61                 // The tag value that this definition will respond to. 
       
    62                 tagDef.Value = k; 
       
    63                 // The .xaml file for the UI. 
       
    64                 tagDef.Source = new Uri("FingersDance.Control.UserPanel;Component/TagVisuSoundControl.xaml", UriKind.Relative);
       
    65 
       
    66                 // The maximum number for this tag value. tagDef.MaxCount = 2; 
       
    67                 // The visualization stays for 2 seconds after the tag is lifted. 
       
    68                 tagDef.LostTagTimeout = 2000.0; 
       
    69                 // The orientation offset (default). 
       
    70                 tagDef.OrientationOffsetFromTag = 0.0; 
       
    71                 // The physical offset (horizontal inches, vertical inches). 
       
    72                 tagDef.PhysicalCenterOffsetFromTag = new Vector(0.5, 0.25); 
       
    73                 // The tag removal behavior (default). 
       
    74                 tagDef.TagRemovedBehavior = TagRemovedBehavior.Fade; 
       
    75                 // Orient UI to tag? (default). 
       
    76                 tagDef.UsesTagOrientation = true; 
       
    77                 // Add the definition to the collection. 
       
    78                 this.tagVisualizer.Definitions.Add(tagDef); 
       
    79             } 
       
    80         }
       
    81 
       
    82         private void OnVisualizationAdded(object sender, TagVisualizerEventArgs e) 
       
    83         { 
       
    84             TagVisuSoundControl camera = (TagVisuSoundControl)e.TagVisualization; 
       
    85             switch (camera.VisualizedTag.Byte.Value) 
       
    86             { 
       
    87                 case 1: camera.cameraModel.Content = "Fabrikam, Inc. ABC-12"; 
       
    88                 break; 
       
    89                 case 2: camera.cameraModel.Content = "Fabrikam, Inc. DEF-34"; 
       
    90                 break; 
       
    91                 case 3: camera.cameraModel.Content = "Fabrikam, Inc. GHI-56"; 
       
    92                 break; 
       
    93                 case 4: camera.cameraModel.Content = "Fabrikam, Inc. JKL-78"; 
       
    94                 break; 
       
    95                 case 5: camera.cameraModel.Content = "Fabrikam, Inc. MNO-90"; 
       
    96                 break; 
       
    97                 default: camera.cameraModel.Content = "UNKNOWN MODEL"; 
       
    98                 break; 
       
    99             } 
    47         }
   100         }
    48         #endregion
   101         #endregion
    49 
   102 
    50         public void PlayerPause()
   103         public void PlayerPause()
    51         {
   104         {
    60 
   113 
    61         public void UserControlSyncSource_DisplayAnnotation(int id, Brush b)
   114         public void UserControlSyncSource_DisplayAnnotation(int id, Brush b)
    62         {
   115         {
    63             UserControlSyncSource.UserControlPlayer_DisplayAnnotation(id, b);
   116             UserControlSyncSource.UserControlPlayer_DisplayAnnotation(id, b);
    64         }
   117         }
    65 	}
   118 
       
   119         //SAR
       
   120         public void UserControlUserPanel_ContactDown(object sender, ContactEventArgs e)
       
   121         {
       
   122             Contact c = e.Contact;
       
   123             string type = "";
       
   124             if (c.Tag.Type == TagType.Byte)
       
   125             {
       
   126                 type = "Byte Tag";
       
   127                 type += (" Value: " + c.Tag.Byte.Value.ToString("X", CultureInfo.InvariantCulture));
       
   128             }
       
   129             else if (c.Tag.Type == TagType.Identity)
       
   130             {
       
   131                 type = "Identity Tag";
       
   132                 type += (" Value: " + c.Tag.Byte.Value.ToString("X", CultureInfo.InvariantCulture));
       
   133             }
       
   134         }
       
   135 
       
   136         private void tagVisualizer_VisualizationAdded(object sender, Microsoft.Surface.Presentation.Controls.TagVisualizerEventArgs e)
       
   137         {
       
   138 
       
   139         }
       
   140 
       
   141         private void v(object sender, Microsoft.Surface.Presentation.Controls.TagVisualizerEventArgs e)
       
   142         {
       
   143 
       
   144         }
       
   145 
       
   146         
       
   147     }
    66 }
   148 }