Exemplo n.º 1
0
        public MainForm()
        {
            InitializeComponent();
            #if !DEBUG
            mnuAdmin.Visible = false;
            #endif
            OpenDB:
            //load settings
            _mysettings = new MySettings();
            _mysettings = _mysettings.load();

            string appPath = utils.helpers.getAppPath();

            _licenseMail = new LicenseMail();
            //subscribe to new license mails
            _licenseMail.StateChanged += on_new_licensemail;

            addLog("Please select Exchange-Connect to start test");
            string dbFile = _mysettings.SQLiteDataBaseFilename;

            if (!dbFile.Contains('\\'))
            {  //build full file name
                dbFile = utils.helpers.getAppPath() + dbFile;
            }
            _licenseDataBase = new LicenseDataBase(ref this.dataGridView1, dbFile);

            if (_licenseDataBase.bIsValidDB == false)
            {
                MessageBox.Show("Error accessing or creating database file: " + dbFile, "Fatal ERROR");
                SettingsForm dlg = new SettingsForm();
                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    goto OpenDB;    //try again
                }
                else
                {
                    MessageBox.Show("Cannot run without valid database path and file name", "Exchange License Mail Grabber");
                    exitApp();
                }
            }
            else
            {
                _licenseDataBase.StateChanged += new StateChangedEventHandler(_licenseDataBase_StateChanged);
                loadData();
            }

            readDGVlayout();
        }
Exemplo n.º 2
0
 private void mnuSettings_Click(object sender, EventArgs e)
 {
     SettingsForm dlg = new SettingsForm();
     dlg.ShowDialog();
 }