client/src/Iri.Modernisation.Controls/ViewModel/VideoViewer/VideoViewerVM.cs
author Matthieu Totet
Mon, 30 Nov 2009 10:20:35 +0100
changeset 15 3f70aee2432f
parent 0 249d70e7b32d
child 22 69a2910ec6f9
permissions -rw-r--r--
Update VideoViewer

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Iri.Modernisation.BaseMVVM.Commands;
using Iri.Modernisation.BaseMVVM.ViewModel;
namespace Iri.Modernisation.Controls.ViewModel
{
    public class VideoViewerVM : BaseMVVM.ViewModel.ViewModel
    {

        private String _source;
        public String Source
        {
            get
            {
                return _source;
            }
            set
            {
                _source = value;
               
                OnPropertyChanged(null);
            }
        }
        public Uri USource
        {
            get
            {
                if (Source != null)
                {
                    return new Uri(Source, UriKind.RelativeOrAbsolute);
                }
                else
                {
                    return null;
                }
            }

        }
        
        public String Info
        {
            get
            {
                return position + ":" + Source;
            }
            
        }
        
        private TimeSpan position = new TimeSpan(0,0,0);
        public TimeSpan Position
        {
            get
            {
                return position;
            }
            set
            {
                position = value;
                //OnPropertyChanged("Position");
               OnPropertyChanged("Info");
            
            }
        }

        private bool _playControl;
        public bool PlayControl
        {
            get
            {
                return _playControl;
            }
            set
            {
                _playControl = value;
                OnPropertyChanged("PlayControl");
            }
        }

        private bool _recordControl;
        public bool RecordControl
        {
            get
            {
                return _recordControl;
            }
            set
            {
                _recordControl = value;
                OnPropertyChanged("RecordControl");
            }
        }
        public VideoViewerVM(bool playControl,bool recordControl )
        {
            _playControl = playControl;
            _recordControl = recordControl;
            InitializeCommands();
        }
        private void InitializeCommands()
        {
            Commands.VideoViewer.SendPosition.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(SendPosition_Executed);
            //Commands.GoToTime.Executed += new EventHandler<SLExtensions.Input.ExecutedEventArgs>(GoToTime_Executed);
        
        }
        void SendPosition_Executed(object sender, SLExtensions.Input.ExecutedEventArgs e)
        {
            //Position = (TimeSpan)(e.Parameter);
        }

       

    }
}