Пример #1
0
        public outlookMain()
        {
            InitializeComponent();
            //subscribe to new license mails
            _licenseMail.StateChanged += on_new_licensemail;

            _olk = new OutlookMail.OutlookMail(ref _licenseMail);

            string dbFile = _mysettings.SQLiteDataBaseFilename;

            if (!dbFile.Contains('\\'))
            {   //build full file name
                dbFile = utils.helpers.getAppPath() + dbFile;
            }
            _licenseDataBase = new LicenseDataBase(ref this.dataGridView1, dbFile);
            _licenseDataBase.StateChanged += new StateChangedEventHandler(_licenseDataBase_StateChanged);
            if (_licenseDataBase.bIsValidDB == false)
            {
                MessageBox.Show("Error accessing or creating database file: " + dbFile, "Fatal ERROR");
                Application.Exit();
            }
            else
            {
                loadData();
            }
        }
Пример #2
0
 private void mnuDisconnect_Click(object sender, EventArgs e)
 {
     if (_olk != null)
     {
         _olk.Dispose();
         _olk = null;
     }
     mnuConnect.Enabled    = true;
     mnuDisconnect.Enabled = false;
 }
Пример #3
0
        private void mnuConnect_Click(object sender, EventArgs e)
        {
            _mysettings = _mysettings.load();
            _userData   = new utils.UserData(_mysettings.ShowDialog, _mysettings.OutlookProfile, _mysettings.Username, "");
            Helpers.GetLogonDataOutlook dlg = new Helpers.GetLogonDataOutlook(ref _userData);
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _olk = new OutlookMail.OutlookMail(ref _licenseMail);
                _olk.StateChanged += new StateChangedEventHandler(_olk_stateChanged);

                //_olk.StateChanged += new StateChangedEventHandler(_olk_StateChanged);
                _olk.start();

                if (_olk.logon(_userData.sOutlookProfile, _userData.sUser, _userData.sPassword, _userData.bShowOutlookDialog))
                {// "Global", "E841719", ""))
                    Cursor.Current = Cursors.WaitCursor;
                    Application.DoEvents();
                    _olk.getMailsAsync();
                }
            }
            mnuConnect.Enabled    = false;
            mnuDisconnect.Enabled = true;
        }
Пример #4
0
        public outlookMain()
        {
            InitializeComponent();
            //subscribe to new license mails
            _licenseMail.StateChanged += on_new_licensemail;

             _olk = new OutlookMail.OutlookMail(ref _licenseMail);

             string dbFile = _mysettings.SQLiteDataBaseFilename;

             if (!dbFile.Contains('\\'))
             {  //build full file name
                 dbFile = utils.helpers.getAppPath() + dbFile;
             }
             _licenseDataBase = new LicenseDataBase(ref this.dataGridView1, dbFile);
             _licenseDataBase.StateChanged += new StateChangedEventHandler(_licenseDataBase_StateChanged);
             if (_licenseDataBase.bIsValidDB == false)
             {
                 MessageBox.Show("Error accessing or creating database file: " + dbFile, "Fatal ERROR");
                 Application.Exit();
             }
             else
                 loadData();
        }
Пример #5
0
 private void mnuDisconnect_Click(object sender, EventArgs e)
 {
     if (_olk != null)
     {
         _olk.Dispose();
         _olk = null;
     }
     mnuConnect.Enabled = true;
     mnuDisconnect.Enabled = false;
 }
Пример #6
0
        private void mnuConnect_Click(object sender, EventArgs e)
        {
            _mysettings = _mysettings.load();
            _userData = new utils.UserData(_mysettings.ShowDialog,_mysettings.OutlookProfile, _mysettings.Username, "");
            Helpers.GetLogonDataOutlook dlg = new Helpers.GetLogonDataOutlook(ref _userData);
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _olk = new OutlookMail.OutlookMail(ref _licenseMail);
                _olk.StateChanged += new StateChangedEventHandler(_olk_stateChanged);

                //_olk.StateChanged += new StateChangedEventHandler(_olk_StateChanged);
                _olk.start();

                if (_olk.logon(_userData.sOutlookProfile, _userData.sUser, _userData.sPassword, _userData.bShowOutlookDialog))
                {// "Global", "E841719", ""))
                    Cursor.Current = Cursors.WaitCursor;
                    Application.DoEvents();
                    _olk.getMailsAsync();
                }
            }
            mnuConnect.Enabled = false;
            mnuDisconnect.Enabled = true;
        }
Пример #7
0
        void _getMails(object param)
        {
            helpers.addLog("_getMails() started...");
            OnStateChanged(new StatusEventArgs(StatusType.busy, "looking thru eMails"));
            OutlookMail _olk = (OutlookMail)param;  //need an instance

            _olk.OnStateChanged(new StatusEventArgs(StatusType.busy, "_getMails() started..."));
            try
            {
                _olk.OnStateChanged(new StatusEventArgs(StatusType.ews_pulse, "looking thru emails"));
                Outlook.Items items = MyInbox.Items;
                items.Sort("[ReceivedTime]");
                foreach (object o in items)// MyInbox.Items.Sort("[ReceivedTime]"))
                {
                    processMail(o);

                    /*
                     * if (o == null)
                     *  continue;
                     * int foundAttachements=0;
                     * if (o == null)
                     *  continue;
                     * Outlook.MailItem mitem = o as Outlook.MailItem;
                     * if (mitem == null)
                     *  continue;
                     * if(mitem.Subject!=null)
                     *  helpers.addLog(string.Format("looking at: {0}\n", mitem.Subject));
                     * else
                     *  helpers.addLog(string.Format("looking at: {0}\n", mitem.EntryID));
                     *
                     * if (mitem.Attachments.Count == 0)
                     *  continue;
                     * else
                     * {
                     *  //look for .xml
                     *  foreach (Outlook.Attachment att in mitem.Attachments)
                     *  {
                     *      if (att.FileName.EndsWith("xml"))
                     *          foundAttachements++;
                     *  }
                     * }
                     * if (foundAttachements == 0)
                     *  continue;   //no attachement ending in xml
                     * if(mitem.Subject.IndexOf(helpers.filterSubject)==-1)
                     *  continue;
                     * if (mitem.Subject.IndexOf(sMailHasAlreadyProcessed) > 0)  //do not process mail again
                     *  continue;
                     *
                     * //process mail
                     * helpers.addLog(string.Format("### mail found: {0},\n{1}\n\n", mitem.Subject, mitem.Body));
                     * _olk.OnStateChanged(new StatusEventArgs(StatusType.ews_pulse, "getMail: processing eMail " + mitem.Subject));
                     * MailMsg myMailMsg = new MailMsg(mitem, _olk._userData.sUser);
                     * int iRet = _olk._licenseMail.processMail(myMailMsg);
                     * //change subject
                     * mitem.Subject += sMailHasAlreadyProcessed;
                     * mitem.Close(Outlook.OlInspectorClose.olSave);
                     * Thread.Sleep(100);
                     * Thread.Yield();
                     */
                }
            }
            catch (System.Exception ex)
            {
                helpers.addExceptionLog(ex.StackTrace);
            }
            _olk.OnStateChanged(new StatusEventArgs(StatusType.ews_pulse, "read mail done"));
        }
Пример #8
0
        private void cONFIRMSMSToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OutlookMail obj = new OutlookMail();

            obj.Show();
        }