Example #1
0
        private void LoadAccount()
        {
            frmAccountSelect acsel = new frmAccountSelect();

            if (acsel.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    m_account = new SMSAccount(acsel.SelectedAccount);
                    string err;
                    err = m_account.LoadKey(null);
                    if (string.IsNullOrEmpty(err) == false)
                    {
                        throw new Exception(err);
                    }
                    Text = string.Format("{0} - {1}", m_wndTitle, acsel.SelectedAccount);
                    err  = m_account.LoadMessagesHistory();
                    if (string.IsNullOrEmpty(err) == false)
                    {
                        throw new Exception(err);
                    }
                    Connect();
                }
                catch (Exception exp)
                {
                    MessageBox.Show(exp.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    m_account = null;
                }
            }
            acsel.Dispose();
        }
Example #2
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            mke             = new SMSAccount("ALICE");
            mke.AddressBook = addressbook;
            string err = mke.LoadKey(null);

            if (string.IsNullOrEmpty(err) == false)
            {
                mke.GenerateKey();
                err = mke.SaveKey(null);
            }
            if (string.IsNullOrEmpty(err) == false)
            {
                MessageBox.Show(err);
            }



            client = new SMSNet(mke);
            client.Connect("127.0.0.1", 5555);
        }