public static void Initialize(CreateParams createParams) { fCreateParams = createParams; OnItemChanged = createParams.callback; fDataProvider = new DataProvider(ItemTree.FromFile(createParams.templateFilePath)); if (File.Exists(fCreateParams.userSettingsFilePath)) { fData = UserDataSerializer.LoadFromFile(fCreateParams.userSettingsFilePath); } else { fData = fDataProvider.GenerateDefaultOptionsSet(); } fDataProvider.ItemChanged += DataProvider_ItemChanged; fDataProvider.DataBinding = fData; if (form == null) { form = new SettingsForm(fDataProvider); form.OnSave += Form_OnSave; } }
private void Initialize() { fView = new DataView(); fData = new DataProvider(ItemTree.FromFile(SettingsFilePath)); fData.ItemChanged += fData_ItemChanged; //Create manually view[1] fDataViewParams = new DataViewParams { container = userControl11, descriptionContainer = controlContainer1, dataProvider = fData }; LoadSettings(); fData.DataBinding = fUserSettings; fView.Create(fDataViewParams); //Create view[2] with predefined 'SettingsForm' from the same data provider fSettingsForm = new SettingsForm(fData); fSettingsForm.OnSave += fSettingsForm_OnSave; fSettingsForm.Show(); }