public override void SetUp () { base.SetUp (); RunAsync (async delegate { workspace = await DataStore.PutAsync (new WorkspaceData () { Name = "Test", }); user = await DataStore.PutAsync (new UserData () { Name = "John Doe", TrackingMode = TrackingMode.StartNew, DefaultWorkspaceId = workspace.Id, }); await SetUpFakeUser (user.Id); var activeManager = new ActiveTimeEntryManager (); await Util.AwaitPredicate (() => activeManager.ActiveTimeEntry != null); ServiceContainer.Register<ExperimentManager> (new ExperimentManager ()); ServiceContainer.Register<ISyncManager> (Mock.Of<ISyncManager> (mgr => !mgr.IsRunning)); ServiceContainer.Register<ActiveTimeEntryManager> (activeManager); ServiceContainer.Register<ITracker> (() => new FakeTracker ()); }); }
public override void OnDestroy () { if (timeEntryManager != null) { timeEntryManager.PropertyChanged -= OnTimeEntryManagerPropertyChanged; timeEntryManager = null; } base.OnDestroy (); }
public override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); if (timeEntryManager == null) { timeEntryManager = ServiceContainer.Resolve<ActiveTimeEntryManager> (); timeEntryManager.PropertyChanged += OnTimeEntryManagerPropertyChanged; } ResetModel (); }
public void OnStart () { // Hook up to time entry manager if (timeEntryManager == null) { timeEntryManager = ServiceContainer.Resolve<ActiveTimeEntryManager> (); timeEntryManager.PropertyChanged += OnActiveTimeEntryManagerPropertyChanged; } canRebind = true; SyncModel (); Rebind (); }
public WidgetSyncManager () { authManager = ServiceContainer.Resolve<AuthManager>(); authManager.PropertyChanged += OnAuthPropertyChanged; activeTimeEntryManager = ServiceContainer.Resolve<ActiveTimeEntryManager> (); widgetUpdateService = ServiceContainer.Resolve<IWidgetUpdateService> (); messageBus = ServiceContainer.Resolve<MessageBus> (); subscriptionSyncStarted = messageBus.Subscribe<SyncStartedMessage> (OnSyncWidget); subscriptionSyncFinished = messageBus.Subscribe<SyncFinishedMessage> (OnSyncWidget); subscriptionStartStopFinished = messageBus.Subscribe<StartStopMessage> (OnSyncWidget); }
public AndroidNotificationManager () { ctx = ServiceContainer.Resolve<Context> (); notificationManager = (NotificationManager)ctx.GetSystemService (Context.NotificationService); runningBuilder = CreateRunningNotificationBuilder (ctx); idleBuilder = CreateIdleNotificationBuilder (ctx); propertyTracker = new PropertyChangeTracker (); TimeEntryManager = ServiceContainer.Resolve<ActiveTimeEntryManager> (); binding = this.SetBinding (() => TimeEntryManager.ActiveTimeEntry).WhenSourceChanges (OnActiveTimeEntryChanged); var bus = ServiceContainer.Resolve<MessageBus> (); subscriptionSettingChanged = bus.Subscribe<SettingChangedMessage> (OnSettingChanged); }
public WidgetSyncManager () { authManager = ServiceContainer.Resolve<AuthManager>(); authManager.PropertyChanged += OnAuthPropertyChanged; widgetUpdateService = ServiceContainer.Resolve<IWidgetUpdateService>(); timeEntryManager = ServiceContainer.Resolve<ActiveTimeEntryManager> (); timeEntryManager.PropertyChanged += OnTimeEntryManagerPropertyChanged; ResetModelToRunning (); messageBus = ServiceContainer.Resolve<MessageBus> (); subscriptionSyncStarted = messageBus.Subscribe<SyncStartedMessage> (OnSync); subscriptionSyncFinished = messageBus.Subscribe<SyncFinishedMessage> (OnSync); }
public AndroidNotificationManager () { ctx = ServiceContainer.Resolve<Context> (); notificationManager = (NotificationManager)ctx.GetSystemService (Context.NotificationService); runningBuilder = CreateRunningNotificationBuilder (ctx); idleBuilder = CreateIdleNotificationBuilder (ctx); propertyTracker = new PropertyChangeTracker (); timeEntryManager = ServiceContainer.Resolve<ActiveTimeEntryManager> (); timeEntryManager.PropertyChanged += OnActiveTimeEntryManagerPropertyChanged; var bus = ServiceContainer.Resolve<MessageBus> (); subscriptionSettingChanged = bus.Subscribe<SettingChangedMessage> (OnSettingChanged); SyncRunningModel (); SyncNotification (); }
public void Dispose () { var bus = ServiceContainer.Resolve<MessageBus> (); if (propertyTracker != null) { propertyTracker.Dispose (); propertyTracker = null; } if (subscriptionSettingChanged != null) { bus.Unsubscribe (subscriptionSettingChanged); subscriptionSettingChanged = null; } if (timeEntryManager != null) { timeEntryManager.PropertyChanged -= OnActiveTimeEntryManagerPropertyChanged; timeEntryManager = null; } if (propertyTracker != null) { propertyTracker.Dispose (); propertyTracker = null; } }
public void Stop () { // Stop listening to timer changes isStarted = false; if (propertyTracker != null) { propertyTracker.Dispose (); propertyTracker = null; } if (timeEntryManager != null) { timeEntryManager.PropertyChanged -= OnTimeEntryManagerPropertyChanged; timeEntryManager = null; } if (showRunning) { currentTimeEntry = null; } }
public void Start () { propertyTracker = new PropertyChangeTracker (); // Start listening to timer changes if (showRunning) { timeEntryManager = ServiceContainer.Resolve<ActiveTimeEntryManager> (); timeEntryManager.PropertyChanged += OnTimeEntryManagerPropertyChanged; ResetModelToRunning (); } isStarted = true; Rebind (); }
protected override void ResetModel () { useDraft = true; if (timeEntryManager == null) { timeEntryManager = ServiceContainer.Resolve<ActiveTimeEntryManager> (); timeEntryManager.PropertyChanged += OnTimeEntryManagerPropertyChanged; } if (timeEntryManager.Draft == null) { TimeEntry = null; } else { TimeEntry = new TimeEntryModel (timeEntryManager.Draft); } }
public void OnStop () { canRebind = false; if (timeEntryManager != null) { timeEntryManager.PropertyChanged -= OnActiveTimeEntryManagerPropertyChanged; timeEntryManager = null; } }
public void OnStart () { // Hook up to time entry manager if (timeEntryManager == null) { timeEntryManager = ServiceContainer.Resolve<ActiveTimeEntryManager> (); timeEntryManager.PropertyChanged += OnActiveTimeEntryManagerPropertyChanged; } canRebind = true; SyncModel (); Rebind (); if (ActiveEntryChanged != null) { ActiveEntryChanged.Invoke (this, EventArgs.Empty); // Initial rendering } }
protected override void Dispose (bool disposing) { if (disposing) { var bus = ServiceContainer.Resolve<MessageBus> (); if (subscriptionSettingChanged != null) { bus.Unsubscribe (subscriptionSettingChanged); subscriptionSettingChanged = null; } if (timeEntryManager != null) { timeEntryManager.PropertyChanged -= OnTimeEntryManagerPropertyChanged; timeEntryManager = null; } } base.Dispose (disposing); }
public MainPagerAdapter (Context ctx, FragmentManager fm) : base (fm) { this.ctx = ctx; timeEntryManager = ServiceContainer.Resolve<ActiveTimeEntryManager> (); timeEntryManager.PropertyChanged += OnTimeEntryManagerPropertyChanged; var bus = ServiceContainer.Resolve<MessageBus> (); subscriptionSettingChanged = bus.Subscribe<SettingChangedMessage> (OnSettingChanged); }