public FrameController(IFrameConfig frameConfig, UiDispatchDelegate uiDispatchDelegate) { _frameConfig = frameConfig; _uiDispatchDelegate = uiDispatchDelegate; _photosDatabase = new PhotoDatabase(_frameConfig.PhotosPath); _photosDatabase.PhotosListChanged += (s, e) => { string nextPhoto = CalculateNextPhoto(); _uiDispatchDelegate.Invoke(() => { CurrentPhoto = nextPhoto; }); }; _random = new Random(DateTime.Now.Millisecond); _currentPhoto = CalculateNextPhoto(); _photoSwitchTimer = new Timer( o => { if (_timerValue >= _frameConfig.PhotoShowTime) { _timerValue = TimeSpan.Zero; CurrentPhoto = CalculateNextPhoto(); RaiseTimerValueChanged(); } else { _timerValue = _timerValue.Add(TimeSpan.FromSeconds(1)); RaiseTimerValueChanged(); } }); }
public ViewBase(string uri, IAppModel appModel, IFrameController frameController, IFrameConfig frameConfig) { _Uri = uri; AppModel = appModel; FrameController = frameController; FrameConfig = frameConfig; }
private void InitAppWithConfig(IFrameConfig frameConfig) { if (_FrameController != null) { _FrameController.Stop(); } _FrameController = new FrameController(frameConfig, new UIDispatchDelegate((a) => UIDispatch.Invoke(a))); _ViewManager = new ViewManager(this, _FrameController, frameConfig); ShowDebugInfo = _FrameConfig.ShowDebugInfo; _FrameController.CurrentPhotoChanged += (s, e) => { CreateAndShowNewView(); }; CreateAndShowNewView(); _FrameController.TimerValueChanged += (s, e) => { TimerValue = _FrameController.TimerValue; }; _FrameController.Start(); }
public ViewModelBase(IFrameController frameController, IFrameConfig config) { FrameController = frameController; FrameConfig = config; ImageUri = frameController.CurrentPhoto; FrameController.CurrentPhotoChanged += FrameController_CurrentPhotoChanged; _Counter++; Console.WriteLine($"Number of ViewModels: {_Counter}"); }
public ViewModelColorize(IFrameController frameController, IFrameConfig config) : base(frameController, config) { var colorizeInfo = frameController.GetNextColorizeInfo(); Hue = colorizeInfo.Hue; Saturation = colorizeInfo.Saturation; Lightness = colorizeInfo.Lightness; }
public AppModel() { if (_Instance != null) { _CurrentViewSwitchInfo = _Instance._CurrentViewSwitchInfo; } _Instance = this; string wd = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); _FrameConfig = new FrameJsonConfig(Path.Combine(wd, "PhotoFrameConfig.json")); _FrameConfig.FrameConfigChanged += (s, e) => { InitAppWithConfig(_FrameConfig); }; InitAppWithConfig(_FrameConfig); }
public ViewNormal(IAppModel appModel, IFrameController frameController, IFrameConfig config) : base("ViewNormal.qml", appModel, frameController, config) { }
public TestView(string uri, IAppModel appModel, IFrameController frameController, IFrameConfig config) : base(uri, appModel, frameController, config) { ViewModelMock = Mock.Of <IViewModel>(); }
public ViewModelNormal(IFrameController frameController, IFrameConfig config) : base(frameController, config) { }
public ViewModelBorder(IFrameController frameController, IFrameConfig config) : base(frameController, config) { BorderColor = ColorToString(FrameController.GetNextBorderColor()); BorderWidth = FrameConfig.BorderWidth; }
public ViewModelBaseTestClass(IFrameController frameController, IFrameConfig frameConfig) : base(frameController, frameConfig) { }
public ViewModelTestBase() { _FrameControllerMock = Mock.Of <IFrameController>(); _FrameConfigMock = Mock.Of <IFrameConfig>(); }
public ViewManagerTest() { _AppModelMock = Mock.Of <IAppModel>(); _FrameControllerMock = Mock.Of <IFrameController>(); _FrameConfigMock = Mock.Of <IFrameConfig>(); }
public ViewTestBase() { _AppModelMock = Mock.Of <IAppModel>(); _FrameControllerMock = Mock.Of <IFrameController>(); _FrameConfigMock = Mock.Of <IFrameConfig>(); }
public ViewBorder(IAppModel appModel, IFrameController frameController, IFrameConfig config) : base("ViewBorder.qml", appModel, frameController, config) { }
public ViewColorize(IAppModel appModel, IFrameController frameController, IFrameConfig frameConfig) : base("ViewColorized.qml", appModel, frameController, frameConfig) { }
public ViewManager(IAppModel appModel, IFrameController frameController, IFrameConfig frameConfig) { _appModel = appModel; _frameController = frameController; _frameConfig = frameConfig; }