Esempio n. 1
0
    private void SetRxEventLearnedStatus(LearningEventArgs e)
    {
      // Make sure we're calling this method from the correct thread...
      if (receivedIrLbl.InvokeRequired)
      {
        SetLearningStatusCallback d = new SetLearningStatusCallback(SetRxEventLearnedStatus);
        this.Invoke(d, new object[] { e });
      }

      else
      {
        receivedIrLbl.Text = e.IrCode;
        string msg;
        MessageBoxIcon mbIcon = MessageBoxIcon.Information;

        if (e.Succeeded)
        {
          int passNumber = 1;

          if (e.IsToggledIrCode)
            passNumber = 2;

          msg = string.Format("Successfully learned IR code {0} of 2 for button:\t\r\n  [{1}]", passNumber, e.Button);
        }

        else
        {
          msg = string.Format("Failed to learn IR code for button:\t\r\n  [{0}]", e.Button);
        }

        USBUIRT.Instance.ReceiveEnabled = false;
        MessageBox.Show(this, msg, "USBUIRT", MessageBoxButtons.OK, mbIcon);
        USBUIRT.Instance.ReceiveEnabled = true;

        this.statusLabel.Text = "";
      }
    }
Esempio n. 2
0
 private void Instance_OnRxEventLearned(object sender, LearningEventArgs e)
 {
   SetRxEventLearnedStatus(e);
 }
Esempio n. 3
0
 private void Instance_StartRxLearning(object sender, LearningEventArgs e)
 {
   SetStartRxLearningStatus(e);
 }
Esempio n. 4
0
    private void SetStartRxLearningStatus(LearningEventArgs e)
    {
      // Make sure we're calling this method from the correct thread...
      if (receivedIrLbl.InvokeRequired)
      {
        SetLearningStatusCallback d = new SetLearningStatusCallback(SetStartRxLearningStatus);
        this.Invoke(d, new object[] { e });
      }

      else
      {
        receivedIrLbl.Text = e.IrCode;
        LearnStatusLbl.Text = string.Format("Learning Media Portal Control Command: {0} of {1}", e.CurrentCodeCount + 1, e.TotalCodeCount);

        LearnPrgBar.Maximum = e.TotalCodeCount;
        LearnPrgBar.Value = e.CurrentCodeCount;
        LearnStatusPnl.BringToFront();

        if (!e.IsToggledIrCode)
        {
          statusLabel.ForeColor = Color.DarkBlue;
          statusLabel.Text = "Step 1 of 2:\r\nPress and hold the [" + e.Button + "] button on your remote";
        }

        else
        {
          statusLabel.ForeColor = Color.Red;
          statusLabel.Text = "Step 2 of 2:\r\nPress and hold the [" + e.Button + "] button on your remote";
        }

        System.Windows.Forms.Application.DoEvents();
      }
    }
Esempio n. 5
0
    private void SetTxEventLearnedStatus(LearningEventArgs e)
    {
      // Make sure we're calling this method from the correct thread...
      if (receivedIrLbl.InvokeRequired)
      {
        SetLearningStatusCallback d = new SetLearningStatusCallback(SetTxEventLearnedStatus);
        this.Invoke(d, new object[] { e });
      }

      else
      {
        receivedIrLbl.Text = e.IrCode;

        if (e.IsToggledIrCode)
          this.LearnPrgBar.Value = e.CurrentCodeCount;

        System.Windows.Forms.Application.DoEvents();

        string msg;
        MessageBoxIcon mbIcon = MessageBoxIcon.Information;

        if (e.Succeeded)
        {
          int passNumber = 1;

          if (e.IsToggledIrCode)
            passNumber = 2;

          msg = string.Format("Successfully learned IR code {0} of 2 for button:\t\r\n  [{1}]", passNumber, e.Button);
        }

        else
        {
          msg = string.Format("Failed to learn IR code for button:\t\r\n  [{0}]", e.Button);
          mbIcon = MessageBoxIcon.Exclamation;
        }

        MessageBox.Show(this, msg, "USBUIRT", MessageBoxButtons.OK, mbIcon);
        this.statusLabel.Text = "";
      }
    }