--- a/src/FingersDance/MainSurfaceWindow.xaml.cs Wed Oct 14 14:29:23 2009 +0200
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs Wed Oct 14 13:44:25 2009 +0200
@@ -18,6 +18,8 @@
using FingersDance.Control.UserPanel;
using FingersDance.Control.Screen;
using FingersDance.Control.Close;
+using FingersDance.ViewModels;
+using FingersDance.Data;
namespace FingersDance
@@ -32,14 +34,18 @@
/// </summary>
///
#region Variables
+
private UserControlUserPanel Panel1 = null;
private UserControlUserPanel Panel2 = null;
private UserControlUserPanel Panel3 = null;
private UserControlUserPanel Panel4 = null;
+ ActionFactory.ActionGenerator _Factory = new FingersDance.ActionFactory.ActionFactory().GetGenerator();
+ private MainViewModel _mainviewmodel = new MainViewModel();
+
#endregion
- ActionFactory.ActionGenerator _Factory = new FingersDance.ActionFactory.ActionFactory().GetGenerator();
+ #region Constructor
public SurfaceWindow1()
{
InitializeComponent();
@@ -51,6 +57,9 @@
// Add handlers for Application activation events
AddActivationHandlers();
}
+ #endregion
+
+ #region Initialization
private void InitPivotInertia()
{
@@ -83,6 +92,7 @@
catch (Exception ex) { }
}
+ #endregion
/// <summary>
/// Occurs when the window is about to close.
@@ -253,13 +263,18 @@
private void UserControlPivot_EH_SurfaceButtonPlayer_ContactDown(object sender, EventArgs e)
{
+ // Si aucune video n'a été sélectionnée et qu'une grid contient un élément (listvideo), on ne fait rien
+ if (_mainviewmodel.Session.VideoPath.Equals("") && (Grid1.Children.Count == 2 || Grid2.Children.Count == 2 || Grid3.Children.Count == 2 || Grid4.Children.Count == 2))
+ return;
+
+ // Traitement du contact down sur le pivot (Création d'un screen ou suppression d'un panel
switch ((int)sender)
{
case 1:
if (Panel1 == null && Grid1.Children.Count == 1)
{
//1-Creation du control Screen
- UserControlScreen Screen = new UserControlScreen(1);
+ UserControlScreen Screen = new UserControlScreen(1, _mainviewmodel);
Screen.Name = "Screen1";
Screen.contexteGrid = Grid1.Name.ToString();
//2-Rajout du screen dans la grid correspondante
@@ -282,7 +297,7 @@
if (Panel2 == null && Grid2.Children.Count == 1)
{
//1-Creation du control Screen
- UserControlScreen Screen = new UserControlScreen(2);
+ UserControlScreen Screen = new UserControlScreen(2, _mainviewmodel);
Screen.Name = "Screen2";
Screen.contexteGrid = Grid2.Name.ToString();
//2-Rajout du screen dans la grid correspondante
@@ -305,7 +320,7 @@
if (Panel3 == null && Grid3.Children.Count == 1)
{
//1-Creation du control Screen
- UserControlScreen Screen = new UserControlScreen(3);
+ UserControlScreen Screen = new UserControlScreen(3, _mainviewmodel);
Screen.Name = "Screen3";
Screen.contexteGrid = Grid3.Name.ToString();
//2-Rajout du screen dans la grid correspondante
@@ -328,7 +343,7 @@
if (Panel4 == null && Grid4.Children.Count == 1)
{
//1-Creation du control Screen
- UserControlScreen Screen = new UserControlScreen(4);
+ UserControlScreen Screen = new UserControlScreen(4, _mainviewmodel);
Screen.Name = "Screen4";
Screen.contexteGrid = Grid4.Name.ToString();
//2-Rajout du screen dans la grid correspondante
@@ -360,28 +375,33 @@
Grid root = (Grid)(((UserControlScreen)sender).Parent);
root.Children.Remove(((UserControlScreen)sender));
//2-Creation du User Panel
+ Project newProject = _mainviewmodel.CreateProject(((UserControlScreen)sender).User);
+
+ if ((Panel1 != null && Panel1.Project.Equals(newProject)) || (Panel2 != null && Panel2.Project.Equals(newProject)) || (Panel3 != null && Panel3.Project.Equals(newProject)) || (Panel4 != null && Panel4.Project.Equals(newProject)))
+ return;
+
switch (((UserControlScreen)sender).id)
{
case 1:
- Panel1 = new UserControlUserPanel(((UserControlScreen)sender).Path);
+ Panel1 = new UserControlUserPanel(newProject, _mainviewmodel.Session.VideoPath);
Panel1.Name = "UserPanel1";
//3-Rajout sur la Grid Root
root.Children.Add(Panel1);
break;
case 2:
- Panel2 = new UserControlUserPanel(((UserControlScreen)sender).Path);
+ Panel2 = new UserControlUserPanel(newProject, _mainviewmodel.Session.VideoPath);
Panel2.Name = "UserPanel2";
//3-Rajout sur la Grid Root
root.Children.Add(Panel2);
break;
case 3:
- Panel3 = new UserControlUserPanel(((UserControlScreen)sender).Path);
+ Panel3 = new UserControlUserPanel(newProject, _mainviewmodel.Session.VideoPath);
Panel3.Name = "UserPanel3";
//3-Rajout sur la Grid Root
root.Children.Add(Panel3);
break;
case 4:
- Panel4 = new UserControlUserPanel(((UserControlScreen)sender).Path);
+ Panel4 = new UserControlUserPanel(newProject, _mainviewmodel.Session.VideoPath);
Panel4.Name = "UserPanel4";
//3-Rajout sur la Grid Root
root.Children.Add(Panel4);