示例#1
0
        public override void Initialize(OptimusMiniSettingsList currentSettings)
        {
            _Bitmap  = new Bitmap(96, 96, PixelFormat.Format16bppRgb565);
            _Graphic = Graphics.FromImage(_Bitmap);

            _TitleFont = new Font("Tahoma", 12f, FontStyle.Bold, GraphicsUnit.Pixel);
            _SmallFont = SystemFonts.DefaultFont;

            _Settings = currentSettings;
            _Accounts = new List <AccountPop3>();

            int lAccountsCounts = 0;

            if (_Settings["AccountsCount"] != "")
            {
                lAccountsCounts = int.Parse(_Settings["AccountsCount"]);
            }

            for (int i = 0; i < lAccountsCounts; i++)
            {
                string      lAccountConfig       = _Settings["Account" + i.ToString()];
                string[]    lAccountConfigValues = lAccountConfig.Split(';');
                AccountPop3 lAccount             = new AccountPop3();
                lAccount.Server   = lAccountConfigValues[0];
                lAccount.User     = lAccountConfigValues[1];
                lAccount.Password = lAccountConfigValues[2];
                lAccount.Secure   = (lAccountConfigValues[3] == "1");
                lAccount.Execute  = lAccountConfigValues[4];
                _Accounts.Add(lAccount);

                string   lAccountKnownIds       = _Settings["AccountKnownIds" + i.ToString()];
                string[] lAccountKnownIdsValues = lAccountKnownIds.Split(';');
                foreach (string lId in lAccountKnownIdsValues)
                {
                    lAccount._KnownMessages.Add(lId);
                }
            }

            _CheckIntervalSeconds = 60;
            if (_Settings["CheckInterval"] != "")
            {
                _CheckIntervalSeconds = int.Parse(_Settings["CheckInterval"]);
            }

            _MessageIntervalSeconds = 5;
            if (_Settings["MessageInterval"] != "")
            {
                _MessageIntervalSeconds = int.Parse(_Settings["MessageInterval"]);
            }

            _NewMessages    = new List <Message>();
            _CurrentMessage = -1;

            RequestNextUpdate(new TimeSpan(0, 0, 0));
        }
示例#2
0
        public override void Initialize(OptimusMiniSettingsList currentSettings)
        {
            _Bitmap = new Bitmap(96, 96, PixelFormat.Format16bppRgb565);
              _Graphic = Graphics.FromImage(_Bitmap);

              _TitleFont = new Font("Tahoma", 12f, FontStyle.Bold, GraphicsUnit.Pixel);
              _SmallFont = SystemFonts.DefaultFont;

              _Settings = currentSettings;
              _Accounts = new List<AccountPop3>();

              int lAccountsCounts = 0;
              if (_Settings["AccountsCount"] != "")
              {
            lAccountsCounts = int.Parse(_Settings["AccountsCount"]);
              }

              for (int i = 0; i < lAccountsCounts; i++)
              {
            string lAccountConfig = _Settings["Account" + i.ToString()];
            string[] lAccountConfigValues = lAccountConfig.Split(';');
            AccountPop3 lAccount = new AccountPop3();
            lAccount.Server = lAccountConfigValues[0];
            lAccount.User = lAccountConfigValues[1];
            lAccount.Password = lAccountConfigValues[2];
            lAccount.Secure = (lAccountConfigValues[3] == "1");
            lAccount.Execute = lAccountConfigValues[4];
            _Accounts.Add(lAccount);

            string lAccountKnownIds = _Settings["AccountKnownIds" + i.ToString()];
            string[] lAccountKnownIdsValues = lAccountKnownIds.Split(';');
            foreach (string lId in lAccountKnownIdsValues)
            {
              lAccount._KnownMessages.Add(lId);
            }
              }

              _CheckIntervalSeconds = 60;
              if (_Settings["CheckInterval"] != "")
              {
            _CheckIntervalSeconds = int.Parse(_Settings["CheckInterval"]);
              }

              _MessageIntervalSeconds = 5;
              if (_Settings["MessageInterval"] != "")
              {
            _MessageIntervalSeconds = int.Parse(_Settings["MessageInterval"]);
              }

              _NewMessages = new List<Message>();
              _CurrentMessage = -1;

              RequestNextUpdate(new TimeSpan(0, 0, 0));
        }
示例#3
0
        public Config(OptimusMiniSettingsList currentSettings)
        {
            InitializeComponent();

            _Settings = currentSettings;
            _Accounts = new List <AccountPop3>();

            int lAccountsCounts = 0;

            if (_Settings["AccountsCount"] != "")
            {
                lAccountsCounts = int.Parse(_Settings["AccountsCount"]);
            }

            for (int i = 0; i < lAccountsCounts; i++)
            {
                string      lAccountConfig       = _Settings["Account" + i.ToString()];
                string[]    lAccountConfigValues = lAccountConfig.Split(';');
                AccountPop3 lAccount             = new AccountPop3();
                lAccount.Server   = lAccountConfigValues[0];
                lAccount.User     = lAccountConfigValues[1];
                lAccount.Password = lAccountConfigValues[2];
                lAccount.Secure   = (lAccountConfigValues[3] == "1");
                lAccount.Execute  = lAccountConfigValues[4];
                _Accounts.Add(lAccount);
                listAccounts.Items.Add(lAccount.Server);
            }

            int lCheckInterval = 60;

            if (_Settings["CheckInterval"] != "")
            {
                lCheckInterval = int.Parse(_Settings["CheckInterval"]);
            }
            textCheckInterval.Text = lCheckInterval.ToString();

            int lMessageInterval = 5;

            if (_Settings["MessageInterval"] != "")
            {
                lMessageInterval = int.Parse(_Settings["MessageInterval"]);
            }
            textMessageInterval.Text = lMessageInterval.ToString();

            selectType.SelectedIndex = 0;
            UpdateActions();
        }
示例#4
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            if (textServer.Text == "" || textUsername.Text == "" || textPassword.Text == "")
            {
                MessageBox.Show("Server, username and password are required.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                textServer.Focus();
            }

            AccountPop3 lAccount = new AccountPop3();

            lAccount.Server   = textServer.Text;
            lAccount.User     = textUsername.Text;
            lAccount.Password = textPassword.Text;
            lAccount.Secure   = checkSecure.Checked;
            lAccount.Execute  = textExecute.Text;

            _Accounts.Add(lAccount);
            listAccounts.Items.Add(lAccount.Server);
            UpdateActions();
        }
示例#5
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            _Settings["AccountsCount"] = _Accounts.Count.ToString();
            for (int i = 0; i < _Accounts.Count; i++)
            {
                AccountPop3 lAccount = _Accounts[i];
                _Settings["Account" + i.ToString()] =
                    string.Join(";", new string[] {
                    lAccount.Server,
                    lAccount.User,
                    lAccount.Password,
                    (lAccount.Secure ? "1" : "0"),
                    lAccount.Execute
                });
            }

            _Settings["CheckInterval"]   = textCheckInterval.Text;
            _Settings["MessageInterval"] = textMessageInterval.Text;

            DialogResult = DialogResult.OK;
        }