author | ARIAS Santiago |
Wed, 04 Nov 2009 11:49:52 +0100 | |
changeset 181 | a5b708a9e066 |
parent 180 | 1c4ad413c837 |
child 184 | 08d773b6ea30 |
permissions | -rw-r--r-- |
35 | 1 |
using System; |
2 |
using System.IO; |
|
3 |
using System.Net; |
|
4 |
using System.Windows; |
|
5 |
using System.Windows.Controls; |
|
6 |
using System.Windows.Data; |
|
7 |
using System.Windows.Media; |
|
8 |
using System.Windows.Media.Animation; |
|
9 |
using System.Windows.Navigation; |
|
143 | 10 |
using FingersDance.Data; |
180 | 11 |
using Microsoft.Surface.Presentation; |
12 |
using System.Globalization; |
|
13 |
using Microsoft.Surface.Presentation.Controls; |
|
14 |
using System.Reflection; |
|
35 | 15 |
|
16 |
namespace FingersDance.Control.UserPanel |
|
17 |
{ |
|
18 |
public partial class UserControlUserPanel |
|
19 |
{ |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
20 |
#region Variables |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
21 |
|
180 | 22 |
//public ContactEventHandler ContactDown; |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
23 |
public event EventHandler OnSuccessAnnotation; //Event to display ColorAnnotation from different Users |
131 | 24 |
public int id = 0; |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
25 |
public uint idcolor = 0; //The color of the Pivot Button |
143 | 26 |
Project _Project = new Project(); |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
27 |
#endregion |
143 | 28 |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
29 |
#region Properties |
143 | 30 |
public Project Project |
31 |
{ |
|
32 |
get { return _Project; } |
|
33 |
set { _Project = value; } |
|
34 |
} |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
35 |
#endregion |
143 | 36 |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
37 |
#region Constructors |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
38 |
public UserControlUserPanel() |
35 | 39 |
{ |
40 |
this.InitializeComponent(); |
|
41 |
||
42 |
// Insert code required on object creation below this point. |
|
43 |
} |
|
119 | 44 |
|
160
e940ca798fe3
Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents:
152
diff
changeset
|
45 |
public UserControlUserPanel(int idPar, Color col, Project p, string path) |
119 | 46 |
{ |
47 |
this.InitializeComponent(); |
|
150
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
146
diff
changeset
|
48 |
id = idPar; |
143 | 49 |
_Project = p; |
160
e940ca798fe3
Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents:
152
diff
changeset
|
50 |
this.UserControlSyncSource.Load(path, col, _Project.Cutting); |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
51 |
UserControlSyncSource.OnSuccessAnnotation+=new EventHandler(UserControlSyncSource_OnSuccessAnnotation); |
180 | 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 |
{ |
|
181 | 84 |
TagVisuSoundControl tagsoundcontrol = (TagVisuSoundControl)e.TagVisualization; |
85 |
switch (tagsoundcontrol.VisualizedTag.Byte.Value) |
|
86 |
{ |
|
87 |
case 1: tagsoundcontrol.volumeModel.Content = "Tag Value 1"; |
|
88 |
break; |
|
89 |
case 2: tagsoundcontrol.volumeModel.Content = "Tag Value 2"; |
|
90 |
break; |
|
91 |
case 3: tagsoundcontrol.volumeModel.Content = "Tag Value 3"; |
|
92 |
break; |
|
93 |
case 4: tagsoundcontrol.volumeModel.Content = "Tag Value 4"; |
|
94 |
break; |
|
95 |
case 5: tagsoundcontrol.volumeModel.Content = "Tag Value 5"; |
|
96 |
break; |
|
97 |
default: tagsoundcontrol.volumeModel.Content = "UNKNOWN MODEL"; |
|
180 | 98 |
break; |
99 |
} |
|
119 | 100 |
} |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
101 |
#endregion |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
102 |
|
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
103 |
public void PlayerPause() |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
104 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
105 |
UserControlSyncSource.PlayerPause(); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
106 |
} |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
107 |
|
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
108 |
|
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
109 |
private void UserControlSyncSource_OnSuccessAnnotation(object sender, EventArgs e) |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
110 |
{ |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
111 |
OnSuccessAnnotation(this, new EventArgs()); |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
112 |
} |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
113 |
|
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
114 |
public void UserControlSyncSource_DisplayAnnotation(int id, Brush b) |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
115 |
{ |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
116 |
UserControlSyncSource.UserControlPlayer_DisplayAnnotation(id, b); |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
117 |
} |
180 | 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 |
} |
|
35 | 148 |
} |