Beispiel #1
0
 private void InitializePlaybackCommunicatorControl()
 {
     // add player communicator control
     _playerCommunicatorControl      = new PlayerCommunicatorControl();
     _playerCommunicatorControl.Dock = DockStyle.Fill;
     PlayerCommunicatorPanel.Controls.Add(_playerCommunicatorControl);
 }
 private void KillPlayerProcess()
 {
     try
     {
         if (_playerProcess.Id != 0)
         {
             PlayerCommunicatorControl communicator = new PlayerCommunicatorControl();
             communicator.SendRequest(RequestFactory.CreateRequest(MessageType.Termination));
         }
     }
     catch (System.Exception)
     {
     }
     // TODO. wait until exits or force it.
 }
        private void SetPlayerType(PlayerType playerType, bool shouldRunLocal)
        {
            try
            {
                // start player if it's not already running
                if (shouldRunLocal)
                {
                    bool isRunning = true;
                    try
                    {
                        if (_playerProcess.Id == 0)
                        {
                            isRunning = false;
                        }
                    }
                    catch (Exception)
                    {
                        isRunning = false;
                    }

                    if (!isRunning)
                    {
                        string arguments = SettingsManager.Instance.PlayerSettings.Port.ToString();
                        _playerProcess.StartInfo.Arguments = arguments;

                        // start process
                        _playerProcess.Start();
                    }
                }

                SetPlayerTypeRequest request = new SetPlayerTypeRequest();
                request.PlayerType = playerType;
                PlayerCommunicatorControl.SendRequest(request);
            }
            catch (System.Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }