示例#1
0
        /// <summary>
        /// Cancels current session and goes back to task list
        /// </summary>
        private void Cancel()
        {
            // Clear task list in service
            mSessionHandler.ClearSessionTasks();

            // Go back to task list
            mUIManager.GoBackToPreviousPage(this);
        }
示例#2
0
        /// <summary>
        /// Adds newly created task to the <see cref="TimeTasksCalculator"/>
        /// </summary>
        public void AddNewTask()
        {
            // Check if we have everything we need for new task to create
            if (!ValidateUserInput())
            {
                // Display message to the user
                mUIManager.DisplayPopupMessageAsync(new PopupMessageViewModel(LocalizationResource.InvalidData, LocalizationResource.ProvidedTaskDataInvalid));

                // Stay at this page so user can correct his mistakes
                return;
            }

            // Data is correct, create new context out of it
            var newTask = new TimeTaskContext
            {
                Id              = TaskId,
                Name            = TaskName,
                Description     = TaskDescription,
                Tags            = TaskTagsString.SplitTagsString(),
                Type            = TaskType,
                AssignedTime    = TaskConstantTime,
                HasConstantTime = TaskHasConstantTime,
                IsImportant     = TaskImportance,
                IsImmortal      = TaskImmortality,
                Priority        = (Priority)TaskPrioritySliderValue,
                CreationDate    = DateTime.Now,
                SessionProgress = 0,
                Progress        = TaskProgress,
                MaxProgress     = TaskMaximumProgress
            };

            // Pass it to the service to handle it
            mTimeTasksService.SaveTask(newTask);

            // Close this page
            mUIManager.GoBackToPreviousPage(this);

            // Refresh UI list so it gets new task
            TaskListHelpers.RaiseRefreshEvent();
        }
 /// <summary>
 /// Closes this page and goes back to previous one
 /// </summary>
 private void ClosePage()
 {
     // Close this page
     mUIManager.GoBackToPreviousPage(this);
 }