Ejemplo n.º 1
0
 private void OnNewData()
 {
     try
     {
         _dataEditor.CloseAllTabs();
         _datasetProvider.ResetSchema();
         _dataEditor.DataFileName = "";
         _applicationController.ExecuteCommand <ReloadSchemaCommand>();
     }
     catch (ReloadSchemaCommandException e)
     {
         _messageCreator.ShowError(e.Message);
     }
     catch (Exception e)
     {
         _messageCreator.ShowError(e.ToString());
     }
 }
Ejemplo n.º 2
0
 /// <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());
 }