Пример #1
0
        public View()
        {
            InitializeComponent();
            presenter = new PlayerPresenter(this, new PlayerModel(this.Handle));

            #region Event Bindings
            Load += (s, e) => {
                Reset();
                presenter.BindModel();
            };
            FormClosed += (s, e) => presenter.Dispose();
            openToolStripMenuItem.Click       += (s, e) => OpenFileClicked.Invoke(s, e);
            clearCacheToolStripMenuItem.Click += (s, e) => ClearCacheClicked.Invoke(s, e);
            playPauseToolStripMenuItem.Click  += (s, e) => PlayPauseInvoked.Invoke(s, e);
            playPauseButton.Click             += (s, e) => PlayPauseInvoked.Invoke(s, e);
            stopButton.Click             += (s, e) => StopInvoked.Invoke(s, e);
            stopToolStripMenuItem.Click  += (s, e) => StopInvoked.Invoke(s, e);
            aboutToolStripMenuItem.Click += (s, e) => AboutClicked.Invoke(s, e);
            exitToolStripMenuItem.Click  += (s, e) => Close();

            timeline.MouseMove += (s, e) =>
            {
                if (TimelinePushed)
                {
                    PlaybackPosition = Math.Min(timeline.Width - slider.Width, Math.Max(e.X, 0)) /
                                       Convert.ToDouble(timeline.Width - slider.Width);
                }
            };
            timeline.MouseDown += (s, e) =>
            {
                TimelinePushed   = true;
                PlaybackPosition = Math.Min(timeline.Width - slider.Width, Math.Max(e.X, 0)) /
                                   Convert.ToDouble(timeline.Width - slider.Width);
            };
            timeline.MouseUp             += (s, e) => TimelinePushed = false;
            timeline.MouseCaptureChanged += (s, e) => TimelinePushed = false;
            #endregion
        }
Пример #2
0
 public void Stop()
 {
     StopInvoked?.Invoke(this, new EventArgs());
 }