/// <summary>
 /// Initializes a new instance of the ReloadSchemaCommand class.
 /// </summary>
 public ReloadSchemaCommand(IDataEditorView dataEditor, IDataSetProvider datasetProvider, IMessageCreator messageCreator, IFileService fileService)
 {
     _fileService     = fileService;
     _messageCreator  = messageCreator;
     _datasetProvider = datasetProvider;
     _dataEditor      = dataEditor;
 }
        private DataEditorPresenter CreatePresenter(IDataEditorView view, IDataSetProvider datasetProvider)
        {
            var applicationController = MockRepository.GenerateStub <IApplicationController>();
            var presenter             = new DataEditorPresenter(applicationController, view, null, null, null, null, datasetProvider, null);

            return(presenter);
        }
 /// <summary>
 /// Initializes a new instance of the GetDataFromDatabaseCommand class.
 /// </summary>
 public GetDataFromDatabaseCommand(IEventAggregator events, DataSetFromDatabasePresenter presenter, IDataEditorView dataEditor, IDataSetProvider datasetProvider)
 {
     _events          = events;
     _datasetProvider = datasetProvider;
     _dataEditor      = dataEditor;
     _presenter       = presenter;
 }
Exemple #4
0
 protected void GenerateStubs()
 {
     datasetProvider       = MockRepository.GenerateStub <IDataSetProvider>();
     view                  = MockRepository.GenerateStub <IDataEditorView>();
     messageCreator        = MockRepository.GenerateStub <IMessageCreator>();
     fileDialogCreator     = MockRepository.GenerateStub <IFileDialogCreator>();
     settingsRepositoru    = MockRepository.GenerateStub <IUserSettingsRepository>();
     projectRepository     = MockRepository.GenerateStub <IProjectRepository>();
     applicationController = MockRepository.GenerateStub <IApplicationController>();
     fileService           = MockRepository.GenerateStub <IFileService>();
 }
        public void Tab_Is_Not_Marked_As_Changed_When_DataViewChanged_Event_Is_Fired_And_DataSet_Contains_No_Changes()
        {
            var              tabName         = "Tab1";
            IDataEditorView  view            = MockRepository.GenerateStub <IDataEditorView>();
            IDataSetProvider dataSetProvider = MockRepository.GenerateStub <IDataSetProvider>();

            dataSetProvider.Stub(d => d.HasTableChanged(tabName)).Return(false);
            IEventRaiser eventRaiser = view.GetEventRaiser(v => v.DataViewChanged += null);

            DataEditorPresenter presenter = CreatePresenter(view, dataSetProvider);

            eventRaiser.Raise(tabName);
            view.AssertWasNotCalled(v => v.MarkTabAsEdited(tabName));
        }
 /// <summary>
 /// Initializes a new instance of the DataEditorPresenter class.
 /// </summary>
 public DataEditorPresenter(IApplicationController applicationController,
                            IDataEditorView dataEditor,
                            IFileDialogCreator fileDialogCreator,
                            IMessageCreator messageCreator,
                            IUserSettingsRepository userSettingsRepository,
                            IProjectRepository projectRepository,
                            IDataSetProvider datasetProvider,
                            IFileService fileService)
 {
     _fileService                         = fileService;
     _messageCreator                      = messageCreator;
     _fileDialogCreator                   = fileDialogCreator;
     _applicationController               = applicationController;
     _datasetProvider                     = datasetProvider;
     _projectRepository                   = projectRepository;
     _userSettingsRepository              = userSettingsRepository;
     _dataEditor                          = dataEditor;
     _dataEditor.Initialize              += OnInitializeView;
     _dataEditor.ReloadData              += () => _applicationController.ExecuteCommand <ReloadDataCommand>();
     _dataEditor.BrowseForDataFile       += SelectDataFile;
     _dataEditor.BrowseForSchemaFile     += SelectSchemaFile;
     _dataEditor.CreateGuid              += CreateGuid;
     _dataEditor.GetDataSetFromDatabase  += GetDataSetFromDatabase;
     _dataEditor.SaveData                += OnSaveData;
     _dataEditor.SaveDataAs              += OnSaveDataAs;
     _dataEditor.NewData                 += OnNewData;
     _dataEditor.DataViewChanged         += HandleDataSetChange;
     _dataEditor.SaveProject             += SaveEditorSettings;
     _dataEditor.SaveProjectAs           += SaveEditorSettingsAs;
     _dataEditor.LoadProject             += LoadEditorSettings;
     _dataEditor.NewProject              += new Action(OnNewProject);
     _dataEditor.ExitApp                 += OnExitingApplication;
     _dataEditor.TableTreeNodeDblClicked += SchemaTableNodeClicked;
     _dataEditor.TabSelected             += OnTabSelected;
     _dataEditor.TableClosed             += OnTableClosed;
     _dataEditor.DataFileChanged         += OnDataFileChanged;
     _dataEditor.SchemaFileChanged       += OnSchemaFileChanged;
     _applicationController.Subscribe <ReinitializeMainViewRequested>((e) => OnReinitializeMainView());
 }
 /// <summary>
 /// Initializes a new instance of the ReloadDataCommand class.
 /// </summary>
 public ReloadDataCommand(IMessageCreator messageCreator, IDataEditorView dataEditor, IDataSetProvider datasetProvider)
 {
     _datasetProvider = datasetProvider;
     _dataEditor      = dataEditor;
     _messageCreator  = messageCreator;
 }