Esempio n. 1
0
 /// <summary>
 /// Sets information from a CAM request
 /// </summary>
 /// <param name="sRequest">Request messages</param>
 /// <param name="nAnswerLength">Expected max. answer length</param>
 /// <param name="bPassword">Show as password input</param>
 public void Request(string sRequest, int nAnswerLength, bool bPassword)
 {
     _requestText  = sRequest;
     _answerLength = nAnswerLength;
     _bPassword    = bPassword;
     _menuState    = CiMenuState.Request;
 }
Esempio n. 2
0
        /// <summary>
        /// CTOR
        /// </summary>
        /// <param name="Title">Title</param>
        /// <param name="Subtitle">Subtitle</param>
        /// <param name="BottomText">Bottomtext</param>
        /// <param name="State">Menu state</param>
        public CiMenu(String Title, String Subtitle, String BottomText, CiMenuState State)
        {
            _title      = Title;
            _subtitle   = Subtitle;
            _bottomText = BottomText;
            _menuState  = State;

            // clear entries before filling later
            _ciMenuEntries.Clear();
        }
Esempio n. 3
0
        /// <summary>
        /// Handles all CiMenu actions from callback
        /// </summary>
        /// <param name="Menu">complete CI menu object</param>
        public void CiMenuCallback(CiMenu Menu)
        {
            ciMenuState = Menu.State;

            switch (ciMenuState)
            {
            // choices available, so show them
            case TvLibrary.Interfaces.CiMenuState.Ready:
                //ciMenuState = CiMenuState.Opened;
                Title.Text      = Menu.Title;
                Subtitle.Text   = Menu.Subtitle;
                BottomText.Text = Menu.BottomText;
                ciMenuChoices   = Menu.NumChoices;

                Choices.Items.Clear();

                // no choices then we are ready yet
                if (ciMenuChoices == 0)
                {
                    ciMenuState = CiMenuState.NoChoices;
                    SetButtonState();
                }
                else
                {
                    foreach (CiMenuEntry entry in Menu.MenuEntries)
                    {
                        Choices.Items.Add(entry);
                    }
                }
                break;

            // errors and menu options with no choices
            case TvLibrary.Interfaces.CiMenuState.Error:
            case TvLibrary.Interfaces.CiMenuState.NoChoices:
                Title.Text      = Menu.Title;
                Subtitle.Text   = Menu.Subtitle;
                BottomText.Text = Menu.BottomText;
                ciMenuChoices   = Menu.NumChoices;
                break;

            // requests require users input so open keyboard
            case TvLibrary.Interfaces.CiMenuState.Request:
                ciMenuState = CiMenuState.Request;
                SetButtonState();
                CiRequest.Text     = String.Format("{0} ({1} Zeichen)", Menu.RequestText, Menu.AnswerLength);
                CiAnswer.MaxLength = (int)Menu.AnswerLength;
                CiAnswer.Text      = "";
                CiAnswer.Focus();
                break;
            }
            SetButtonState();
        }
Esempio n. 4
0
 private void btnSendAnswer_Click(object sender, EventArgs e)
 {
     try
     {
         if (ciMenuState == CiMenuState.Ready && Choices.SelectedIndex != -1)
         {
             RemoteControl.Instance.SelectMenu(cardNumber, Convert.ToByte(Choices.SelectedIndex + 1));
         }
         if (ciMenuState == CiMenuState.Request)
         {
             RemoteControl.Instance.SendMenuAnswer(cardNumber, false, CiAnswer.Text);
             ciMenuState = CiMenuState.Ready;
         }
         SetButtonState();
     }
     catch (Exception ex)
     {
         Log.Write(ex);
     }
 }
Esempio n. 5
0
 private void btnCloseMenu_Click(object sender, EventArgs e)
 {
     try
     {
         if (ciMenuState == CiMenuState.NoChoices || ciMenuState == CiMenuState.Ready)
         {
             RemoteControl.Instance.SelectMenu(cardNumber, 0); // back
             ciMenuState = CiMenuState.Closed;
         }
         if (ciMenuState == CiMenuState.Request)
         {
             RemoteControl.Instance.SendMenuAnswer(cardNumber, true, null);
             ciMenuState = CiMenuState.Ready;
         }
         SetButtonState();
     }
     catch (Exception ex)
     {
         Log.Write(ex);
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Sets information from a CAM request 
 /// </summary>
 /// <param name="sRequest">Request messages</param>
 /// <param name="nAnswerLength">Expected max. answer length</param>
 /// <param name="bPassword">Show as password input</param>
 public void Request(string sRequest, int nAnswerLength, bool bPassword)
 {
   _requestText = sRequest;
   _answerLength = nAnswerLength;
   _bPassword = bPassword;
   _menuState = CiMenuState.Request;
 }
Esempio n. 7
0
    /// <summary>
    /// CTOR
    /// </summary>
    /// <param name="Title">Title</param>
    /// <param name="Subtitle">Subtitle</param>
    /// <param name="BottomText">Bottomtext</param>
    /// <param name="State">Menu state</param>
    public CiMenu(String Title, String Subtitle, String BottomText, CiMenuState State)
    {
      _title = Title;
      _subtitle = Subtitle;
      _bottomText = BottomText;
      _menuState = State;

      // clear entries before filling later
      _ciMenuEntries.Clear();
    }
Esempio n. 8
0
    /// <summary>
    /// Handles all CiMenu actions from callback
    /// </summary>
    /// <param name="Menu">complete CI menu object</param>
    public void CiMenuCallback(CiMenu Menu)
    {
      ciMenuState = Menu.State;

      switch (ciMenuState)
      {
          // choices available, so show them
        case TvLibrary.Interfaces.CiMenuState.Ready:
          //ciMenuState = CiMenuState.Opened;
          Title.Text = Menu.Title;
          Subtitle.Text = Menu.Subtitle;
          BottomText.Text = Menu.BottomText;
          ciMenuChoices = Menu.NumChoices;

          Choices.Items.Clear();

          // no choices then we are ready yet
          if (ciMenuChoices == 0)
          {
            ciMenuState = CiMenuState.NoChoices;
            SetButtonState();
          }
          else
          {
            foreach (CiMenuEntry entry in Menu.MenuEntries)
            {
              Choices.Items.Add(entry);
            }
          }
          break;

          // errors and menu options with no choices
        case TvLibrary.Interfaces.CiMenuState.Error:
        case TvLibrary.Interfaces.CiMenuState.NoChoices:
          Title.Text = Menu.Title;
          Subtitle.Text = Menu.Subtitle;
          BottomText.Text = Menu.BottomText;
          ciMenuChoices = Menu.NumChoices;
          break;

          // requests require users input so open keyboard
        case TvLibrary.Interfaces.CiMenuState.Request:
          ciMenuState = CiMenuState.Request;
          SetButtonState();
          CiRequest.Text = String.Format("{0} ({1} Zeichen)", Menu.RequestText, Menu.AnswerLength);
          CiAnswer.MaxLength = (int)Menu.AnswerLength;
          CiAnswer.Text = "";
          CiAnswer.Focus();
          break;
      }
      SetButtonState();
    }
Esempio n. 9
0
 private void btnSendAnswer_Click(object sender, EventArgs e)
 {
   try
   {
     if (ciMenuState == CiMenuState.Ready && Choices.SelectedIndex != -1)
     {
       RemoteControl.Instance.SelectMenu(cardNumber, Convert.ToByte(Choices.SelectedIndex + 1));
     }
     if (ciMenuState == CiMenuState.Request)
     {
       RemoteControl.Instance.SendMenuAnswer(cardNumber, false, CiAnswer.Text);
       ciMenuState = CiMenuState.Ready;
     }
     SetButtonState();
   }
   catch (Exception ex)
   {
     Log.Write(ex);
   }
 }
Esempio n. 10
0
 private void btnCloseMenu_Click(object sender, EventArgs e)
 {
   try
   {
     if (ciMenuState == CiMenuState.NoChoices || ciMenuState == CiMenuState.Ready)
     {
       RemoteControl.Instance.SelectMenu(cardNumber, 0); // back
       ciMenuState = CiMenuState.Closed;
     }
     if (ciMenuState == CiMenuState.Request)
     {
       RemoteControl.Instance.SendMenuAnswer(cardNumber, true, null);
       ciMenuState = CiMenuState.Ready;
     }
     SetButtonState();
   }
   catch (Exception ex)
   {
     Log.Write(ex);
   }
 }