Exemple #1
0
 void CognitivEmoStateUpdated(object sender, EmoStateUpdatedEventArgs e)
 {
     Rule rule = App.CurrentApp.Rules.FirstOrDefault(r => r.Headset == e.userId && r.Action == e.emoState.CognitivGetCurrentAction() && r.IRCode != null);
     if (rule != null && e.emoState.CognitivGetCurrentActionPower() >= rule.Threshold)
     {
         if (rule.IRCode != lastIRCode)
         {
             Status = "Sending IR Code: " + rule.IRCode.Name;
             App.CurrentApp.USBUIRTInterface.Controller.TransmitAsync(rule.IRCode.Code, CodeFormat.Pronto, 2, TimeSpan.Zero);
             lastIRCode = rule.IRCode;
         }
     }
     else
     {
         lastIRCode = null;
     }
 }
Exemple #2
0
        void LearnIRCodeExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            if (App.CurrentApp.USBUIRTInterface.Connected == false)
            {
                MessageBox.Show("USB-UIRT not connected", "EmIR", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            LearnIRCodeWindow learnIRCodeWindow = new LearnIRCodeWindow();
            learnIRCodeWindow.Owner = this;
            bool? dialogResult = learnIRCodeWindow.ShowDialog();
            if (dialogResult.GetValueOrDefault(false))
            {
                IRCode newCode = new IRCode { Code = learnIRCodeWindow.IRCode };
                App.CurrentApp.IRCodes.Add(newCode);
                IRCodesListView.SelectedItem = newCode;
            }
        }