src/FingersDance/MainSurfaceWindow.xaml.cs
author cavaliet
Tue, 24 Nov 2009 22:08:57 +0100
changeset 229 05aba5def1fc
parent 225 b60e13ed75c8
child 230 010a2af88bb7
permissions -rw-r--r--
add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
     1
using System;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
     2
using System.Collections.Generic;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
     3
using System.Linq;
191
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
     4
using System.Xml;
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
     5
using System.Xml.Linq;
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
     6
using System.Text;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
     7
using System.Windows;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
     8
using System.Windows.Controls;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
     9
using System.Windows.Data;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    10
using System.Windows.Documents;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    11
using System.Windows.Input;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    12
using System.Windows.Media;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    13
using System.Windows.Media.Imaging;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    14
using System.Windows.Shapes;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    15
using System.Windows.Threading;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    16
using Microsoft.Surface;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    17
using Microsoft.Surface.Presentation;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    18
using Microsoft.Surface.Presentation.Controls;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    19
60
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
    20
using FingersDance.Control.UserPanel;
82
c37122b567fa Work ControlScreen
sarias
parents: 77
diff changeset
    21
using FingersDance.Control.Screen;
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
    22
using FingersDance.Control.Close;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
    23
using FingersDance.ViewModels;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
    24
using FingersDance.Data;
156
e16c8c913c65 Color Factory et application des couleurs au pivot
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 152
diff changeset
    25
using FingersDance.Factory;
60
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
    26
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    27
namespace FingersDance
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    28
{
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    29
    /// <summary>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    30
    /// Interaction logic for SurfaceWindow1.xaml
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    31
    /// </summary>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    32
    public partial class SurfaceWindow1 : SurfaceWindow
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    33
    {
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    34
        /// <summary>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    35
        /// Default constructor.
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    36
        /// </summary>
54
c724ac229181 Singleton de la factory
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 45
diff changeset
    37
        /// 
60
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
    38
        #region Variables
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
    39
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
    40
        private UserControlUserPanel Panel1 = null;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
    41
        private UserControlUserPanel Panel2 = null;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
    42
        private UserControlUserPanel Panel3 = null;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
    43
        private UserControlUserPanel Panel4 = null;
156
e16c8c913c65 Color Factory et application des couleurs au pivot
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 152
diff changeset
    44
        ActionGenerator _Factory = (new ActionFactory()).GetGenerator();
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    45
        private MainViewModel _mainviewmodel = new MainViewModel();
60
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
    46
        #endregion
54
c724ac229181 Singleton de la factory
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 45
diff changeset
    47
c724ac229181 Singleton de la factory
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 45
diff changeset
    48
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
    49
        #region Constructor
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    50
        public SurfaceWindow1()
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    51
        {
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    52
            InitializeComponent();
60
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
    53
            //Permet d'initialiser l'inertie du Pivot une fois relach�.
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
    54
            InitPivotInertia();
58
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    55
            //Permet d'initialiser les quand Grid � la position initiale du pivot
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    56
            InitGridPositions();
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    57
            // Add handlers for Application activation events
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    58
            AddActivationHandlers();
217
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
    59
            // Add credit text
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
    60
            CreditsText1.Text = CreditsText2.Text = CreditsText3.Text = CreditsText4.Text =
225
b60e13ed75c8 Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
cavaliet
parents: 224
diff changeset
    61
                "MICROSOFT :\nPierre-Louis Xech\n\nEFREI :\nSantiago Arias\nRiley Ikni\nJonathan Pamphile\n\nSTRATE COLLEGE :\nAnnabelle Eug�nia\nHuieun Kim\nBaptiste Lanne\nIoana Ocnarescu\nVanessa Reiser\nDominique Sciamma\n\nINSTITUT DE RECHERCHE ET D'INNOVATION\nThibaut Cavali�\nYves-Marie Haussonne\nVincent Puig";
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    62
        }
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
    63
        #endregion
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
    64
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
    65
        #region Initialization
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    66
60
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
    67
        private void InitPivotInertia()
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
    68
        {
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
    69
            try
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
    70
            {
77
e95e916eb018 Travail sur le Pivot et le control Session Input
sarias
parents: 73
diff changeset
    71
                ScatterViewItem item = (ScatterViewItem)scaterview.Items.GetItemAt(0);
60
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
    72
                item.DecelerationRate = double.NaN;
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
    73
            }
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
    74
            catch (Exception ex) { }
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
    75
        }
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
    76
58
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    77
        private void InitGridPositions()
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    78
        {
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    79
            //Initialise les 4 Grids � la positions initiale du Pivot.   
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    80
            try
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    81
            {
77
e95e916eb018 Travail sur le Pivot et le control Session Input
sarias
parents: 73
diff changeset
    82
                ScatterViewItem item = (ScatterViewItem)scaterview.Items.GetItemAt(0);
58
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    83
                Grid1.Width =item.Center.X;
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    84
                Grid1.Height = item.Center.Y;
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    85
                
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    86
                Grid2.Width = item.Center.X;
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    87
                Grid2.Height = 768 - item.Center.Y;
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    88
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    89
                Grid3.Width = 1024 - item.Center.X;
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    90
                Grid3.Height = 768 - item.Center.Y;
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    91
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    92
                Grid4.Width = 1024 - item.Center.X;
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    93
                Grid4.Height = item.Center.Y;
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    94
            }
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    95
            catch (Exception ex) { }
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    96
        }
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
    97
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
    98
        #endregion
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
    99
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   100
        #region Application Default Functions
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   101
        /// <summary>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   102
        /// Occurs when the window is about to close. 
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   103
        /// </summary>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   104
        /// <param name="e"></param>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   105
        protected override void OnClosed(EventArgs e)
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   106
        {
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   107
            base.OnClosed(e);
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   108
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   109
            // Remove handlers for Application activation events
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   110
            RemoveActivationHandlers();
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   111
        }
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   112
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   113
        /// <summary>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   114
        /// Adds handlers for Application activation events.
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   115
        /// </summary>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   116
        private void AddActivationHandlers()
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   117
        {
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   118
            // Subscribe to surface application activation events
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   119
            ApplicationLauncher.ApplicationActivated += OnApplicationActivated;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   120
            ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   121
            ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   122
        }
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   123
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   124
        /// <summary>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   125
        /// Removes handlers for Application activation events.
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   126
        /// </summary>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   127
        private void RemoveActivationHandlers()
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   128
        {
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   129
            // Unsubscribe from surface application activation events
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   130
            ApplicationLauncher.ApplicationActivated -= OnApplicationActivated;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   131
            ApplicationLauncher.ApplicationPreviewed -= OnApplicationPreviewed;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   132
            ApplicationLauncher.ApplicationDeactivated -= OnApplicationDeactivated;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   133
        }
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   134
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   135
        /// <summary>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   136
        /// This is called when application has been activated.
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   137
        /// </summary>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   138
        /// <param name="sender"></param>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   139
        /// <param name="e"></param>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   140
        private void OnApplicationActivated(object sender, EventArgs e)
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   141
        {
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   142
            //TODO: enable audio, animations here
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   143
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   144
        }
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   145
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   146
        /// <summary>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   147
        /// This is called when application is in preview mode.
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   148
        /// </summary>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   149
        /// <param name="sender"></param>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   150
        /// <param name="e"></param>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   151
        private void OnApplicationPreviewed(object sender, EventArgs e)
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   152
        {
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   153
            //TODO: Disable audio here if it is enabled
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   154
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   155
            //TODO: optionally enable animations here
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   156
        }
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   157
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   158
        /// <summary>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   159
        ///  This is called when application has been deactivated.
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   160
        /// </summary>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   161
        /// <param name="sender"></param>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   162
        /// <param name="e"></param>
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   163
        private void OnApplicationDeactivated(object sender, EventArgs e)
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   164
        {
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   165
            //TODO: disable audio, animations here
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   166
        }
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   167
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   168
        /// <summary>
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   169
        ///  This is called when application has been loaded, we change the orientation
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   170
        ///  of the application
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   171
        /// </summary>
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   172
        /// <param name="sender"></param>
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   173
        /// <param name="e"></param>
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   174
        private void mainSurfaceWindow_Loaded(object sender, RoutedEventArgs e)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   175
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   176
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   177
            if (ApplicationLauncher.InitialOrientation == UserOrientation.Top)
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   178
            {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   179
                // Rotate the main canvas by 180 degrees.
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   180
                this.MainGrid.LayoutTransform = new RotateTransform(180.0);
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   181
            }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   182
            else
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   183
            {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   184
                // Remove the rotate transform on the main canvas.
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   185
                this.MainGrid.LayoutTransform = null;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   186
            }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   187
            // Dismiss the loading screen.
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   188
            ApplicationLauncher.SignalApplicationLoadComplete();
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   189
        }
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   190
        #endregion
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   191
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   192
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   193
        
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   194
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   195
        #region Pivot Actions
77
e95e916eb018 Travail sur le Pivot et le control Session Input
sarias
parents: 73
diff changeset
   196
        private void scaterview_ContactChanged(object sender, ContactEventArgs e)
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   197
        { }
77
e95e916eb018 Travail sur le Pivot et le control Session Input
sarias
parents: 73
diff changeset
   198
        private void ScatterViewItemPivot_ContactChanged(object sender, ContactEventArgs e)
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   199
        {
58
d7313fb1806c Initialisation de la position du Pivot au centre et des positions des 4 Grids
sarias
parents: 54
diff changeset
   200
            //Permet la MAJ des 4 Grids � la position du pivot
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   201
            try
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   202
            {
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   203
                Grid1.Width = e.GetPosition(mainSurfaceWindow).X;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   204
                Grid1.Height = e.GetPosition(mainSurfaceWindow).Y;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   205
60
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
   206
                Grid3.Width = e.GetPosition(mainSurfaceWindow).X;
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   207
                Grid3.Height = 768 - e.GetPosition(mainSurfaceWindow).Y;
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   208
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   209
                Grid4.Width = 1024 - e.GetPosition(mainSurfaceWindow).X;
60
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
   210
                Grid4.Height = 768 - e.GetPosition(mainSurfaceWindow).Y;
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
   211
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
   212
                Grid2.Width = 1024 - e.GetPosition(mainSurfaceWindow).X;
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
   213
                Grid2.Height = e.GetPosition(mainSurfaceWindow).Y;
89
f9a931434910 Grisage lors du resize.
sarias
parents: 82
diff changeset
   214
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   215
                //GRISAGE
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   216
                //Grid1
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   217
                if (Grid1.Width < (1024 / 4) || Grid2.Height < (768 / 4))
89
f9a931434910 Grisage lors du resize.
sarias
parents: 82
diff changeset
   218
                {
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   219
                    try
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   220
                    {
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   221
                        if (Panel1 != null)
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   222
                        {
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   223
                            Panel1.PlayerPause();
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   224
                            Panel1.PanelVisibility(Visibility.Hidden);
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   225
                        }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   226
                        Grid1.Children[1].Visibility = Visibility.Hidden;
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   227
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   228
                    }
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   229
                    catch (Exception) { }
89
f9a931434910 Grisage lors du resize.
sarias
parents: 82
diff changeset
   230
                }
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   231
                else
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   232
                {
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   233
                    try
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   234
                    { 
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   235
                        Grid1.Children[1].Visibility = Visibility.Visible;
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   236
                        if (Panel1 != null)
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   237
                        {
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   238
                            Panel1.PanelVisibility(Visibility.Visible);
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   239
                        }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   240
                    }
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   241
                    catch (Exception) { }
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   242
                }
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   243
                //Grid2
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   244
                if (Grid2.Width < (1024 / 4) || Grid2.Height < (768 / 4))
89
f9a931434910 Grisage lors du resize.
sarias
parents: 82
diff changeset
   245
                {
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   246
                    try
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   247
                    {
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   248
                        if (Panel2 != null)
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   249
                        {
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   250
                            Panel2.PlayerPause();
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   251
                            Panel2.PanelVisibility(Visibility.Hidden);
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   252
                        }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   253
                        Grid2.Children[1].Visibility = Visibility.Hidden; 
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   254
                    }
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   255
                    catch (Exception) { }
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   256
                }
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   257
                else
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   258
                {
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   259
                    try
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   260
                    {
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   261
                        Grid2.Children[1].Visibility = Visibility.Visible;
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   262
                        if (Panel2 != null)
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   263
                        {
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   264
                            Panel2.PanelVisibility(Visibility.Visible);
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   265
                        }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   266
                    }
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   267
                    catch (Exception) { }
89
f9a931434910 Grisage lors du resize.
sarias
parents: 82
diff changeset
   268
                }
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   269
                //Grid3
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   270
                if (Grid3.Width < (1024 / 4) || Grid3.Height < (768 / 4))
89
f9a931434910 Grisage lors du resize.
sarias
parents: 82
diff changeset
   271
                {
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   272
                    try
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   273
                    {
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   274
                        if (Panel3 != null)
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   275
                        {
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   276
                            Panel3.PlayerPause();
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   277
                            Panel3.PanelVisibility(Visibility.Hidden);
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   278
                        }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   279
                        Grid3.Children[1].Visibility = Visibility.Hidden;
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   280
                    }
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   281
                    catch (Exception) { }
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   282
                }
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   283
                else
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   284
                {
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   285
                    try
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   286
                    {
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   287
                        Grid3.Children[1].Visibility = Visibility.Visible;
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   288
                        if (Panel3 != null)
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   289
                        {
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   290
                            Panel3.PanelVisibility(Visibility.Visible);
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   291
                        }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   292
                    }
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   293
                    catch (Exception) { }
89
f9a931434910 Grisage lors du resize.
sarias
parents: 82
diff changeset
   294
                }
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   295
                //Grid4
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   296
                if (Grid4.Width < (1024 / 4) || Grid4.Height < (768 / 4))
89
f9a931434910 Grisage lors du resize.
sarias
parents: 82
diff changeset
   297
                {
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   298
                    try
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   299
                    {
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   300
                        if (Panel4 != null)
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   301
                        {
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   302
                            Panel4.PlayerPause();
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   303
                            Panel4.PanelVisibility(Visibility.Hidden);
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   304
                        }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   305
                        Grid4.Children[1].Visibility = Visibility.Hidden;
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   306
                    }
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   307
                    catch (Exception) { }
89
f9a931434910 Grisage lors du resize.
sarias
parents: 82
diff changeset
   308
                }
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   309
                else
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   310
                {
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   311
                    try
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   312
                    { 
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   313
                        Grid4.Children[1].Visibility = Visibility.Visible;
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   314
                        if (Panel4 != null)
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   315
                        {
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   316
                            Panel4.PanelVisibility(Visibility.Visible);
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   317
                        }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   318
                    }
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   319
                    catch (Exception) { }
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   320
                }
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   321
            }
91
0f29e2660bb7 grisage sur le les controls
sarias
parents: 89
diff changeset
   322
            catch (Exception) { }
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   323
        }
60
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
   324
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   325
        //SAR
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   326
        private void ScatterViewItemPivot_ContactLeave(object sender, ContactEventArgs e)
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   327
        {
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   328
            //Permet la MAJ des 4 Grids � la position du pivot
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   329
            try
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   330
            {
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   331
                Grid1.Width = e.GetPosition(mainSurfaceWindow).X;
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   332
                Grid1.Height = e.GetPosition(mainSurfaceWindow).Y;
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   333
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   334
                Grid3.Width = e.GetPosition(mainSurfaceWindow).X;
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   335
                Grid3.Height = 768 - e.GetPosition(mainSurfaceWindow).Y;
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   336
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   337
                Grid4.Width = 1024 - e.GetPosition(mainSurfaceWindow).X;
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   338
                Grid4.Height = 768 - e.GetPosition(mainSurfaceWindow).Y;
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   339
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   340
                Grid2.Width = 1024 - e.GetPosition(mainSurfaceWindow).X;
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   341
                Grid2.Height = e.GetPosition(mainSurfaceWindow).Y;
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   342
                ((ScatterViewItem)sender).Center = new Point(e.GetPosition(mainSurfaceWindow).X,e.GetPosition(mainSurfaceWindow).Y);
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   343
            }
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   344
            catch (Exception) { }
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   345
        }
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   346
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   347
        private void UserControlPivot_EH_SurfaceButtonPlayer_ContactDown(object sender, EventArgs e)
60
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
   348
        {
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   349
            //  Traitement du contact down sur le pivot (Cr�ation d'un screen ou suppression d'un panel
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   350
            switch ((int)sender)
60
b4008a356f90 Resolution Inertie du Pivot.
sarias
parents: 58
diff changeset
   351
            {
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   352
                case 1:
217
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   353
                    if (Panel1 == null && Grid1.Children.Count == 3)
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   354
                    {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   355
                        //1-Creation du control Screen
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   356
                        UserControlScreen Screen = new UserControlScreen(1, _mainviewmodel);
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   357
                        Screen.Name = "Screen1";
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   358
                        Screen.contexteGrid = Grid1.Name.ToString();
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   359
                        //2-Rajout du screen dans la grid correspondante
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   360
                        Grid1.Children.Add(Screen);
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   361
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 188
diff changeset
   362
                        Screen.UC_Screen_NewCutting += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown); 
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   363
                    }
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   364
                    else //Affichage du message de confirmation
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   365
                    {
217
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   366
                        if (Panel1 != null && Grid1.Children.Count == 4)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   367
                        {
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 139
diff changeset
   368
                            UserControlClose UCclose = new UserControlClose(1, "�tes-vous s�r de vouloir quitter ?");
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   369
                            UCclose.Name = "CloseAlert1";
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   370
                            Grid1.Children.Add(UCclose);
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 139
diff changeset
   371
                            UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   372
                        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   373
                    }
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   374
                    break;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   375
                case 2:
217
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   376
                    if (Panel2 == null && Grid2.Children.Count == 3)
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   377
                    {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   378
                        //1-Creation du control Screen
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   379
                        UserControlScreen Screen = new UserControlScreen(2, _mainviewmodel);
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   380
                        Screen.Name = "Screen2";
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   381
                        Screen.contexteGrid = Grid2.Name.ToString();
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   382
                        //2-Rajout du screen dans la grid correspondante
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   383
                        Grid2.Children.Add(Screen);
72
f1ca0958c992 Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents: 60
diff changeset
   384
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: 168
diff changeset
   385
                        Screen.UC_Screen_NewCutting += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   386
                    }
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   387
                    else //Affichage du message de confirmation
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   388
                    {
217
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   389
                        if (Panel2 != null && Grid2.Children.Count == 4)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   390
                        {
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 139
diff changeset
   391
                            UserControlClose UCclose = new UserControlClose(2, "�tes-vous s�r de vouloir quitter ?");
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   392
                            UCclose.Name = "CloseAlert2";
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   393
                            Grid2.Children.Add(UCclose);
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 139
diff changeset
   394
                            UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   395
                        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   396
                    }
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   397
                    break;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   398
                case 3:
217
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   399
                    if (Panel3 == null && Grid3.Children.Count == 3)
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   400
                    {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   401
                        //1-Creation du control Screen
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   402
                        UserControlScreen Screen = new UserControlScreen(3, _mainviewmodel);
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   403
                        Screen.Name = "Screen3";
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   404
                        Screen.contexteGrid = Grid3.Name.ToString();
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   405
                        //2-Rajout du screen dans la grid correspondante
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   406
                        Grid3.Children.Add(Screen);
72
f1ca0958c992 Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents: 60
diff changeset
   407
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: 168
diff changeset
   408
                        Screen.UC_Screen_NewCutting += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   409
                    }
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   410
                    else //Affichage du message de confirmation
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   411
                    {
217
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   412
                        if (Panel3 != null && Grid3.Children.Count == 4)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   413
                        {
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 139
diff changeset
   414
                            UserControlClose UCclose = new UserControlClose(3, "�tes-vous s�r de vouloir quitter ?");
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   415
                            UCclose.Name = "CloseAlert3";
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   416
                            Grid3.Children.Add(UCclose);
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 139
diff changeset
   417
                            UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   418
                        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   419
                    }
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   420
                    break;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   421
                case 4:
217
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   422
                    if (Panel4 == null && Grid4.Children.Count == 3)
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   423
                    {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   424
                        //1-Creation du control Screen
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   425
                        UserControlScreen Screen = new UserControlScreen(4, _mainviewmodel);
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   426
                        Screen.Name = "Screen4";
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   427
                        Screen.contexteGrid = Grid4.Name.ToString();
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   428
                        //2-Rajout du screen dans la grid correspondante
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   429
                        Grid4.Children.Add(Screen);
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   430
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: 168
diff changeset
   431
                        Screen.UC_Screen_NewCutting += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   432
                    }
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   433
                    else //Affichage du message de confirmation
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   434
                    {
217
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   435
                        if (Panel4 != null && Grid4.Children.Count == 4)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   436
                        {
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 139
diff changeset
   437
                            UserControlClose UCclose = new UserControlClose(4, "�tes-vous s�r de vouloir quitter ?");
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   438
                            UCclose.Name = "CloseAlert4";
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   439
                            Grid4.Children.Add(UCclose);
140
fc7c12f9da30 Add a confirm dialog box before deleting an annotation by drag and drop. Now the UserControlClose is a generic confirm dialog box sending a ConfirmYesOrNo Event.
cavaliet
parents: 139
diff changeset
   440
                            UCclose.ConfirmYesOrNo += new EventHandler<ConfirmEventArgs>(CloseAlert_EH_SurfaceButton_ContactDown);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   441
                        }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   442
                    }
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   443
                    break;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   444
            }
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   445
73
bda95242e600 Travail sur Enchainement New Session --> UserPanel.
sarias
parents: 72
diff changeset
   446
        }
72
f1ca0958c992 Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents: 60
diff changeset
   447
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   448
        #endregion
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   449
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   450
73
bda95242e600 Travail sur Enchainement New Session --> UserPanel.
sarias
parents: 72
diff changeset
   451
        //Button Submit du control SessionInput
bda95242e600 Travail sur Enchainement New Session --> UserPanel.
sarias
parents: 72
diff changeset
   452
        private void SessionInput_EH_SurfaceButtonSubmit_ContactDown(object sender, EventArgs e)
bda95242e600 Travail sur Enchainement New Session --> UserPanel.
sarias
parents: 72
diff changeset
   453
        {
bda95242e600 Travail sur Enchainement New Session --> UserPanel.
sarias
parents: 72
diff changeset
   454
            try
bda95242e600 Travail sur Enchainement New Session --> UserPanel.
sarias
parents: 72
diff changeset
   455
            {
191
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   456
                // We get UserControlScreen's instance and content
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 97
diff changeset
   457
                Grid root = (Grid)(((UserControlScreen)sender).Parent);
191
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   458
                // We remove the UserControlScreen's instance
104
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 97
diff changeset
   459
                root.Children.Remove(((UserControlScreen)sender));
211
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 195
diff changeset
   460
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 195
diff changeset
   461
                if ((((UserControlScreen)sender).Cutting != null && ((UserControlScreen)sender).AnnotationOrSearchMode == "Annotation") || (((UserControlScreen)sender).AnnotationOrSearchMode == "Search"))
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   462
                {
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   463
                    //2-Creation du User Panel
190
619ca3ae13c7 MainViewModel is now well linked to all the users'cuttings. At any moment, the MVM has all annotations. This step prepares data saving.
cavaliet
parents: 188
diff changeset
   464
                    Cutting newCutting = ((UserControlScreen)sender).Cutting;
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   465
                    uint UintIdColor = 0;
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   466
186
83615722dbab Debug data management for others panels to redisplay.
cavaliet
parents: 182
diff changeset
   467
                    // We test if each Panel does not already own the sent cuttingVM
211
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 195
diff changeset
   468
                    if (((UserControlScreen)sender).Cutting != null && ((UserControlScreen)sender).AnnotationOrSearchMode == "Annotation")
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 195
diff changeset
   469
                    {
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 195
diff changeset
   470
                        if (Panel1 != null)
214
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   471
                            if (Panel1.Cutting != null)
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   472
                                if (Panel1.Cutting.Title==newCutting.Title)
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   473
                                    return;
211
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 195
diff changeset
   474
                        if (Panel2 != null)
214
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   475
                            if (Panel2.Cutting != null)
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   476
                                if (Panel2.Cutting.Title == newCutting.Title)
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   477
                                    return;
211
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 195
diff changeset
   478
                        if (Panel3 != null)
214
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   479
                            if (Panel3.Cutting != null)
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   480
                                if (Panel3.Cutting.Title == newCutting.Title)
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   481
                                    return;
211
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 195
diff changeset
   482
                        if (Panel4 != null)
214
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   483
                            if (Panel4.Cutting != null)
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   484
                                if (Panel4.Cutting.Title == newCutting.Title)
beebae32b1ed third step of search : better integration of search panel and debug from loaded search project and annotated project.
cavaliet
parents: 211
diff changeset
   485
                                    return;
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   486
211
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 195
diff changeset
   487
                        // We add the new cutting to the _mainviewmodel's datas IF THE CUTTING IS NEW (if not it means that it is from a loaded project)
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 195
diff changeset
   488
                        if (!_mainviewmodel.Project.CuttingsDict.ContainsKey(newCutting.Title))
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 195
diff changeset
   489
                        {
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 195
diff changeset
   490
                            _mainviewmodel.Project.Cuttings.Add(newCutting);
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 195
diff changeset
   491
                            _mainviewmodel.Project.CuttingsDict.Add(newCutting.Title, newCutting);
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   492
                            // In this case, we have to find a new color in the available ones.
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   493
                            KeyValuePair<uint,Color> kvp = ColorFactory.getAvailablePairUintColor();
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   494
                            newCutting.Color = kvp.Value;
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   495
                            UintIdColor = kvp.Key;
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   496
                            // Now we can take off this new color from the available colors
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   497
                            ColorFactory.TakeOffColor(kvp.Value);
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   498
                        }
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   499
                        else{
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   500
                            // If the color 
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   501
                            UintIdColor = ColorFactory.getId(newCutting.Color);
211
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 195
diff changeset
   502
                        }
192
11083c390ce4 Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents: 191
diff changeset
   503
                    }
186
83615722dbab Debug data management for others panels to redisplay.
cavaliet
parents: 182
diff changeset
   504
                    // And now we build the new UserPanel
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   505
                    switch (((UserControlScreen)sender).id)
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   506
                    {
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   507
                        case 1:
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   508
                            UserControlPivot.ApplyColor(1, UintIdColor);
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   509
                            Panel1 = new UserControlUserPanel(1, newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject);
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   510
                            Panel1.Name = "UserPanel1";
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   511
                            Panel1.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
188
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   512
                            Panel1.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   513
                            Panel1.idcolor = UintIdColor;
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   514
                            //3-Rajout sur la Grid Root
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   515
                            root.Children.Add(Panel1);
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   516
                            break;
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   517
                        case 2:
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   518
                            UserControlPivot.ApplyColor(2, UintIdColor);
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   519
                            Panel2 = new UserControlUserPanel(2, newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject);
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   520
                            Panel2.Name = "UserPanel2";
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   521
                            Panel2.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
188
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   522
                            Panel2.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   523
                            Panel2.idcolor = UintIdColor;
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   524
                            //3-Rajout sur la Grid Root
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   525
                            root.Children.Add(Panel2);
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   526
                            break;
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   527
                        case 3:
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   528
                            UserControlPivot.ApplyColor(3, UintIdColor);
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   529
                            Panel3 = new UserControlUserPanel(3, newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject);
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   530
                            Panel3.Name = "UserPanel3";
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   531
                            Panel3.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
188
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   532
                            Panel3.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   533
                            Panel3.idcolor = UintIdColor;
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   534
                            //3-Rajout sur la Grid Root
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   535
                            root.Children.Add(Panel3);
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   536
                            break;
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   537
                        case 4:
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   538
                            UserControlPivot.ApplyColor(4, UintIdColor);
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   539
                            Panel4 = new UserControlUserPanel(4, newCutting, _mainviewmodel.Project.VideoPath, ((UserControlScreen)sender).AnnotationOrSearchMode, ((UserControlScreen)sender).SearchedProject);
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   540
                            Panel4.Name = "UserPanel4";
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   541
                            Panel4.OnSuccessAnnotation += new EventHandler(Panel_OnSuccessAnnotation);
188
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   542
                            Panel4.OnTagVisualisation += new EventHandler(Panel_OnTagVisualisation);
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   543
                            Panel4.idcolor = UintIdColor;
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   544
                            //3-Rajout sur la Grid Root
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   545
                            root.Children.Add(Panel4);
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   546
                            break;
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   547
                    }
112
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 104
diff changeset
   548
                }
73
bda95242e600 Travail sur Enchainement New Session --> UserPanel.
sarias
parents: 72
diff changeset
   549
            }
bda95242e600 Travail sur Enchainement New Session --> UserPanel.
sarias
parents: 72
diff changeset
   550
            catch (Exception ex) { }
72
f1ca0958c992 Travail sur le control List Video et comunication entre ListVideo et FingersDance
sarias
parents: 60
diff changeset
   551
        }
73
bda95242e600 Travail sur Enchainement New Session --> UserPanel.
sarias
parents: 72
diff changeset
   552
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   553
        //Actions du boutton Alert selon l'action close OK ou NON
141
923687896770 UserControlClose more readable and MainSurfaceWindow now uses the ConfirmYesOrNo event.
cavaliet
parents: 140
diff changeset
   554
        private void CloseAlert_EH_SurfaceButton_ContactDown(object sender, ConfirmEventArgs e)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   555
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   556
            Grid root = (Grid)(((UserControlClose)sender).Parent);
141
923687896770 UserControlClose more readable and MainSurfaceWindow now uses the ConfirmYesOrNo event.
cavaliet
parents: 140
diff changeset
   557
            if(e.Confirmed==true)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   558
            {
141
923687896770 UserControlClose more readable and MainSurfaceWindow now uses the ConfirmYesOrNo event.
cavaliet
parents: 140
diff changeset
   559
                switch(e.PanelNumber)
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   560
                {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   561
                    case 1:
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: 156
diff changeset
   562
                        UserControlPivot.ApplyColor(1, 0);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   563
                        root.Children.Remove(Panel1);
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   564
                        Panel1.PanelClose();
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   565
                        Panel1 = null;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   566
                        break;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   567
                    case 2:
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: 156
diff changeset
   568
                        UserControlPivot.ApplyColor(2, 0);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   569
                        root.Children.Remove(Panel2);
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   570
                        Panel2.PanelClose();
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   571
                        Panel2 = null;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   572
                        break;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   573
                    case 3:
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: 156
diff changeset
   574
                        UserControlPivot.ApplyColor(3, 0);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   575
                        root.Children.Remove(Panel3);
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   576
                        Panel3.PanelClose();
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   577
                        Panel3 = null;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   578
                        break;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   579
                    case 4:
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: 156
diff changeset
   580
                        UserControlPivot.ApplyColor(4, 0);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   581
                        root.Children.Remove(Panel4);
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   582
                        Panel4.PanelClose();
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   583
                        Panel4 = null;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   584
                        break;
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   585
                }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   586
            }
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   587
            root.Children.Remove(((UserControlClose)sender));
168
d70ee2002f75 Thumb Timeline Rotation and Debug Closing Panels
ARIAS Santiago
parents: 162
diff changeset
   588
            if (Panel1 == null && Panel2 == null && Panel3 == null && Panel4 == null)
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: 168
diff changeset
   589
                _mainviewmodel.CloseProject();
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 119
diff changeset
   590
        }
77
e95e916eb018 Travail sur le Pivot et le control Session Input
sarias
parents: 73
diff changeset
   591
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   592
211
50e6fe2c2ea2 second step for search. Menu created and UserPanel modified for search mode.
cavaliet
parents: 195
diff changeset
   593
        //On success annotation we save the update datas
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   594
        private void Panel_OnSuccessAnnotation(object sender, EventArgs e)
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   595
        {
191
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   596
            // We save datas
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   597
            saveDatas();
188
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   598
        }
191
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   599
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   600
        //
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   601
        // Enable to save datas in a xml file with LDT format
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   602
        //
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   603
        private void saveDatas()
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   604
        {
192
11083c390ce4 Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents: 191
diff changeset
   605
            // We build the xml to be saved, with the ldt format
191
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   606
            XDocument d = new XDocument(
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   607
                new XElement("iri",
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   608
                    new XElement("project",
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   609
                        new XAttribute("id", "1"),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   610
                        new XAttribute("user", "IRI-Strate-EFREI"),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   611
                        new XAttribute("title", _mainviewmodel.Project.Name),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   612
                        new XAttribute("abstract", _mainviewmodel.Project.Description)
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   613
                    ),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   614
                    new XElement("medias",
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   615
                        new XElement("media",
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   616
                            new XAttribute("id","for_oneflat"),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   617
                            new XAttribute("src","srcIri"),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   618
                            new XAttribute("video",""),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   619
                            new XAttribute("extra",""),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   620
                            new XAttribute("pict","")
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   621
                        )
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   622
                    ),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   623
                    new XElement("annotations",
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   624
                        new XElement("content",
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   625
                            new XAttribute("id", "for_oneflat"),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   626
                            new XAttribute("title", "D�c. personnels"),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   627
                            new XAttribute("author", "perso"),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   628
                            new XAttribute("abstract", "Ensemble de d�coupages d�finis par un utilisateur")
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   629
                        )
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   630
                    ),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   631
                    new XElement("displays"),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   632
                    new XElement("edits")
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   633
                )
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   634
            );
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   635
            // We add each cutting
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   636
            XElement annotContent = (XElement)(d.Root.Elements().ToList()[2]).FirstNode;
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   637
            foreach (Cutting cut in _mainviewmodel.Project.Cuttings)
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   638
            {
229
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   639
                XElement cutNode = new XElement("decoupage", new XAttribute("id", cut.Id), new XAttribute("author", "perso"), new XAttribute("color", "0x" + cut.Color.ToString().Substring(3)), // Color.ToString() return #AARRGGBB and we keep only 0xRRGGBB);
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   640
                                                new XElement("title", cut.Title),
05aba5def1fc add an attribute Color to a Cutting, save it in ldt xml file and redisplay it in the pivot's button. Make ColorFactory truly static.
cavaliet
parents: 225
diff changeset
   641
                                                new XElement("abstract", ""));
191
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   642
                XElement cutElmts = new XElement("elements");
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   643
                cutNode.Add(cutElmts);
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   644
                foreach (Annotation annot in cut.AnnotList)
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   645
                {
192
11083c390ce4 Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents: 191
diff changeset
   646
                    cutElmts.Add(new XElement("element", new XAttribute("id", annot.Id),
191
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   647
                                                         new XAttribute("begin", annot.TcBegin),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   648
                                                         new XAttribute("dur", annot.Dur),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   649
                                                         new XAttribute("author", cut.Title),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   650
                                                         new XAttribute("date", DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString()),
192
11083c390ce4 Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents: 191
diff changeset
   651
                                                         new XAttribute("color", "0x" + annot.Color.ToString().Substring(3)), // Color.ToString() return #AARRGGBB and we keep only 0xRRGGBB
191
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   652
                                                         new XAttribute("src", ""),
225
b60e13ed75c8 Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
cavaliet
parents: 224
diff changeset
   653
                                                         new XElement("title", String.Join(",", annot.GestureType.ToArray())),
191
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   654
                                                         new XElement("abstract"),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   655
                                                         new XElement("audio"),
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   656
                                                         new XElement("tags"),
225
b60e13ed75c8 Now an annotation has a list of gesture string and not simple gesture string. These are saved into and loaded from the ldt xml file.
cavaliet
parents: 224
diff changeset
   657
                                                         new XElement("gestureType", String.Join(",", annot.GestureType.ToArray()))));
191
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   658
                }
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   659
                annotContent.Add(cutNode);
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   660
            }
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   661
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   662
            d.Declaration = new XDeclaration("1.0", "utf-8", "true");
192
11083c390ce4 Second step of data saving : id added for cutting and annotation, and now we can load/display/change the already existing projects.
cavaliet
parents: 191
diff changeset
   663
            //Console.WriteLine(d);
223
90d2be5c3d39 commit with changes for real table file management
cavaliet
parents: 217
diff changeset
   664
            String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/" + _mainviewmodel.Project.Name + ".ldt";
90d2be5c3d39 commit with changes for real table file management
cavaliet
parents: 217
diff changeset
   665
            d.Save(path);
191
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   666
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   667
        }
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   668
8a25a85f2656 First step of data saving in a ldt/xml file. First step of displaying the existing ldt files (not loaded yet)
cavaliet
parents: 190
diff changeset
   669
188
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   670
        //On Tag Visualisation Mute all the other Players
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   671
        private void Panel_OnTagVisualisation(object sender, EventArgs e)
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   672
        {
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   673
            UserControlUserPanel PanelMaster = (UserControlUserPanel)sender;
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   674
            if (Panel1 != null)
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   675
            {
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   676
               if (!PanelMaster.Name.Equals(Panel1.Name))
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   677
                   Panel1.PlayerMute(true);
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   678
            }
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   679
            if (Panel2 != null)
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   680
            {
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   681
                if (!PanelMaster.Name.Equals(Panel2.Name))
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   682
                    Panel2.PlayerMute(true);
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   683
            }
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   684
            if (Panel3 != null)
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   685
            {
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   686
                if (!PanelMaster.Name.Equals(Panel3.Name))
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   687
                    Panel3.PlayerMute(true);
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   688
            }
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   689
            if (Panel4 != null)
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   690
            {
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   691
                if (!PanelMaster.Name.Equals(Panel4.Name))
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   692
                    Panel4.PlayerMute(true);
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   693
                
e642ad0c366b Tag Visualisation Control Sound (Use Byte Value "01") and Mute all other Players opened
ARIAS Santiago
parents: 186
diff changeset
   694
            }
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
   695
        }
217
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   696
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   697
        private void CreditsButton_ContactDown(object sender, EventArgs e)
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   698
        {
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   699
            Console.WriteLine("CreditsButton_ContactDown");
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   700
            if(sender==CreditsButton1)
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   701
            {
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   702
                CreditsScroll1.Visibility = (CreditsScroll1.Visibility == Visibility.Hidden) ? Visibility.Visible : Visibility.Hidden;
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   703
            }
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   704
            else if (sender == CreditsButton2)
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   705
            {
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   706
                CreditsScroll2.Visibility = (CreditsScroll2.Visibility == Visibility.Hidden) ? Visibility.Visible : Visibility.Hidden;
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   707
            }
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   708
            else if (sender == CreditsButton3)
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   709
            {
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   710
                CreditsScroll3.Visibility = (CreditsScroll3.Visibility == Visibility.Hidden) ? Visibility.Visible : Visibility.Hidden;
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   711
            }
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   712
            else if (sender == CreditsButton4)
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   713
            {
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   714
                CreditsScroll4.Visibility = (CreditsScroll4.Visibility == Visibility.Hidden) ? Visibility.Visible : Visibility.Hidden;
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   715
            }
6cfd723a1378 add credit panel
cavaliet
parents: 214
diff changeset
   716
        }
224
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   717
874de6d84a2e Panels visibility
ARIAS Santiago
parents: 223
diff changeset
   718
        
45
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   719
    }
f003ae353cd7 Dev des 4 User Panels Resizables avec un pivot basique.
sarias
parents:
diff changeset
   720
}