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