Exemple #1
0
 public bool Save(MySettings settings)
 {
     StreamWriter sw = null;
     try
     {
         //now global: XmlSerializer xs = new XmlSerializer(typeof(MySettings));
         //omit xmlns:xsi from xml output
         //Create our own namespaces for the output
         XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
         //Add an empty namespace and empty value
         ns.Add("", "");
         sw = new StreamWriter(settingsFile);
         xs.Serialize(sw, settings, ns);
         return true;
     }
     catch (Exception ex)
     {
         utils.helpers.addExceptionLog(ex.Message);
         return false;
     }
     finally
     {
         if (sw != null)
             sw.Close();
     }
 }
Exemple #2
0
        void loadSettings()
        {
            _mysettings = _mysettings.load();
            txtDomain.Text = _mysettings.ExchangeDomainname;
            txtUser.Text = _mysettings.ExchangeUsername;
            txtExchangeServiceURL.Text = _mysettings.ExchangeServiceURL;
            chkUseWebProxy.Checked = _mysettings.UseWebProxy;
            txtWebProxy.Text = _mysettings.ExchangeWebProxy;
            numProxyPort.Value = _mysettings.EchangeWebProxyPort;

            chkEnableLogging.Checked = _mysettings.UseLogging;

            txtDatabaseFile.Text = _mysettings.SQLiteDataBaseFilename;
        }
Exemple #3
0
        void loadSettings()
        {
            _mysettings                = _mysettings.load();
            txtDomain.Text             = _mysettings.ExchangeDomainname;
            txtUser.Text               = _mysettings.ExchangeUsername;
            txtExchangeServiceURL.Text = _mysettings.ExchangeServiceURL;
            chkUseWebProxy.Checked     = _mysettings.UseWebProxy;
            txtWebProxy.Text           = _mysettings.ExchangeWebProxy;
            numProxyPort.Value         = _mysettings.EchangeWebProxyPort;

            chkEnableLogging.Checked = _mysettings.UseLogging;

            txtDatabaseFile.Text = _mysettings.SQLiteDataBaseFilename;
        }
Exemple #4
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();
        }
Exemple #5
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();
        }
        public ManualDataInput(ref Helpers.LicenseDataBase licData, ref MySettings Settings)
        {
            InitializeComponent();

            txtProduct.Text = "[NAU-1504] CETerm for Windows CE 6.0 / 5.0 / CE .NET";
            _licenseDataBase = licData;
            attachErrorProvider();
            btnSave.Enabled = false;

            // Create the list to use as the custom source.
            var source = new AutoCompleteStringCollection();
            source.AddRange(_licenseDataBase.productList);
            txtProduct.AutoCompleteCustomSource = source;
            txtProduct.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            txtProduct.AutoCompleteSource = AutoCompleteSource.CustomSource;

            //prefill
            _settings = Settings;
            //settings.load();
            txtReceivedBy.Text = _settings.ExchangeUsername;
        }
Exemple #7
0
        public ManualDataInput(ref Helpers.LicenseDataBase licData, ref MySettings Settings)
        {
            InitializeComponent();

            txtProduct.Text  = "[NAU-1504] CETerm for Windows CE 6.0 / 5.0 / CE .NET";
            _licenseDataBase = licData;
            attachErrorProvider();
            btnSave.Enabled = false;

            // Create the list to use as the custom source.
            var source = new AutoCompleteStringCollection();

            source.AddRange(_licenseDataBase.productList);
            txtProduct.AutoCompleteCustomSource = source;
            txtProduct.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            txtProduct.AutoCompleteSource       = AutoCompleteSource.CustomSource;

            //prefill
            _settings = Settings;
            //settings.load();
            txtReceivedBy.Text = _settings.ExchangeUsername;
        }
Exemple #8
0
        public MySettings load()
        {
            MySettings settings = new MySettings();
            StreamReader sr=null;
            try
            {
                XmlSerializer xs = new XmlSerializer(typeof(MySettings));
                sr = new StreamReader(settingsFile);
                settings = (MySettings)xs.Deserialize(sr);
                sr.Close();
            }
            catch (Exception ex)
            {
                utils.helpers.addExceptionLog("MySettings load Exception: ");
            }
            finally
            {
                if(sr!=null)
                    sr.Close();
            }

            return settings;
        }
Exemple #9
0
        private void mnuConnect_Click(object sender, EventArgs e)
        {
            _mysettings = _mysettings.load();
            _userData   = new utils.UserData(_mysettings.ExchangeDomainname, _mysettings.ExchangeUsername, "", _mysettings.UseWebProxy);
            Helpers.GetLogonData dlg = new Helpers.GetLogonData(ref _userData);
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _ews = new ews(ref _licenseMail);
                _ews.StateChanged += new StateChangedEventHandler(_ews_stateChanged1);
                _ews.start();

                if (_ews.logon(_userData.sDomain, _userData.sUser, _userData.sPassword,
                               _mysettings.UseWebProxy,
                               _mysettings.ExchangeWebProxy,
                               _mysettings.EchangeWebProxyPort))
                {// "Global", "E841719", ""))
                    Cursor.Current = Cursors.WaitCursor;
                    Application.DoEvents();
                    _ews.getMailsAsync();
                }
            }
            mnuConnect.Enabled    = false;
            mnuDisconnect.Enabled = true;
        }
Exemple #10
0
        private void mnuConnect_Click(object sender, EventArgs e)
        {
            _mysettings = _mysettings.load();
            _userData = new utils.UserData(_mysettings.ExchangeDomainname, _mysettings.ExchangeUsername, "", _mysettings.UseWebProxy);
            Helpers.GetLogonData dlg = new Helpers.GetLogonData(ref _userData);
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _ews = new ews(ref _licenseMail);
                _ews.StateChanged += new StateChangedEventHandler(_ews_stateChanged1);
                _ews.start();

                if (_ews.logon(_userData.sDomain, _userData.sUser, _userData.sPassword,
                    _mysettings.UseWebProxy,
                    _mysettings.ExchangeWebProxy,
                    _mysettings.EchangeWebProxyPort))
                {// "Global", "E841719", ""))
                    Cursor.Current = Cursors.WaitCursor;
                    Application.DoEvents();
                    _ews.getMailsAsync();
                }
            }
            mnuConnect.Enabled = false;
            mnuDisconnect.Enabled = true;
        }