private void LoadAccounts() { OutlookSession session = new OutlookSession(); EmailAccountCollection collection = session.EmailAccounts; if (collection.Count > 0) { int g = 0; for (int i = 0; i < collection.Count; i++) { EmailAccount account = collection[i]; if (!account.Name.ToLower().Equals("activesync")) { RadioButton rb = new RadioButton(); if (dbManager.ACCOUNTS.Rows.Count > 0) { rb.Checked = dbManager.ACCOUNTS.Rows.Contains(account.Name); } rb.Text = account.Name; rb.Top = 5 + (g * 20); rb.Left = 4; rb.Width = PnlAccounts.Width - 20; rb.Click += new EventHandler(rb_Click); g++; this.PnlAccounts.Controls.Add(rb); } } this.PnlAccounts.Invalidate(); } }
public Engine(string[] args) { // If the interceptor is enabled if (MessageInterceptor.IsApplicationLauncherEnabled(AppRegisterName)) { // We started this app via an SMS {1} if (args.Length > 0) { // An SMS started the Engine... if (args[0].Equals("1")) { InitializeComponent(); dbManager = new DatabaseManager(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase)); // we must have both accounts and recipients to proceed! if ((dbManager.ACCOUNTS.Rows.Count > 0) && (dbManager.RECIPIENTS.Rows.Count > 0)) { this.session = new OutlookSession(); this.collection = session.EmailAccounts; // Set the recipient collection this.recipientCollection = dbManager.RECIPIENTS.Rows; if (collection.Count > 0) { // Set the email account this.emailAccount = collection[Convert.ToString(dbManager.ACCOUNTS.Rows[0]["ADDRESS"])]; if (this.emailAccount != null) { // Create the Interceptor smsInterceptor = new MessageInterceptor(AppRegisterName, true); smsInterceptor.MessageReceived += new MessageInterceptorEventHandler(smsInterceptor_MessageReceived); } else { this.Close(); } } else { this.Close(); } } else { this.Close(); } } else { this.Close(); } } else { this.Close(); } } else { this.Close(); } }