Exemple #1
0
        /// <summary>
        /// Constructs a new instance of the <see cref="CWClientScheduler"/> class.
        /// </summary>
        public CWClientScheduler()
        {
            // This call is required by the Windows.Forms Component Designer.
            InitializeComponent();

            globals = Globals.Instance();
            tmrStart = new System.Timers.Timer();
            startTimer = new AlarmTimer();
            if(globals.Settings.EnableScheduler)
            {
                startTimer.AlarmTime = globals.Settings.StartTime.AddMinutes(-5);
            }
            else
            {
                startTimer.AlarmTime = DateTime.Now.AddMinutes(1);
            }
            startTimer.Enabled = true;
            startTimer.OnAlarmBell += new EventHandler(startTimer_OnAlarmBell);
            startTimer.Start();
            updateBackoff = new Backoff(BackoffSpeed.Linear);
            updating = false;
        }
Exemple #2
0
 /// <summary>
 /// Provides a global access point for the single instance of the <see cref="Globals"/>
 /// class.
 /// </summary>
 /// <returns>A reference to the single instance of <see cref="Globals"/>.</returns>
 public static Globals Instance()
 {
     if (instance==null)
     {
         //Make sure the call is thread-safe. We cannot use the private mutex since
         //it hasn't yet been initialized - it gets initialized in the constructor.
         Mutex imutex=new Mutex();
         imutex.WaitOne();
         if( instance == null )
         {
             instance = new Globals();
         }
         imutex.Close();
     }
     return instance;
 }