Exemplo n.º 1
0
        private async Task StartEntry(Guid id)
        {
            var model = new TimeEntryModel(id);
            await model.LoadAsync();

            await TimeEntryModel.ContinueAsync(model.Data);
        }
Exemplo n.º 2
0
        public async Task ContinueTimeEntry(Guid timeEntryId)
        {
            var entryModel = new TimeEntryModel(timeEntryId);
            await TimeEntryModel.ContinueAsync(entryModel.Data);

            ServiceContainer.Resolve <ITracker>().SendTimerStartEvent(TimerStartSource.WidgetStart);
        }
        public async Task <TimeEntryData> ContinueTimeEntryAsync(int index)
        {
            var newTimeEntry    = new TimeEntryData();
            var timeEntryHolder = Collection.ElementAt(index) as ITimeEntryHolder;

            if (timeEntryHolder == null)
            {
                return(newTimeEntry);
            }

            if (timeEntryHolder.Data.State == TimeEntryState.Running)
            {
                newTimeEntry = await TimeEntryModel.StopAsync(timeEntryHolder.Data);

                ServiceContainer.Resolve <ITracker>().SendTimerStopEvent(TimerStopSource.App);
            }
            else
            {
                newTimeEntry = await TimeEntryModel.ContinueAsync(timeEntryHolder.Data);

                ServiceContainer.Resolve <ITracker>().SendTimerStartEvent(TimerStartSource.AppContinue);
            }

            return(newTimeEntry);
        }
        private async void ContinueTimeEntry(TimeEntryModel model)
        {
            DurOnlyNoticeDialogFragment.TryShow(FragmentManager);

            var entry = await model.ContinueAsync();

            var bus = ServiceContainer.Resolve <MessageBus> ();

            bus.Send(new UserTimeEntryStateChangeMessage(this, entry));
        }
        private async void ContinueTimeEntry (TimeEntryModel model)
        {
            DurOnlyNoticeDialogFragment.TryShow (FragmentManager);

            var entry = await model.ContinueAsync ();

            var bus = ServiceContainer.Resolve<MessageBus> ();
            bus.Send (new UserTimeEntryStateChangeMessage (this, entry));

        }
Exemplo n.º 6
0
        private async void ContinueTimeEntry(TimeEntryModel model)
        {
            DurOnlyNoticeDialogFragment.TryShow(FragmentManager);

            var entry = await model.ContinueAsync();

            var bus = ServiceContainer.Resolve <MessageBus> ();

            bus.Send(new UserTimeEntryStateChangeMessage(this, entry));

            // Ping analytics
            ServiceContainer.Resolve <ITracker> ().SendTimerStartEvent(TimerStartSource.AppContinue);
        }
        public override async void OnListItemClick(ListView l, View v, int position, long id)
        {
            RecentTimeEntriesAdapter adapter = null;

            if (l.Adapter is HeaderViewListAdapter)
            {
                var headerAdapter = (HeaderViewListAdapter)l.Adapter;
                adapter = headerAdapter.WrappedAdapter as RecentTimeEntriesAdapter;
                // Adjust the position by taking into account the fact that we've got headers
                position -= headerAdapter.HeadersCount;
            }
            else if (l.Adapter is RecentTimeEntriesAdapter)
            {
                adapter = (RecentTimeEntriesAdapter)l.Adapter;
            }

            if (adapter == null || position < 0 || position >= adapter.Count)
            {
                return;
            }

            var data = adapter.GetEntry(position);

            if (data == null)
            {
                return;
            }

            var model = new TimeEntryModel(data);

            // Show a notice about tapping on entries acts as continue.
            if (RecentTimeEntryContinueDialogFragment.TryShow(FragmentManager, model))
            {
                return;
            }

            // Scroll to top (where the new model will appear)
            ListView.SmoothScrollToPosition(0);

            DurOnlyNoticeDialogFragment.TryShow(FragmentManager);

            var entry = await model.ContinueAsync();

            // Notify that the user explicitly started something
            var bus = ServiceContainer.Resolve <MessageBus> ();

            bus.Send(new UserTimeEntryStateChangeMessage(this, entry));

            // Ping analytics
            ServiceContainer.Resolve <ITracker> ().SendTimerStartEvent(TimerStartSource.AppContinue);
        }
Exemplo n.º 8
0
        private async void ContinueEntry()
        {
            if (!modelLoaded)
            {
                return;
            }

            var entry = await model.ContinueAsync();

            // Notify that the user explicitly started something
            var bus = ServiceContainer.Resolve <MessageBus> ();

            bus.Send(new UserTimeEntryStateChangeMessage(this, entry));
        }
Exemplo n.º 9
0
            protected override async Task OnContinueAsync()
            {
                if (DataSource == null)
                {
                    return;
                }
                await TimeEntryModel.ContinueAsync(DataSource);

                if (ContinueCallback != null)
                {
                    ContinueCallback(DataSource);
                }

                // Ping analytics
                ServiceContainer.Resolve <ITracker>().SendTimerStartEvent(TimerStartSource.AppContinue);
            }
        private async void ContinueEntry()
        {
            if (!modelLoaded)
            {
                return;
            }

            var entry = await model.ContinueAsync();

            // Notify that the user explicitly started something
            var bus = ServiceContainer.Resolve <MessageBus> ();

            bus.Send(new UserTimeEntryStateChangeMessage(this, entry));

            // Ping analytics
            ServiceContainer.Resolve <ITracker> ().SendTimerStartEvent(TimerStartSource.AppContinue);
        }
        public void TestActiveEntryAfterContinue()
        {
            RunAsync(async delegate {
                var startTime = Time.UtcNow - TimeSpan.FromHours(2);
                var te1       = await DataStore.PutAsync(new TimeEntryData {
                    Description = "Morning meeting",
                    State       = TimeEntryState.Finished,
                    StartTime   = startTime,
                    ModifiedAt  = startTime,
                    IsDirty     = true,
                    WorkspaceId = workspace.Id,
                    UserId      = user.Id,
                });

                startTime = Time.UtcNow - TimeSpan.FromHours(1);
                var te2   = await DataStore.PutAsync(new TimeEntryData {
                    Description = "Morning coffee",
                    State       = TimeEntryState.Finished,
                    StartTime   = startTime,
                    ModifiedAt  = startTime,
                    IsDirty     = true,
                    WorkspaceId = workspace.Id,
                    UserId      = user.Id,
                });

                Assert.AreNotEqual(te1.Id, ActiveManager.ActiveTimeEntry.Id);
                Assert.AreNotEqual(te2.Id, ActiveManager.ActiveTimeEntry.Id);

                te1 = await TimeEntryModel.ContinueAsync(te1);
                te2 = await GetEntry(te2.Id);

                Assert.AreEqual(te1.Id, ActiveManager.ActiveTimeEntry.Id);
                Assert.IsTrue(ActiveManager.IsRunning);
                Assert.AreEqual(te1.State, TimeEntryState.Running);
                Assert.AreEqual(te2.State, TimeEntryState.Finished);

                te2 = await TimeEntryModel.ContinueAsync(te2);
                te1 = await GetEntry(te1.Id);

                Assert.AreEqual(te2.Id, ActiveManager.ActiveTimeEntry.Id);
                Assert.IsTrue(ActiveManager.IsRunning);
                Assert.AreEqual(te2.State, TimeEntryState.Running);
                Assert.AreEqual(te1.State, TimeEntryState.Finished);
            });
        }
        public override async void OnListItemClick (ListView l, View v, int position, long id)
        {

            RecentTimeEntriesAdapter adapter = null;
            if (l.Adapter is HeaderViewListAdapter) {
                var headerAdapter = (HeaderViewListAdapter)l.Adapter;
                adapter = headerAdapter.WrappedAdapter as RecentTimeEntriesAdapter;
                // Adjust the position by taking into account the fact that we've got headers
                position -= headerAdapter.HeadersCount;
            } else if (l.Adapter is RecentTimeEntriesAdapter) {
                adapter = (RecentTimeEntriesAdapter)l.Adapter;
            }

            if (adapter == null || position < 0 || position >= adapter.Count)
                return;

            var data = adapter.GetEntry (position);
            if (data == null)
                return;

            var model = new TimeEntryModel (data);

            // Show a notice about tapping on entries acts as continue.
            if (RecentTimeEntryContinueDialogFragment.TryShow (FragmentManager, model))
                return;

            // Scroll to top (where the new model will appear)
            ListView.SmoothScrollToPosition (0);

            DurOnlyNoticeDialogFragment.TryShow (FragmentManager);

            var entry = await model.ContinueAsync ();

            // Notify that the user explicitly started something
            var bus = ServiceContainer.Resolve<MessageBus> ();
            bus.Send (new UserTimeEntryStateChangeMessage (this, entry));
        }
Exemplo n.º 13
0
 private async Task StartEntry (Guid id)
 {
     var model = new TimeEntryModel (id);
     await model.LoadAsync();
     await model.ContinueAsync();
 }