Example #1
0
 /// <summary>
 /// The default Constructor.
 /// </summary>
 /// <param name="nmsProtocol">The NMS protocol.</param>
 public TennisProtocol(NmsProtocol nmsProtocol) : base(nmsProtocol)
 {
 }
Example #2
0
 /// <summary>
 /// The default Constructor.
 /// </summary>
 /// <param name="nmsProtocol">The NMS protocol.</param>
 protected GameProtocol(NmsProtocol nmsProtocol)
 {
     Contract.Requires(nmsProtocol != null);
     NmsProtocol = nmsProtocol;
     NmsProtocol.InformationReportReceived += OnInformationReportReceived;
 }
Example #3
0
        /// <summary>
        /// Загружает с универсального пульта длительность таймеров и обновляет провайдера игры.
        /// </summary>
        /// <param name="uconsole">Адрес пульта или <c>null</c>.</param>
        /// <remarks>Асинхронная операция.</remarks>
        public async void LoadProvider(Address uconsole = null)
        {
            if (uconsole == null)
            {
                uconsole = Address.Empty;
            }

            var timerInfos = new List <ReadProgressInfo>(12);
            var options    = new NibusOptions
            {
                Progress = new Progress <object>(o => timerInfos.Add((ReadProgressInfo)o))
            };

            await NmsProtocol.ReadManyValuesAsync(
                options,
                uconsole,
                (int)Uconsole.Timer1Min,
                (int)Uconsole.Timer1Sec,
                (int)Uconsole.Timer2Min,
                (int)Uconsole.Timer2Sec,
                (int)Uconsole.Timer3Min,
                (int)Uconsole.Timer3Sec,
                (int)Uconsole.Timer4Min,
                (int)Uconsole.Timer4Sec,
                (int)Uconsole.Timer5Min,
                (int)Uconsole.Timer5Sec,
                (int)Uconsole.Timer6Min,
                (int)Uconsole.Timer6Sec);

            foreach (var progressInfo in timerInfos.Where(pi => !pi.IsFaulted && !pi.IsCanceled))
            {
                switch (progressInfo.Id)
                {
                case (int)Uconsole.Timer1Min:
                    Provider.Timers[0].Duration = (uint)(Provider.Timers[0].Duration % 60 + (byte)progressInfo.Value * 60);
                    break;

                case (int)Uconsole.Timer1Sec:
                    Provider.Timers[0].Duration = (Provider.Timers[0].Duration / 60) * 60 + (byte)progressInfo.Value;
                    break;

                case (int)Uconsole.Timer2Min:
                    Provider.Timers[1].Duration = (uint)(Provider.Timers[0].Duration % 60 + (byte)progressInfo.Value * 60);
                    break;

                case (int)Uconsole.Timer2Sec:
                    Provider.Timers[1].Duration = (Provider.Timers[0].Duration / 60) * 60 + (byte)progressInfo.Value;
                    break;

                case (int)Uconsole.Timer3Min:
                    Provider.Timers[2].Duration = (uint)(Provider.Timers[0].Duration % 60 + (byte)progressInfo.Value * 60);
                    break;

                case (int)Uconsole.Timer3Sec:
                    Provider.Timers[2].Duration = (Provider.Timers[0].Duration / 60) * 60 + (byte)progressInfo.Value;
                    break;

                case (int)Uconsole.Timer4Min:
                    Provider.Timers[3].Duration = (uint)(Provider.Timers[0].Duration % 60 + (byte)progressInfo.Value * 60);
                    break;

                case (int)Uconsole.Timer4Sec:
                    Provider.Timers[3].Duration = (Provider.Timers[0].Duration / 60) * 60 + (byte)progressInfo.Value;
                    break;

                case (int)Uconsole.Timer5Min:
                    Provider.Timers[4].Duration = (uint)(Provider.Timers[0].Duration % 60 + (byte)progressInfo.Value * 60);
                    break;

                case (int)Uconsole.Timer5Sec:
                    Provider.Timers[4].Duration = (Provider.Timers[0].Duration / 60) * 60 + (byte)progressInfo.Value;
                    break;

                case (int)Uconsole.Timer6Min:
                    Provider.Timers[5].Duration = (uint)(Provider.Timers[0].Duration % 60 + (byte)progressInfo.Value * 60);
                    break;

                case (int)Uconsole.Timer6Sec:
                    Provider.Timers[5].Duration = (Provider.Timers[0].Duration / 60) * 60 + (byte)progressInfo.Value;
                    break;
                }
            }
        }
Example #4
0
 /// <summary>
 /// Запрашивает информацию об игре.
 /// </summary>
 public void RequestGameInfo()
 {
     NmsProtocol.FireEventNotification((int)Events.RequestGameInfo);
 }
Example #5
0
 /// <summary>
 /// The default Constructor.
 /// </summary>
 /// <param name="nmsProtocol">The NMS protocol.</param>
 public IceHockeyProtocol(NmsProtocol nmsProtocol) : base(nmsProtocol)
 {
 }