예제 #1
0
        public BusinessLogic(IView view)
        {
            Configuration = new ConfigurationBuilder()
                            .SetBasePath(Directory.GetCurrentDirectory())
                            .AddJsonFile(settingsFile, optional: false, reloadOnChange: true)
                            .Build();

            _baseDataPath  = Path.GetFullPath(Configuration["DataPath"]);
            _fileExtension = Configuration["FileExtension"];

            string culture = Configuration["CultureInfo"];

            CultureInfo.CurrentCulture   = new CultureInfo(culture, true);
            CultureInfo.CurrentUICulture = new CultureInfo(culture, true);

            _schedule = new QuestionScheduler();
            _view     = view;

            _view.Question     = Properties.Resources.QuestionText;
            _view.InputHint    = Properties.Resources.InputHint;
            _view.HelpText     = Properties.Resources.HelpText;
            _view.TimeToAnswer = GetTimeToAnswerFromString(Configuration["TimeToAnswer"]);

            _schedule.RaiseSchedulerEvent += Schedule_RaiseSchedulerEvent;

            _view.RaiseActivityAddedEvent    += View_RaiseActivityAddedEvent;
            _view.RaiseActivityChangedEvent  += View_RaiseActivityChangedEvent;
            _view.RaiseNoActivityEvent       += View_RaiseNoActivityEvent;
            _view.RaiseApplicationCloseEvent += View_RaiseApplicationCloseEvent;
            _view.ActivateMenu();
        }