public ServiceAcceptingFactoryService(
     ScopedFactoryService scopedService,
     IFactoryService transientService)
 {
     ScopedService = scopedService;
     TransientService = transientService;
 }
 public TypeWithSupersetConstructors(
     IFakeMultipleService multipleService,
     IFactoryService factoryService,
     IFakeService fakeService,
     IFakeScopedService scopedService)
 {
 }
예제 #3
0
 public FeedCategoryViewModel(
     INavigationService navigationService,
     IFeedStoreService feedStoreService,
     IFactoryService factoryService,
     Category category)
 {
     Title = category.Title;
     (IsLoading, IsEmpty) = (true, false);
     Items       = new ObservableCollection <ArticleViewModel>();
     OpenSources = new ObservableCommand(navigationService.Navigate <ChannelsViewModel>);
     Fetch       = new ObservableCommand(async() =>
     {
         IsLoading.Value = true;
         var sources     = category.Channels;
         var response    = await feedStoreService.LoadAsync(sources);
         Items.Clear();
         foreach (var article in response.Item2)
         {
             Items.Add(factoryService.CreateInstance <
                           ArticleViewModel>(article));
         }
         IsEmpty.Value   = Items.Count == 0;
         IsLoading.Value = false;
     });
 }
예제 #4
0
 public ServiceAcceptingFactoryService(
     ScopedFactoryService scopedService,
     IFactoryService transientService)
 {
     ScopedService    = scopedService;
     TransientService = transientService;
 }
 public TypeWithSupersetConstructors(
    IFakeMultipleService multipleService, 
    IFactoryService factoryService,
    IFakeService fakeService,
    IFakeScopedService scopedService)
 {
 }
예제 #6
0
 public FeedViewModel(
     ICategoriesRepository categoriesRepository,
     INavigationService navigationService,
     IFactoryService factoryService)
 {
     (IsEmpty, IsLoading) = (false, true);
     Selected             = new ObservableProperty <FeedCategoryViewModel>();
     OpenSources          = new ObservableCommand(navigationService.Navigate <ChannelsViewModel>);
     Items = new ObservableCollection <FeedCategoryViewModel>();
     Load  = new ObservableCommand(async() =>
     {
         IsEmpty.Value   = false;
         IsLoading.Value = true;
         Items.Clear();
         var categories = await categoriesRepository.GetAllAsync();
         foreach (var category in categories)
         {
             Items.Add(factoryService.CreateInstance <
                           FeedCategoryViewModel>(category));
         }
         Selected.Value  = Items.FirstOrDefault();
         IsEmpty.Value   = Items.Count == 0;
         IsLoading.Value = false;
     });
 }
예제 #7
0
 public DatabaseApiClientService(
     MyConfiguration configuration,
     IFactoryService factoryService)
 {
     _configuration  = configuration;
     _factoryService = factoryService;
 }
예제 #8
0
        /// <summary>
        /// Registers a factory method for the specified type.
        /// </summary>
        /// <typeparam name="T">The type to be returned by the factory.</typeparam>
        /// <param name="factoryService">The factory service.</param>
        /// <param name="factoryMethod">The factory method.</param>
        public static void Register <T>(this IFactoryService factoryService, Func <T> factoryMethod) where T : class
        {
            if (factoryMethod == null)
            {
                throw new ArgumentNullException(nameof(factoryMethod));
            }

            factoryService.Register(factoryMethod, typeof(T));
        }
 public BlazorApiClientService(
     MyBlazorConfiguration configuration,
     IFactoryService factoryService,
     ILoggedUserService loggedUserService)
 {
     _configuration     = configuration;
     _factoryService    = factoryService;
     _loggedUserService = loggedUserService;
 }
예제 #10
0
 public TypeWithSupersetConstructors(
     IFakeService fakeService,
     IFactoryService factoryService)
     : this(
         fakeService,
         multipleService: null,
         factoryService: factoryService)
 {
 }
예제 #11
0
 public TypeWithSupersetConstructors(
     IFakeService fakeService,
     IFactoryService factoryService)
     : this(
         fakeService,
         multipleService : null,
         factoryService : factoryService)
 {
 }
예제 #12
0
        public ShellViewModel(IFactoryService service)
        {
            if (service == null) throw new ArgumentNullException("IFactoryService is missing");

            this.service = service;
            Trades = this.service.CreateTrades();
            ChartItems = this.service.CreateChartData(Trades);

            WireUpCommands();
        }
        //private readonly ILoggedUserService _loggedUserService;

        public DatabaseApiClientService(
            MyConfiguration configuration,
            IFactoryService factoryService//,
            //ILoggedUserService loggedUserService
            )
        {
            _configuration  = configuration;
            _factoryService = factoryService;
            //_loggedUserService = loggedUserService;
        }
예제 #14
0
        /// <summary>
        /// Returns an object of the specified type.
        /// </summary>
        /// <param name="factoryService">The factory service.</param>
        /// <param name="type">The type of the object to be returned.</param>
        /// <returns>An instance of an object of the specified type.</returns>
        public static object Get(this IFactoryService factoryService, Type type)
        {
            var factory = factoryService.GetFactory(type);

            if (factory == null)
            {
                throw new InvalidOperationException($"No factory has been registered for {type.FullName}.");
            }

            return(factory.Get());
        }
예제 #15
0
 public TypeWithSupersetConstructors(
    IFakeService fakeService,
    IFakeMultipleService multipleService,
    IFactoryService factoryService)
     : this(
         multipleService,
         factoryService,
         fakeService,
         scopedService: null)
 {
 }
예제 #16
0
 public TypeWithSupersetConstructors(
     IFakeService fakeService,
     IFakeMultipleService multipleService,
     IFactoryService factoryService)
     : this(
         multipleService,
         factoryService,
         fakeService,
         scopedService : null)
 {
 }
예제 #17
0
 public TransferWorkService(IUnitOfWork unitOfWork,
                            IMapper mapper, ILogger <TransferWorkService> logger, HRMDBContext context,
                            IEmployeeService employeeService, IUnitService unitService, IFactoryService factoryService) :
     base(unitOfWork, mapper, logger)
 {
     _unitOfWork      = unitOfWork;
     _mapper          = mapper;
     _logger          = logger;
     _context         = context;
     _employeeService = employeeService;
     _unitService     = unitService;
     _factoryService  = factoryService;
 }
예제 #18
0
        public ChannelsViewModel(
            ICategoriesRepository categoriesRepository,
            ITranslationsService translationsService,
            INavigationService navigationService,
            IFactoryService factoryService,
            IDialogService dialogService)
        {
            (IsEmpty, IsLoading) = (false, true);
            Items       = new ObservableCollection <ChannelCategoryViewModel>();
            OpenSearch  = new ObservableCommand(navigationService.Navigate <SearchViewModel>);
            AddCategory = new ObservableCommand(async() =>
            {
                var name = await dialogService.ShowDialogForResults(
                    translationsService.Resolve("EnterNameOfNewCategory"),
                    translationsService.Resolve("EnterNameOfNewCategoryTitle"));
                if (string.IsNullOrWhiteSpace(name))
                {
                    return;
                }
                var category = new Category {
                    Title = name
                };
                await categoriesRepository.InsertAsync(category);
                Items.Add(factoryService.CreateInstance <
                              ChannelCategoryViewModel>(category, this));
            });
            Load = new ObservableCommand(async() =>
            {
                IsLoading.Value = true;
                var categories  = await categoriesRepository.GetAllAsync();
                Items.Clear();
                foreach (var category in categories)
                {
                    Items.Add(factoryService.CreateInstance <
                                  ChannelCategoryViewModel>(category, this));
                }
                IsEmpty.Value   = Items.Count == 0;
                IsLoading.Value = false;

                // Subscribe on collection changed to perform items rearranging.
                Items.CollectionChanged += async(s, a) =>
                {
                    IsEmpty.Value = Items.Count == 0;
                    var items     = Items.Select(i => i.Category.Value);
                    await categoriesRepository.RearrangeAsync(items);
                };
            });
        }
예제 #19
0
        /// <summary>
        /// Registers a factory method for the specified type.
        /// </summary>
        /// <param name="factoryService">The factory service.</param>
        /// <param name="factoryMethod">The factory method.</param>
        /// <param name="type">The type to be returned by the factory.</param>
        public static void Register(this IFactoryService factoryService, Func <object> factoryMethod, Type type)
        {
            if (factoryMethod == null)
            {
                throw new ArgumentNullException(nameof(factoryMethod));
            }
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            var factory = (IDefaultFactory <object>) typeof(DefaultFactory <>).MakeGenericType(type).CreateObject();

            factory.Factory = factoryMethod;
            factoryService.Register(factory, type);
        }
예제 #20
0
        public UwpNavigationService(
            ICategoriesRepository categoriesRepository,
            IFactoryService factoryService)
        {
            _factoryService       = factoryService;
            _categoriesRepository = categoriesRepository;

            var systemNavigationManager = SystemNavigationManager.GetForCurrentView();

            systemNavigationManager.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            systemNavigationManager.BackRequested += NavigateBack;

            var page  = (Page)((Frame)Window.Current.Content).Content;
            var color = (Color)Application.Current.Resources["SystemChromeLowColor"];

            StatusBar.SetBackgroundColor(page, color);
            StatusBar.SetBackgroundOpacity(page, 1);
        }
예제 #21
0
        public MappingsListViewModel(
            IFactoryService factoryService,
            ISettingsService settingsService,
            IMidiService midiService,
            IOrchestratorService orchestratorService,
            IDialogService dialogService)
        {
            if (factoryService == null)
            {
                throw new ArgumentNullException(nameof(factoryService));
            }
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }
            if (midiService == null)
            {
                throw new ArgumentNullException(nameof(midiService));
            }
            if (dialogService == null)
            {
                throw new ArgumentNullException(nameof(dialogService));
            }
            if (orchestratorService == null)
            {
                throw new ArgumentNullException(nameof(orchestratorService));
            }

            _factoryService      = factoryService;
            _settingsService     = settingsService;
            _dialogService       = dialogService;
            _orchestratorService = orchestratorService;

            RouteCommand(MappingsCommand.Add, AddMapping);
            RouteCommand(MappingsCommand.Edit, EditMapping);
            RouteCommand(MappingsCommand.Delete, DeleteMapping);
            RouteCommand(MappingsCommand.MoveUp, () => MoveMapping(-1));
            RouteCommand(MappingsCommand.MoveDown, () => MoveMapping(1));
            RouteCommand(ToolBarCommand.Reset, ResetStates);

            LoadMappings();
            midiService.NoteEventReceived += MapMidiEvent;
        }
예제 #22
0
 public SearchViewModel(
     IFactoryService factoryService,
     ISearchService searchService)
 {
     SearchQuery = string.Empty;
     (IsGreeting, IsEmpty, IsLoading) = (true, false, false);
     Items = new ObservableCollection <SearchItemViewModel>();
     Fetch = new ObservableCommand(async() =>
     {
         IsLoading.Value   = true;
         var query         = SearchQuery.Value;
         var searchResults = await searchService.SearchAsync(query);
         IsGreeting.Value  = false;
         Items.Clear();
         foreach (var feedlyItem in searchResults.Results)
         {
             Items.Add(factoryService.CreateInstance <
                           SearchItemViewModel>(feedlyItem));
         }
         IsEmpty.Value   = Items.Count == 0;
         IsLoading.Value = false;
     });
 }
예제 #23
0
 public TypeWithDefaultConstructorParameters(
     IFactoryService factoryService)
 {
 }
예제 #24
0
 public CreatePolylineSetCommandHandler(IFactoryService factoryService)
 {
     m_factoryService = factoryService;
 }
예제 #25
0
 public TypeWithMultipleParameterizedConstructors(IFactoryService factoryService)
 {
 }
 public TypeWithDefaultConstructorParameters(
     IFactoryService factoryService,
     IFakeScopedService singletonService = null)
 {
 }
 public TypeWithDefaultConstructorParameters(
     IFactoryService factoryService)
 {
 }
예제 #28
0
 public FactoryController(IFactoryService factoryService, IHubContext <FactoryHub> hubContext)
 {
     _factoryService = factoryService;
     _hubContext     = hubContext;
 }
 public TypeWithSupersetConstructors(IFactoryService factoryService)
 {
 }
 public TypeWithGenericServices(
     IFakeService fakeService,
     IFactoryService factoryService,
     IFakeOpenGenericService<IFakeService> logger)
 {
 }
 public FactoryController(IFactoryService service)
 {
     _service = service;
 }
예제 #32
0
 public TypeWithGenericServices(
     IFakeService fakeService,
     IFactoryService factoryService,
     IFakeOpenGenericService <IFakeService> logger)
 {
 }
 public TypeWithUnresolvableEnumerableConstructors(IFactoryService factoryService)
 {
 }
 public TypeWithSupersetConstructors(IFactoryService factoryService)
 {
 }
예제 #35
0
        public MainWindowViewModel(
            IFactoryService factoryService,
            IDialogService dialogService,
            ISettingsService settingsService,
            IMidiService midiService,
            IOrchestratorService orchestratorService,
            ILogService logService,
            EmulatorViewModel emulatorViewModel,
            MappingsListViewModel mappingsViewModel,
            LogViewModel logViewModel)
        {
            if (factoryService == null)
            {
                throw new ArgumentNullException(nameof(factoryService));
            }
            if (settingsService == null)
            {
                throw new ArgumentNullException(nameof(settingsService));
            }
            if (midiService == null)
            {
                throw new ArgumentNullException(nameof(midiService));
            }
            if (orchestratorService == null)
            {
                throw new ArgumentNullException(nameof(orchestratorService));
            }
            if (logService == null)
            {
                throw new ArgumentNullException(nameof(logService));
            }
            if (mappingsViewModel == null)
            {
                throw new ArgumentNullException(nameof(mappingsViewModel));
            }
            if (logViewModel == null)
            {
                throw new ArgumentNullException(nameof(logViewModel));
            }

            _factoryService      = factoryService;
            _dialogService       = dialogService;
            _settingsService     = settingsService;
            _midiService         = midiService;
            _orchestratorService = orchestratorService;
            _logService          = logService;

            Mappings = mappingsViewModel;
            Emulator = emulatorViewModel;
            Log      = logViewModel;

            RouteCommand(ToolBarCommand.Settings, ChangeSettings);
            RouteCommand(ToolBarCommand.Outputs, ChangeOutputs);

            Initialize();

            _dialogService.DialogShown  += (s, e) => HasDialog = true;
            _dialogService.DialogClosed += (s, e) => HasDialog = false;

            var version = Assembly.GetEntryAssembly().GetName().Version;

            Title = $"MIDI 2 Orchestrator Bridge v{version} - LightPi (c) Christian Kratky 2016";
        }
예제 #36
0
 public TypeWithDefaultConstructorParameters(
     IFactoryService factoryService,
     IFakeScopedService singletonService = null)
 {
 }
 public TypeWithUnresolvableEnumerableConstructors(IFactoryService factoryService)
 {
 }
 public FactoryController(IFactoryService factoryService)
 {
     this.factoryService = factoryService;
 }
예제 #39
0
 public FactoryAdminDashboardService(PfscDbContext context) : base(context)
 {
     _factoryService = new FactoryService(_context);
 }
예제 #40
0
        public FaveViewModel(
            IFavoritesRepository favoritesReposirory,
            IFactoryService factoryService)
        {
            (IsEmpty, IsLoading) = (false, true);
            var longDatePattern = CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern;

            Items = new ObservableCollection <ObservableGrouping <string, ArticleViewModel> >();
            Load  = new ObservableCommand(async() =>
            {
                IsLoading.Value = true;
                var articles    = await favoritesReposirory.GetAllAsync();
                Items.Clear();
                var groupings = articles
                                .Select(i => factoryService.CreateInstance <ArticleViewModel>(i))
                                .OrderByDescending(i => i.PublishedDate.Value)
                                .GroupBy(i => i.PublishedDate.Value.ToString(longDatePattern))
                                .Select(i => new ObservableGrouping <string, ArticleViewModel>(i))
                                .ToList();

                groupings.ForEach(Items.Add);
                foreach (var grouping in groupings)
                {
                    foreach (var viewModel in grouping)
                    {
                        viewModel.IsFavorite.PropertyChanged += (o, args) => RemoveOrRestore(viewModel);
                    }
                }

                IsEmpty.Value   = Items.Count == 0;
                IsLoading.Value = false;
            });
            OrderByDate = new ObservableCommand(() =>
            {
                IsLoading.Value = true;
                var groupings   = Items
                                  .SelectMany(i => i)
                                  .OrderByDescending(i => i.PublishedDate.Value)
                                  .GroupBy(i => i.PublishedDate.Value.ToString(longDatePattern))
                                  .Select(i => new ObservableGrouping <string, ArticleViewModel>(i))
                                  .ToList();

                Items.Clear();
                groupings.ForEach(Items.Add);
                IsLoading.Value = false;
            });
            OrderByFeed = new ObservableCommand(() =>
            {
                IsLoading.Value = true;
                var groupings   = Items
                                  .SelectMany(i => i)
                                  .OrderBy(i => i.Feed.Value)
                                  .GroupBy(i => i.Feed.Value.ToString())
                                  .Select(i => new ObservableGrouping <string, ArticleViewModel>(i))
                                  .ToList();

                Items.Clear();
                groupings.ForEach(Items.Add);
                IsLoading.Value = false;
            });
            void RemoveOrRestore(ArticleViewModel viewModel)
            {
                if (!viewModel.IsFavorite.Value)
                {
                    var related = Items.First(i => i.Contains(viewModel));
                    related.Remove(viewModel);
                    if (related.Count == 0)
                    {
                        Items.Remove(related);
                    }
                }
                else
                {
                    const string restored = "*Restored";
                    var          existing = Items.FirstOrDefault(i => i.Key == restored);
                    if (existing == null)
                    {
                        Items.Add(new ObservableGrouping <
                                      string, ArticleViewModel>(restored, new[] { viewModel }));
                    }
                    else
                    {
                        existing.Add(viewModel);
                    }
                }
            }
        }
 public TypeWithMultipleParameterizedConstructors(IFactoryService factoryService)
 {
 }