예제 #1
0
        private void StartStopMediaUriElements()
        {
            var player = m_players[_playerToStartStopNext];

            int pos = panel.Children.IndexOf(player);
            if(panel.Children.Contains(player))
                panel.Children.Remove(player);

            if (pos < 0)
                pos = panel.Children.Count;
            else if(!REUSE_PLAYERS)
            {
                m_players[_playerToStartStopNext].Close();
                m_players[_playerToStartStopNext] = new MediaUriElement { Width = 320, Height = 240 };
                player = m_players[_playerToStartStopNext];
            }

            player.BeginInit();
            player.Source = new Uri(GetRandomFileFromDirectory());
            panel.Children.Insert(pos, player);
            player.EndInit();

            Debug.WriteLine(player.Source.OriginalString);

            _playerToStartStopNext++;

            if (_playerToStartStopNext > MAX_PLAYERS - 1)
            {
                _playerToStartStopNext = 0;
            }
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.btnOpen = ((System.Windows.Controls.Button)(target));
                return;

            case 2:
                this.mediaUriElement = ((WPFMediaKit.DirectShow.Controls.MediaUriElement)(target));
                return;

            case 3:
                this.btnOpen2 = ((System.Windows.Controls.Button)(target));
                return;

            case 4:
                this.mediaUriElement2 = ((WPFMediaKit.DirectShow.Controls.MediaUriElement)(target));
                return;

            case 5:
                this.btnComparar = ((System.Windows.Controls.Button)(target));
                return;

            case 6:
                this.btnSubirAlGrupo = ((System.Windows.Controls.Button)(target));
                return;

            case 7:
                this.btnBuscarEnGrupo = ((System.Windows.Controls.Button)(target));
                return;
            }
            this._contentLoaded = true;
        }
예제 #3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.btnOpen = ((System.Windows.Controls.Button)(target));

            #line 29 "..\..\MainWindow.xaml"
                this.btnOpen.Click += new System.Windows.RoutedEventHandler(this.btnOpen_Click);

            #line default
            #line hidden
                return;

            case 2:
                this.cobVideoSource = ((System.Windows.Controls.ComboBox)(target));

            #line 31 "..\..\MainWindow.xaml"
                this.cobVideoSource.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.cobVideoSource_SelectionChanged);

            #line default
            #line hidden
                return;

            case 3:
                this.txtBrightness = ((System.Windows.Controls.TextBox)(target));
                return;

            case 4:
                this.btnChangeParam = ((System.Windows.Controls.Button)(target));

            #line 34 "..\..\MainWindow.xaml"
                this.btnChangeParam.Click += new System.Windows.RoutedEventHandler(this.btnChangeParam_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.txtVue = ((System.Windows.Controls.TextBox)(target));
                return;

            case 6:
                this.txtContrast = ((System.Windows.Controls.TextBox)(target));
                return;

            case 7:

            #line 39 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 8:
                this.chkDeeperColor = ((System.Windows.Controls.CheckBox)(target));
                return;

            case 9:
                this.errorText = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 10:
                this.mediaUriElement = ((WPFMediaKit.DirectShow.Controls.MediaUriElement)(target));
                return;

            case 11:
                this.cameraCaptureElement = ((WPFMediaKit.DirectShow.Controls.VideoCaptureElement)(target));
                return;

            case 12:
                this.slider = ((System.Windows.Controls.Slider)(target));

            #line 58 "..\..\MainWindow.xaml"
                this.slider.ValueChanged += new System.Windows.RoutedPropertyChangedEventHandler <double>(this.slider_ValueChanged);

            #line default
            #line hidden
                return;

            case 13:
                this.btnStop = ((System.Windows.Controls.Button)(target));

            #line 60 "..\..\MainWindow.xaml"
                this.btnStop.Click += new System.Windows.RoutedEventHandler(this.btnStop_Click);

            #line default
            #line hidden
                return;

            case 14:
                this.btnPause = ((System.Windows.Controls.Button)(target));

            #line 61 "..\..\MainWindow.xaml"
                this.btnPause.Click += new System.Windows.RoutedEventHandler(this.btnPause_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
        public Card(CustomButton close, int _h = 300, int _w = 370)
        {
            closeBtn = close;
            closeBtn.Margin = new Thickness(2);
            Height = _h;
            Width = _w;
            this.index = close.Index;
            hasPlayed = false;

            //UpDown control
            mediaPosition = new DoubleUpDown { Width = 75, Height = 30, Margin = new Thickness(2) };
            mediaPosition.Value = 0;

            //Groupbox
            Box = new GroupBox();
            Box.Width = Width;
            Box.Height = Height;
            Box.Header = new Label { Content = string.Format("Video {0}", index + 1) };
            Box.Margin = new Thickness(5, 2, 5, 2);

            //StackPanels
            Panel = new StackPanel();
            Panel.Orientation = Orientation.Vertical;

            //bottomPanel WrapPanel
            bottomPanel = new WrapPanel();
            bottomPanel.Orientation = Orientation.Horizontal;
            bottomPanel.Height = 50;

            //MediaUriElement
            player = new MediaUriElement();
            player.LoadedBehavior = WPFMediaKit.DirectShow.MediaPlayers.MediaState.Manual;
            player.PreferedPositionFormat = WPFMediaKit.DirectShow.MediaPlayers.MediaPositionFormat.MediaTime;
            player.Height = 225;
            player.Margin = new Thickness(1);

            //BusyIndicator
            busy = new BusyIndicator();

            //Buttons
            Open = new Button { Content = "Open Video" };
            PlayPause = new Button { Content = sPlay, Height = 30, Width = 30, Margin = new Thickness(2) };

            //Slider
            slider = new Slider { Width = 200, Minimum = 0, SmallChange = 1, LargeChange = 10, Value = 0, Margin = new Thickness(2) };

            PlayPause.IsEnabled = false;
            slider.IsEnabled = false;
            mediaPosition.IsEnabled = false;

            SetLayout();
            Open.Click += Open_Click;
            PlayPause.Click += PlayPause_Click;
        }