Ejemplo n.º 1
0
        private async void frmMain_Load(object sender, System.EventArgs e)
        {
            var monthValues = new int[] { 3, 6, 9, 12 }.Select(i => new ListItem <int>(i, i.ToString()));

            _settings = SettingsBase.Load <Settings>();
            _binder   = new ControlBinder <Settings>();

            _binder.Add(tbSourcePath, model => model.SourcePath);
            _binder.Add(chkDelete, model => model.Delete);
            _binder.Add(chkDeleteBinObj, model => model.DeleteBinAndObj);
            _binder.Add(chkDeletePackages, model => model.DeletePackages);

            _binder.AddItems(cbDeleteMonths,
                             (model) => model.DeleteMonthsOld = cbDeleteMonths.GetValue <int>(),
                             (model) => cbDeleteMonths.SetValue(model.DeleteMonthsOld), monthValues);

            _binder.Add(chkArchive, model => model.Archive);
            _binder.Add(tbArchivePath, model => model.ArchivePath);
            _binder.AddItems(cbArchiveMonths,
                             (model) => model.ArchiveMonthsOld = cbArchiveMonths.GetValue <int>(),
                             (model) => cbArchiveMonths.SetValue(model.ArchiveMonthsOld), monthValues);

            _binder.Document = _settings;
            UpdateArchiveInfo();
            UpdateDeleteInfo();
        }