public void ApplyJot(Window window)
 {
     _tracker.Configure(window)
     .IdentifyAs(GetType().ToString())
     .AddProperties <Window>(w => w.Height, w => w.Width, w => w.Left, w => w.Top, w => w.WindowState)
     .RegisterPersistTrigger("Closed")
     .Apply();
 }
Exemple #2
0
        public MainWindow(MainViewModel model)
        {
            InitializeComponent();

            _model = model;

            DataContext = _model;

            _tracker.Configure(this)
            .IdentifyAs(GetType().ToString())
            .AddProperties <MainWindow>(w => w.Height, w => w.Width, w => w.Left, w => w.Top, w => w.WindowState)
            .RegisterPersistTrigger(nameof(Closed))
            .Apply();

            Loaded  += MainWindow_Loaded;
            Closing += MainWindow_Closing;
        }
Exemple #3
0
        public MainWindow(MainViewModel model, StateTracker tracker)
        {
            InitializeComponent();

            Thread.CurrentThread.Name = "UI Thread";

            _model = model;

            tracker.Configure(this)
            .IdentifyAs("MainWindow")
            .AddProperties <MainWindow>(w => w.Height, w => w.Width, w => w.Left, w => w.Top, w => w.WindowState)
            .RegisterPersistTrigger(nameof(Closed))
            .Apply();

            DataContext = _model;

            Loaded  += MainWindow_Loaded;
            Closing += MainWindow_Closing;
        }
Exemple #4
0
        public void GlobalTriggerCausesPersist()
        {
            //The idea: verify that firing the PersistRequired event causes the data store to commit the data

            Mock <IStore>        storeMoq        = new Mock <IStore>();
            Mock <IStoreFactory> storeFactoryMoq = new Mock <IStoreFactory>();

            storeFactoryMoq.Setup(sf => sf.CreateStoreForObject(It.IsAny <string>())).Returns(storeMoq.Object);

            var stateTracker1 = new StateTracker(storeFactoryMoq.Object, _trigger);

            stateTracker1.RegisterConfigurationInitializer(new FooConfigurationInitializer());//add initializer

            var testData1 = new Foo()
            {
                Double = 123.45f, Int = 456
            };
            var cfg1 = stateTracker1.Configure(testData1).IdentifyAs("x");

            //verify changes were committed once the persist trigger was fired
            storeMoq.Verify(s => s.CommitChanges(), Times.Never);
            _trigger.Fire();
            storeMoq.Verify(s => s.CommitChanges(), Times.Once);
        }
Exemple #5
0
 public Config()
 {
     Tracker.Configure(this).Apply();
 }
 private Settings()
 {
     Tracker.Configure(this)
     .Apply();
 }