protected TransactionalCommandTask(Func<bool> canExecute)
        {
            if (canExecute == null) throw new ArgumentNullException(nameof(canExecute));

            _canExecute = canExecute;
            _dataContextManager = SimpleIoc.Default.GetInstance<IDataContextManager>();
        }
示例#2
0
        public RepositoryBase(IDataContextManager dataContextManager)
        {
            if (dataContextManager == null)
            {
                throw new ArgumentNullException(nameof(dataContextManager));
            }

            _dataContextManager = dataContextManager;
        }
示例#3
0
        protected override void Arrange()
        {
            DataContextManager = new DataContextManager();
            DataContextManager.RefreshSettingsDataContext().Wait();

            var switchableDevice = new Device {
                Identifier = Guid.NewGuid(), Name = "switchable device", Capability = DeviceCapability.Switchable, Type = DeviceType.Fifthplay
            };
            var unsupportedDevice = new Device {
                Identifier = Guid.NewGuid(), Name = "unsupported device", Capability = DeviceCapability.None, Type = DeviceType.Ifttt
            };

            DataContextManager.SettingsDataContext.IsApplicationEnabled = true;
            DataContextManager.SettingsDataContext.Devices = new List <Device> {
                switchableDevice, unsupportedDevice
            };

            DataContextManager.SettingsDataContext.Actions = new List <Business.Model.Action>
            {
                new Business.Model.Action
                {
                    Identifier               = Guid.NewGuid(),
                    DeviceIdentifier         = switchableDevice.Identifier,
                    ActionTypeIdentifier     = DataContextManager.SettingsDataContext.ActionTypes.First().Identifer,
                    ActionArgumentIdentifier = DataContextManager.SettingsDataContext.ActionTypes.First().ActionArguments.First().Identifer,
                    ActionTrigger            = ActionTrigger.Home
                },
                new Business.Model.Action
                {
                    Identifier               = Guid.NewGuid(),
                    DeviceIdentifier         = unsupportedDevice.Identifier,
                    ActionTypeIdentifier     = DataContextManager.SettingsDataContext.ActionTypes.First().Identifer,
                    ActionArgumentIdentifier = DataContextManager.SettingsDataContext.ActionTypes.First().ActionArguments.ElementAt(1).Identifer,
                    ActionTrigger            = ActionTrigger.Away
                }
            };

            DataContextManager.SettingsDataContext.Logs.Add(new ActionLog {
                Identifier = Guid.NewGuid(), ActionArgumentValue = "on", Type = "Home", ActionTypeName = "switch", DeviceName = "dummy device", Timestamp = DateTimeOffset.UtcNow
            });
            DataContextManager.SettingsDataContext.Logs.Add(new ActionLog {
                Identifier = new Guid("6fd4aa18-e36c-493c-815d-d4e1e8ed675f"), ActionArgumentValue = "on", Type = "Home", ActionTypeName = "switch", DeviceName = "Desk lamp", Timestamp = DateTimeOffset.UtcNow
            });
            DataContextManager.SettingsDataContext.Logs.Add(new FailedActionLog {
                Identifier = Guid.NewGuid(), ActionArgumentValue = "on", Type = "Home", ActionTypeName = "switch", DeviceName = "dummy device", Timestamp = DateTimeOffset.UtcNow, Error = "dummy-error"
            });
            DataContextManager.SettingsDataContext.Logs.Add(new FailedActionLog {
                Identifier = Guid.NewGuid(), ActionArgumentValue = "on", Type = "Home", ActionTypeName = "switch", DeviceName = "dummy device", Timestamp = DateTimeOffset.UtcNow, Error = "dummy-error"
            });
            DataContextManager.SettingsDataContext.Logs.Add(new ExceptionLog {
                Identifier = Guid.NewGuid(), Error = new Exception().ToString(), Timestamp = DateTimeOffset.UtcNow
            });
            DataContextManager.SettingsDataContext.Logs.Add(new ExceptionLog {
                Identifier = Guid.NewGuid(), Error = "dummy-error", Timestamp = DateTimeOffset.UtcNow
            });
        }
示例#4
0
        public GeofenceBackgroundTask()
        {
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

            SimpleIoc.Default.ConfigureBusiness();

            _dataContextManager = SimpleIoc.Default.GetInstance <IDataContextManager>();
            _actionExecutor     = SimpleIoc.Default.GetInstance <IActionExecutor>();
            _logger             = SimpleIoc.Default.GetInstance <ILogger>();
        }
        public GeofenceBackgroundTask()
        {
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

            SimpleIoc.Default.ConfigureBusiness();

            _dataContextManager = SimpleIoc.Default.GetInstance<IDataContextManager>();
            _actionExecutor = SimpleIoc.Default.GetInstance<IActionExecutor>();
            _logger = SimpleIoc.Default.GetInstance<ILogger>();
        }
        protected TransactionalCommandTask(Func <bool> canExecute)
        {
            if (canExecute == null)
            {
                throw new ArgumentNullException(nameof(canExecute));
            }

            _canExecute         = canExecute;
            _dataContextManager = SimpleIoc.Default.GetInstance <IDataContextManager>();
        }
示例#7
0
        protected override void Arrange()
        {
            DataContextManager = new DataContextManager();
            DataContextManager.RefreshSettingsDataContext().Wait();

            var switchableDevice = new Device { Identifier = Guid.NewGuid(), Name = "switchable device", Capability = DeviceCapability.Switchable, Type = DeviceType.Fifthplay };
            var unsupportedDevice = new Device { Identifier = Guid.NewGuid(), Name = "unsupported device", Capability = DeviceCapability.None, Type = DeviceType.Ifttt };

            DataContextManager.SettingsDataContext.IsApplicationEnabled = true;
            DataContextManager.SettingsDataContext.Devices = new List<Device> { switchableDevice, unsupportedDevice };

            DataContextManager.SettingsDataContext.Actions = new List<Business.Model.Action>
            {
                new Business.Model.Action
                {
                    Identifier = Guid.NewGuid(),
                    DeviceIdentifier = switchableDevice.Identifier,
                    ActionTypeIdentifier = DataContextManager.SettingsDataContext.ActionTypes.First().Identifer,
                    ActionArgumentIdentifier = DataContextManager.SettingsDataContext.ActionTypes.First().ActionArguments.First().Identifer,
                    ActionTrigger = ActionTrigger.Home
                },
                new Business.Model.Action
                {
                    Identifier = Guid.NewGuid(),
                    DeviceIdentifier = unsupportedDevice.Identifier,
                    ActionTypeIdentifier = DataContextManager.SettingsDataContext.ActionTypes.First().Identifer,
                    ActionArgumentIdentifier = DataContextManager.SettingsDataContext.ActionTypes.First().ActionArguments.ElementAt(1).Identifer,
                    ActionTrigger = ActionTrigger.Away
                }
            };

            DataContextManager.SettingsDataContext.Logs.Add(new ActionLog { Identifier = Guid.NewGuid(), ActionArgumentValue = "on", Type = "Home", ActionTypeName = "switch", DeviceName = "dummy device", Timestamp = DateTimeOffset.UtcNow });
            DataContextManager.SettingsDataContext.Logs.Add(new ActionLog { Identifier = new Guid("6fd4aa18-e36c-493c-815d-d4e1e8ed675f"), ActionArgumentValue = "on", Type = "Home", ActionTypeName = "switch", DeviceName = "Desk lamp", Timestamp = DateTimeOffset.UtcNow });
            DataContextManager.SettingsDataContext.Logs.Add(new FailedActionLog { Identifier = Guid.NewGuid(), ActionArgumentValue = "on", Type = "Home", ActionTypeName = "switch", DeviceName = "dummy device", Timestamp = DateTimeOffset.UtcNow, Error = "dummy-error" });
            DataContextManager.SettingsDataContext.Logs.Add(new FailedActionLog { Identifier = Guid.NewGuid(), ActionArgumentValue = "on", Type = "Home", ActionTypeName = "switch", DeviceName = "dummy device", Timestamp = DateTimeOffset.UtcNow, Error = "dummy-error" });
            DataContextManager.SettingsDataContext.Logs.Add(new ExceptionLog { Identifier = Guid.NewGuid(), Error = new Exception().ToString(), Timestamp = DateTimeOffset.UtcNow });
            DataContextManager.SettingsDataContext.Logs.Add(new ExceptionLog { Identifier = Guid.NewGuid(), Error = "dummy-error", Timestamp = DateTimeOffset.UtcNow });
        }
示例#8
0
 public ExampleController(IDataContextManager <ExampleDbContext> manager, IGenericRepository <UserEntity> repository)
 {
     this.manager    = manager;
     this.repository = repository;
 }
示例#9
0
 public DeviceRepository(IDataContextManager dataContextManager)
     : base(dataContextManager)
 {
 }
示例#10
0
 public LogRepository(IDataContextManager dataContextManager)
     : base(dataContextManager)
 {
 }
 public ActionTypeRepository(IDataContextManager dataContextManager)
     : base(dataContextManager)
 {
 }
示例#12
0
 public DeviceRepository(IDataContextManager dataContextManager)
     : base(dataContextManager)
 {
 }
示例#13
0
 public ActionRepository(IDataContextManager dataContextManager)
     : base(dataContextManager)
 {
 }
 public EFGenericRepositoryExample(IDataContextManager <ExampleDbContext> manager)
 {
     this.manager = manager;
 }
示例#15
0
        public RepositoryBase(IDataContextManager dataContextManager)
        {
            if (dataContextManager == null) throw new ArgumentNullException(nameof(dataContextManager));

            _dataContextManager = dataContextManager;
        }
示例#16
0
 public AbstractService(IDataContextManager dataContextManager, IUnityContainer container)
 {
     DataContextManager = dataContextManager;
     MapperFactory      = new MapperFactory(container);
 }
 public ApplicationRepository(IDataContextManager dataContextManager)
     : base(dataContextManager)
 {
 }
示例#18
0
 public LogRepository(IDataContextManager dataContextManager)
     : base(dataContextManager)
 {
 }
 public AbstractService(IDataContextManager dataContextManager, IUnityContainer container)
 {
     DataContextManager = dataContextManager;
     MapperFactory = new MapperFactory(container);
 }
 public ConvenienceViewModelBase()
 {
     _navigationService = ServiceLocator.Current.GetInstance<INavigationService>();
     _dataContextManager = ServiceLocator.Current.GetInstance<IDataContextManager>();
     IsLoading = false;
 }
 public ConvenienceViewModelBase()
 {
     _navigationService  = ServiceLocator.Current.GetInstance <INavigationService>();
     _dataContextManager = ServiceLocator.Current.GetInstance <IDataContextManager>();
     IsLoading           = false;
 }