Exemplo n.º 1
0
 public void TestSetUp()
 {
     _services          = MockRepository.GenerateStub <IApplicationServices>();
     _databaseInspector = MockRepository.GenerateStub <IDatabaseInspector>();
     _services.Expect(x => x.Resolve <TemplateHost>()).Return(new TemplateHost(_services, _databaseInspector));
     _model = new TemplateModel(_services, new NVelocityWrapper());
 }
 public void TestSetUp()
 {
     _services = MockRepository.GenerateStub<IApplicationServices>();
     _databaseInspector = MockRepository.GenerateStub<IDatabaseInspector>();
     _services.Expect(x => x.Resolve<TemplateHost>()).Return(new TemplateHost(_services, _databaseInspector));
     _model = new TemplateModel(_services, new NVelocityWrapper());
 }
        public UpcomingMoviePageViewModel(IApplicationServices <Results> rService,
                                          IApplicationServices <Genres> gService,
                                          IApplicationServices <Images> imgService,
                                          ISettings setSetvices,
                                          IDefaultSettings defSetService,
                                          IUIFunctions uiFuncService,
                                          INavigationService navigationService,
                                          IMobileAnalyticsFunctions analitycFuncService,
                                          IMobileCenterCrashes mbcService)
        {
            _navigationService         = navigationService;
            resultsService             = rService;
            genresService              = gService;
            imagesService              = imgService;
            settingsService            = setSetvices;
            defaultSettingsService     = defSetService;
            uiFunctionsService         = uiFuncService;
            analyticsFunctionsService  = analitycFuncService;
            mobileCenterCrashesService = mbcService;

            GetMoreItensCommand = new DelegateCommand(LoadMoreItens);
            ItemTappedCommand   = new DelegateCommand <Results>((obj) => MovieDetails(obj));
            SearchMovieCommand  = new DelegateCommand <string>((obj) => SearchMovie(obj));
            defaultSettingsService.ConfigureInitialSettings();
            GetMovieList();
        }
Exemplo n.º 4
0
 public ExportWindow(IApplicationServices services)
 {
     _services = services;
     InitializeComponent();
     txtFilePath.Text = string.Format("{0}\\export{1:yyyy-MM-dd}.htm",
                                      Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), DateTime.Today);
 }
        public ConnectionConfigurationViewModel(IApplicationServices applicationServices)
        {
            _hartCommunicationService = applicationServices.HartCommunicationService;
            PossiblePortNames         = new ObservableCollection <string>(_hartCommunicationService.PossiblePortNames);

            _selectedPortName = new DataWrapper <string>(this, _selectedPortChangeArgs, () =>
            {
                if (_selectedPortName != null)
                {
                    _hartCommunicationService.PortName = _selectedPortName.DataValue;
                }
            })
            {
                DataValue = _hartCommunicationService.PortName
            };

            _cachedListOfDataWrappers = DataWrapperHelper.GetWrapperProperties(this);

            SaveCommand = new SimpleCommand <object, object>(item =>
            {
                EndEdit();
                CloseActivePopUpCommand.Execute(true);
            });

            CancelCommand = new SimpleCommand <object, object>(item =>
            {
                CancelEdit();
                CloseActivePopUpCommand.Execute(true);
            });
        }
Exemplo n.º 6
0
 public void ConfigureServices(IApplicationServices services)
 {
     services.IocContainer
     .RegisterTypeByAssembly(Assembly.GetExecutingAssembly())
     .AddTransient <School>()
     .AddTransient <Class>();
 }
        // BASE CTOR
        public GlobalController(
            IUserServices authUserServices,
            IRoleServices roleServices,
            IApplicationServices applicationServices,
            IIndustryServices industryServices,
            IRegionServices regionServices,
            IEventServices eventServices,
            IEventDirectorServices eventDirectorServices,
            ILogServices logServices,
            INotificationServices notificationServices,
            IUserServices userServices,
            IUserRoleServices userRoleServices)
        {
            UserServices        = authUserServices;
            RoleServices        = roleServices;
            ApplicationServices = applicationServices;
            IndustryServices    = industryServices;
            RegionServices      = regionServices;

            EventServices         = eventServices;         /*must be included in all constructors*/
            EventDirectorServices = eventDirectorServices; /*must be included in all constructors*/
            LogServices           = logServices;           /*must be included in all constructors*/
            NotificationServices  = notificationServices;  /*must be included in all constructors*/

            UserServices     = userServices;               /*must be included in all constructors*/
            UserRoleServices = userRoleServices;           /*must be included in all constructors*/

            EmailHelper = new EmailHelper();

            CreateEmailLogFunc = CreateEmailLog;
        }
Exemplo n.º 8
0
        protected void ConfigureMostRecentFileList(IApplicationServices services)
        {
            // get the files out of the settings and register them
            var mostRecentFilesService = services.Resolve <IMostRecentFilesService>();

            if (services.Settings.MostRecentFiles != null)
            {
                foreach (string mostRecentFile in services.Settings.MostRecentFiles)
                {
                    mostRecentFilesService.Filenames.Add(mostRecentFile);
                }
            }

            // watch for changes
            mostRecentFilesService.MostRecentFilesChanged += mostRecentFilesService_MostRecentFilesChanged;

            // need to manually call the update - only required on first load
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance <OpenRecentFile1Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance <OpenRecentFile2Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance <OpenRecentFile3Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance <OpenRecentFile4Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance <OpenRecentFile5Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance <OpenRecentFile6Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance <OpenRecentFile7Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance <OpenRecentFile8Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance <OpenRecentFile9Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance <OpenRecentFile10Command>()).UpdateName();
        }
 /// <summary>Initializes a new instance of the <see cref="ConnectionStringBuilderForm"/> class.</summary>
 /// <param name="hostWindow">The host window.</param>
 /// <param name="services">The services.</param>
 public ConnectionStringBuilderForm(IHostWindow hostWindow, IApplicationServices services)
 {
     InitializeComponent();
     _hostWindow = hostWindow;
     _services = services;
     Icon = ImageResource.database_edit_icon;
 }
 public ListingServices(
     EmailAppManagerContext context,
     IApplicationServices appService)
 {
     this.context    = context;
     this.appService = appService;
 }
        public void SetUp()
        {
            var unitOfWork = new UnitOfWork();

            // AUTH
            _authUserServices    = new UserServices(unitOfWork);
            _roleServices        = new RoleServices(unitOfWork);
            _applicationServices = new ApplicationServices(unitOfWork);
            _industryServices    = new IndustryServices(unitOfWork);
            _regionServices      = new RegionServices(unitOfWork);

            _countryServices                       = new CountryServices(unitOfWork);
            _editionServices                       = new EditionServices(unitOfWork);
            _editionCohostServices                 = new EditionCohostServices(unitOfWork);
            _editionCountryServices                = new EditionCountryServices(unitOfWork);
            _editionKeyVisitorServices             = new EditionKeyVisitorServices(unitOfWork);
            _editionTranslationServices            = new EditionTranslationServices(unitOfWork);
            _editionTranslationSocialMediaServices = new EditionTranslationSocialMediaServices(unitOfWork);
            _editionVisitorServices                = new EditionVisitorServices(unitOfWork);
            _eventServices         = new EventServices(unitOfWork);
            _eventDirectorServices = new EventDirectorServices(unitOfWork);
            _fileServices          = new FileServices(unitOfWork);
            _keyVisitorServices    = new KeyVisitorServices(unitOfWork);
            _logServices           = new LogServices(unitOfWork);
            _notificationServices  = new NotificationServices(unitOfWork);
            _subscriptionServices  = new SubscriptionServices(unitOfWork);
            _userServices          = new UserServices(unitOfWork);
            _userRoleServices      = new UserRoleServices(unitOfWork);

            _editionHelper = new EditionHelper();

            _controller = new EditionController(
                _authUserServices,
                _roleServices,
                _applicationServices,
                _industryServices,
                _regionServices,
                _countryServices,
                _editionServices,
                _editionCohostServices,
                _editionCountryServices,
                _editionKeyVisitorServices,
                _editionTranslationServices,
                _editionTranslationSocialMediaServices,
                _editionVisitorServices,
                _eventServices,
                _eventDirectorServices,
                _fileServices,
                _keyVisitorServices,
                _logServices,
                _notificationServices,
                _subscriptionServices,
                _userServices,
                _userRoleServices,
                _editionHelper
                );
            _controller.SetDefaultUser();

            AutoMapperConfig.Register();
        }
Exemplo n.º 12
0
        public ConfigureController(IApplicationServices applicationServices, IClientFactory<IConfigurationClient> configurationService)
            : base(applicationServices)
        {
            Guard.IsNotNull(configurationService, "configurationService");

            this.configurationService = configurationService;
        }
Exemplo n.º 13
0
 /// <summary>Initializes a new instance of the <see cref="QueryForm"/> class.</summary>
 /// <param name="services">The services.</param>
 /// <param name="settings">The settings.</param>
 /// <param name="hostWindow">The host window.</param>
 public QueryForm(IApplicationServices services, IApplicationSettings settings, IHostWindow hostWindow)
     : this()
 {
     _services   = services;
     _settings   = settings;
     _hostWindow = hostWindow;
 }
Exemplo n.º 14
0
        private static void Main(string[] args)
        {
#if !DEBUG
            AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
            Application.ThreadException += ApplicationThreadException;
#endif

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            IApplicationServices services = ApplicationServices.Instance;

            ConfigureContainer(services);

            services.LoadPlugIn(new CoreApplicationPlugIn());
            services.LoadPlugIn(new ConnectionStringsManagerLoader());
            services.LoadPlugIn(new DatabaseInspectorLoader());
            services.LoadPlugIn(new ViewTableLoader());
            services.LoadPlugIn(new TemplateViewerLoader());
            services.LoadPlugIn(new SearchToolsLoader());
            services.LoadPlugIn(new TextGeneratorLoader());

            if (services.Settings.LoadExternalPlugins)
            {
                var plugins = PlugInUtility.GetInstances <IPlugIn>(Environment.CurrentDirectory, Settings.Default.PlugInFileFilter);
                Array.Sort(plugins, new PlugInComparer());
                foreach (var plugin in plugins)
                {
                    services.LoadPlugIn(plugin);
                }
            }

            services.HostWindow.SetArguments(args);
            Application.Run(services.HostWindow.Instance);
        }
Exemplo n.º 15
0
 public ExportWindow(IApplicationServices services)
 {
     _services = services;
     InitializeComponent();
     txtFilePath.Text = string.Format("{0}\\export{1:yyyy-MM-dd}.htm",
                                      Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), DateTime.Today);
 }
 /// <summary>Initializes a new instance of the <see cref="ConnectionStringBuilderForm"/> class.</summary>
 /// <param name="hostWindow">The host window.</param>
 /// <param name="services">The services.</param>
 public ConnectionStringBuilderForm(IHostWindow hostWindow, IApplicationServices services)
 {
     InitializeComponent();
     _hostWindow = hostWindow;
     _services   = services;
     Icon        = ImageResource.database_edit_icon;
 }
 /// <summary>Initializes a new instance of the <see cref="DbConnectionsForm"/> class.</summary>
 /// <param name="services">The services.</param>
 /// <param name="hostWindow">The host window.</param>
 /// <param name="settings">The settings.</param>
 public DbConnectionsForm(IApplicationServices services, IHostWindow hostWindow, IApplicationSettings settings)
     : this()
 {
     _services = services;
     _hostWindow = hostWindow;
     _settings = settings;
 }
Exemplo n.º 18
0
 /// <summary>Initializes a new instance of the <see cref="DbConnectionsForm"/> class.</summary>
 /// <param name="services">The services.</param>
 /// <param name="hostWindow">The host window.</param>
 /// <param name="settings">The settings.</param>
 public DbConnectionsForm(IApplicationServices services, IHostWindow hostWindow, IApplicationSettings settings)
     : this()
 {
     _services   = services;
     _hostWindow = hostWindow;
     _settings   = settings;
 }
        public HistoryViewModel(IApplicationServices applicationServices)
        {
            _applicationServices = applicationServices;
            _applicationServices.HartCommunicationService.SendingCommand += HartCommunicationServiceOnSendingCommand;
            _applicationServices.HartCommunicationService.Receive        += HartCommunicationServiceOnReceive;

            _dispatcher = Dispatcher.CurrentDispatcher;
        }
Exemplo n.º 20
0
 public PumpController(IDatabaseServices DatabaseService, IEmployeeServices EmployeeServices, IApplicationServices ApplicationServices, ICallDataServices CallDataServices, ICallTreeServices CallTreeServices)
 {
     _databaseServices    = DatabaseService;
     _employeeServices    = EmployeeServices;
     _applicationServices = ApplicationServices;
     _callDataServices    = CallDataServices;
     _callTreeServices    = CallTreeServices;
 }
Exemplo n.º 21
0
 public StockTransferController(IApplicationServices applicationServices,
                                ITenantSettingService tenantSettingService,
                                IHostingEnvironment environment)
 {
     _applicationServices  = applicationServices;
     _tenantSettingService = tenantSettingService;
     Environment           = environment;
 }
Exemplo n.º 22
0
 public SalesOrderUploadController(IApplicationServices applicationServices,
                                   ITenantSettingService tenantSettingService,
                                   IHostingEnvironment environment)
 {
     _applicationServices  = applicationServices;
     _tenantSettingService = tenantSettingService;
     Environment           = environment;
 }
Exemplo n.º 23
0
        public AuthenticationController(IApplicationServices applicationServices, IFormsAuthentication formsAuthentication, IAuthenticator authenticator)
            : base(applicationServices)
        {
            Guard.IsNotNull(formsAuthentication, "formsAuthentication");
            Guard.IsNotNull(authenticator, "authenticator");

            this.formsAuthentication = formsAuthentication;
            this.authenticator = authenticator;
        }
 /// <summary>Initializes a new instance of the <see cref="ConnectionStringBuilderForm"/> class.</summary>
 /// <param name="hostWindow">The host window.</param>
 /// <param name="definition">The definition.</param>
 /// <param name="services">The services.</param>
 public ConnectionStringBuilderForm(IHostWindow hostWindow, DbConnectionDefinition definition, IApplicationServices services)
     : this(hostWindow, services)
 {
     ConnectionDefinition = definition;
     ConnectionName = ConnectionDefinition.Name;
     Comments = ConnectionDefinition.Comment;
     _initProvider = ConnectionDefinition.ProviderName;
     _connStr = ConnectionDefinition.ConnectionString;
 }
Exemplo n.º 25
0
        public ViewModelLogOut(AppState appState,
                               IApplicationServices appServices,
                               IAppNavigationService navigationService,
                               MainViewModel mainViewModel)
        {
            __AppState          = appState;
            __NavigationService = navigationService;

            __MainViewModel = mainViewModel;
        }
Exemplo n.º 26
0
        public FloatingOverlayWindow(AppState appState, IApplicationServices applicationServices, IService service, Window mainWindow, MainViewModel mainViewModel)
        {
            InitializeComponent();
            SetInitialWindowPosition();
            __MainWindow = mainWindow;

            ViewModel = new FloatingOverlayWindowViewModel(appState, service, applicationServices, mainViewModel);
            ViewModel.PropertyChanged += ViewModelOnPropertyChanged;
            DataContext = this;//__ViewModel;
        }
Exemplo n.º 27
0
        /// <summary>Initializes a new instance of the <see cref="MainForm"/> class.</summary>
        /// <param name="services">The services.</param>
        /// <param name="settings">The settings.</param>
        public MainForm(IApplicationServices services, IApplicationSettings settings)
            : this()
        {
            _services = services;
            _settings = settings;

            AllowDrop  = true;
            DragEnter += WindowDragEnter;
            DragDrop  += WindowDragDrop;
        }
        /// <summary>
        /// Occurs when this command is created
        /// </summary>
        /// <param name="hook">Instance of the application</param>
        public override void OnCreate(object hook)
        {
            if (hook == null)
            {
                return;
            }

            m_hookHelper      = new HookHelperClass();
            m_hookHelper.Hook = hook;
            m_appServices     = null;
        }
        public static void SetService(IApplicationServices applicationServices)
        {
            lock (lockObject)
            {
                if (_helperContext == null)
                {
                    _helperContext = new AppCoreHelper();
                }

                _appServices = applicationServices;
            }
        }
Exemplo n.º 30
0
        /// <summary>Initializes a new instance of the <see cref="OptionsForm"/> class.</summary>
        /// <param name="applicationServices">The application services.</param>
        /// <param name="hostWindow">The host window.</param>
        public OptionsForm(IApplicationServices applicationServices, IHostWindow hostWindow)
        {
            InitializeComponent();

            // add a grid to the panel
            _propertyGrid = new PropertyGrid();
            _propertyGrid.Dock = DockStyle.Fill;
            groupBox1.Controls.Add(_propertyGrid);

            _services = applicationServices;
            _host = hostWindow;
        }
Exemplo n.º 31
0
        /// <summary>Initializes a new instance of the <see cref="OptionsForm"/> class.</summary>
        /// <param name="applicationServices">The application services.</param>
        /// <param name="hostWindow">The host window.</param>
        public OptionsForm(IApplicationServices applicationServices, IHostWindow hostWindow)
        {
            InitializeComponent();

            // add a grid to the panel
            _propertyGrid      = new PropertyGrid();
            _propertyGrid.Dock = DockStyle.Fill;
            groupBox1.Controls.Add(_propertyGrid);

            _services = applicationServices;
            _host     = hostWindow;
        }
        public static void SetService(IApplicationServices applicationServices)
        {
            lock (lockObject)
            {
                if (_helperContext == null)
                {
                    _helperContext = new AppCoreHelper();
                }

                _appServices = applicationServices;
            }
        }
Exemplo n.º 33
0
        private static void LoadPlugins(object state)
        {
            IApplicationServices services = (IApplicationServices)state;
            var path    = Environment.CurrentDirectory;
            var plugins = AssemblyLoader.GetInstances <IPlugIn>(path, "MiniSqlQuery.*");

            if (services.Settings.LoadExternalPlugins)
            {
                plugins = plugins.Concat(AssemblyLoader.GetInstances <IPlugIn>(path, Settings.Default.PlugInFileFilter));
            }

            plugins.OrderBy(x => x.RequestedLoadOrder).ToList().ForEach(services.LoadPlugIn);
        }
Exemplo n.º 34
0
 public UserController(
     IAppEmailService appEmailService,
     IUserService userService,
     IApplicationServices applicationService,
     IViewModelMapper <AppUser, UserViewModel> userMapper,
     IHttpContextAccessor contextAccessor)
 {
     this.appEmailService    = appEmailService;
     this.userService        = userService;
     this.applicationService = applicationService;
     this.userMapper         = userMapper;
     this.contextAccessor    = contextAccessor;
 }
Exemplo n.º 35
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //log4net.Config.XmlConfigurator.Configure(new FileInfo("log4net.config"));
            //log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            //log.Info("程序开始,加载SAP配置!!");

            //SAPINT.SapConfig.SAPConfigFromFile.LoadSAPAllConfig();
            //SAPINT.SapConfig.SAPConfigFromFile.LoadSAPClientConfig();


            //IOC入口,获取主程序的实例
            IApplicationServices services = ApplicationServices.Instance;

            //加载程序内部服务
            ConfigureContainer(services);

            //跟上面不同,以下加载内部插件
            services.LoadPlugIn(new CoreApplicationPlugIn());
            services.LoadPlugIn(new ConnectionStringsManagerLoader());
            services.LoadPlugIn(new DatabaseInspectorLoader());
            services.LoadPlugIn(new ViewTableLoader());
            services.LoadPlugIn(new TemplateViewerLoader());
            services.LoadPlugIn(new SearchToolsLoader());
            services.LoadPlugIn(new TextGeneratorLoader());

            //加载外部插件
            if (services.Settings.LoadExternalPlugins)
            {
                var plugins = PlugInUtility.GetInstances <IPlugIn>(Environment.CurrentDirectory, Settings.Default.PlugInFileFilter);
                Array.Sort(plugins, new PlugInComparer());
                foreach (var plugin in plugins)
                {
                    services.LoadPlugIn(plugin);
                }
            }

            //插件加载完!!!

            //services.HostWindow = services.Container.Resolve<IHostWindow>();
            //services.HostWindow.SetArguments(args);
            MainForm mainform = (MainForm)services.HostWindow;

            // mainform.Serivices = services;
            //  mainform.Settings = services.Settings;
            mainform.SetArguments(args);

            Application.Run(mainform);
        }
Exemplo n.º 36
0
        public UserInterface(IApplicationServices appServices)
        {
            this.appServices = appServices;

            this.menu = new MenuItem[]
            {
                MenuItem.CreateNonTerminal("Register new user", 'R', new RegisterCommand(appServices), () => true),
                MenuItem.CreateNonTerminal("Login", 'L', new LoginCommand(appServices), () => true),
                MenuItem.CreateNonTerminal("LogOut", 'O', new LogoutCommand(appServices), () => appServices.IsUserLoggedIn),
                MenuItem.CreateNonTerminal("Deposit", 'D', new DepositCommand(appServices), () => appServices.IsUserLoggedIn),
                MenuItem.CreateNonTerminal("Purchase", 'P', new PurchaseCommand(appServices), () => true),
                MenuItem.CreateTerminal("Quit", 'Q')
            };
        }
        /// <summary>Initializes a new instance of the <see cref="ViewTableForm"/> class.</summary>
        /// <param name="services">The services.</param>
        /// <param name="settings">The settings.</param>
        public ViewTableForm(IApplicationServices services, IApplicationSettings settings)
            : this()
        {
            _services = services;
            _settings = settings;
            _batch = new QueryBatch();
            TableName = string.Empty;
            Text = Resources.ViewData;

            dataGridViewResult.DefaultCellStyle.NullValue = _settings.NullText;
            dataGridViewResult.DataBindingComplete += DataGridViewResultDataBindingComplete;
            _services.Settings.DatabaseConnectionReset += SettingsDatabaseConnectionReset;
            _services.SystemMessagePosted += ServicesSystemMessagePosted;
        }
Exemplo n.º 38
0
        /// <summary>Initializes a new instance of the <see cref="BasicEditor"/> class.</summary>
        /// <param name="services">The services.</param>
        /// <param name="settings">The settings.</param>
        public BasicEditor(IApplicationServices services, IApplicationSettings settings)
            : this()
        {
            _services = services;
            _settings = settings;

            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<SaveFileCommand>());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<CloseActiveWindowCommand>());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<CloseAllWindowsCommand>());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<CopyQueryEditorFileNameCommand>());

            CommandControlBuilder.MonitorMenuItemsOpeningForEnabling(formContextMenuStrip);
        }
Exemplo n.º 39
0
        /// <summary>Initializes a new instance of the <see cref="ViewTableForm"/> class.</summary>
        /// <param name="services">The services.</param>
        /// <param name="settings">The settings.</param>
        public ViewTableForm(IApplicationServices services, IApplicationSettings settings)
            : this()
        {
            _services = services;
            _settings = settings;
            _batch    = new QueryBatch();
            TableName = string.Empty;
            Text      = Resources.ViewData;

            dataGridViewResult.DefaultCellStyle.NullValue = _settings.NullText;
            dataGridViewResult.DataBindingComplete       += DataGridViewResultDataBindingComplete;
            _services.Settings.DatabaseConnectionReset   += SettingsDatabaseConnectionReset;
            _services.SystemMessagePosted += ServicesSystemMessagePosted;
        }
Exemplo n.º 40
0
        /// <summary>Initializes a new instance of the <see cref="QueryForm"/> class.</summary>
        /// <param name="services">The services.</param>
        /// <param name="settings">The settings.</param>
        /// <param name="hostWindow">The host window.</param>
        public QueryForm(IApplicationServices services, IApplicationSettings settings, IHostWindow hostWindow)
            : this()
        {
            _services   = services;
            _settings   = settings;
            _hostWindow = hostWindow;

            var completionProvider = _services.Resolve <ICompletionProvider>();

            if (completionProvider.Enabled)
            {
                _textArea.KeyEventHandler += completionProvider.KeyEventHandlerFired;
            }
        }
Exemplo n.º 41
0
        /// <summary>Initializes a new instance of the <see cref="BasicEditor"/> class.</summary>
        /// <param name="services">The services.</param>
        /// <param name="settings">The settings.</param>
        public BasicEditor(IApplicationServices services, IApplicationSettings settings)
            : this()
        {
            _services = services;
            _settings = settings;

            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <SaveFileCommand>());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CloseActiveWindowCommand>());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CloseAllWindowsCommand>());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CopyQueryEditorFileNameCommand>());

            CommandControlBuilder.MonitorMenuItemsOpeningForEnabling(formContextMenuStrip);
        }
        /// <summary>Initializes a new instance of the <see cref="DatabaseInspectorForm"/> class.</summary>
        /// <param name="services">The services.</param>
        /// <param name="hostWindow">The host window.</param>
        public DatabaseInspectorForm(IApplicationServices services, IHostWindow hostWindow)
        {
            InitializeComponent();
            BuildImageList();

            DatabaseTreeView.Nodes.Clear();
            TreeNode root = CreateRootNodes();
            root.Nodes.Add("Loading problem - check connection details and reset...");
            DatabaseTreeView.Nodes.Add(root);

            _services = services;
            _hostWindow = hostWindow;

            _services.Settings.DatabaseConnectionReset += Settings_DatabaseConnectionReset;
        }
Exemplo n.º 43
0
        /// <summary>Initializes a new instance of the <see cref="TemplateEditorForm"/> class.</summary>
        /// <param name="services">The services.</param>
        /// <param name="hostWindow">The host window.</param>
        public TemplateEditorForm(IApplicationServices services, IHostWindow hostWindow)
        {
            InitializeComponent();
            txtEdit.Document.DocumentChanged += DocumentDocumentChanged;
            _services = services;
            _hostWindow = hostWindow;

            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<SaveFileCommand>());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<CloseActiveWindowCommand>());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<CloseAllWindowsCommand>());
            formContextMenuStrip.Items.Add(CommandControlBuilder.CreateToolStripMenuItem<CopyQueryEditorFileNameCommand>());

            CommandControlBuilder.MonitorMenuItemsOpeningForEnabling(formContextMenuStrip);
        }
Exemplo n.º 44
0
        /// <summary>
        /// 	The configure container.
        /// </summary>
        /// <param name = "services">The services.</param>
        public static void ConfigureContainer(IApplicationServices services)
        {
            // singletons
            services.RegisterSingletonComponent<IApplicationSettings, ApplicationSettings>("ApplicationSettings");
            services.RegisterSingletonComponent<IHostWindow, MainForm>("HostWindow");
            services.RegisterSingletonComponent<IFileEditorResolver, FileEditorResolverService>("FileEditorResolver");

            // components
            services.RegisterComponent<AboutForm>("AboutForm");
            services.RegisterComponent<ITextFindService, BasicTextFindService>("DefaultTextFindService");
            services.RegisterComponent<IQueryEditor, QueryForm>("QueryForm");
            services.RegisterComponent<ISqlWriter, SqlWriter>("DefaultSqlWriter");
            services.RegisterComponent<ITextFormatter, NVelocityWrapper>("TextFormatter");
            services.RegisterComponent<TemplateModel>("TemplateModel");
            services.RegisterComponent<BatchQuerySelectForm>("BatchQuerySelectForm");
        }
Exemplo n.º 45
0
        /// <summary>
        /// 配置主服务,加载必要的插件
        /// </summary>
        /// <param name="services"></param>
        public static void ConfigureContainer(IApplicationServices services)
        {
            // services.RegisterSingletonComponent<IApplicationSettings, ApplicationSettings>("ApplicationSettings");
            // services.RegisterSingletonComponent<IApplicationSettings, ApplicationSettings>(");
            //services.RegisterSingletonComponent<IHostWindow, MainForm>("HostWindow");

            //services.RegisterSingletonComponent<IFileEditorResolver, FileEditorResolverService>("FileEditorResolver");
            //
            //services.RegisterComponent<AboutForm>("AboutForm");
            //services.RegisterComponent<ITextFindService, BasicTextFindService>("DefaultTextFindService");
            //services.RegisterComponent<IQueryEditor, QueryForm>("QueryForm");
            //services.RegisterComponent<ISqlWriter, SqlWriter>("DefaultSqlWriter");
            //services.RegisterComponent<ITextFormatter, NVelocityWrapper>("TextFormatter");
            //services.RegisterComponent<TemplateModel>("TemplateModel");
            //services.RegisterComponent<BatchQuerySelectForm>("BatchQuerySelectForm");
            //services.RegisterComponent<IApplicationSettings, ApplicationSettings>();
            //services.RegisterComponent<IHostWindow, MainForm>();

            //services.RegisterComponent<IFileEditorResolver, FileEditorResolverService>();
            //services.RegisterComponent<AboutForm>();
            //services.RegisterComponent<ITextFindService, BasicTextFindService>();

            // services.RegisterComponent<IQueryEditor, QueryForm>();
            // services.RegisterComponent<ISqlWriter, SqlWriter>();
            // services.RegisterComponent<TemplateModel>();
            // services.RegisterComponent<BatchQuerySelectForm>();

            //批量更新时,不使用services.RegisterComponent,
            var builder = new ContainerBuilder();

            //首先注册设置服务
            builder.RegisterType<ApplicationSettings>().As<IApplicationSettings>().InstancePerLifetimeScope();

            //
            builder.RegisterType<MainForm>().As<IHostWindow>().InstancePerLifetimeScope().WithParameters(
             new[] { new ResolvedParameter((p,c)=>p.ParameterType == typeof(IApplicationServices),(p,c)=>c.Resolve<IApplicationServices>()),
                    new ResolvedParameter((p,c)=>p.ParameterType == typeof(IHostWindow),(p,c)=>c.Resolve<IHostWindow>())
                });

            builder.RegisterType<FileEditorResolverService>().As<IFileEditorResolver>().InstancePerLifetimeScope().WithParameter(
                new ResolvedParameter((p, c) => p.ParameterType == typeof(IApplicationServices), (p, c) => c.Resolve<IApplicationServices>())
            );

            builder.RegisterType<AboutForm>().WithParameter(
                new ResolvedParameter((p, c) => p.ParameterType == typeof(IApplicationServices), (p, c) => c.Resolve<IApplicationServices>())
            );

            builder.RegisterType<BasicTextFindService>().As<ITextFindService>().WithParameter(
               new ResolvedParameter((p, c) => p.ParameterType == typeof(IApplicationServices), (p, c) => c.Resolve<IApplicationServices>())
               );

            builder.RegisterType<QueryForm>().As<IQueryEditor>().WithParameters(
                new[] { new ResolvedParameter((p,c)=>p.ParameterType == typeof(IApplicationServices),(p,c)=>c.Resolve<IApplicationServices>()),
                    new ResolvedParameter((p,c)=>p.ParameterType == typeof(IApplicationSettings),(p,c)=>c.Resolve<IApplicationSettings>()),
                    new ResolvedParameter((p,c)=>p.ParameterType == typeof(IHostWindow),(p,c)=>c.Resolve<IHostWindow>())
                });

            builder.RegisterType<SqlWriter>().As<ISqlWriter>();
            builder.RegisterType<NVelocityWrapper>().As<ITextFormatter>();

            // services.RegisterComponent<ITextFormatter, NVelocityWrapper>();

            builder.RegisterType<TemplateModel>().WithParameters(
            new[] { new ResolvedParameter((p,c)=>p.ParameterType == typeof(IApplicationServices),(p,c)=>c.Resolve<IApplicationServices>()),
                    new ResolvedParameter((p,c)=>p.ParameterType == typeof(ITextFormatter),(p,c)=>c.Resolve<ITextFormatter>()),
                    new ResolvedParameter((p,c)=>p.ParameterType == typeof(TemplateData),(p,c)=>c.Resolve<TemplateData>())
                });
            builder.RegisterType<BatchQuerySelectForm>();
            builder.Update(services.Container);
        }
        protected void ConfigureMostRecentFileList(IApplicationServices services)
        {
            // get the files out of the settings and register them
            var mostRecentFilesService = services.Resolve<IMostRecentFilesService>();
            if (services.Settings.MostRecentFiles != null)
            {
                foreach (string mostRecentFile in services.Settings.MostRecentFiles)
                {
                    mostRecentFilesService.Filenames.Add(mostRecentFile);
                }
            }

            // watch for changes
            mostRecentFilesService.MostRecentFilesChanged += mostRecentFilesService_MostRecentFilesChanged;

            // need to manually call the update - only required on first load
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance<OpenRecentFile1Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance<OpenRecentFile2Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance<OpenRecentFile3Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance<OpenRecentFile4Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance<OpenRecentFile5Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance<OpenRecentFile6Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance<OpenRecentFile7Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance<OpenRecentFile8Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance<OpenRecentFile9Command>()).UpdateName();
            ((OpenRecentFileCommand)CommandManager.GetCommandInstance<OpenRecentFile10Command>()).UpdateName();
        }
    /// <summary>
    /// Obtains the IApplicationServices interface instance implemented by the hosting application.
    /// This is needed so the command can determine the selected layer, and update the application's status message.
    /// </summary>
    void GetApplicationServices()
    {
      if (m_appServices == null)
      {
        IToolbarControl2 toolbarControl = m_hookHelper.Hook as IToolbarControl2;
        if (toolbarControl == null)
          throw new ApplicationException(
            "Command appears to be running in an unexpected environment. Its hookHelper ought to be a toolbar control.");

        m_appServices = toolbarControl.CustomProperty as IApplicationServices;
        if (m_appServices == null)
          throw new ApplicationException(
            "Command appears to be running in an unexpected environment. The toolbar custom property ought to be an instance of IApplicationServices.");
      }
    }
    /// <summary>
    /// Occurs when this command is created
    /// </summary>
    /// <param name="hook">Instance of the application</param>
    public override void OnCreate(object hook)
    {
      if (hook == null)
        return;

      m_hookHelper = new HookHelperClass();
      m_hookHelper.Hook = hook;
      m_appServices = null;
    }
Exemplo n.º 49
0
        public View(IApplicationServices applicationServices=null, WindowManager manager = null)
        {
            urls = new ApplicationUrls();
            Urls.ProxyUrl = string.Empty;
            Culture = System.Threading.Thread.CurrentThread.CurrentCulture;
            Content = null;
            setInstance(this);
            WindowManager = manager ?? new WindowManager();
            VerticalContentAlignment = System.Windows.VerticalAlignment.Stretch;
            HorizontalContentAlignment = System.Windows.HorizontalAlignment.Stretch;

            MapApplication.SetApplication(this);
            IApplicationAdmin appAdmin = MapApplication.Current as IApplicationAdmin;
            if (appAdmin != null)
            {
                if (appAdmin.ConfigurableControls != null)
                {
                    appAdmin.ConfigurableControls.Clear();
                    appAdmin.ConfigurableControls.CollectionChanged -= ConfigurableControls_CollectionChanged;
                    appAdmin.ConfigurableControls.CollectionChanged += ConfigurableControls_CollectionChanged;
                }
            }

            SidePanelHelper.Reset();
        }
Exemplo n.º 50
0
 /// <summary>Initializes a new instance of the <see cref="AboutForm"/> class.</summary>
 /// <param name="services">The services.</param>
 public AboutForm(IApplicationServices services)
     : this()
 {
     _services = services;
 }
Exemplo n.º 51
0
 /// <summary>Initializes a new instance of the <see cref="TemplateViewForm"/> class.</summary>
 /// <param name="services">The services.</param>
 /// <param name="model">The model.</param>
 public TemplateViewForm(IApplicationServices services, TemplateModel model)
 {
     InitializeComponent();
     _services = services;
     _model = model;
 }
Exemplo n.º 52
0
 public HomeController(IApplicationServices applicationServices)
     : base(applicationServices)
 {
 }
 /// <summary>Initializes a new instance of the <see cref="TemplateModel"/> class.</summary>
 /// <param name="services">The services.</param>
 /// <param name="formatter">The formatter.</param>
 /// <param name="templateData">The template data.</param>
 public TemplateModel(IApplicationServices services, ITextFormatter formatter, TemplateData templateData)
 {
     _services = services;
     _formatter = formatter;
     _templateData = templateData;
 }
Exemplo n.º 54
0
        /// <summary>Initializes a new instance of the <see cref="QueryForm"/> class.</summary>
        /// <param name="services">The services.</param>
        /// <param name="settings">The settings.</param>
        /// <param name="hostWindow">The host window.</param>
        public QueryForm(IApplicationServices services, IApplicationSettings settings, IHostWindow hostWindow)
            : this()
        {
            _services = services;
            _settings = settings;
            _hostWindow = hostWindow;

            var completionProvider = _services.Resolve<ICompletionProvider>();
            if (completionProvider.Enabled)
            {
                _textArea.KeyEventHandler += completionProvider.KeyEventHandlerFired;
            }
        }
Exemplo n.º 55
0
 public SearchController(IApplicationServices applicationServices)
     : base(applicationServices)
 {
 }
Exemplo n.º 56
0
 /// <summary>Initializes a new instance of the <see cref="TemplateModel"/> class.</summary>
 /// <param name="services">The services.</param>
 /// <param name="formatter">The formatter.</param>
 public TemplateModel(IApplicationServices services, ITextFormatter formatter)
 {
     _services = services;
     _formatter = formatter;
 }
Exemplo n.º 57
0
 public ExitAppCommand(IApplicationServices app, IUserNotificationService notificationService)
 {
     _app = app;
     _notificationService = notificationService;
 }
 /// <summary>Initializes a new instance of the <see cref="FindReplaceForm"/> class.</summary>
 /// <param name="services">The services.</param>
 public FindReplaceForm(IApplicationServices services)
 {
     InitializeComponent();
     StartPosition = FormStartPosition.CenterParent;
     _services = services;
 }
 /// <summary>
 /// 	Called when the plugins are loading during application startup. 
 /// 	Stores the reference to <paramref name = "services" />.
 /// </summary>
 /// <param name = "services">The application services intance.</param>
 public void LoadPlugIn(IApplicationServices services)
 {
     Services = services;
 }
Exemplo n.º 60
0
 /// <summary>Initializes a new instance of the <see cref="GoToLineForm"/> class.</summary>
 /// <param name="services">The services.</param>
 public GoToLineForm(IApplicationServices services)
 {
     _services = services;
     InitializeComponent();
 }