private void SendCommand(IArmletInfo armletId, MessageId messageId, string text) { if (text.Length > 140) { throw new ArgumentOutOfRangeException("text"); } SendPayload(armletId, CreateStringPayload(messageId, text)); }
private void Update(IArmletInfo armletInfo) { _armletInfo = armletInfo; Id = armletInfo.Id.ToString() + " / " + armletInfo.Id.ToString("X2"); BloodLevel = armletInfo.BloodLevel.ToString(); Name = armletInfo.Name; Status = armletInfo.Status; Room = armletInfo.Room.ToString(); Regen = armletInfo.Regen.ToString(); ToxicLevel = armletInfo.Toxic.ToString(); }
private void Update(IArmletInfo armletInfo) { Value = armletInfo; Id = string.Format("{0}\n0x{1:X2}", armletInfo.Id, armletInfo.Id); BloodLevel = armletInfo.BloodLevel.ToString(Thread.CurrentThread.CurrentCulture); Name = armletInfo.Name; Status = armletInfo.Status; Room = armletInfo.RoomName; Regen = armletInfo.Regen.ToString(Thread.CurrentThread.CurrentCulture); ToxicLevel = armletInfo.Toxic.ToString(Thread.CurrentThread.CurrentCulture); Pulse = armletInfo.Pulse.ToString(Thread.CurrentThread.CurrentCulture); Temp = (armletInfo.Temp / 10 + 30).ToString(Thread.CurrentThread.CurrentCulture); }
private void SendPayload(IArmletInfo armlet, byte[] payload) { armlet.SetStatus("Отправляется сообщение"); OnArmletListUpdated(); try { _armletService.DeliverToSingleArmlet(armlet.Id, payload); } catch (GateNotConnectedException exc) { foreach (var gateId in exc.GateId) { _gates[gateId].Value.SetOnline(false); } } }
public void SendSetName(string text, IArmletInfo armletId) { text = Armlet.TransformName(text); armletId.SetName(text); SendCommand(armletId, MessageId.MSG_SET_PLAYER_NAME, text); }
public void SendSetLockList(IArmletInfo armlet, byte[] lockList) { SendPayload(armlet, CreatePayload(MessageId.MSG_UPDATE_LOCK_LIST, lockList)); }
private void SendPayload(IArmletInfo armlet, byte[] payload) { armlet.SetStatus("Отправляется сообщение"); OnArmletListUpdated(); _armletService.DeliverToSingleArmlet(armlet.Id, payload); }
public ArmletWatcher(IArmletInfo armletInfo) { Update(armletInfo); armletInfo.ArmletUpdated += () => Dispatcher.BeginInvoke(new Action(() => Update(armletInfo))); }
public void SetSetPlayerRegen(IArmletInfo armlet, byte regen) { armlet.SetRegen(regen); SendPayload(armlet, CreatePayload(MessageId.MSG_SET_PLAYER_REGENERATION, new[] {regen})); }
public void SendShowMessage(IArmletInfo armletId, string text) { SendPayload(armletId, CreateMessagePayload(text)); }
public void SetSetPlayerRegen(IArmletInfo armlet, byte regen) { armlet.SetRegen(regen); SendPayload(armlet, CreatePayload(MessageId.MSG_SET_PLAYER_REGENERATION, new[] { regen })); }
private void Update(IArmletInfo armletInfo) { Value = armletInfo; Id = string.Format("{0}\n0x{1:X2}", armletInfo.Id, armletInfo.Id); BloodLevel = armletInfo.BloodLevel.ToString(Thread.CurrentThread.CurrentCulture); Name = armletInfo.Name; Status = armletInfo.Status; Room = armletInfo.RoomName; Regen = armletInfo.Regen.ToString(Thread.CurrentThread.CurrentCulture); ToxicLevel = armletInfo.Toxic.ToString(Thread.CurrentThread.CurrentCulture); Pulse = armletInfo.Pulse.ToString(Thread.CurrentThread.CurrentCulture); Temp = ( armletInfo.Temp / 10 + 30).ToString(Thread.CurrentThread.CurrentCulture); }