internal void OnCustomCommand(ControllerContract param) { switch (param.Message) { case ControllerMessage.CONTROLLER_CONNECT_USB: this.EventLog.WriteEntry(ServiceMessages.MESSAGE_CONTROLLER_CONNECT_USB); this.publisher.PushCommand(param); break; case ControllerMessage.CONTROLLER_CONNECT_BT: this.EventLog.WriteEntry(ServiceMessages.MESSAGE_CONTROLLER_CONNECT_BT); this.publisher.PushCommand(param); break; case ControllerMessage.CONTROLLER_DISCONNECT_USB: this.EventLog.WriteEntry(ServiceMessages.MESSAGE_CONTROLLER_DISCONNECT_USB); this.publisher.PushCommand(param); break; case ControllerMessage.CONTROLLER_DISCONNECT_BT: this.EventLog.WriteEntry(ServiceMessages.MESSAGE_CONTROLLER_DISCONNECT_BT); this.publisher.PushCommand(param); break; case ControllerMessage.CONTROLLER_BATTERY_CHANGE: this.EventLog.WriteEntry(ServiceMessages.MESSAGE_CONTROLLER_BATTERY_CHANGE); this.publisher.PushCommand(param); break; case ControllerMessage.NONE: this.EventLog.WriteEntry("Change controller status request"); this.publisher.PushCommand(param); break; } }
public void PushCommand(ControllerContract param) { foreach (IPublishingService subscriber in SubscribingService.GetSubscribers()) { subscriber.PushCommand(param); } }
public ControllerViewModel(INotifyIconManager iconManager, IControllerConfigurationManager controllerConfigurationManager, ControllerContract controller) { IconManager = iconManager; ControllerConfigurationManager = controllerConfigurationManager; Id = controller.Id; Name = controller.Name; ChangeStatus(controller); }
public void PushCommand(ControllerContract param) { throw new NotImplementedException(); }
public void SendCommand(ControllerContract param) { service.OnCustomCommand(param); }
private void ControllerChangeStatus(ControllerContract controller) { ControllerViewModel c = Controllers.FirstOrDefault(param => param.Id == controller.Id); if (c != null && controller.IsUsbConnected == false && controller.IsBluetoothConnected == false) { Controllers.Remove(c); } else if (c != null) { c.ChangeStatus(controller); } else { Controllers.Add(new ControllerViewModel(IconManager, ControllerConfigurationManager, controller)); } }
public void ChangeStatus(ControllerContract controller) { IsUsbConnected = controller.IsUsbConnected; IsBluetoothConnected = controller.IsBluetoothConnected; BatteryValue = controller.BatteryValue; if (IsUsbConnected) Status = "Charging ..."; else Status = "Battery " + BatteryValue + "%"; IconManager.SetIcon(Id, IsUsbConnected, BatteryValue, ShowIcon ?? false); }
public void PushCommand(ControllerContract param) { MessengerManager.NotifyColleagues(AppMessages.CONTROLLER_CHANGE_STATUS, param); }