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.
--- a/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs Wed Oct 28 13:46:38 2009 +0100
+++ b/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs Wed Oct 28 17:07:27 2009 +0100
@@ -19,10 +19,10 @@
{
public String contexteGrid;
public int id = 0;
- public event EventHandler UC_Screen_NewSession;
+ public event EventHandler UC_Screen_NewCutting;
public MainViewModel MainViewModel;
- public ProjectViewModel Project = new ProjectViewModel();
- List<Session> sessions = new List<Session>();
+ public CuttingViewModel Cutting;
+ private List<Project> existingProjects = new List<Project>();
User User = new User();
public UserControlScreen(int id, MainViewModel mvmodel)
@@ -32,7 +32,7 @@
this.InitializeComponent();
this.id = id;
MainViewModel = mvmodel;
- if (MainViewModel.Session.VideoPath.Equals(""))
+ if (MainViewModel.Project.VideoPath.Equals(""))
{
//1-Creation de la ListVideo
UserControlListVideo ListVideo = new UserControlListVideo();
@@ -47,9 +47,9 @@
}
catch (Exception)
{
- Project = null;
- if (UC_Screen_NewSession != null)
- UC_Screen_NewSession(this, new EventArgs());
+ Cutting = null;
+ if (UC_Screen_NewCutting != null)
+ UC_Screen_NewCutting(this, new EventArgs());
}
}
@@ -67,69 +67,70 @@
{
try
{
- //1 rensegner la video choisie au screen
- MainViewModel.CreateSession(((UserControlListVideo)sender).VideoName, ((UserControlListVideo)sender).path);
+ //1 renseigner la video choisie au screen et créer un nouveau projet à partir de ce chemin vidéo
+ MainViewModel.CreateProject(((UserControlListVideo)sender).VideoName, ((UserControlListVideo)sender).path);
//2-Supression du UC List Video
LayoutRoot.Children.Remove((UserControlListVideo)sender);
- OpenSession();
+ OpenProjectList();
}
catch (Exception ex)
{
- Project = null;
- if (UC_Screen_NewSession != null)
- UC_Screen_NewSession(this, new EventArgs());
+ Cutting = null;
+ if (UC_Screen_NewCutting != null)
+ UC_Screen_NewCutting(this, new EventArgs());
}
}
- private void OpenSession()
+ private void OpenProjectList()
{
try
{
- sessions = LoadSessions(MainViewModel.Session.VideoPath);
- UserControlListSession listSession = new UserControlListSession(sessions);
- listSession.Name = "ListSession";
- LayoutRoot.Children.Add(listSession);
- listSession.EH_List_ContactDown += new EventHandler(listSession_EH_List_ContactDown);
+ existingProjects = LoadProjects(MainViewModel.Project.VideoPath);
+ UserControlListSession listProject = new UserControlListSession(existingProjects);
+ listProject.Name = "ListProject";
+ LayoutRoot.Children.Add(listProject);
+ listProject.EH_List_ContactDown += new EventHandler(listProject_EH_List_ContactDown);
}
catch (Exception)
{
- Project = null;
- if (UC_Screen_NewSession != null)
- UC_Screen_NewSession(this, new EventArgs());
+ Cutting = null;
+ if (UC_Screen_NewCutting != null)
+ UC_Screen_NewCutting(this, new EventArgs());
}
}
- private List<Session> LoadSessions(string name)
+ private List<Project> LoadProjects(string name)
{
+ // Does nothing because for the moment we do not load sessions when we know the video path, we just create a new session
try
{
- return new List<Session>();
+ return new List<Project>();
}
catch (Exception)
{
- return new List<Session>();
+ return new List<Project>();
}
}
- void listSession_EH_List_ContactDown(object sender, EventArgs e)
+ void listProject_EH_List_ContactDown(object sender, EventArgs e)
{
try
{
LayoutRoot.Children.Remove((UserControlListSession)sender);
- if (((UserControlListSession)sender).SelectedItem.Equals("New Session"))
+ if (((UserControlListSession)sender).SelectedItem.Equals("New Project"))
{
- UserControlSessionInput SessionInput = new UserControlSessionInput();
- SessionInput.Name = "SessionInput";
- LayoutRoot.Children.Add(SessionInput);
- SessionInput.EH_SurfaceButtonSubmit_ContactDown += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
+ UserControlSessionInput ProjectInput = new UserControlSessionInput();
+ ProjectInput.Name = "ProjectInput";
+ LayoutRoot.Children.Add(ProjectInput);
+ ProjectInput.EH_SurfaceButtonSubmit_ContactDown += new System.EventHandler(this.ProjectInput_EH_SurfaceButtonSubmit_ContactDown);
}
else
{
- foreach (Session elt in sessions)
+ foreach (Project elt in existingProjects)
{
if (elt.Name.Equals(((UserControlListSession)sender).SelectedItem))
{
- MainViewModel.Session.Projects = elt.Projects;
+ MainViewModel.Project.Project = elt;
OpenProject();
return;
}
@@ -138,20 +139,20 @@
}
catch (Exception)
{
- Project = null;
- if (UC_Screen_NewSession != null)
- UC_Screen_NewSession(this, new EventArgs());
+ Cutting = null;
+ if (UC_Screen_NewCutting != null)
+ UC_Screen_NewCutting(this, new EventArgs());
}
}
- private void SessionInput_EH_SurfaceButtonSubmit_ContactDown(object sender, EventArgs e)
+ private void ProjectInput_EH_SurfaceButtonSubmit_ContactDown(object sender, EventArgs e)
{
try
{
- MainViewModel.Session.Alias = ((UserControlSessionInput)sender).Alias;
- MainViewModel.Session.Email = ((UserControlSessionInput)sender).Email;
- MainViewModel.Session.Description = ((UserControlSessionInput)sender).Description;
- MainViewModel.Session.Name = ((UserControlSessionInput)sender).SessionName;
+ //MainViewModel.Project.Alias = ((UserControlSessionInput)sender).Alias;
+ //MainViewModel.Project.Email = ((UserControlSessionInput)sender).Email;
+ MainViewModel.Project.Description = ((UserControlSessionInput)sender).Description;
+ MainViewModel.Project.Name = ((UserControlSessionInput)sender).SessionName;
//2-Suppression UCSession Input
LayoutRoot.Children.Remove((UserControlSessionInput)sender);
@@ -159,9 +160,9 @@
}
catch (Exception ex)
{
- Project = null;
- if (UC_Screen_NewSession != null)
- UC_Screen_NewSession(this, new EventArgs());
+ Cutting = null;
+ if (UC_Screen_NewCutting != null)
+ UC_Screen_NewCutting(this, new EventArgs());
}
}
@@ -169,66 +170,67 @@
{
try
{
- UserControlListProject listProjects = new UserControlListProject(MainViewModel.Session.Projects);
- listProjects.Name = "ListProjects";
- LayoutRoot.Children.Add(listProjects);
- listProjects.EH_Item_ContactDown += new EventHandler(listProjects_EH_Item_ContactDown);
+ UserControlListProject listCuttings = new UserControlListProject(MainViewModel.Project.CuttingsDict);
+ listCuttings.Name = "listCuttings";
+ LayoutRoot.Children.Add(listCuttings);
+ listCuttings.EH_Item_ContactDown += new EventHandler(listCuttings_EH_Item_ContactDown);
}
catch (Exception)
{
- Project = null;
- if (UC_Screen_NewSession != null)
- UC_Screen_NewSession(this, new EventArgs());
+ Cutting = null;
+ if (UC_Screen_NewCutting != null)
+ UC_Screen_NewCutting(this, new EventArgs());
}
}
- void listProjects_EH_Item_ContactDown(object sender, EventArgs e)
+ void listCuttings_EH_Item_ContactDown(object sender, EventArgs e)
{
try
{
LayoutRoot.Children.Remove((UserControlListProject)sender);
- if (((UserControlListProject)sender).SelectedItem.Equals("New Project"))
+ if (((UserControlListProject)sender).SelectedItem.Equals("New Cutting"))
{
- UserControlNewProject newProject = new UserControlNewProject(User);
- newProject.Name = "newProject";
- LayoutRoot.Children.Add(newProject);
- newProject.EH_NewProject_ContactDown += new EventHandler(newProject_EH_NewProject_ContactDown);
- }
+ UserControlNewProject newCutting = new UserControlNewProject(User);
+ newCutting.Name = "newCutting";
+ LayoutRoot.Children.Add(newCutting);
+ newCutting.EH_NewCutting_ContactDown += new EventHandler(newCutting_EH_NewProject_ContactDown);
+ }
else
{
- foreach(KeyValuePair<string, Project> elt in MainViewModel.Session.Projects)
+ foreach(KeyValuePair<string, Cutting> elt in MainViewModel.Project.CuttingsDict)
if (elt.Key.Equals(((UserControlListProject)sender).SelectedItem))
{
- Project = new ProjectViewModel(elt.Value);
- if (UC_Screen_NewSession != null)
- UC_Screen_NewSession(this, new EventArgs());
+ Cutting = new CuttingViewModel(elt.Value, 815);
+ if (UC_Screen_NewCutting != null)
+ UC_Screen_NewCutting(this, new EventArgs());
return;
}
}
}
catch (Exception)
{
- Project = null;
- if (UC_Screen_NewSession != null)
- UC_Screen_NewSession(this, new EventArgs());
+ Cutting = null;
+ if (UC_Screen_NewCutting != null)
+ UC_Screen_NewCutting(this, new EventArgs());
}
}
- void newProject_EH_NewProject_ContactDown(object sender, EventArgs e)
+ void newCutting_EH_NewProject_ContactDown(object sender, EventArgs e)
{
try
{
+ Console.WriteLine("newCutting_EH_NewProject_ContactDown");
LayoutRoot.Children.Remove((UserControlNewProject)sender);
- Project = new ProjectViewModel(((UserControlNewProject)sender).Project);
- MainViewModel.Session.Projects.Add(Project.Name, Project.Project);
- if (UC_Screen_NewSession != null)
- UC_Screen_NewSession(this, new EventArgs());
+ Cutting = new CuttingViewModel(((UserControlNewProject)sender).Cutting, 850);
+ MainViewModel.Project.CuttingsDict.Add(Cutting.Title, ((UserControlNewProject)sender).Cutting);
+ if (UC_Screen_NewCutting != null)
+ UC_Screen_NewCutting(this, new EventArgs());
}
- catch (Exception)
+ catch (Exception)
{
- Project = null;
- if (UC_Screen_NewSession != null)
- UC_Screen_NewSession(this, new EventArgs());
+ Cutting = null;
+ if (UC_Screen_NewCutting != null)
+ UC_Screen_NewCutting(this, new EventArgs());
}
}
}
--- a/src/FingersDance.Control.SessionInput/UserControlListProject.xaml.cs Wed Oct 28 13:46:38 2009 +0100
+++ b/src/FingersDance.Control.SessionInput/UserControlListProject.xaml.cs Wed Oct 28 17:07:27 2009 +0100
@@ -25,23 +25,23 @@
public event EventHandler EH_Item_ContactDown;
public string SelectedItem = "";
- public UserControlListProject(Dictionary<string, Project> projects)
+ public UserControlListProject(Dictionary<string, Cutting> cuttings)
{
InitializeComponent();
- OpenSessions(projects);
+ OpenSessions(cuttings);
}
- private void OpenSessions(Dictionary<string, Project> projects)
+ private void OpenSessions(Dictionary<string, Cutting> cuttings)
{
try
{
CustomListBoxItem Contener = new CustomListBoxItem();
- Contener.Name = "New Project";
- UserControlCustomLabel l = new UserControlCustomLabel("New Project");
+ Contener.Name = "New Cutting";
+ UserControlCustomLabel l = new UserControlCustomLabel("New Cutting");
Contener.Content = l;
stackPanel.Children.Add(Contener);
Contener.ContactTapGesture += Item_ContactTapGesture;
- foreach (KeyValuePair<string, Project> elt in projects)
+ foreach (KeyValuePair<string, Cutting> elt in cuttings)
{
Contener = new CustomListBoxItem();
Contener.Name = elt.Key;
--- a/src/FingersDance.Control.SessionInput/UserControlListSession.xaml.cs Wed Oct 28 13:46:38 2009 +0100
+++ b/src/FingersDance.Control.SessionInput/UserControlListSession.xaml.cs Wed Oct 28 17:07:27 2009 +0100
@@ -25,21 +25,21 @@
public event EventHandler EH_List_ContactDown;
public string SelectedItem = "";
- public UserControlListSession(List<Session> sessions)
+ public UserControlListSession(List<Project> projects)
{
InitializeComponent();
- OpenSessions(sessions);
+ OpenProjects(projects);
}
- private void OpenSessions(List<Session> sessions)
+ private void OpenProjects(List<Project> projects)
{
CustomListBoxItem Contener = new CustomListBoxItem();
- Contener.Name = "New Session";
- UserControlCustomLabel l = new UserControlCustomLabel("New Session");
+ Contener.Name = "New Project";
+ UserControlCustomLabel l = new UserControlCustomLabel("New Project");
Contener.Content = l;
stackPanel.Children.Add(Contener);
Contener.ContactTapGesture += Item_ContactTapGesture;
- foreach (Session elt in sessions)
+ foreach (Project elt in projects)
{
Contener = new CustomListBoxItem();
Contener.Name = elt.Name;
--- a/src/FingersDance.Control.SessionInput/UserControlNewProject.xaml Wed Oct 28 13:46:38 2009 +0100
+++ b/src/FingersDance.Control.SessionInput/UserControlNewProject.xaml Wed Oct 28 17:07:27 2009 +0100
@@ -322,7 +322,7 @@
<Grid x:Name="LayoutRoot" Background="{DynamicResource SessionInput__Background_xaml}">
<Custom:SurfaceTextBox d:LayoutOverrides="HorizontalAlignment" Margin="112,17.818,8,0" x:Name="ST_ProjectName" VerticalAlignment="Top" Text="" TextWrapping="Wrap" Background="#7EFFFFFF" Foreground="#FF000000"/>
- <Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="Project Name:" Margin="14.367,9.818,0,0" x:Name="LProjectName" Foreground="#FFBCB3B3"/>
+ <Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="Cutting Name:" Margin="14.367,9.818,0,0" x:Name="LProjectName" Foreground="#FFBCB3B3"/>
<Custom:SurfaceTextBox d:LayoutOverrides="HorizontalAlignment, VerticalAlignment" Margin="112,50.626,8,0" x:Name="ST_Date" VerticalAlignment="Top" Text="" TextWrapping="Wrap" Background="#7EFFFFFF" BorderBrush="{x:Null}" Foreground="#FF000000"/>
<Label HorizontalAlignment="Left" VerticalAlignment="Top" Content="Date:" Margin="14.367,42.626,0,0" x:Name="LDate" Foreground="#FFBCB3B3"/>
<Custom:SurfaceTextBox d:LayoutOverrides="HorizontalAlignment" Margin="112,0,8,30.403" x:Name="ST_Desc" VerticalAlignment="Bottom" Text="" TextWrapping="Wrap" Background="#7EFFFFFF" BorderBrush="{x:Null}" Foreground="#FF000000"/>
--- a/src/FingersDance.Control.SessionInput/UserControlNewProject.xaml.cs Wed Oct 28 13:46:38 2009 +0100
+++ b/src/FingersDance.Control.SessionInput/UserControlNewProject.xaml.cs Wed Oct 28 17:07:27 2009 +0100
@@ -20,8 +20,8 @@
/// </summary>
public partial class UserControlNewProject : UserControl
{
- public event EventHandler EH_NewProject_ContactDown;
- public Project Project = new Project();
+ public event EventHandler EH_NewCutting_ContactDown;
+ public Cutting Cutting = new Cutting();
User _User = new User();
public UserControlNewProject(User u)
@@ -37,16 +37,17 @@
private void SurfaceButtonSubmit_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
{
- Project = new Project(_User, new Cutting());
- if (EH_NewProject_ContactDown != null)
- EH_NewProject_ContactDown(this, new EventArgs());
+ Cutting = new Cutting(_User.Name, new List<Annotation>());
+ if (EH_NewCutting_ContactDown != null)
+ EH_NewCutting_ContactDown(this, new EventArgs());
}
private void SurfaceButtonSubmit_Click(object sender, RoutedEventArgs e)
{
- Project = new Project(ST_ProjectName.Text, ST_Date.Text, ST_Desc.Text, _User, new Cutting());
- if (EH_NewProject_ContactDown != null)
- EH_NewProject_ContactDown(this, new EventArgs());
+ //Project = new Project(ST_ProjectName.Text, ST_Date.Text, ST_Desc.Text, _User, new Cutting());
+ Cutting = new Cutting(_User.Name, new List<Annotation>());
+ if (EH_NewCutting_ContactDown != null)
+ EH_NewCutting_ContactDown(this, new EventArgs());
}
#endregion
--- a/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs Wed Oct 28 13:46:38 2009 +0100
+++ b/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs Wed Oct 28 17:07:27 2009 +0100
@@ -8,6 +8,7 @@
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using FingersDance.Data;
+using FingersDance.ViewModels;
namespace FingersDance.Control.UserPanel
{
@@ -18,17 +19,27 @@
public event EventHandler OnSuccessAnnotation; //Event to display ColorAnnotation from different Users
public int id = 0;
public uint idcolor = 0; //The color of the Pivot Button
- Project _Project = new Project();
+ //Project _Project = new Project();
+ private CuttingViewModel cutVM;
+
#endregion
#region Properties
- public Project Project
+ public CuttingViewModel CuttingVM
{
- get { return _Project; }
- set { _Project = value; }
+ get { return cutVM; }
+ set { cutVM = value; }
}
#endregion
+ //#region Properties
+ //public Project Project
+ //{
+ // get { return _Project; }
+ // set { _Project = value; }
+ //}
+ //#endregion
+
#region Constructors
public UserControlUserPanel()
{
@@ -37,12 +48,12 @@
// Insert code required on object creation below this point.
}
- public UserControlUserPanel(int idPar, Color col, Project p, string path)
+ public UserControlUserPanel(int idPar, Color col, Cutting cut, string path)
{
this.InitializeComponent();
id = idPar;
- _Project = p;
- this.UserControlSyncSource.Load(path, col, _Project.Cutting);
+ //_Project = p;
+ this.UserControlSyncSource.Load(path, col, cut);
UserControlSyncSource.OnSuccessAnnotation+=new EventHandler(UserControlSyncSource_OnSuccessAnnotation);
}
#endregion
--- a/src/FingersDance.Data/Annotation.cs Wed Oct 28 13:46:38 2009 +0100
+++ b/src/FingersDance.Data/Annotation.cs Wed Oct 28 17:07:27 2009 +0100
@@ -6,36 +6,6 @@
namespace FingersDance.Data
{
- public class AnnotationAddedEventArg : EventArgs
- {
- private float _tcBegin;
- private float _dur;
- private String _gestureType;
-
- public float TcBegin
- {
- get { return this._tcBegin; }
- }
- public float Dur
- {
- get { return this._dur; }
- }
- public String GestureType
- {
- get { return this._gestureType; }
- }
-
- public AnnotationAddedEventArg(float tcBegin, float dur, String gestureType)
- {
-
- this._tcBegin = tcBegin;
- this._dur = dur;
- this._gestureType = gestureType;
-
- }
-
- }
-
public class Annotation
{
private float _tcBegin;
@@ -43,17 +13,12 @@
private string _gestureType;
private Color _color;
- //public event EventHandler<AnnotationAddedEventArg> AnnotationAdded;
-
public Annotation(float tcBeginPar, float durPar, string gesturePar, Color colorPar)
{
this._tcBegin = tcBeginPar;
this._dur = durPar;
this._gestureType = gesturePar;
this._color = colorPar;
-
- //AnnotationAdded(this, new AnnotationAddedEventArg(_tcBegin, _dur, _gestureType));
-
}
public float TcBegin
--- a/src/FingersDance.Data/Project.cs Wed Oct 28 13:46:38 2009 +0100
+++ b/src/FingersDance.Data/Project.cs Wed Oct 28 17:07:27 2009 +0100
@@ -9,27 +9,38 @@
public class Project
{
private string _name = "";
- private string _date = "";
+ private string _date = DateTime.Now.ToString();
private string _description = "";
- private User _user = new User();
- private Cutting _cutting = new Cutting();
+ private String _videoname = "";
+ private String _videopath = "";
+
+ //private User _user = new User();
+ //private Cutting _cutting = new Cutting();
+ private List<Cutting> _cuttings = new List<Cutting>();
+
#region Constructor
- public Project(string name, string date, string desc, User u, Cutting c)
+ public Project(string videoName, string videoPath)
+ {
+ _videoname = videoName;
+ _videopath = videoPath;
+ }
+
+ public Project(string name, string date, string desc)
{
_date = date;
_description = desc;
_name = name;
- _user = u;
- _cutting = c;
+ //_user = u;
+ //_cutting = c;
}
- public Project(User u, Cutting c)
- {
- _user = u;
- _cutting = c;
- }
+ //public Project(User u, Cutting c)
+ //{
+ // _user = u;
+ // _cutting = c;
+ //}
public Project()
{}
@@ -56,16 +67,28 @@
set { _description = value; }
}
- public User User
+ public String VideoPath
{
- get { return _user; }
- set { _user = value; }
+ get { return _videopath; }
+ set { _videopath = value; }
}
- public Cutting Cutting
+ //public User User
+ //{
+ // get { return _user; }
+ // set { _user = value; }
+ //}
+
+ //public Cutting Cutting
+ //{
+ // get { return _cutting; }
+ // set { _cutting = value; }
+ //}
+
+ public List<Cutting> Cuttings
{
- get { return _cutting; }
- set { _cutting = value; }
+ get { return _cuttings; }
+ set { _cuttings = value; }
}
#endregion
--- a/src/FingersDance.ViewModel/AnnotationViewModel.cs Wed Oct 28 13:46:38 2009 +0100
+++ b/src/FingersDance.ViewModel/AnnotationViewModel.cs Wed Oct 28 17:07:27 2009 +0100
@@ -10,74 +10,67 @@
{
public class AnnotationViewModel : ViewModelBase
{
- private float _tcBegin;
- private float _dur;
- private String _gestureType;
- private Color _color;
+ readonly Annotation a;
private float _marginLeft;
private Double _scaleX = 1;
- public AnnotationViewModel(Annotation a, float marginLeft, Double scaleX)
+ public AnnotationViewModel(Annotation aPar, float marginLeft, Double scaleX)
{
- this._tcBegin = a.TcBegin;
- this._dur = a.Dur;
- this._gestureType = a.GestureType;
- this._color = a.Color;
+ a = aPar;
+
this._marginLeft = marginLeft;
this._marginLeft = marginLeft;
this._scaleX = scaleX;
}
- public AnnotationViewModel(Annotation a, float marginLeft)
+ public AnnotationViewModel(Annotation aPar, float marginLeft)
{
- this._tcBegin = a.TcBegin;
- this._dur = a.Dur;
- this._gestureType = a.GestureType;
- this._color = a.Color;
+ a = aPar;
+
this._marginLeft = marginLeft;
}
public float TcBegin
{
- get { return _tcBegin; }
+ get { return a.TcBegin; }
set
{
- if (value == _tcBegin || float.IsNaN(value))
+ if (value == a.TcBegin || float.IsNaN(value))
return;
- _tcBegin = value;
+ a.TcBegin = value;
base.OnPropertyChanged("TcBegin");
}
}
public float Dur
{
- get { return _dur; }
+ get { return a.Dur; }
set
{
- if (value == _dur || float.IsNaN(value))
+ if (value == a.Dur || float.IsNaN(value))
return;
- _dur = value;
+ a.Dur = value;
base.OnPropertyChanged("Dur");
}
}
public String GestureType
{
- get { return _gestureType; }
+ get { return a.GestureType; }
set
{
- if (value == _gestureType || String.IsNullOrEmpty(value))
+ if (value == a.GestureType || String.IsNullOrEmpty(value))
return;
- _gestureType = value;
+ a.GestureType = value;
base.OnPropertyChanged("GestureType");
}
}
public Color Color
{
- get { return _color; }
+ get { return a.Color; }
set
{
- if (value == _color)
+ if (value == a.Color)
return;
- _color = value;
+ a.Color = value;
}
}
public float MarginLeft
--- a/src/FingersDance.ViewModel/CuttingViewModel.cs Wed Oct 28 13:46:38 2009 +0100
+++ b/src/FingersDance.ViewModel/CuttingViewModel.cs Wed Oct 28 17:07:27 2009 +0100
@@ -9,12 +9,13 @@
{
public class CuttingViewModel : ViewModelBase
{
- private string _title;
+ private Cutting cut;
+
private List<AnnotationViewModel> _annotList = new List<AnnotationViewModel>();
public CuttingViewModel(Cutting c, float annotWidth) {
- this._title = c.Title;
+ cut = c;
this._annotList = new List<AnnotationViewModel>();
int i = 0;
foreach (Annotation annot in c.AnnotList)
@@ -25,14 +26,24 @@
}
+ public Cutting Cutting
+ {
+ get { return cut; }
+ set
+ {
+ cut = value;
+ base.OnPropertyChanged("Cutting");
+ }
+ }
+
public String Title
{
- get { return _title; }
+ get { return cut.Title; }
set
{
- if (value == _title || String.IsNullOrEmpty(value))
+ if (value == cut.Title || String.IsNullOrEmpty(value))
return;
- _title = value;
+ cut.Title = value;
base.OnPropertyChanged("Title");
}
}
--- a/src/FingersDance.ViewModel/MainViewModel.cs Wed Oct 28 13:46:38 2009 +0100
+++ b/src/FingersDance.ViewModel/MainViewModel.cs Wed Oct 28 17:07:27 2009 +0100
@@ -13,43 +13,55 @@
#region Attributes
public Dictionary<String, UserViewModel> Users = new Dictionary<string,UserViewModel>();
- public SessionViewModel Session = new SessionViewModel();
+ //public SessionViewModel Session = new SessionViewModel();
+ public ProjectViewModel Project = new ProjectViewModel();
#endregion
#region Methods
- public Project CreateProject(User u)
+ public void CreateProject(string videoName, string videoPath)
{
- if (Users.ContainsKey(u.Email))
- {
- if (Session.Projects.ContainsKey(u.Email))
- return Session.Projects[u.Email];
- else
- {
- Project p = new Project(u, new Cutting());
- Session.Projects.Add(u.Email, p);
- return p;
- }
- }
- else
- {
- AddUser(u);
- Project p = new Project(u, new Cutting());
- Session.Projects.Add(u.Email, p);
- return p;
- }
+ Project = new ProjectViewModel(new Project(videoName, videoPath));
}
- public void CreateSession(string name, string path)
- {
- Session = new SessionViewModel(new Session(name, path));
- }
+ //public Project CreateProject(User u)
+ //{
+ // if (Users.ContainsKey(u.Email))
+ // {
+ // if (Project.CuttingsDict.ContainsKey(u.Email))
+ // return Project.CuttingsDict[u.Email];
+ // else
+ // {
+ // Project p = new Project(u, new Cutting());
+ // Session.Projects.Add(u.Email, p);
+ // return p;
+ // }
+ // }
+ // else
+ // {
+ // AddUser(u);
+ // Project p = new Project(u, new Cutting());
+ // Session.Projects.Add(u.Email, p);
+ // return p;
+ // }
+ //}
- public void CloseSession()
+ //public void CreateSession(string name, string path)
+ //{
+ // Session = new SessionViewModel(new Session(name, path));
+ //}
+
+ //public void CloseSession()
+ //{
+ // Session = null;
+ // Session = new SessionViewModel();
+ //}
+
+ public void CloseProject()
{
- Session = null;
- Session = new SessionViewModel();
+ Project = null;
+ Project = new ProjectViewModel();
}
private void AddUser(User u)
--- a/src/FingersDance.ViewModel/ProjectViewModel.cs Wed Oct 28 13:46:38 2009 +0100
+++ b/src/FingersDance.ViewModel/ProjectViewModel.cs Wed Oct 28 17:07:27 2009 +0100
@@ -8,7 +8,9 @@
{
public class ProjectViewModel : ViewModelBase
{
- readonly Project project = new Project();
+ private Project project = new Project();
+
+ private Dictionary<String, Cutting> _cuttingsDict = new Dictionary<string,Cutting>();
#region Constructor
@@ -26,6 +28,7 @@
public Project Project
{
get { return project; }
+ set { project = value; }
}
public string Date
@@ -46,16 +49,28 @@
set { project.Description = value; }
}
- public User User
+ public String VideoPath
{
- get { return project.User; }
- set { project.User = value; }
+ get { return project.VideoPath; }
+ set { project.VideoPath = value; }
}
- public Cutting Cutting
+ //public User User
+ //{
+ // get { return project.User; }
+ // set { project.User = value; }
+ //}
+
+ public List<Cutting> Cuttings
{
- get { return project.Cutting; }
- set { project.Cutting = value; }
+ get { return project.Cuttings; }
+ set { project.Cuttings = value; }
+ }
+
+ public Dictionary<String, Cutting> CuttingsDict
+ {
+ get { return _cuttingsDict; }
+ set { _cuttingsDict = value; }
}
#endregion
--- a/src/FingersDance/MainSurfaceWindow.xaml.cs Wed Oct 28 13:46:38 2009 +0100
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs Wed Oct 28 17:07:27 2009 +0100
@@ -291,7 +291,7 @@
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.Name.Equals("") && (Grid1.Children.Count == 2 || Grid2.Children.Count == 2 || Grid3.Children.Count == 2 || Grid4.Children.Count == 2))
+ if (_mainviewmodel.Project.Name.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
@@ -307,7 +307,7 @@
//2-Rajout du screen dans la grid correspondante
Grid1.Children.Add(Screen);
- Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
+ Screen.UC_Screen_NewCutting += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
}
else //Affichage du message de confirmation
{
@@ -330,7 +330,7 @@
//2-Rajout du screen dans la grid correspondante
Grid2.Children.Add(Screen);
- Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
+ Screen.UC_Screen_NewCutting += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
}
else //Affichage du message de confirmation
{
@@ -353,7 +353,7 @@
//2-Rajout du screen dans la grid correspondante
Grid3.Children.Add(Screen);
- Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
+ Screen.UC_Screen_NewCutting += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
}
else //Affichage du message de confirmation
{
@@ -376,7 +376,7 @@
//2-Rajout du screen dans la grid correspondante
Grid4.Children.Add(Screen);
- Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
+ Screen.UC_Screen_NewCutting += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
}
else //Affichage du message de confirmation
{
@@ -405,12 +405,12 @@
Grid root = (Grid)(((UserControlScreen)sender).Parent);
root.Children.Remove(((UserControlScreen)sender));
- if (((UserControlScreen)sender).Project != null)
+ if (((UserControlScreen)sender).Cutting != null)
{
//2-Creation du User Panel
- Project newProject = ((UserControlScreen)sender).Project.Project;
+ CuttingViewModel newCuttingVM = ((UserControlScreen)sender).Cutting;
- 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)))
+ if ((Panel1 != null && Panel1.CuttingVM.Equals(newCuttingVM)) || (Panel2 != null && Panel2.CuttingVM.Equals(newCuttingVM)) || (Panel3 != null && Panel3.CuttingVM.Equals(newCuttingVM)) || (Panel4 != null && Panel4.CuttingVM.Equals(newCuttingVM)))
return;
Random c = new Random();
@@ -419,7 +419,7 @@
{
case 1:
UserControlPivot.ApplyColor(1, color);
- Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath);
+ Panel1 = new UserControlUserPanel(1, (new ColorFactory()).Colors[color], newCuttingVM.Cutting, _mainviewmodel.Project.VideoPath);
Panel1.Name = "UserPanel1";
Panel1.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
Panel1.idcolor = color;
@@ -428,7 +428,7 @@
break;
case 2:
UserControlPivot.ApplyColor(2, color);
- Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath);
+ Panel2 = new UserControlUserPanel(2, (new ColorFactory()).Colors[color], newCuttingVM.Cutting, _mainviewmodel.Project.VideoPath);
Panel2.Name = "UserPanel2";
Panel2.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
Panel2.idcolor = color;
@@ -437,7 +437,7 @@
break;
case 3:
UserControlPivot.ApplyColor(3, color);
- Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath);
+ Panel3 = new UserControlUserPanel(3, (new ColorFactory()).Colors[color], newCuttingVM.Cutting, _mainviewmodel.Project.VideoPath);
Panel3.Name = "UserPanel3";
Panel3.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
Panel3.idcolor = color;
@@ -446,7 +446,7 @@
break;
case 4:
UserControlPivot.ApplyColor(4, color);
- Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newProject, _mainviewmodel.Session.VideoPath);
+ Panel4 = new UserControlUserPanel(4, (new ColorFactory()).Colors[color], newCuttingVM.Cutting, _mainviewmodel.Project.VideoPath);
Panel4.Name = "UserPanel4";
Panel4.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
Panel4.idcolor = color;
@@ -491,7 +491,7 @@
}
root.Children.Remove(((UserControlClose)sender));
if (Panel1 == null && Panel2 == null && Panel3 == null && Panel4 == null)
- _mainviewmodel.CloseSession();
+ _mainviewmodel.CloseProject();
}