private void InitIndicators() { Service = new StateControlViewModel { Name = "Status.Service", GreenTooltip = "Status.Tooltip.ConectedService", RedTooltip = "Status.Tooltip.DisconectedService", Visible = true, }; Server = new StateControlViewModel { Name = "Status.Server", GreenTooltip = "Status.Tooltip.ConectedServer", OrangeTooltip = "Status.Tooltip.NotApprovedServer", RedTooltip = "Status.Tooltip.DisconectedServer", }; RFID = new StateControlViewModel { Name = "Status.RFID", GreenTooltip = "Status.Tooltip.ConectedRFID", RedTooltip = "Status.Tooltip.DisconectedRFID", }; Dongle = new StateControlViewModel { Name = "Status.Dongle", GreenTooltip = "Status.Tooltip.ConectedDongle", RedTooltip = "Status.Tooltip.DisconectedDongle", }; TBServer = new StateControlViewModel { Name = "Status.Network", GreenTooltip = "Status.Tooltip.NetworkAvailable", RedTooltip = "Status.Tooltip.NetworkUnavailable", }; Indicators.Add(Server); Indicators.Add(RFID); Indicators.Add(Dongle); }
Task OnComponentsStateChangedMessage(HideezMiddleware.IPC.Messages.ServiceComponentsStateChangedMessage msg) { _log.WriteLine("Updating components state indicators"); // Service Service.Visible = !_serviceProxy.IsConnected; // HES switch (msg.HesStatus) { case HesStatus.Ok: Server.State = StateControlState.Green; break; case HesStatus.NotApproved: Server.State = StateControlState.Orange; break; default: Server.State = StateControlState.Red; break; } Server.Visible = _serviceProxy.IsConnected; // RFID RFID.State = StateControlViewModel.BoolToState(msg.RfidStatus == RfidStatus.Ok); RFID.Visible = msg.RfidStatus != RfidStatus.Disabled && _serviceProxy.IsConnected; // Bluetooth Dongle.State = StateControlViewModel.BoolToState(msg.BluetoothStatus == BluetoothStatus.Ok); Dongle.Visible = _serviceProxy.IsConnected; // Try&Buy Server TBServer.State = StateControlViewModel.BoolToState(msg.TbHesStatus == HesStatus.Ok); TBServer.Visible = _serviceProxy.IsConnected; return(Task.CompletedTask); }