Example #1
0
        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;
            }
        }
Example #2
0
 public void PushCommand(ControllerContract param)
 {
     foreach (IPublishingService subscriber in SubscribingService.GetSubscribers())
     {
         subscriber.PushCommand(param);
     }
 }
Example #3
0
        public ControllerViewModel(INotifyIconManager iconManager, IControllerConfigurationManager controllerConfigurationManager, ControllerContract controller)
        {
            IconManager = iconManager;
            ControllerConfigurationManager = controllerConfigurationManager;

            Id = controller.Id;
            Name = controller.Name;

            ChangeStatus(controller);
        }
Example #4
0
 public void PushCommand(ControllerContract param)
 {
     throw new NotImplementedException();
 }
Example #5
0
 public void SendCommand(ControllerContract param)
 {
     service.OnCustomCommand(param);
 }
Example #6
0
        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));
            }
        }
Example #7
0
        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);
        }
Example #8
0
 public void PushCommand(ControllerContract param)
 {
     MessengerManager.NotifyColleagues(AppMessages.CONTROLLER_CHANGE_STATUS, param);
 }