public AppContext() { InitializeComponent(); ReadGeneralInfo(); if (!_useDirectRef && (_login.Equals("") || _password.Equals(""))) { var setView = new SettingsView(this); setView.Show(); } _notifyIcon.Click += OnIconClick; var listener = new YotaListener(this); _yota = new YotaNavigator(_login, _password, _deviceId, _useDirectRef, listener); _animMgr = new ProcessAnimationManager( this, _backColor, _textColor, _textFont ); _animMgr.SetText("?"); if (Settings.Default.NeedScheduler) _scheduler = new Scheduler(_yota); else { if (_yota != null && _yota.UserDataIsFull()) _yota.SetRate(-1); } }
public Scheduler(YotaNavigator yota) { DbOpenHelper.CreateDbIfNotExists(); // считываем настрйки автоматизации for (int key = 0; key < KeyCount; ++key) { bool need; int rate; DbOpenHelper.ReadChangeRateEventEnable(key, out need, out rate); _startEventNeed[key] = need; _startEventRate[key] = rate; } _timeSchedule = DbOpenHelper.ReadTimeSchedule().ToArray(); _processSchedule = DbOpenHelper.ReadProcessSchedule(); // определяем тариф _yota = yota; if (_yota != null && _yota.UserDataIsFull()) { if (NeedChangeOnEvent(KeyOnStartApp)) _yota.SetRate(RateNumOnChange(KeyOnStartApp)); else _yota.SetRate(-1); } // события по расписанию _timeExecutor = new ScheduleByTimerExecuter(this); _timeExecutor.ManageStartAndStop(); }