Exemplo n.º 1
0
        private void addMediaBox(IMedia media)
        {
            int      mediaListCount = mediaList.Count;
            MediaBox box            = new MediaBox(media);

            control.mediaBoxControl.Add(box);

            mediaBoxes.Add(box);

            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval = TimeSpan.FromMilliseconds(50);
            timer.Tick    += new EventHandler(delegate(object o, EventArgs a)
            {
                if (media.GetLength() > 0)
                {
                    updateTimeRange(media.GetLength());
                    if (mediaListCount == 1 &&
                        media.GetLength() > Properties.Settings.Default.DefaultZoomInSeconds &&
                        Properties.Settings.Default.DefaultZoomInSeconds != 0)
                    {
                        fixTimeRange(Properties.Settings.Default.DefaultZoomInSeconds);
                    }
                    timer.Stop();
                }
            });
            timer.Start();

            MediaBoxStatic.Select(box);
            updateNavigator();
        }
Exemplo n.º 2
0
        private void loadMedia(string filename, bool is_video, string url = null)
        {
            if (!File.Exists(filename))
            {
                MessageTools.Error("Media file not found '" + filename + "'");
                return;
            }

            double pos   = MainHandler.Time.TimeFromPixel(signalCursor.X);
            IMedia media = mediaList.addMedia(filename, pos, url);

            control.mediaVideoControl.addMedia(media, is_video);
            control.navigator.playButton.IsEnabled = true;
            innomediaplaymode = false;
            noMediaPlayHandler(null);

            ColumnDefinition columvideo = control.videoskel.ColumnDefinitions[0];

            columvideo.Width = new GridLength(1, GridUnitType.Star);

            DispatcherTimer _timer = new DispatcherTimer();

            _timer.Interval = TimeSpan.FromMilliseconds(50);
            _timer.Tick    += new EventHandler(delegate(object s, EventArgs a)
            {
                if (media.GetLength() > 0)
                {
                    updateTimeRange(media.GetLength());
                    if (this.mediaList.Medias.Count == 1 && media.GetLength() > Properties.Settings.Default.DefaultZoominSeconds && Properties.Settings.Default.DefaultZoominSeconds != 0)
                    {
                        fixTimeRange(Properties.Settings.Default.DefaultZoominSeconds);
                    }
                    _timer.Stop();
                }
            });
            _timer.Start();
        }