Пример #1
0
 public GCodeController(ILoadOptionsManager loadOptionsManager, IUserFileManager fileManager, GCodeLoadHelper loadHelper, ICNCLibUserContext userContext)
 {
     _loadOptionsManager = loadOptionsManager;
     _fileManager        = fileManager;
     _loadHelper         = loadHelper;
     _userContext        = userContext;
 }
Пример #2
0
 public ItemManager(IUnitOfWork unitOfWork, IItemRepository repository, ICNCLibUserContext userContext, IMapper mapper) : base(unitOfWork, repository, mapper)
 {
     _unitOfWork  = unitOfWork ?? throw new ArgumentNullException();
     _repository  = repository ?? throw new ArgumentNullException();
     _userContext = userContext ?? throw new ArgumentNullException();
     _mapper      = mapper ?? throw new ArgumentNullException();
 }
Пример #3
0
 public ItemManager(IUnitOfWork unitOfWork, IItemRepository repository, ICNCLibUserContext userContext, IMapper mapper) : base(unitOfWork, repository, mapper)
 {
     _unitOfWork  = unitOfWork;
     _repository  = repository;
     _userContext = userContext;
     _mapper      = mapper;
 }
Пример #4
0
 public UserManager(IUnitOfWork unitOfWork,
                    IUserRepository repository,
                    IMachineRepository machineRepository,
                    IItemRepository itemRepository,
                    IUserFileRepository userFileRepository,
                    IConfigurationRepository configRepository,
                    IInitRepository initRepository,
                    ICNCLibUserContext userContext,
                    ICurrentDateTime currentDate,
                    IMapper mapper,
                    IOneWayPasswordProvider passwordProvider,
                    CallStatisticCache callStatisticCache) : base(unitOfWork, repository, mapper)
 {
     _unitOfWork         = unitOfWork;
     _repository         = repository;
     _machineRepository  = machineRepository;
     _itemRepository     = itemRepository;
     _configRepository   = configRepository;
     _userFileRepository = userFileRepository;
     _initRepository     = initRepository;
     _userContext        = userContext;
     _currentDate        = currentDate;
     _mapper             = mapper;
     _passwordProvider   = passwordProvider;
     _callStatisticCache = callStatisticCache;
 }
Пример #5
0
 public UserFileManager(IUnitOfWork unitOfWork, IUserFileRepository repository, ICNCLibUserContext userContext, IMapper mapper, ICurrentDateTime currentDateTime) : base(unitOfWork, repository, mapper)
 {
     _unitOfWork      = unitOfWork;
     _repository      = repository;
     _userContext     = userContext;
     _mapper          = mapper;
     _currentDateTime = currentDateTime;
 }
Пример #6
0
 public MachineManager(IUnitOfWork unitOfWork, IMachineRepository repository, IConfigurationRepository repositoryConfig, ICNCLibUserContext userContext, IMapper mapper) :
     base(unitOfWork, repository, mapper)
 {
     _unitOfWork       = unitOfWork;
     _repository       = repository;
     _repositoryConfig = repositoryConfig;
     _userContext      = userContext;
     _mapper           = mapper;
 }
Пример #7
0
 public MachineManager(IUnitOfWork unitOfWork, IMachineRepository repository, IConfigurationRepository repositoryConfig, ICNCLibUserContext userContext, IMapper mapper) :
     base(unitOfWork, repository, mapper)
 {
     _unitOfWork       = unitOfWork ?? throw new ArgumentNullException();
     _repository       = repository ?? throw new ArgumentNullException();
     _repositoryConfig = repositoryConfig ?? throw new ArgumentNullException();
     _userContext      = userContext ?? throw new ArgumentNullException();
     _mapper           = mapper ?? throw new ArgumentNullException();
 }
Пример #8
0
        public SetupWindowViewModel(IFactory <IMachineService> machineService, IFactory <IJoystickService> joystickService, IMapper mapper, Global global, ICNCLibUserContext userContext)
        {
            _machineService  = machineService;
            _joystickService = joystickService;
            _mapper          = mapper;
            _global          = global;
            _userContext     = userContext;

            ResetOnConnect = false;
        }
 public EepromConfigurationController(IEepromConfigurationManager eepromConfigurationManager, ICNCLibUserContext userContext)
 {
     _eepromConfigurationManager = eepromConfigurationManager;
     _userContext = userContext;
 }
Пример #10
0
 public CambamController(ILoadOptionsManager loadOptionsManager, GCodeLoadHelper loadHelper, ICNCLibUserContext userContext)
 {
     _loadOptionsManager = loadOptionsManager;
     _loadHelper         = loadHelper;
     _userContext        = userContext;
 }
Пример #11
0
        private void AppStartup(object sender, StartupEventArgs e)
        {
            var userContextRW = new CNCLibUserContext();
            ICNCLibUserContext userContext = userContextRW;

            var localizationCollector = new LocalizationCollector();
            var moduleInit            = new InitializationManager();

            moduleInit.Add(new Framework.Tools.ModuleInitializer());
            moduleInit.Add(new Framework.Arduino.SerialCommunication.ModuleInitializer());
            moduleInit.Add(new Framework.Logic.ModuleInitializer()
            {
                MapperConfiguration =
                    new MapperConfiguration(
                        cfg =>
                {
                    cfg.AddProfile <WpfAutoMapperProfile>();
                    cfg.AddProfile <GCodeGUIAutoMapperProfile>();
                })
            });
            moduleInit.Add(new CNCLib.Logic.Client.ModuleInitializer());
            moduleInit.Add(new CNCLib.WpfClient.ModuleInitializer());
            moduleInit.Add(new CNCLib.Service.WebAPI.ModuleInitializer()
            {
                ConfigureHttpClient = httpClient =>
                {
                    HttpClientHelper.PrepareHttpClient(httpClient, @"https://cnclib.azurewebsites.net");
                    httpClient.DefaultRequestHeaders.Authorization =
                        new AuthenticationHeaderValue(
                            "Basic", Base64Helper.StringToBase64($"{userContextRW.UserName}:{userContextRW.Password}"));
                }
            });

            GlobalDiagnosticsContext.Set("logDir", $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}/CNCLib.Web/logs");

            _logger.Info(@"Starting ...");
            FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

            AppService.ServiceCollection = new ServiceCollection();
            AppService.ServiceCollection
            .AddTransient <ILoggerFactory, LoggerFactory>()
            .AddTransient(typeof(ILogger <>), typeof(Logger <>))
            .AddSingleton(userContext);

            moduleInit.Initialize(AppService.ServiceCollection, localizationCollector);

            AppService.BuildServiceProvider();

            // Open WebAPI Connection
            //
            bool ok = Task.Run(
                async() =>
            {
                try
                {
                    await userContextRW.InitUserContext(userContextRW.UserName);

                    using (var scope = AppService.ServiceProvider.CreateScope())
                    {
                        var controller = scope.ServiceProvider.GetRequiredService <IMachineService>();
                        var m          = await controller.Get(1000000);

                        return(true);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"Cannot connect to WebAPI: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    Current.Shutdown();
                    return(false);
                }
            }).ConfigureAwait(true).GetAwaiter().GetResult();
        }
Пример #12
0
 public JoystickController(IJoystickManager manager, ICNCLibUserContext userContext)
 {
     _manager     = manager;
     _userContext = userContext;
 }
Пример #13
0
 public ConfigurationRepository(CNCLibContext dbContext, ICNCLibUserContext userContext) : base(dbContext)
 {
     _userContext = userContext ?? throw new ArgumentNullException();
 }
Пример #14
0
 public SetUserContextFilter(ICNCLibUserContext userContext)
 {
     _userContext = userContext;
 }
Пример #15
0
 public GCodeController(ILoadOptionsManager loadOptionsManager, ICNCLibUserContext userContext)
 {
     _loadOptionsManager = loadOptionsManager ?? throw new ArgumentNullException();
     _userContext        = userContext ?? throw new ArgumentNullException();
     ((CNCLibUserContext)_userContext).InitFromController(this);
 }
Пример #16
0
 public MachineController(IMachineManager manager, ICNCLibUserContext userContext)
 {
     _manager     = manager ?? throw new ArgumentNullException();
     _userContext = userContext ?? throw new ArgumentNullException();
     ((CNCLibUserContext)_userContext).InitFromController(this);
 }
Пример #17
0
 public MachineController(IMachineService service, ICNCLibUserContext usercontext)
 {
     _service     = service ?? throw new ArgumentNullException();
     _userContext = usercontext ?? throw new ArgumentNullException();
     ((CNCLibUserContext)_userContext).InitFromController(this);
 }
Пример #18
0
 public EepromConfigurationController(IEepromConfigurationManager eepromConfigurationManager, ICNCLibUserContext userContext)
 {
     _eepromConfigurationManager = eepromConfigurationManager ?? throw new ArgumentNullException();
     _userContext = userContext ?? throw new ArgumentNullException();
     ((CNCLibUserContext)_userContext).InitFromController(this);
 }
Пример #19
0
 public MachineRepository(CNCLibContext context, ICNCLibUserContext userContext) : base(context)
 {
     _userContext = userContext ?? throw new ArgumentNullException();
 }
Пример #20
0
 public UserFileController(IUserFileManager manager, ICNCLibUserContext userContext)
 {
     _manager     = manager;
     _userContext = userContext;
 }
Пример #21
0
 public ItemController(IItemManager manager, ICNCLibUserContext userContext)
 {
     _manager     = manager;
     _userContext = userContext;
 }
Пример #22
0
 public UserService(IUserManager manager, ICNCLibUserContext userContext) : base(manager)
 {
     _manager     = manager;
     _userContext = userContext;
 }
Пример #23
0
        public SetupWindowViewModel(IFactory <IMachineService> machineService, IFactory <IJoystickService> joystickService, IMapper mapper, Global global, ICNCLibUserContext userContext)
        {
            _machineService  = machineService ?? throw new ArgumentNullException();
            _joystickService = joystickService ?? throw new ArgumentNullException();
            _mapper          = mapper ?? throw new ArgumentNullException();
            _global          = global ?? throw new ArgumentNullException();
            _userContext     = userContext ?? throw new ArgumentNullException();

            ResetOnConnect = false;
        }
Пример #24
0
 public MachineController(IMachineManager manager, ICNCLibUserContext userContext)
 {
     _manager     = manager;
     _userContext = userContext;
 }
Пример #25
0
 public LoadOptionsController(ILoadOptionsManager manager, ICNCLibUserContext userContext)
 {
     _manager     = manager;
     _userContext = userContext;
 }
Пример #26
0
 public CambamController(ILoadOptionsService loadOptionsService, ICNCLibUserContext usercontext)
 {
     _loadOptionsService = loadOptionsService ?? throw new ArgumentNullException();
     _usercontext        = usercontext ?? throw new ArgumentNullException();
     ((CNCLibUserContext)_usercontext).InitFromController(this);
 }
 public EepromConfigurationController(IEepromConfigurationService eepromConfigurationService, ICNCLibUserContext usercontext)
 {
     _eepromConfigurationService = eepromConfigurationService ?? throw new ArgumentNullException();
     _usercontext = usercontext ?? throw new ArgumentNullException();
     ((CNCLibUserContext)_usercontext).InitFromController(this);
 }