Esempio n. 1
0
        private void InitPlugin()
        {
            DisposePlugin();
            _cfg.ReadConfig();

            _currentUsersEmailAddress = this.Application.ActiveExplorer().Session
                                        .CurrentUser.AddressEntry.GetExchangeUser().PrimarySmtpAddress;

            //DateTime dueTime = new DateTime(
            //    DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, DateTime.Now.Hour + 1, 0, 0);
            DateTime dueTime = new DateTime(
                DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 0, 5, 0).AddDays(1);
            TimeSpan timeRemaining = dueTime.Subtract(DateTime.Now);

            _t = new System.Threading.Timer(
                new System.Threading.TimerCallback(TimerTick), null,
                Convert.ToInt32(timeRemaining.TotalMilliseconds), // start at next day 00:05:00
                24 * 60 * 60 * 1000);                             // repeat every day

            if (_cfg.ShowDebug)
            {
                MessageBox.Show(String.Format("Start timer at {0} waiting {1}",
                                              dueTime, timeRemaining),
                                Config.PROD_SHORT_NAME + " (Debug)",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 2
0
        private void btnConfig_Click(object sender, RibbonControlEventArgs e)
        {
            Config cfg = Config.Singleton;

            cfg.ReadConfig();

            Form         f  = new Dialogs.Config(cfg);
            DialogResult rc = f.ShowDialog();

            if (rc == DialogResult.OK)
            {
                cfg.WriteConfig();
            }
        }