src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs
author riley
Sun, 18 Oct 2009 17:42:21 +0200
changeset 165 e78e40b9d761
parent 162 0b9f989bcb37
child 168 d70ee2002f75
permissions -rw-r--r--
Pivot Improved and methods for timeline
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     1
using System;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     2
using System.IO;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     3
using System.Net;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     4
using System.Windows;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     5
using System.Windows.Controls;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     6
using System.Windows.Data;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     7
using System.Windows.Media;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     8
using System.Windows.Media.Animation;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
     9
using System.Windows.Navigation;
39
0efa1d506f28 Correct compilation + lib
ymh
parents: 35
diff changeset
    10
using FingersDance.Control.TimeLine;
160
e940ca798fe3 Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents: 152
diff changeset
    11
using FingersDance.Data;
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    12
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    13
namespace FingersDance.Control.SyncSource
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    14
{
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    15
	public partial class UserControlSyncSource
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    16
	{
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    17
        #region Variables   
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    18
            public event EventHandler OnSuccessAnnotation;
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    19
        #endregion
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    20
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    21
		public UserControlSyncSource()
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    22
		{
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    23
			this.InitializeComponent();
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    24
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    25
			// Insert code required on object creation below this point.
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    26
		}
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    27
160
e940ca798fe3 Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents: 152
diff changeset
    28
        public void Load(string path, Color col, Cutting projCutting)
119
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 75
diff changeset
    29
        {
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 75
diff changeset
    30
            this.UserControlPlayer.initPlayer(path);
150
569925b65604 Annotations are now colored with the same color as the pivot's button
cavaliet
parents: 143
diff changeset
    31
            //Initialisation du Timer
160
e940ca798fe3 Enhance color factory and send the current project (data) to the timeline instance in order to build the project's cutting's annotation list.
cavaliet
parents: 152
diff changeset
    32
            UCTimeLine.initTimer(col, projCutting);
143
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 121
diff changeset
    33
            this.UserControlPlayer.playerPlay();
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    34
            this.userControlTimeLine.OnSuccessAnnotation+=new EventHandler(userControlTimeLine_OnSuccessAnnotation);
165
e78e40b9d761 Pivot Improved and methods for timeline
riley
parents: 162
diff changeset
    35
            this.UserControlPlayer.PlayerStopOrPause +=new EventHandler(UserControlPlayer_PlayerStopOrPause);
119
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 75
diff changeset
    36
        }
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    37
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    38
        #region player
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    39
        private void UserControlPlayer_PlayerOpened(object sender, EventArgs e)
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    40
        {
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    41
            //Initialisation du slider
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
    42
            UCTimeLine.initslider(UserControlPlayer.TotalMilliseconds);
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    43
            //Demarrage du Timer
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
    44
            UCTimeLine.timerStart();
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    45
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    46
        }
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    47
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    48
        //Set a bursh color to the stack panel in the Player
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    49
        public void UserControlPlayer_DisplayAnnotation(int id, Brush b)
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    50
        {
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    51
            UserControlPlayer.displayStackPanelAnnotations(id, b);
165
e78e40b9d761 Pivot Improved and methods for timeline
riley
parents: 162
diff changeset
    52
e78e40b9d761 Pivot Improved and methods for timeline
riley
parents: 162
diff changeset
    53
        }
e78e40b9d761 Pivot Improved and methods for timeline
riley
parents: 162
diff changeset
    54
        public void UserControlPlayer_PlayerStopOrPause(object sender, EventArgs e)
e78e40b9d761 Pivot Improved and methods for timeline
riley
parents: 162
diff changeset
    55
        { 
e78e40b9d761 Pivot Improved and methods for timeline
riley
parents: 162
diff changeset
    56
            
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    57
        }
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    58
        #endregion
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    59
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    60
        #region TimeLine
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    61
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    62
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    63
        private void UserControlTimeLine_DragStarted(object sender, EventArgs e)
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    64
        {
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    65
            UserControlPlayer.playerPause();
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    66
        }
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    67
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    68
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    69
        private void UserControlTimeLine_DragCompleted(object sender, EventArgs e)
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    70
        {
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    71
        }
162
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    72
        private void userControlTimeLine_OnSuccessAnnotation(object sender, EventArgs e)
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    73
        {
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    74
            OnSuccessAnnotation(this, new EventArgs());
0b9f989bcb37 Display annotations in all opened UserPanels with the user's color
sarias
parents: 160
diff changeset
    75
        }
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    76
        #endregion
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    77
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    78
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    79
        #region SynSource pour chaque X milliseconds
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    80
        private void UserControlTimeLine_TimerTick(object sender, EventArgs e)
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    81
        {
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
    82
            if (!UCTimeLine.IsDragging)
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    83
            {
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
    84
                UCTimeLine.Slider.Value = UserControlPlayer.Player.Position.TotalMilliseconds;
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    85
            }
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
    86
            if (UCTimeLine.FinishedDragging)
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    87
            {
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
    88
                int SliderValue = (int)UCTimeLine.Slider.Value;
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    89
                TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue);
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    90
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    91
                UserControlPlayer.Player.Position = ts;
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    92
                UserControlPlayer.playerPlay();
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    93
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
    94
                UCTimeLine.IsDragging = false;
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
    95
                UCTimeLine.FinishedDragging = false;
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    96
            }
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    97
        }
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
    98
        #endregion
75
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
    99
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
   100
        public UserControlTimeLine userControlTimeLine
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
   101
        {
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
   102
            get { return this.UCTimeLine; }
99d003723474 data binding second step. we can add annotation by clicking on menu buttons or timeline.
cavaliet
parents: 39
diff changeset
   103
        }
152
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   104
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   105
        public void PlayerPause()
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   106
        {
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   107
            UserControlPlayer.playerPause();
46577fd0a294 PlayerPause en resize
PAMPHILE Jonathan <pamphile@efrei.fr>
parents: 150
diff changeset
   108
        }
35
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   109
    }
ed77793b767a Control Pivot,
sarias
parents:
diff changeset
   110
}