예제 #1
0
    private void SetTxEndSingleCommandLearningStatus(EventArgs e)
    {
      // Make sure we're calling this method from the correct thread...
      if (receivedIrLbl.InvokeRequired)
      {
        SetEndLearningCallback d = new SetEndLearningCallback(SetTxEndSingleCommandLearningStatus);
        this.Invoke(d, new object[] {e});
      }

      else
      {
        statusLabel.Text = "";
        receivedIrLbl.Text = "";
        string msg = "";
        MessageBoxIcon mbIcon = MessageBoxIcon.Information;

        MediaPortal.IR.USBUIRT.Instance.StartLearning -=
          new MediaPortal.IR.USBUIRT.StartLearningEventHandler(Instance_StartTxLearning);
        MediaPortal.IR.USBUIRT.Instance.OnEventLearned -=
          new MediaPortal.IR.USBUIRT.EventLearnedHandler(Instance_OnTxEventLearned);
        MediaPortal.IR.USBUIRT.Instance.OnEndLearning -=
          new MediaPortal.IR.USBUIRT.EndLearnedHandler(Instance_OnTxEndSingleCommandLearning);

        if (MediaPortal.IR.USBUIRT.Instance.AbortLearn)
        {
          LearnPrgBar.Value = 0;
          msg = "Set top box IR training aborted by user.\t";
          mbIcon = MessageBoxIcon.Exclamation;
          LearnStatusLbl.Text = "Set top box IR training aborted by user!";
        }

        else if (MediaPortal.IR.USBUIRT.Instance.SaveTunerValues())
        {
          LearnPrgBar.Value = LearnPrgBar.Maximum;
          msg = "Set top box IR training completed successfully.\t";
          mbIcon = MessageBoxIcon.Information;
          LearnStatusLbl.Text = "Set top box IR training completed successfully!";
        }

        else
        {
          LearnPrgBar.Value = 0;
          msg = "Set top box IR training Failed: Unable to save IR code settings to file.\t";
          mbIcon = MessageBoxIcon.Exclamation;
          LearnStatusLbl.Text = "Set top box IR training Failed!";
        }

        MessageBox.Show(this, msg, "USBUIRT", MessageBoxButtons.OK, mbIcon);
        this.Close();
      }
    }
예제 #2
0
    private void SetEndRxSingleCommandLearningStatus(EventArgs e)
    {
      // Make sure we're calling this method from the correct thread...
      if (receivedIrLbl.InvokeRequired)
      {
        SetEndLearningCallback d = new SetEndLearningCallback(SetEndRxSingleCommandLearningStatus);
        this.Invoke(d, new object[] { e });
      }

      else
      {
        MPCommandsPnl.BringToFront();
        statusLabel.Text = "";
        receivedIrLbl.Text = "";
        string msg = "";
        MessageBoxIcon mbIcon = MessageBoxIcon.Information;

        USBUIRT.Instance.StartLearning -= new USBUIRTAPI.StartLearningEventHandler(Instance_StartRxLearning);
        USBUIRT.Instance.OnEventLearned -= new USBUIRTAPI.EventLearnedHandler(Instance_OnRxEventLearned);
        USBUIRT.Instance.OnEndLearning -= new USBUIRTAPI.EndLearnedHandler(Instance_OnEndRxSingleCommandLearning);

        if (USBUIRT.Instance.AbortLearn)
        {
          LearnPrgBar.Value = 0;
          msg = "Media Portal Control IR training aborted by user.\t";
          mbIcon = MessageBoxIcon.Exclamation;
          LearnStatusLbl.Text = "Media Portal Control IR training aborted by user!";
        }

        else if (USBUIRT.Instance.SaveInternalValues())
        {
          LearnPrgBar.Value = LearnPrgBar.Maximum;
          msg = "Media Portal Control IR training completed successfully.\t";
          mbIcon = MessageBoxIcon.Information;
          LearnStatusLbl.Text = "Media Portal Control IR training completed successfully!";
        }

        else
        {
          LearnPrgBar.Value = 0;
          msg = "Media Portal Control IR training Failed: Unable to save IR code settings to file.\t";
          mbIcon = MessageBoxIcon.Exclamation;
          LearnStatusLbl.Text = "Media Portal Control IR training Failed!";
        }

        ActionsCheckList_SelectedIndexChanged(null, null);
        MessageBox.Show(this, msg, "USBUIRT", MessageBoxButtons.OK, mbIcon);
      }
    }