Beispiel #1
0
        public ConfigForm(PlayerForm player)
        {
            _player = player;
            Closed += (x, y) =>
            {
                if (_player.PlayerClosing)
                {
                    return;
                }
                _player.Close();
            };

            InitializeComponent();
            _context.SetPlayPosition = x =>
            {
                _player.ExpectingPositionChange = true;
                _player.MediaControl.Ctlcontrols.currentPosition = x;
                _player.ExpectingPositionChange = false;
            };
            _context.SetPlayState = x =>
            {
                _player.ExpectingStateChange = true;
                switch (x)
                {
                case 1:                                 //Stopped	Playback of the current media item is stopped.
                    _player.MediaControl.Ctlcontrols.stop();
                    break;

                case 2:                                 //Paused	Playback of the current media item is paused.
                    //When a media item is paused, resuming playback begins from the same location.
                    _player.MediaControl.Ctlcontrols.pause();
                    break;

                case 3:                                 //Playing	The current media item is playing.
                    _player.MediaControl.Ctlcontrols.play();
                    break;

                case 4:                                 //ScanForward	The current media item is fast forwarding.
                    _player.MediaControl.Ctlcontrols.fastForward();
                    break;

                case 5:                                 //ScanReverse	The current media item is fast rewinding.
                    _player.MediaControl.Ctlcontrols.fastReverse();
                    break;
                }
                _player.ExpectingStateChange = false;
            };
            _context.AttemptPlayFile = AttemptPlayFile;
            Action <string> netLog = NetLog;

            _context.Log            = x => this.Invoke(netLog, x);
            _context.GetSyncMessage = GetSyncMessage;

            UpdateVisibility();
            rbServer.CheckedChanged += (x, y) => UpdateVisibility();
            rbClient.CheckedChanged += (x, y) => UpdateVisibility();

            textBox1.Text = Properties.Settings.Default.ServerIP;
        }
        public ConfigForm(PlayerForm player)
        {
            _player = player;
            Closed += (x, y) =>
            {
                if (_player.PlayerClosing)
                    return;
                _player.Close();
            };

            InitializeComponent();
            _context.SetPlayPosition = x =>
                                           {
                                               _player.ExpectingPositionChange = true;
                                               _player.MediaControl.Ctlcontrols.currentPosition = x;
                                               _player.ExpectingPositionChange = false;
                                           };
            _context.SetPlayState = x =>
                                        {
                                            _player.ExpectingStateChange = true;
                                            switch(x)
                                            {
                                                case 1: //Stopped	Playback of the current media item is stopped.
                                                    _player.MediaControl.Ctlcontrols.stop();
                                                    break;
                                                case 2: //Paused	Playback of the current media item is paused.
                                                    //When a media item is paused, resuming playback begins from the same location.
                                                    _player.MediaControl.Ctlcontrols.pause();
                                                    break;
                                                case 3: //Playing	The current media item is playing.
                                                    _player.MediaControl.Ctlcontrols.play();
                                                    break;
                                                case 4: //ScanForward	The current media item is fast forwarding.
                                                    _player.MediaControl.Ctlcontrols.fastForward();
                                                    break;
                                                case 5: //ScanReverse	The current media item is fast rewinding.
                                                    _player.MediaControl.Ctlcontrols.fastReverse();
                                                    break;
                                            }
                                            _player.ExpectingStateChange = false;
                                        };
            _context.AttemptPlayFile = AttemptPlayFile;
            Action<string> netLog = NetLog;
            _context.Log = x => this.Invoke(netLog, x);
            _context.GetSyncMessage = GetSyncMessage;

            UpdateVisibility();
            rbServer.CheckedChanged += (x,y) => UpdateVisibility();
            rbClient.CheckedChanged += (x, y) => UpdateVisibility();

            textBox1.Text = Properties.Settings.Default.ServerIP;
        }