Exemplo n.º 1
0
        /// <summary>
        /// Seek to a position in  the video.
        /// </summary>
        /// <param name="position">The position to seek to.</param>
        public void SeekVideo(double position)
        {
            var info = GetInfo();

            info.VideoPosition = position;
            OnInfoChanged?.Invoke(info);
        }
 private void TxtBx_TextChanged(object sender, EventArgs e)
 {
     if (!_disableUpdate)
     {
         OnInfoChanged?.Invoke(this, new EventArgs());
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Sets the video.
        /// </summary>
        /// <param name="url"></param>
        public void SetVideo(string url)
        {
            var info = GetInfo();

            info.VideoUrl = url;
            OnInfoChanged?.Invoke(info);
        }
 private void CmbBxAnnotation_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!_disableUpdate)
     {
         OnInfoChanged?.Invoke(this, new EventArgs());
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// A client disconnected.
        /// </summary>
        /// <param name="ip">The ip address of the client.</param>
        /// <param name="port">The port the client was connected to.</param>
        private void WCFServerService_ClientDisconnected(string ip, int port)
        {
            var client = _clients.FirstOrDefault(c => c.IpAddress == ip && c.Port == port);

            if (client != null)
            {
                _clients.Remove(client);
                _serverInfo.Clients = _clients.ToDictionary(c => c.IpAddress, c => c.Port);
                OnInfoChanged?.Invoke(_serverInfo);
            }
        }
        private void gameStatisticsControl1_DoubleClick(object sender, EventArgs e)
        {
            var gameStatEditor = new FrmGameStatisticsEditor(gameStatisticsControl1.GameCount, gameStatisticsControl1.WhitePercent, gameStatisticsControl1.NullPercent);

            if (gameStatEditor.ShowDialog() == DialogResult.OK)
            {
                gameStatisticsControl1.SetStatistics(gameStatEditor.GameCount, gameStatEditor.WhiteCount, gameStatEditor.DrawCount);
                if (!_disableUpdate)
                {
                    OnInfoChanged?.Invoke(this, new EventArgs());
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// A client could not be reached.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="e">The exception.</param>
        private void HandleClientError(Client client, Exception e)
        {
            var cl = _clients.FirstOrDefault(c => c.IpAddress == client.IpAddress && c.Port == client.Port);

            if (cl != null)
            {
                lock (_clients)
                {
                    _clients.Remove(cl);
                    _serverInfo.Clients = _clients.GroupBy(c => c.IpAddress).Select(g => g.First()).ToDictionary(c => c.IpAddress, c => c.Port);
                    OnInfoChanged?.Invoke(_serverInfo);
                }
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// The client connected.
 /// </summary>
 /// <param name="client">The connected client.</param>
 private void WCFServerService_ClientConnected(Client client)
 {
     if (!_clients.Any(c => c.IpAddress == client.IpAddress && c.Port == client.Port))
     {
         _clients.Add(client);
         _serverInfo.Clients = _clients.GroupBy(c => c.IpAddress).Select(g => g.First()).ToDictionary(c => c.IpAddress, c => c.Port);
         OnInfoChanged?.Invoke(_serverInfo);
         var currentsong = _player.GetCurrentSong();
         if (currentsong != null)
         {
             Play(currentsong, client);
         }
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// Disconnect from the server.
        /// </summary>
        /// <returns>The musicplayer.</returns>
        public IMusicPlayer Disconnect()
        {
            if (_factory.State == CommunicationState.Opened)
            {
                try
                {
                    _server.Goodbye();
                    _factory.Close();
                }
                catch { }
            }

            _factory.Abort();
            OnInfoChanged?.Invoke(null);
            base.Dispose();
            return(null);
        }