Esempio n. 1
0
        /// <summary>
        ///     Static factory to create a MpdSocketClient
        /// </summary>
        /// <param name="hostname"></param>
        /// <param name="port"></param>
        /// <returns>Task which return MpdSocketClient</returns>
        public static async Task <MpdSocketClient> CreateAsync(string hostname, int port)
        {
            var mpdSocketClient = new MpdSocketClient();
            await mpdSocketClient.InitAsync(hostname, port).ConfigureAwait(false);

            return(mpdSocketClient);
        }
Esempio n. 2
0
        /// <summary>
        ///     Initialize the MpdStateMonitor
        /// </summary>
        /// <param name="hostname"></param>
        /// <param name="port"></param>
        /// <returns>Task to await</returns>
        private async Task InitAsync(string hostname, int port)
        {
            _mpdSocketClient = await MpdSocketClient.CreateAsync(hostname, port);

            // TODO: store in member variable to prevent GC?
            // ReSharper disable once UnusedVariable
            var ignoringTask = BackgroundCheckerAsync();
        }
Esempio n. 3
0
		/// <summary>
		///     Static factory to create a MpdSocketClient
		/// </summary>
		/// <param name="hostname"></param>
		/// <param name="port"></param>
		/// <returns>Task which return MpdSocketClient</returns>
		public static async Task<MpdSocketClient> CreateAsync(string hostname, int port)
		{
			var mpdSocketClient = new MpdSocketClient();
			await mpdSocketClient.InitAsync(hostname, port).ConfigureAwait(false);
			return mpdSocketClient;
		}
Esempio n. 4
0
		/// <summary>
		///     Initialize the MpdStateMonitor
		/// </summary>
		/// <param name="hostname"></param>
		/// <param name="port"></param>
		/// <returns>Task to await</returns>
		private async Task InitAsync(string hostname, int port)
		{
			_mpdSocketClient = await MpdSocketClient.CreateAsync(hostname, port);
			// TODO: store in member variable to prevent GC?
			// ReSharper disable once UnusedVariable
			var ignoringTask = BackgroundCheckerAsync();
		}