author | cavaliet |
Wed, 04 Nov 2009 16:28:01 +0100 | |
changeset 186 | 83615722dbab |
parent 184 | 08d773b6ea30 |
child 188 | e642ad0c366b |
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; |
|
182
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
15 |
using FingersDance.ViewModels; |
35 | 16 |
|
17 |
namespace FingersDance.Control.UserPanel |
|
18 |
{ |
|
19 |
public partial class UserControlUserPanel |
|
20 |
{ |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
21 |
#region Variables |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
22 |
|
180 | 23 |
//public ContactEventHandler ContactDown; |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
24 |
public event EventHandler OnSuccessAnnotation; //Event to display ColorAnnotation from different Users |
131 | 25 |
public int id = 0; |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
26 |
public uint idcolor = 0; //The color of the Pivot Button |
182
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
27 |
//Project _Project = new Project(); |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
28 |
private CuttingViewModel cutVM; |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
29 |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
30 |
#endregion |
143 | 31 |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
32 |
#region Properties |
182
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
33 |
public CuttingViewModel CuttingVM |
143 | 34 |
{ |
182
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
35 |
get { return cutVM; } |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
36 |
set { cutVM = value; } |
143 | 37 |
} |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
38 |
#endregion |
143 | 39 |
|
182
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
40 |
//#region Properties |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
41 |
//public Project Project |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
42 |
//{ |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
43 |
// get { return _Project; } |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
44 |
// set { _Project = value; } |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
45 |
//} |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
46 |
//#endregion |
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
47 |
|
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
48 |
#region Constructors |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
49 |
public UserControlUserPanel() |
35 | 50 |
{ |
51 |
this.InitializeComponent(); |
|
52 |
||
53 |
// Insert code required on object creation below this point. |
|
54 |
} |
|
119 | 55 |
|
186
83615722dbab
Debug data management for others panels to redisplay.
cavaliet
parents:
184
diff
changeset
|
56 |
public UserControlUserPanel(int idPar, Color col, CuttingViewModel cutVMPar, string path) |
119 | 57 |
{ |
58 |
this.InitializeComponent(); |
|
150
569925b65604
Annotations are now colored with the same color as the pivot's button
cavaliet
parents:
146
diff
changeset
|
59 |
id = idPar; |
182
25b49d4f1635
First step of data reorganisation : session is meant to disappear : a "session" is in fact a project and one project owns several cuttings, one per user. WARNING : this commit builds without problems but we can not open more than one UserPanel.
cavaliet
parents:
162
diff
changeset
|
60 |
//_Project = p; |
186
83615722dbab
Debug data management for others panels to redisplay.
cavaliet
parents:
184
diff
changeset
|
61 |
cutVM = cutVMPar; |
83615722dbab
Debug data management for others panels to redisplay.
cavaliet
parents:
184
diff
changeset
|
62 |
this.UserControlSyncSource.Load(path, col, cutVM); |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
63 |
UserControlSyncSource.OnSuccessAnnotation+=new EventHandler(UserControlSyncSource_OnSuccessAnnotation); |
180 | 64 |
//SAR -Contact Down event for TAG Control |
65 |
InitializeDefinitions(); |
|
66 |
} |
|
67 |
||
68 |
private void InitializeDefinitions() |
|
69 |
{ |
|
70 |
for (byte k = 1; k <= 5; k++) |
|
71 |
{ |
|
72 |
ByteTagVisualizationDefinition tagDef = new ByteTagVisualizationDefinition(); |
|
73 |
// The tag value that this definition will respond to. |
|
74 |
tagDef.Value = k; |
|
75 |
// The .xaml file for the UI. |
|
76 |
tagDef.Source = new Uri("FingersDance.Control.UserPanel;Component/TagVisuSoundControl.xaml", UriKind.Relative); |
|
77 |
||
78 |
// The maximum number for this tag value. tagDef.MaxCount = 2; |
|
79 |
// The visualization stays for 2 seconds after the tag is lifted. |
|
80 |
tagDef.LostTagTimeout = 2000.0; |
|
81 |
// The orientation offset (default). |
|
82 |
tagDef.OrientationOffsetFromTag = 0.0; |
|
83 |
// The physical offset (horizontal inches, vertical inches). |
|
84 |
tagDef.PhysicalCenterOffsetFromTag = new Vector(0.5, 0.25); |
|
85 |
// The tag removal behavior (default). |
|
86 |
tagDef.TagRemovedBehavior = TagRemovedBehavior.Fade; |
|
87 |
// Orient UI to tag? (default). |
|
88 |
tagDef.UsesTagOrientation = true; |
|
89 |
// Add the definition to the collection. |
|
90 |
this.tagVisualizer.Definitions.Add(tagDef); |
|
91 |
} |
|
92 |
} |
|
93 |
||
94 |
private void OnVisualizationAdded(object sender, TagVisualizerEventArgs e) |
|
95 |
{ |
|
181 | 96 |
TagVisuSoundControl tagsoundcontrol = (TagVisuSoundControl)e.TagVisualization; |
97 |
switch (tagsoundcontrol.VisualizedTag.Byte.Value) |
|
98 |
{ |
|
99 |
case 1: tagsoundcontrol.volumeModel.Content = "Tag Value 1"; |
|
100 |
break; |
|
101 |
case 2: tagsoundcontrol.volumeModel.Content = "Tag Value 2"; |
|
102 |
break; |
|
103 |
case 3: tagsoundcontrol.volumeModel.Content = "Tag Value 3"; |
|
104 |
break; |
|
105 |
case 4: tagsoundcontrol.volumeModel.Content = "Tag Value 4"; |
|
106 |
break; |
|
107 |
case 5: tagsoundcontrol.volumeModel.Content = "Tag Value 5"; |
|
108 |
break; |
|
109 |
default: tagsoundcontrol.volumeModel.Content = "UNKNOWN MODEL"; |
|
180 | 110 |
break; |
111 |
} |
|
119 | 112 |
} |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
113 |
#endregion |
152
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
114 |
|
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
115 |
public void PlayerPause() |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
116 |
{ |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
117 |
UserControlSyncSource.PlayerPause(); |
46577fd0a294
PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents:
150
diff
changeset
|
118 |
} |
162
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
119 |
|
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
120 |
|
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
121 |
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
|
122 |
{ |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
123 |
OnSuccessAnnotation(this, new EventArgs()); |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
124 |
} |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
125 |
|
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
126 |
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
|
127 |
{ |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
128 |
UserControlSyncSource.UserControlPlayer_DisplayAnnotation(id, b); |
0b9f989bcb37
Display annotations in all opened UserPanels with the user's color
sarias
parents:
160
diff
changeset
|
129 |
} |
180 | 130 |
|
131 |
//SAR |
|
132 |
public void UserControlUserPanel_ContactDown(object sender, ContactEventArgs e) |
|
133 |
{ |
|
134 |
Contact c = e.Contact; |
|
135 |
string type = ""; |
|
136 |
if (c.Tag.Type == TagType.Byte) |
|
137 |
{ |
|
138 |
type = "Byte Tag"; |
|
139 |
type += (" Value: " + c.Tag.Byte.Value.ToString("X", CultureInfo.InvariantCulture)); |
|
140 |
} |
|
141 |
else if (c.Tag.Type == TagType.Identity) |
|
142 |
{ |
|
143 |
type = "Identity Tag"; |
|
144 |
type += (" Value: " + c.Tag.Byte.Value.ToString("X", CultureInfo.InvariantCulture)); |
|
145 |
} |
|
146 |
} |
|
147 |
||
148 |
private void tagVisualizer_VisualizationAdded(object sender, Microsoft.Surface.Presentation.Controls.TagVisualizerEventArgs e) |
|
149 |
{ |
|
150 |
||
151 |
} |
|
152 |
||
153 |
private void v(object sender, Microsoft.Surface.Presentation.Controls.TagVisualizerEventArgs e) |
|
154 |
{ |
|
155 |
||
156 |
} |
|
157 |
||
158 |
|
|
159 |
} |
|
35 | 160 |
} |