Example #1
0
        public ShellViewModel(IPresentationService presentationService,
                              IShellSettingsService shellSettingsService,
                              IEventAggregator eventAggregator,
                              IMenuViewModel menu,
                              ISettingsViewModel settings,
                              ICodeGenSettingsService codeGenSettingsService,
                              ICodeGenSettings codeGenSettings,
                              IMessageService messageService,
                              IMappingViewModel mapping,
                              ISchemaService schemaService,
                              ICustomSchemaSqlViewModel customSchemaSqlViewModel,
                              ITemplateWriterService templateWriterService)
        {
            this._shellSettingsService   = shellSettingsService;
            this._codeGenSettingsService = codeGenSettingsService;
            this._codeGenSettings        = codeGenSettings;
            this._messageService         = messageService;
            this._templateWriterService  = templateWriterService;
            this.Menu                     = menu;
            this.Settings                 = settings;
            this.Mapping                  = mapping;
            this._schemaService           = schemaService;
            this.CustomSchemaSqlViewModel = customSchemaSqlViewModel;
            this.WindowClosing            = new Command <CancelEventArgs>(OnWindowClosing);
            this.WindowDrop               = new Command <DragEventArgs>(OnWindowDrop);

            this.DisplayText = "IQToolkit CodeGen";
            this.SetWindowPosition(presentationService);

            eventAggregator.GetEvent <LoadSchemaEvent>().Subscribe(this.LoadSchemaEventHandler);
            eventAggregator.GetEvent <GenerateFilesEvent>().Subscribe(_ => this.GenerateFilesEventHandler());
            eventAggregator.GetEvent <CustomSchemaSqlViewVisibilityChangedEvent>().Subscribe(this.CustomSchemaSqlViewVisibilityChangedEvent);
        }
Example #2
0
 public CodeGenSettingsService(ICodeGenSettings settings, IFileDialogService fileDialogService, IMostRecentlyUsedFileService mostRecentlyUsedFileService, IXmlSerializerService xmlSerializerService)
 {
     this._settings                    = settings;
     this._fileDialogService           = fileDialogService;
     this._mostRecentlyUsedFileService = mostRecentlyUsedFileService;
     this._xmlSerializerService        = xmlSerializerService;
 }
Example #3
0
 public SchemaService(IDatabaseProvider databaeProvider, ICodeGenSettings codeGenSettings, IMessageService messageService, ICodeGenSettingsService codeGenSettingsService)
 {
     this._databaseProvider       = databaeProvider;
     this._codeGenSettings        = codeGenSettings;
     this._messageService         = messageService;
     this._codeGenSettingsService = codeGenSettingsService;
     this._dispatcher             = Dispatcher.CurrentDispatcher;
 }
Example #4
0
        public SettingsViewModel(ICodeGenSettings settings, ITemplateFileService templateFileService, ISchemaService schemaService, IEventAggregator eventAggregator)
        {
            this.Settings  = settings;
            this.Databases = new ObservableCollection <IDatabase>(schemaService.Databases);
            this.SetTemplates(templateFileService);

            this.LoadSchemaCommand         = new Command(_ => this.PublishLoadSchemaEvent());
            this.CustomizeSchemaSqlCommand = new Command(x => eventAggregator.GetEvent <CustomSchemaSqlViewVisibilityChangedEvent>().Publish(true));
            this._eventAggregator          = eventAggregator;
            this._eventAggregator.GetEvent <SchemaProviderNameChangedEvent>().Subscribe(this.UpdateSelectedProvider);
        }
Example #5
0
        public CustomSchemaSqlViewModel(IEventAggregator eventAggregator, ICodeGenSettings codeGenSettings)
        {
            ArgumentUtility.CheckNotNull("eventAggregator", eventAggregator);
            ArgumentUtility.CheckNotNull("codeGenSettings", codeGenSettings);

            this._codeGenSettings      = codeGenSettings;
            this._associationSchemaSql = codeGenSettings.AssociationSchemaSql;
            this._columnSchemaSql      = codeGenSettings.ColumnSchemaSql;
            this._tableSchemaSql       = codeGenSettings.TableSchemaSql;

            this.OkCommand    = new Command(_ => this.ExecuteOkCommand());
            this.CloseCommand = new Command(_ => eventAggregator.GetEvent <CustomSchemaSqlViewVisibilityChangedEvent>().Publish(false));
            this.SetSchemaInfo();
        }
Example #6
0
        public MappingViewModel(ICodeGenSettings settings, IEventAggregator eventAggregator)
        {
            this.Tables = new ObservableCollection <Table>();

            this.Columns      = new ObservableCollection <Column>();
            this.Associations = new ObservableCollection <Association>();

            this._eventAggregator = eventAggregator;

            this.UpdateTables(settings.Tables);

            this.AllTableSelectionCommand       = new Command(x => this.ExecuteAllTableSelectionCommand());
            this.AllColumnSelectionCommand      = new Command(x => this.ExecuteAllColumnSelectionCommand());
            this.AllAssociationSelectionCommand = new Command(x => this.ExecuteAllAssociateSelectionCommand());
            this.GenerateFilesCommand           = new Command(x => eventAggregator.GetEvent <GenerateFilesEvent>().Publish(null));

            this._eventAggregator.GetEvent <TablesChangedEvent>().Subscribe(this.UpdateTables);
        }
 public TemplateWriterService(IApplicationService applicationService, ICodeGenSettings codeGenSettings)
 {
     this._codeGenSettings = codeGenSettings;
     this._basePath        = applicationService.TemplatePath;
 }