Esempio n. 1
0
 public void OnDestroy (Activity activity)
 {
     if (propertyTracker != null) {
         propertyTracker.Dispose ();
         propertyTracker = null;
     }
 }
Esempio n. 2
0
        public void OnCreate (Activity activity)
        {
            this.activity = activity;
            propertyTracker = new PropertyChangeTracker ();

            Root = LayoutInflater.From (activity).Inflate (Resource.Layout.TimerComponent, null);

            FindViews ();
        }
        public override void OnStart ()
        {
            base.OnStart ();

            propertyTracker = new PropertyChangeTracker ();
            canRebind = true;

            Rebind ();
            RebindTags ();
        }
        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);
        }
Esempio n. 5
0
        protected override void Dispose (bool disposing)
        {
            base.Dispose (disposing);

            if (disposing) {
                if (tagsView != null) {
                    tagsView.Updated -= OnTagsUpdated;
                }
                if (propertyTracker != null) {
                    propertyTracker.Dispose ();
                    propertyTracker = null;
                }
            }
        }
        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 Dispose ()
 {
     var bus = ServiceContainer.Resolve<MessageBus> ();
     if (propertyTracker != null) {
         propertyTracker.Dispose ();
         propertyTracker = null;
     }
     if (subscriptionSettingChanged != null) {
         bus.Unsubscribe (subscriptionSettingChanged);
         subscriptionSettingChanged = null;
     }
     if (subscriptionAuthChanged != null) {
         bus.Unsubscribe (subscriptionAuthChanged);
         subscriptionAuthChanged = null;
     }
     if (propertyTracker != null) {
         propertyTracker.Dispose ();
         propertyTracker = null;
     }
 }
        public void TestTracker (Action<PropertyChangeTracker> injection, bool shouldNotify)
        {
            var tracker = new PropertyChangeTracker ();
            var demoObject = DemoObject.Bake ();

            string detectedChangedTargetName = null;

            tracker.Add (demoObject, ((string obj) => {
                detectedChangedTargetName = obj;
            }));

            if (injection != null) {
                injection (tracker);
            }

            string changedTargetName = demoObject.Change ();

            if (shouldNotify) {
                Assert.That (changedTargetName, Is.EqualTo (detectedChangedTargetName));
            } else {
                Assert.That (changedTargetName, Is.Not.EqualTo (detectedChangedTargetName));
            }
        }
Esempio n. 10
0
        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;
            }
        }
Esempio n. 11
0
        public void Start ()
        {
            propertyTracker = new PropertyChangeTracker ();

            // Start listening to timer changes
            if (showRunning) {
                timeEntryManager = ServiceContainer.Resolve<ActiveTimeEntryManager> ();
                timeEntryManager.PropertyChanged += OnTimeEntryManagerPropertyChanged;
                ResetModelToRunning ();
            }

            isStarted = true;
            Rebind ();
        }
        public override void OnStop ()
        {
            base.OnStop ();

            canRebind = false;

            if (propertyTracker != null) {
                propertyTracker.Dispose ();
                propertyTracker = null;
            }
        }