public DevicePage(DeviceViewModel device, IDeviceRepository deviceRepository = null, IRealTimeService realTimeService = null) { _deviceViewModel = device; _deviceRepository = deviceRepository ?? DependencyService.Get<IDeviceRepository>(); _realTimeService = realTimeService ?? DependencyService.Get<IRealTimeService>(); _notifyPage = new NotifyPage(this); _realTimeService.DeviceUpdated += RealTimeService_DeviceUpdated; BindingContext = _deviceViewModel; InitializeComponent(); if (device.DeviceType == DeviceType.AutomaticWindow || device.DeviceType == DeviceType.Thermostat) ChangeSettingButton.IsVisible = true; if (device.DeviceType == DeviceType.Thermostat) ContinousSettingEntry.IsVisible = true; }
protected override void Initialize(RequestContext requestContext) { base.Initialize(requestContext); if (requestContext.HttpContext.User.Identity.IsAuthenticated) { aService = new AccountService(_context, _currentUserId); dService = new DiscussionService(_context, _currentUserId); bService = new BlogService(_context, _currentUserId); qService = new QuestionService(_context, _currentUserId); rService = new RealTimeService(_context, _currentUserId); cService = new CommonService(_context, _currentUserId); } else { aService = new AccountService(_context); dService = new DiscussionService(_context); bService = new BlogService(_context); qService = new QuestionService(_context); cService = new CommonService(_context); } }