public ChartTestPresenter(IChartTestView view, IChartEditorAndDisplayPresenter chartEditorAndDisplayPresenter, TestEnvironment testEnvironment, IDataColumnToPathElementsMapper dataColumnToPathColumnValuesMapper, IDataRepositoryCreator dataRepositoryCreator, IOSPSuiteXmlSerializerRepository ospSuiteXmlSerializerRepository, DataPersistor dataPersistor, IChartFromTemplateService chartFromTemplateService, IChartTemplatePersistor chartTemplatePersistor, IDimensionFactory dimensionFactory, IChartUpdater chartUpdater) : base(view) { _model = testEnvironment.Model.Root; _dataRepositories = new Cache <string, DataRepository>(repository => repository.Name); _chartEditorAndDisplayPresenter = chartEditorAndDisplayPresenter; _dataRepositoryCreator = dataRepositoryCreator; _ospSuiteXmlSerializerRepository = ospSuiteXmlSerializerRepository; _dataPersistor = dataPersistor; _chartFromTemplateService = chartFromTemplateService; _chartTemplatePersistor = chartTemplatePersistor; _dimensionFactory = dimensionFactory; _chartUpdater = chartUpdater; _view.AddChartEditorView(chartEditorAndDisplayPresenter.EditorPresenter.View); _view.AddChartDisplayView(chartEditorAndDisplayPresenter.DisplayPresenter.View); _simulationSettings = new SimulationSettings(); AddSubPresenters(chartEditorAndDisplayPresenter); configureChartEditorPresenter(dataColumnToPathColumnValuesMapper); bindCurveChartToEditor(); configureChartEditorEvents(); InitializeWith(new OSPSuiteMacroCommand <IOSPSuiteExecutionContext>()); }
public ChartEditorLayoutTask(IPresentationUserSettings userSettings, IChartLayoutTemplateRepository chartLayoutTemplateRepository, IOSPSuiteXmlSerializerRepository chartEditorXmlSerializerRepository, IDialogCreator dialogCreator) { _userSettings = userSettings; _chartLayoutTemplateRepository = chartLayoutTemplateRepository; _dialogCreator = dialogCreator; _settingsPersistor = new DataPersistor(chartEditorXmlSerializerRepository); }
public void LoadSettings() { var fileDialog = new OpenFileDialog(); var fileName = getFileName(fileDialog); if (string.IsNullOrEmpty(fileName) || !fileDialog.CheckFileExists) { return; } var settingsPersister = new DataPersistor(_ospSuiteXmlSerializerRepository); var settings = settingsPersister.Load <ChartEditorAndDisplaySettings>(fileName); _chartEditorAndDisplayPresenter.CopySettingsFrom(settings); }
void Awake() { if (persist == null) { DontDestroyOnLoad(gameObject); persist = this; } else { Destroy(gameObject); } user = new User(); user.UserCharacter = new Character(); StartCoroutine(getSectorHolderValuesOnce()); // StartCoroutine(populateListOfUsersOnce()); StartCoroutine(GetTeamsCreated()); }
public void LoadChart() { var fileDialog = new OpenFileDialog(); var fileName = getFileName(fileDialog); if (string.IsNullOrEmpty(fileName) || !fileDialog.CheckFileExists) { return; } var dataPersitor = new DataPersistor(_ospSuiteXmlSerializerRepository); _dataRepositories = dataPersitor.Load <ICache <string, DataRepository> >(fileName.Replace(".", "_d."), _dimensionFactory); Chart = dataPersitor.Load <CurveChart>(fileName, _dimensionFactory, _dataRepositories); ChartEditorPresenter.Clear(); ChartEditorPresenter.AddDataRepositories(_dataRepositories); ChartEditorPresenter.Edit(Chart); }
public void SaveRestoreTest() { DataPersistor persistor = new DataPersistor(); persistor.FullPath = Path.Combine(Path.GetTempPath(), "test1.json"); persistor.SaveDataMethod = this.SaveMethod; persistor.RestoreDataMethod = this.RestoreMethod; this.Data["value1"] = "ORIGINAL DATA1"; this.Data["value2"] = "ORIGINAL DATA2"; persistor.Save(); // change some values this.Data["value1"] = "New DATA1"; this.Data["value2"] = "New DATA2"; persistor.Restore(); // check for restored values Assert.AreEqual("ORIGINAL DATA1", this.Data["value1"]); Assert.AreEqual("ORIGINAL DATA2", this.Data["value2"]); File.Delete(persistor.FullPath); }
public void MultipleSaveTest() { DataPersistor persistor = new DataPersistor(); persistor.FullPath = Path.Combine(Path.GetTempPath(), "test2.json"); persistor.SaveDataMethod = this.SaveMethod; persistor.RestoreDataMethod = this.RestoreMethod; this.Data["value1"] = "ORIGINAL DATA1"; this.Data["value2"] = "ORIGINAL DATA2"; persistor.Save(); persistor.Restore(); this.Data["value3"] = "ADDED DATA3"; persistor.Save(); persistor.Restore(); this.Data["value2"] = "CHANGED DATA2"; persistor.Save(); persistor.Restore(); // check for restored values Assert.AreEqual("ORIGINAL DATA1", this.Data["value1"]); Assert.AreEqual("CHANGED DATA2", this.Data["value2"]); Assert.AreEqual("ADDED DATA3", this.Data["value3"]); File.Delete(persistor.FullPath); }
public ChartLayoutTemplateRepository(IApplicationConfiguration configuration, IOSPSuiteXmlSerializerRepository modellingXmlSerializerRepository) { _configuration = configuration; _settingsPersistor = new DataPersistor(modellingXmlSerializerRepository); }