Esempio n. 1
0
        /// <summary>
        /// Builds a default run state for test purposes.
        /// </summary>
        /// <param name="model">The application model to include in the run state.</param>
        /// <returns>A run state object.</returns>
        public static RunState BuildRunState(IApplicationModel model)
        {
            var config = new RunnerConfiguration()
            {
                FailFast   = true,
                FailStages = Runner.Core.Stages.All
            };

            config.Args.Add("microsoft.cli.findpaths", new string[] { "C:\\source\\repos\\ambiztalk\\src\\Microsoft.AzureIntegrationMigration.BizTalk.StageRunners\\bin\\Debug" });
            config.Args.Add("microsoft.cli.findpatterns", "*StageRunners*.dll");
            config.Args.Add("microsoft.cli.templateconfigpath", "C:\\source\\repos\\ambiztalk\\config");
            config.Args.Add("microsoft.biztalk.msidiscoverer.msidir", "C:\\Temp\\Scenarios");
            config.Args.Add("microsoft.biztalk.msidiscoverer.unpackdir", "C:\\Temp\\Output");

            var stageRunner1 = new Mock <IStageRunner>();

            stageRunner1.Object.Priority = 1;
            stageRunner1.Object.Skip     = false;
            config.StageRunners.Add(stageRunner1.Object);

            var stageRunner2 = new Mock <IStageRunner>();

            stageRunner2.Object.Priority = 2;
            stageRunner2.Object.Skip     = false;
            config.StageRunners.Add(stageRunner2.Object);

            var state = new RunState(config, model);

            return(state);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ApplicationVm"/> class.
        /// </summary>
        /// <param name="model">
        /// The base application model.
        /// </param>
        public ApplicationVm(IApplicationModel model)
        {
            this.Model = model;
            DateInfoModel currentDate = new DateInfoModel(DateTime.Now, this.Model.StartDateType);

            this.SelectedCase = new DateCase(this.Model.Factory.Create(currentDate, this.Model.Factory, this.Model.TaskMediator));
        }
        public ResourceUseCase(
            // Get the ViewToRegionBinder that the baseclass needs
            IViewToRegionBinder viewtoToRegionBinder
            , IRegionManager regionManager
            , IUnityContainer container
            , IEventAggregator eventAggregator
            // Get the factories that can create the viewmodels
            , ObjectFactory<ResourceListViewModel> resourceViewModel
            , ObjectFactory<ResourceToolbarViewModel> resourceToolbarViewModel
            , IApplicationModel applicationModel
            , IModelVisualizationRegistry modelVisualizationRegistry)
           : base(viewtoToRegionBinder)
        {
            this.ApplicationModel = applicationModel;
            this.Container = container;
            // Just before the view is initialized for the first time
            this.AddInitializationMethods(
                // Create the emailViewModel and assign it to this variable
               () => this._resourceListViewModel = resourceViewModel.CreateInstance()
               , () => this._resourceToolbarViewModel = resourceToolbarViewModel.CreateInstance());

            // Register visualizations for these view models. This means: whenever a viewmodel is displayed, 
            // use this type of view to visualize it. 
            modelVisualizationRegistry.Register<ResourceListViewModel, ResourceListView>();
            modelVisualizationRegistry.Register<ResourceToolbarViewModel, ResourceToolbarView>();
            modelVisualizationRegistry.Register<ResourceEditViewModel, ResourceEditView>();

            container.RegisterType<IResourceAssignService, ResourceAssignmentService>(new ContainerControlledLifetimeManager());
            container.RegisterInstance(container.Resolve<IResourceAssignService>());

            regionManager.RegisterViewWithRegion("ResourceEditRegion", typeof(ResourceEditViewModel));
            // watch for OpenResourceEvents fired by (Link)Button command in ProjectEditViewModel...
            eventAggregator.GetEvent<OpenResourceByIdEvent>().Subscribe(OpenResourceById);
        }
Esempio n. 4
0
        public EditViewModel(IApplicationModel appModel)
            : base()
        {
            _appModel = appModel;

            Name = _appModel.CurrentFile.Name;
        }
        public AddRegistrationPropertyCommand(CommandAttribute commandAttribute, ElementCollectionViewModel collection, IApplicationModel applicationModel, DefaultCollectionElementAddCommand defaultAddPropertyCommand, IUIServiceWpf uiService)
            : base(commandAttribute, collection, defaultAddPropertyCommand, uiService)
        {
            this.collection = collection as InjectionMemberCollectionViewModel;

            this.applicationModel = applicationModel;
        }
 public SaveMergedEnvironmentConfigurationCommand(IUIServiceWpf uiService, ConfigurationSourceModel configurationSource, IApplicationModel application, ElementViewModel overridesViewModel)
     : base(uiService)
 {
     this.configurationSource = configurationSource;
     this.application = application;
     this.overridesViewModel = (EnvironmentSourceViewModel)overridesViewModel;
 }
Esempio n. 7
0
 public ApplicationViewBase(IApplicationController controller)
 {
     _controller      = controller;
     _model           = controller.Model;
     _view            = CreateConcreteView(); // otherwise would be this...
     _controller.View = _view;
 }
Esempio n. 8
0
        public void AnalyzeAsyncWithSuccess(ResourceGeneratorAnalyzer analyzer, IApplicationModel model, MigrationContext context, Exception e)
        {
            "Given a model"
            .x(() => model = TestHelper.CreateDefaultModelForAnalyzing());

            "And a context"
            .x(() => context = TestHelper.BuildContext());

            "And an analyzer"
            .x(() => analyzer = new ResourceGeneratorAnalyzer(_mockRepository.Object, _mockGenerator.Object, model, context, _mockLogger.Object));

            "When analyzing"
            .x(async() => e = await Record.ExceptionAsync(async() => await analyzer.AnalyzeAsync(CancellationToken.None).ConfigureAwait(false)).ConfigureAwait(false));

            "Then the analyze should succeed"
            .x(() => e.Should().BeNull());

            "And the model target resource templates should have been generated using the generator"
            .x(() =>
            {
                _mockGenerator.Verify(g => g.GenerateResourcesAsync(
                                          It.Is <AzureIntegrationServicesModel>(m => m == model),
                                          It.IsAny <IList <YamlStream> >(),
                                          It.Is <CancellationToken>(t => t == CancellationToken.None)), Times.Once);
            });
        }
        public AddRegistrationPropertyCommand(CommandAttribute commandAttribute, ElementCollectionViewModel collection, IApplicationModel applicationModel, DefaultCollectionElementAddCommand defaultAddPropertyCommand, IUIServiceWpf uiService)
            : base(commandAttribute, collection, defaultAddPropertyCommand, uiService)
        {
            this.collection = collection as InjectionMemberCollectionViewModel;

            this.applicationModel = applicationModel;
        }
Esempio n. 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="App"/> class.
        /// </summary>
        /// <param name="model">
        /// The model.
        /// </param>
        public App(IApplicationModel model)
        {
            this.InitializeComponent();

            ApplicationVm viewModel = new ApplicationVm(model);

            NavigationPage navigationPage = new NavigationPage();

            this.MainPage = navigationPage;

            MasterDetailPage master = new MasterDetailPage()
            {
                Master = new SettingsView()
                {
                    BindingContext = viewModel
                },
                Detail = new DateView()
                {
                    BindingContext = viewModel
                }
            };

            master.SetBinding(Page.TitleProperty, "Title");
            master.BindingContext = master.Detail;
            navigationPage.PushAsync(master);
        }
        public void ConstructWithNullModel(HtmlReportFormatter reporter, IApplicationModel model, MigrationContext context, IRunState state, IReportWriter writer, ILogger logger, Exception e)
        {
            "Given an reporter"
            .x(() => reporter.Should().BeNull());

            "And a model"
            .x(() => model.Should().BeNull());

            "And run state"
            .x(() => state = TestHelper.BuildRunState(model));

            "And a context"
            .x(() => context = TestHelper.BuildContext());

            "And a writer"
            .x(() => writer = _mockWriter.Object);

            "And a logger"
            .x(() => logger = _mockLogger.Object);

            "When constructing with a null model"
            .x(() => e = Record.Exception(() => new HtmlReportFormatter(model, context, state, writer, logger)));

            "Then the constructor should throw an exception"
            .x(() => e.Should().NotBeNull().And.Subject.Should().BeOfType <ArgumentNullException>().Which.ParamName.Should().Be("model"));
        }
 public SaveMergedEnvironmentConfigurationCommand(IUIServiceWpf uiService, ConfigurationSourceModel configurationSource, IApplicationModel application, ElementViewModel overridesViewModel)
     : base(uiService)
 {
     this.configurationSource = configurationSource;
     this.application         = application;
     this.overridesViewModel  = (EnvironmentSourceViewModel)overridesViewModel;
 }
        public ProjectEditViewModel(IEventAggregator eventAggregator, IUnityContainer container, IApplicationModel applicationModel)
        {
            this.ApplicationModel = applicationModel;
            this.EventAggregator = eventAggregator;
            this.Container = container;
            this.ProjectStatus = new ObjectStatus();

            // RegionContext is bound to the selected item in the project listbox...
            this.RegionContext = new ObservableObject<object>();
            this.RegionContext.PropertyChanged += new PropertyChangedEventHandler(RegionContext_PropertyChanged);
            
            // watch for login changes....
            this.EventAggregator.GetEvent<ApplyAuthorizationEvent>().Subscribe(ApplyAuthorization);
 
            // register Toolbar global button commmand...
            this.AddNewProjectCommand = new DelegateCommandReplacement<object>(AddNewProject, CanAddNewProject);
            UseCaseCommands.AddNewProjectCommmand.RegisterCommand(AddNewProjectCommand);

            // wire up local button commands....
            this.SaveCommand = new DelegateCommandReplacement<object>(Save, CanSave);
            this.DeleteCommand = new DelegateCommandReplacement<ProjectTracker.Library.ProjectResource>(Delete);
            this.UndoCommand = new DelegateCommandReplacement<object>(Undo, CanUndo);
            this.AssignCommand = new DelegateCommandReplacement<object>(Assign, CanAssign);
            this.OpenResourceCommand = new DelegateCommandReplacement<int>(OpenResourceByID);
        }
Esempio n. 14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="controller"></param>
        public frmMovimentosCAIXA(IApplicationController controller)
        {
            _controller = controller;
            _model      = controller.Model;

            InitializeComponent();
        }
Esempio n. 15
0
        public Shell()
        {
            InitializeComponent();

            AppDomain.CurrentDomain.AssemblyResolve += this.OnAssemblyResolve;

            container =
                new ConfigurationContainer(GetProfile(App.CommandLineParameters.ProfileFileName));

            container.RegisterInstance <IUIServiceWpf>(this);
            container.RegisterInstance <IWindowsFormsEditorService>(this);
            container.RegisterInstance <IUIService>(this);
            container.RegisterInstance <IAssemblyDiscoveryService>(new LoadedAssembliesDiscoveryService());

            container.DiscoverSubstituteTypesFromAssemblies();

            applicationModel = container.Resolve <IApplicationModel>();
            DataContext      = applicationModel;

            applicationModel.New();
            applicationModel.OnCloseAction = () => RequestClose();

            InputBindings.Add(new InputBinding(applicationModel.NewConfigurationCommand, new KeyGesture(Key.N, ModifierKeys.Control)));
            InputBindings.Add(new InputBinding(applicationModel.SaveConfigurationCommand, new KeyGesture(Key.S, ModifierKeys.Control)));
            InputBindings.Add(new InputBinding(applicationModel.SaveAsConfigurationCommand, new KeyGesture(Key.A, ModifierKeys.Control)));
            InputBindings.Add(new InputBinding(applicationModel.OpenConfigurationCommand, new KeyGesture(Key.O, ModifierKeys.Control)));
        }
Esempio n. 16
0
        public Shell()
        {
            InitializeComponent();

            AppDomain.CurrentDomain.AssemblyResolve += this.OnAssemblyResolve;

            container =
                new ConfigurationContainer(GetProfile(App.CommandLineParameters.ProfileFileName));

            container.RegisterInstance<IUIServiceWpf>(this);
            container.RegisterInstance<IWindowsFormsEditorService>(this);
            container.RegisterInstance<IUIService>(this);
            container.RegisterInstance<IAssemblyDiscoveryService>(new LoadedAssembliesDiscoveryService());

            container.DiscoverSubstituteTypesFromAssemblies();

            applicationModel = container.Resolve<IApplicationModel>();
            DataContext = applicationModel;

            applicationModel.New();
            applicationModel.OnCloseAction = () => RequestClose();

            InputBindings.Add(new InputBinding(applicationModel.NewConfigurationCommand, new KeyGesture(Key.N, ModifierKeys.Control)));
            InputBindings.Add(new InputBinding(applicationModel.SaveConfigurationCommand, new KeyGesture(Key.S, ModifierKeys.Control)));
            InputBindings.Add(new InputBinding(applicationModel.SaveAsConfigurationCommand, new KeyGesture(Key.A, ModifierKeys.Control)));
            InputBindings.Add(new InputBinding(applicationModel.OpenConfigurationCommand, new KeyGesture(Key.O, ModifierKeys.Control)));
        }
        public void ConstructWithSuccess(HtmlReportFormatter reporter, IApplicationModel model, MigrationContext context, IRunState state, IReportWriter writer, ILogger logger, Exception e)
        {
            "Given an reporter"
            .x(() => reporter.Should().BeNull());

            "And a model"
            .x(() => model = TestHelper.BuildModel());

            "And run state"
            .x(() => state = TestHelper.BuildRunState(model));

            "And a context"
            .x(() => context = TestHelper.BuildContext());

            "And a writer"
            .x(() => writer = _mockWriter.Object);

            "And a logger"
            .x(() => logger = _mockLogger.Object);

            "When constructing..."
            .x(() => e = Record.Exception(() => new HtmlReportFormatter(model, context, state, writer, logger)));

            "Then the constructor should NOT throw an exception"
            .x(() => e.Should().BeNull());
        }
Esempio n. 18
0
        public ResourceUseCase(
            // Get the ViewToRegionBinder that the baseclass needs
            IViewToRegionBinder viewtoToRegionBinder
            , IRegionManager regionManager
            , IUnityContainer container
            , IEventAggregator eventAggregator
            // Get the factories that can create the viewmodels
            , ObjectFactory <ResourceListViewModel> resourceViewModel
            , ObjectFactory <ResourceToolbarViewModel> resourceToolbarViewModel
            , IApplicationModel applicationModel
            , IModelVisualizationRegistry modelVisualizationRegistry)
            : base(viewtoToRegionBinder)
        {
            this.ApplicationModel = applicationModel;
            this.Container        = container;
            // Just before the view is initialized for the first time
            this.AddInitializationMethods(
                // Create the emailViewModel and assign it to this variable
                () => this._resourceListViewModel      = resourceViewModel.CreateInstance()
                , () => this._resourceToolbarViewModel = resourceToolbarViewModel.CreateInstance());

            // Register visualizations for these view models. This means: whenever a viewmodel is displayed,
            // use this type of view to visualize it.
            modelVisualizationRegistry.Register <ResourceListViewModel, ResourceListView>();
            modelVisualizationRegistry.Register <ResourceToolbarViewModel, ResourceToolbarView>();
            modelVisualizationRegistry.Register <ResourceEditViewModel, ResourceEditView>();

            container.RegisterType <IResourceAssignService, ResourceAssignmentService>(new ContainerControlledLifetimeManager());
            container.RegisterInstance(container.Resolve <IResourceAssignService>());

            regionManager.RegisterViewWithRegion("ResourceEditRegion", typeof(ResourceEditViewModel));
            // watch for OpenResourceEvents fired by (Link)Button command in ProjectEditViewModel...
            eventAggregator.GetEvent <OpenResourceByIdEvent>().Subscribe(OpenResourceById);
        }
 /// <summary>
 /// Creates a new instance of a <see cref="SC001DocumentSchemaGenerator"/> class.
 /// </summary>
 /// <param name="fileRepository">The file repository.</param>
 /// <param name="model">The model.</param>
 /// <param name="context">The context.</param>
 /// <param name="logger">A logger.</param>
 public SC001DocumentSchemaGenerator(IFileRepository fileRepository, IApplicationModel model, MigrationContext context, ILogger logger)
     : base(nameof(SC001DocumentSchemaGenerator), model, context, logger)
 {
     // Validate and set the member.
     _fileRepository = fileRepository ?? throw new ArgumentNullException(nameof(fileRepository));
     _logger         = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Esempio n. 20
0
        public ContentViewModel(IApplicationModel appModel)
            : base()
        {
            _appModel = appModel;
            Model = _appModel.CurrentFile;

            EventAggregator.GetEvent<PropertySelectionChangedEvent>().Subscribe(OnPropertySelectionChanged);
        }
Esempio n. 21
0
 /// <summary>
 /// Default constructor for dependency injection.
 /// </summary>
 /// <param name="model">The application model.</param>
 /// <param name="context">The migration context.</param>
 /// <param name="state">The application's run state.</param>
 /// <param name="writer">An instance of a <see cref="IReportWriter"/> to be used for writing the report.</param>
 /// <param name="logger">An instance of a <see cref="ILogger"/> to be used for logging within the class.</param>
 protected BizTalkReporterBase(IApplicationModel model, MigrationContext context, IRunState state, IReportWriter writer, ILogger logger)
 {
     Model   = (AzureIntegrationServicesModel)model ?? throw new ArgumentNullException(nameof(model));
     Context = context ?? throw new ArgumentNullException(nameof(context));
     State   = state ?? throw new ArgumentNullException(nameof(state));
     Writer  = writer ?? throw new ArgumentNullException(nameof(writer));
     Logger  = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Esempio n. 22
0
 /// <summary>
 /// Creates a new instance of the <see cref="BizTalkParserBase" class./>
 /// </summary>
 /// <param name="parserName">The name of the BizTalk parser.</param>
 /// <param name="model">The application model.</param>
 /// <param name="context">The context that gathers migration information.</param>
 /// <param name="logger">A logger.</param>
 public BizTalkParserBase(string parserName, IApplicationModel model, MigrationContext context, ILogger logger)
 {
     // Validate and set the members
     _name    = parserName ?? throw new ArgumentNullException(nameof(parserName));
     _model   = (AzureIntegrationServicesModel)model ?? throw new ArgumentNullException(nameof(model));
     _context = context ?? throw new ArgumentNullException(nameof(context));
     _logger  = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 /// <summary>
 /// Default constructor for dependency injection.
 /// </summary>
 /// <param name="converterName">The name of the converter.</param>
 /// <param name="model">The application model.</param>
 /// <param name="context">The migration context.</param>
 /// <param name="logger">An instance of a <see cref="ILogger"/> to be used for logging within the class.</param>
 protected BizTalkConverterBase(string converterName, IApplicationModel model, MigrationContext context, ILogger logger)
 {
     // Validate and set the members.
     _name   = converterName ?? throw new ArgumentNullException(nameof(converterName));
     Model   = (AzureIntegrationServicesModel)model ?? throw new ArgumentNullException(nameof(model));
     Context = context ?? throw new ArgumentNullException(nameof(context));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Esempio n. 24
0
 /// <summary>
 /// Creates a new instance of the <see cref="MsiDiscoverer" class./>
 /// </summary>
 /// <param name="fileRepository">The file repository.</param>
 /// <param name="model">The application model.</param>
 /// <param name="context">The context that gathers migration information.</param>
 /// <param name="logger">The logger.</param>
 public MsiDiscoverer(IFileRepository fileRepository, IApplicationModel model, MigrationContext context, ILogger logger)
     : base(DiscovererName, model, context, logger)
 {
     // Validate and set the members
     _fileRepository = fileRepository ?? throw new ArgumentNullException(nameof(fileRepository));
     _logger         = logger ?? throw new ArgumentNullException(nameof(logger));
     _ = context.WorkingFolder ?? throw new ArgumentException(ErrorMessages.WorkingDirectoryCannotBeNull, nameof(context));
 }
 public RolesModule(
     IApplicationModel applicationModel
     , RolesListUseCase rolesListUseCase
     , IModelVisualizationRegistry modelVisualizationRegistry)
 {
     this._applicationModel = applicationModel;
     this._rolesListUseCase = rolesListUseCase;
     this._modelVisualizationRegistry = modelVisualizationRegistry;
 }
Esempio n. 26
0
 public ProjectModule(
     IApplicationModel applicationModel
     , ProjectUseCase projectUseCase
     , IModelVisualizationRegistry modelVisualizationRegistry)
 {
     this._applicationModel           = applicationModel;
     this._projectUseCase             = projectUseCase;
     this._modelVisualizationRegistry = modelVisualizationRegistry;
 }
Esempio n. 27
0
 public ResourceModule(
     IApplicationModel applicationModel
     , ResourceUseCase resourceUseCase
     , IModelVisualizationRegistry modelVisualizationRegistry)
 {
     this._applicationModel           = applicationModel;
     this._resourceUseCase            = resourceUseCase;
     this._modelVisualizationRegistry = modelVisualizationRegistry;
 }
 public ProjectModule(
     IApplicationModel applicationModel
     , ProjectUseCase projectUseCase
     , IModelVisualizationRegistry modelVisualizationRegistry)
 {
     this._applicationModel = applicationModel;
     this._projectUseCase = projectUseCase;
     this._modelVisualizationRegistry = modelVisualizationRegistry;
 }
Esempio n. 29
0
 public RolesModule(
     IApplicationModel applicationModel
     , RolesListUseCase rolesListUseCase
     , IModelVisualizationRegistry modelVisualizationRegistry)
 {
     this._applicationModel           = applicationModel;
     this._rolesListUseCase           = rolesListUseCase;
     this._modelVisualizationRegistry = modelVisualizationRegistry;
 }
Esempio n. 30
0
 public ApplicationPresenter(IGameplayView gameplayView, IUserInterfaceView interfaceView,
                             IApplicationModel model, Screens screens, GameSettings settings)
 {
     _gameplayView  = gameplayView;
     _interfaceView = interfaceView;
     _model         = model;
     _screens       = screens;
     _settings      = settings;
 }
        public void CanAddUseCases()
        {
            IApplicationModel             applicationModel = CreateApplicationModel();
            IActiveAwareUseCaseController mockActiveAwareUseCaseController = new MockUseCase();

            applicationModel.AddMainUseCase(mockActiveAwareUseCaseController);

            Assert.IsTrue(applicationModel.MainUseCases.Contains(mockActiveAwareUseCaseController));
        }
 public ResourceModule(
     IApplicationModel applicationModel
     , ResourceUseCase resourceUseCase
     , IModelVisualizationRegistry modelVisualizationRegistry)
 {
     this._applicationModel = applicationModel;
     this._resourceUseCase = resourceUseCase;
     this._modelVisualizationRegistry = modelVisualizationRegistry;
 }
Esempio n. 33
0
 public LoginModule(
     IApplicationModel applicationModel
     , LoginUseCase loginUseCase
     , IModelVisualizationRegistry modelVisualizationRegistry)
 {
     this._applicationModel           = applicationModel;
     this._loginUseCase               = loginUseCase;
     this._modelVisualizationRegistry = modelVisualizationRegistry;
 }
 public LoginModule(
     IApplicationModel applicationModel
     , LoginUseCase loginUseCase
     , IModelVisualizationRegistry modelVisualizationRegistry)
 {
     this._applicationModel = applicationModel;
     this._loginUseCase = loginUseCase;
     this._modelVisualizationRegistry = modelVisualizationRegistry;
 }
 public CalendarModule(IApplicationModel applicationModel
     , CalendarMainUseCase mainCalenderUseCase
     , IRegionManager regionManager
     , IModelVisualizationRegistry modelVisualizationRegistry)
 {
     this.applicationModel = applicationModel;
     this.mainCalenderUseCase = mainCalenderUseCase;
     this.regionManager = regionManager;
     this.modelVisualizationRegistry = modelVisualizationRegistry;
 }
Esempio n. 36
0
 public MainPageViewModel(IApplicationModel applicationModel)
 {
     _applicationModel = applicationModel;
     //ReactiveBinder.Bind(() => _applicationModel.Title, () => Title);
     //ReactiveBinder.Bind(_applicationModel.ObserveProperty(x => x.Title), () => Title);
     _applicationModel
     .ObserveProperty(x => x.Title)
     .Select(x => x + " append.")
     .Bind(() => Title);
 }
Esempio n. 37
0
        public async Task <bool> AddOrUpdateAsync(IApplicationModel model)
        {
            var redisItem = new
            {
                RedisKey = $"{model.ApplicationName}:{model.Name}",
                Json     = JsonConvert.SerializeObject(model)
            };

            return(await Database.StringSetAsync(redisItem.RedisKey, redisItem.Json));
        }
 public ResourceListViewModel(IEventAggregator eventAggregator, IUnityContainer container, IApplicationModel applicationModel)
 {
     this.EventAggregator = eventAggregator;
     this.Container = container;
     this.ApplicationModel = applicationModel;
     // load resource list...
     this.Resources = ProjectTracker.Library.ResourceList.GetResourceList();
     // watch for new added resources...
     this.EventAggregator.GetEvent<NewResourceAddedEvent>().Subscribe(UpdateResourceList);
 }
Esempio n. 39
0
 public CalendarModule(IApplicationModel applicationModel
                       , CalendarMainUseCase mainCalenderUseCase
                       , IRegionManager regionManager
                       , IModelVisualizationRegistry modelVisualizationRegistry)
 {
     this.applicationModel           = applicationModel;
     this.mainCalenderUseCase        = mainCalenderUseCase;
     this.regionManager              = regionManager;
     this.modelVisualizationRegistry = modelVisualizationRegistry;
 }
Esempio n. 40
0
        public void Dispose()
        {
            applicationModel = null;
            if (container != null)
            {
                container.Dispose();
                container = null;
            }

            GC.SuppressFinalize(this);
        }
Esempio n. 41
0
 public EmailModule(
     IApplicationModel applicationModel
     , IRegionManager regionManager
     , EmailMainUseCase mainEmailUseCase
     , IModelVisualizationRegistry modelVisualizationRegistry)
 {
     this.applicationModel           = applicationModel;
     this.regionManager              = regionManager;
     this.mainEmailUseCase           = mainEmailUseCase;
     this.modelVisualizationRegistry = modelVisualizationRegistry;
 }
Esempio n. 42
0
        public ApplicationViewModel(IApplicationModel model, IDialogService dialogService)
        {
            _model         = model;
            _dialogService = dialogService;
            var map = new Dictionary <string, Func <Window> >();

            map[LOGIN_DLG] = () => new LoginWindow();
            _dialogService.Configure(map);
            Settings = new SettingsViewModel(_model.Settings);
            Module   = new ModuleViewModel(_model.Module);
        }
 public EmailModule(
     IApplicationModel applicationModel
     , IRegionManager regionManager
     , EmailMainUseCase mainEmailUseCase
     , IModelVisualizationRegistry modelVisualizationRegistry)
 {
     
     this.applicationModel = applicationModel;
     this.regionManager = regionManager;
     this.mainEmailUseCase = mainEmailUseCase;
     this.modelVisualizationRegistry = modelVisualizationRegistry;
 }
        protected override void Arrange()
        {
            base.Arrange();

            var resources = new ResourceHelper<ConfigFileLocator>();
            var localFilename = resources.DumpResourceFileToDisk("systemweb_and_el.config");
            
            applicationModel = Container.Resolve<IApplicationModel>();
            applicationModel.Load(localFilename);

            saveAsTargetFileName = localFilename.Replace(".config", ".saveas.config");
        }
Esempio n. 45
0
        public EmployeeDetailModel Create(IApplicationModel employee)
        {
            EmployeeDetailModel employeeDetail = new EmployeeDetailModel();

            employeeDetail.FirstName = employee.FirstName;
            employeeDetail.LastName  = employee.LastName;
            employeeDetail.Email     = $"{employee.FirstName}.{employee.LastName}@csscorp.com";

            employeeDetail.IsManager = true;

            return(employeeDetail);
        }
        protected override void Arrange()
        {
            base.Arrange();

            UIServiceMock.Setup(x => x.ShowWindow(It.IsAny<Window>()));
            UIServiceMock.Setup(
                x => x.ShowMessageWpf(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<MessageBoxButton>())).Returns(
                MessageBoxResult.OK);

            var resources = new ResourceHelper<ConfigFileLocator>();
            resources.DumpResourceFileToDisk(sourceFileName);

            applicationModel = Container.Resolve<IApplicationModel>();
        }
        public EmailMainUseCase(
            // Get the ViewToRegionBinder that the baseclass needs
            IViewToRegionBinder viewtoToRegionBinder
            // Get the factories that can create the viewmodels
            , ObjectFactory<EmailMainViewModel> emailViewFactory
            , ObjectFactory<EmailToolBarViewModel> emailToolBarFactory
            , IApplicationModel applicationModel) : base(viewtoToRegionBinder)
        {
            ApplicationModel = applicationModel;

            // Just before the view is initialized for the first time
            this.AddInitializationMethods(
                    // Create the emailViewModel and assign it to this variable
                () => this.emailViewModel = emailViewFactory.CreateInstance()
                    // Create the toolbarViewModel and assign it to this variable
                , () => this.emailToolBarViewModel = emailToolBarFactory.CreateInstance());
        }
        public RolesListUseCase(
            // Get the ViewToRegionBinder that the baseclass needs
            IViewToRegionBinder viewtoToRegionBinder
            , IRegionManager regionManager
            // Get the factories that can create the viewmodels
            , ObjectFactory<RolesListViewModel> rolesViewModel
             , ObjectFactory<RolesToolbarViewModel> rolesToolbarViewModel
           , IApplicationModel applicationModel)
            : base(viewtoToRegionBinder)
        {
            this._applicationModel = applicationModel;

            // Just before the view is initialized for the first time
            this.AddInitializationMethods(
                // Create the emailViewModel and assign it to this variable
               () => this._rolesListViewModel = rolesViewModel.CreateInstance()
               , () => this._rolesToolbarViewModel = rolesToolbarViewModel.CreateInstance());
       }
        public NewProjectUseCase(
            // Get the ViewToRegionBinder that the baseclass needs
            IViewToRegionBinder viewtoToRegionBinder
            // Get the factories that can create the viewmodels
            , ObjectFactory<ProjectEditViewModel> projectEditViewModel
            , IApplicationModel applicationModel
            , IModelVisualizationRegistry modelVisualizationRegistry)
            : base(viewtoToRegionBinder)
        {
            // Just before the view is initialized for the first time
            this.AddInitializationMethods(
                // Create the emailViewModel and assign it to this variable
               () => this._projectEditViewModel = projectEditViewModel.CreateInstance());

            // Register visualizations for these view models. This means: whenever a viewmodel is displayed, 
            // use this type of view to visualize it. 
            modelVisualizationRegistry.Register<ProjectEditViewModel, ProjectEditView>();
        }
        protected override void Arrange()
        {
            base.Arrange();

            ApplicationModel = Container.Resolve<IApplicationModel>();

            var configurationSection = new MockSectionWithSingleChild
            {
                Children = 
                {
                    {new TestHandlerDataWithChildren{Name = "Element"} }
                }
            };

            SectionViewModel sectionViewmodel = SectionViewModel.CreateSection(Container, "MockSection", configurationSection);
            Element = sectionViewmodel.GetDescendentsOfType<TestHandlerDataWithChildren>().First();
            ApplicationModel.OnSelectedElementChanged(null);
            ElementContainer = new ElementModelContainer { DataContext = Element };
        }
Esempio n. 51
0
        public App()
        {
            _diConfiguration = new DependencyInjectionConfiguration();
            _errorHandler = _diConfiguration.Container.Resolve<IErrorHandler>();

            try
            {
                _model = _diConfiguration.Container.Resolve<IApplicationModel>();
                Startup += (s, e) => _model.Start();
                _model.Exited += () => Shutdown();

                DispatcherUnhandledException += (s, e) => e.Handled = _errorHandler.Handle(e.Exception);
            }
            catch (Exception ex)
            {
                if (_errorHandler == null)
                    throw;

                _errorHandler.Handle(ex);
            }
        }
 public void AddApplicationBlockCommandInitialize(IApplicationModel applicationModel)
 {
     this.applicationModel = applicationModel;
 }
Esempio n. 53
0
 public virtual void PropertyDependencyInitialization(SectionViewModel containingSection, IApplicationModel applicationModel)
 {
     this.containingSection = containingSection;
     this.appModel = applicationModel;
 }
Esempio n. 54
0
        public void Dispose()
        {
            applicationModel = null;
            if (container != null)
            {
                container.Dispose();
                container = null;
            }

            GC.SuppressFinalize(this);
        }
        protected override void Arrange()
        {
            base.Arrange();
            
            UIServiceMock.Setup(x => x.ShowWindow(It.IsAny<Window>()));
            UIServiceMock.Setup(
                           x => x.ShowError(It.IsAny<Exception>(), It.IsAny<string>()));

            var resources = new ResourceHelper<ConfigFileLocator>();
            resources.DumpResourceFileToDisk(sourceFileName);
            resources.DumpResourceFileToDisk("configurationsource_invalid_satellite.config");

            applicationModel = Container.Resolve<IApplicationModel>();
        }
Esempio n. 56
0
 public LoginViewModel(IApplicationModel appModel)
     : base()
 {
     _appModel = appModel;
     Model = _appModel;
 }
Esempio n. 57
0
 public HomeViewModel(IApplicationModel appModel)
     : base()
 {
     _appModel = appModel;
 }
Esempio n. 58
0
 public PropertyViewModel(IApplicationModel appModel)
     : base()
 {
     _appModel = appModel;
     Model = _appModel.CurrentFile;
 }
 public void DefaultDeleteCommandModelInitialize(IApplicationModel applicationModel)
 {
     this.applicationModel = applicationModel;
 }