Exemplo n.º 1
0
        private void FormSMS_Load(object sender, EventArgs e)
        {
            ToolTip tooltips = new ToolTip();
              tooltips.SetToolTip(this.ButtonDelete, "Delete Address");
              tooltips.SetToolTip(this.ButtonSave, "Save Address");
              tooltips.SetToolTip(this.ButtonNew, "New Address");
              tooltips.SetToolTip(this.ButtonSettings, "Edit Settings");
              tooltips.SetToolTip(this.ButtonLog, "SMS Log");
              tooltips.SetToolTip(this.ButtonCheck, "Check Messages");
              tooltips.SetToolTip(this.ButtonSend, "Send Message");
              ComboBoxName.Sorted = true;

              try
              {
            string fromphone = "";
            string username = "";
            string password = "";
            if (GetRegistryValues(out fromphone, out username, out password))
            {
              string datapath = Path.Combine(System.IO.Path.GetTempPath(), fromphone + ".tmp");
              string text = string.Empty;
              using (StreamReader streamReader = new StreamReader(datapath, Encoding.UTF8))
              {
            text = streamReader.ReadToEnd();
              }

              JavaScriptSerializer json = new JavaScriptSerializer();
              IncomingSMS inbound = json.Deserialize<IncomingSMS>(text);

              foreach (MessageList message in inbound.messages)
              {
            if (message.direction != "inbound")
            {
              continue;
            }

            string body = "From: " + message.from + "\r\n" +
              "Date: " + message.date_sent + "\r\n" +
              "Body: \r\n" + message.body + "\r\n\r\n";

            mIncoming.Add(message.sid, body);
              }
            }
            else
            {
              mSettingsDialog = new EditSettings();
              mSettingsDialog.ShowDialog();
            }
              }
              catch (System.Exception)
              {
            // safety net
              }

              LoadAddresses();
              ComboBoxName.SelectedIndex = 0;
              TextBoxMessage.Focus();
        }
Exemplo n.º 2
0
 private void ButtonSettings_Click(object sender, EventArgs e)
 {
     mSettingsDialog = new EditSettings();
       mSettingsDialog.ShowDialog();
 }