public UserDisplayUnitsPresenter(IUserDisplayUnitsView view, IDisplayUnitsPresenter displayUnitsPresenter, IUserSettings userSettings, ICloneManager cloneManager)
     : base(view)
 {
     _displayUnitsPresenter = displayUnitsPresenter;
     _userSettings          = userSettings;
     _cloneManager          = cloneManager;
     AddSubPresenters(_displayUnitsPresenter);
     _view.AddView(_displayUnitsPresenter.View);
     _settingsToEdit = cloneManager.Clone(_userSettings.DisplayUnits);
 }
        protected override void Context()
        {
            _cloneManager         = A.Fake <ICloneManager>();
            _view                 = A.Fake <IUserDisplayUnitsView>();
            _displayUnitPresenter = A.Fake <IDisplayUnitsPresenter>();
            _userSettings         = A.Fake <IUserSettings>();

            _cloneDisplayUnitsManager = new DisplayUnitsManager();
            A.CallTo(() => _cloneManager.Clone(_userSettings.DisplayUnits)).Returns(_cloneDisplayUnitsManager);
            sut = new UserDisplayUnitsPresenter(_view, _displayUnitPresenter, _userSettings, _cloneManager);
        }
        protected override void Context()
        {
            _view   = A.Fake <IEditDisplayUnitsView>();
            _cloner = A.Fake <ICloneManagerForModel>();
            _displayUnitPresenter = A.Fake <IDisplayUnitsPresenter>();
            sut = new EditDisplayUnitsPresenter(_view, _cloner, _displayUnitPresenter);

            sut.Initialize();
            _displayUnitManager = new DisplayUnitsManager();
            _clonedUnitManager  = new DisplayUnitsManager();
            A.CallTo(() => _cloner.Clone(_displayUnitManager)).Returns(_clonedUnitManager);
        }
 protected override void Context()
 {
     base.Context();
     _fileName = "file";
     A.CallTo(() => _dialogCreator.AskForFileToOpen(Captions.LoadUnitsFromFile, Constants.Filter.UNITS_FILE_FILTER, Constants.DirectoryKey.MODEL_PART, null, null)).Returns(_fileName);
     sut.Edit(_displayUnitManager);
     _newDisplayUnitManager = new DisplayUnitsManager();
     _newDisplayUnitManager.AddDisplayUnit(new DisplayUnitMap {
         Dimension = _dimension1, DisplayUnit = _dimension1.DefaultUnit
     });
     A.CallTo(() => _serializationTask.Load <DisplayUnitsManager>(_fileName, false)).Returns(_newDisplayUnitManager);
 }
 public PresentationUserSettings()
 {
     DisplayUnits     = new DisplayUnitsManager();
     ComparerSettings = new ComparerSettings();
     DiagramOptions   = new DiagramOptions {
         SnapGridVisible = true
     };
     ProjectFiles = new List <string>();
     JournalPageEditorSettings = new JournalPageEditorSettings();
     DefaultChartYScaling      = Scalings.Log;
     ParameterIdentificationFeedbackEditorSettings = new ParameterIdentificationFeedbackEditorSettings();
     SensitivityAnalysisFeedbackEditorSettings     = new SensitivityAnalysisFeedbackEditorSettings();
 }
 public BatchUserSettings()
 {
     ProjectFiles             = new List <string>();
     DiagramOptions           = new DiagramOptions();
     ForceLayoutConfigutation = new ForceLayoutConfiguration();
     ChartOptions             = new ChartOptions();
     DisplayUnits             = new DisplayUnitsManager();
     ComparerSettings         = new ComparerSettings {
         CompareHiddenEntities = true
     };
     JournalPageEditorSettings = new JournalPageEditorSettings();
     ParameterIdentificationFeedbackEditorSettings = new ParameterIdentificationFeedbackEditorSettings();
     MergeConflictViewSettings = new MergeConflictViewSettings();
 }
 public void Edit(DisplayUnitsManager displayUnitsManager, string displayUnitsType)
 {
     _displayUnitsManagerToEdit = displayUnitsManager;
     _clonedUnitManager         = _cloner.Clone(_displayUnitsManagerToEdit);
     _displayUnitsPresenter.Edit(_clonedUnitManager);
     _view.Caption = Captions.ManageDisplayUnits(displayUnitsType);
     _view.Display();
     if (_view.Canceled)
     {
         return;
     }
     // User confirms changes=> Update
     _displayUnitsManagerToEdit.UpdatePropertiesFrom(_clonedUnitManager, _cloner);
 }
 protected override void Context()
 {
     _userSettings             = A.Fake <IPresentationUserSettings>();
     _projectRetriever         = A.Fake <IProjectRetriever>();
     _userSettingsDisplayUnits = A.Fake <DisplayUnitsManager>();
     _projectDisplayUnits      = A.Fake <DisplayUnitsManager>();
     A.CallTo(() => _userSettings.DisplayUnits).Returns(_userSettingsDisplayUnits);
     A.CallTo(() => _projectRetriever.CurrentProject.DisplayUnits).Returns(_projectDisplayUnits);
     sut                    = new DisplayUnitRetriever(_projectRetriever, _userSettings);
     _dimension             = A.Fake <IDimension>();
     _defaultDimensionUnit  = A.Fake <Unit>();
     _dimension.DefaultUnit = _defaultDimensionUnit;
     A.CallTo(() => _userSettingsDisplayUnits.DisplayUnitFor(_dimension)).Returns(_userSettingsUnit);
     A.CallTo(() => _projectDisplayUnits.DisplayUnitFor(_dimension)).Returns(_projectSettingsUnit);
 }
Example #9
0
        public UserSettings(DockManager dockManager, RibbonBarManager ribbonManager, INumericFormatterOptions numericFormatterOptions,
                            ISkinManager skinManager, IPKSimConfiguration configuration, DirectoryMapSettings directoryMapSettings)
        {
            _dockManager             = dockManager;
            _ribbonManager           = ribbonManager;
            _numericFormatterOptions = numericFormatterOptions;
            _skinManager             = skinManager;
            _directoryMapSettings    = directoryMapSettings;

            DisplayUnits     = new DisplayUnitsManager();
            ComparerSettings = new ComparerSettings {
                CompareHiddenEntities = false
            };
            ProjectFiles = new List <string>();
            Rules.AddRange(AllRules.All());
            DiagramOptions            = new DiagramOptions();
            TemplateDatabasePath      = configuration.DefaultTemplateUserDatabasePath;
            JournalPageEditorSettings = new JournalPageEditorSettings();
            ParameterIdentificationFeedbackEditorSettings = new ParameterIdentificationFeedbackEditorSettings();
            SensitivityAnalysisFeedbackEditorSettings     = new SensitivityAnalysisFeedbackEditorSettings();
            ResetToDefault();
            _layoutWasExplicitelyReset = false;
        }
        protected override void Context()
        {
            _view              = A.Fake <IDisplayUnitsView>();
            _dimensionFactory  = A.Fake <IDimensionFactory>();
            _dialogCreator     = A.Fake <IDialogCreator>();
            _serializationTask = A.Fake <ISerializationTask>();
            _cloneManager      = A.Fake <ICloneManagerForModel>();

            sut = new DisplayUnitsPresenter(_view, _dimensionFactory, _dialogCreator, _serializationTask, _cloneManager);

            _displayUnitManager = new DisplayUnitsManager();
            _allDimensions      = new List <IDimension>();
            A.CallTo(() => _dimensionFactory.Dimensions).Returns(_allDimensions);
            _dimension1 = A.Fake <IDimension>();
            _dimension2 = A.Fake <IDimension>();
            _dimension3 = A.Fake <IDimension>();
            _allDimensions.Add(_dimension1);
            _allDimensions.Add(_dimension2);
            _allDimensions.Add(_dimension3);

            A.CallTo(() => _view.BindTo(A <IEnumerable <DefaultUnitMapDTO> > ._))
            .Invokes(x => _allDTOs = x.GetArgument <IEnumerable <DefaultUnitMapDTO> >(0));
        }
 public void Edit(DisplayUnitsManager unitsManager)
 {
     _unitsManager = unitsManager;
     bindToView();
 }
Example #12
0
 public BatchUserSettings()
 {
     DisplayUnits = new DisplayUnitsManager();
     ProjectFiles = new List <string>();
     ResetToDefault();
 }
 private Unit displayUnitIn(DisplayUnitsManager displayUnitsManager, IDimension dimension)
 {
     return(displayUnitsManager.DisplayUnitFor(dimension));
 }