public override void OnConnection(VMEODClient client) { base.OnConnection(client); PlayerClient = client; // get the registers var args = client.Invoker.Thread.TempRegisters; // get the initial minutes and seconds CurrentDisplayedMinutes = args[2]; CurrentDisplayedSeconds = args[3]; // get the current running states IsRunning = (args[0] == 1) ? true : false; if (Enum.IsDefined(typeof(VMEODTimerPluginStates), args[1])) { State = (VMEODTimerPluginStates)Enum.ToObject(typeof(VMEODTimerPluginStates), args[1]); } else { State = VMEODTimerPluginStates.Countdown; } // show the client: @params - Byte[] { 0 if IsRunning or 1 if !IsRunning, 0 if State = Countdown 1 if State = Stopwatch, Minutes/256, Seconds } PlayerClient.Send("Timer_Show", new Byte[] { (byte)args[0], (byte)args[1], (byte)(CurrentDisplayedMinutes), (byte)CurrentDisplayedSeconds }); }
void StateChangeHandler(string evt, byte[] newState, VMEODClient client) { if ((newState == null) || (newState.Length < 1) || (newState[0] > 1)) { return; } switch (State) { case VMEODTimerPluginStates.Countdown: { // change to stopwatch if (newState[0] == 1) { PlayerClient.SendOBJEvent(new VMEODEvent((short)VMEODTimerEvents.ToggleStopwatch)); State = VMEODTimerPluginStates.Stopwatch; } break; } default: { // change to countdown if (newState[0] == 0) { PlayerClient.SendOBJEvent(new VMEODEvent((short)VMEODTimerEvents.ToggleStopwatch)); State = VMEODTimerPluginStates.Countdown; } break; } } }