Ejemplo n.º 1
0
 public async void ResetTotalSpentTime(JiraTask jiraTask)
 {
     ResetTimer(jiraTask);
     jiraTask.TotalSpentTime      = TimeSpan.FromSeconds(0);
     jiraTask.SpentTimeCollection = new ObservableCollection <JiraTaskTime>();
     jiraTask.NotifyPropertyChanged("TotalSpentTime");
     await saveCurrentTaskState(jiraTask);
 }
Ejemplo n.º 2
0
        //Get One Task
        //public async Task<JiraTask> GetJiraTaskAsync(JiraTask jiraTask)
        //{
        //    await getJiraTaskDataAsync();
        //    var matches = _jiraTask.FirstOrDefault(p => p.ID == jiraTask.ID);

        //    return matches;

        //}



        //Change Task
        public async void ChangeJiraTask(JiraTask jiraTask)
        {
            var jTask = _jiraTask.FirstOrDefault(p => p.ID == jiraTask.ID);

            jTask.ID   = jiraTask.ID;
            jTask.Name = jiraTask.Name;
            jTask.Note = jiraTask.Note;

            jiraTask.NotifyPropertyChanged("ID");
            jiraTask.NotifyPropertyChanged("Name");
            jiraTask.NotifyPropertyChanged("Note");

            await saveJiraTaskDataAsync();
        }
Ejemplo n.º 3
0
        //Save
        private async Task saveCurrentTaskState(JiraTask jiraTask)
        {
            if (jiraTask.CurrentTimer != 0)
            {
                if (jiraTask.SpentTimeCollection == null)
                {
                    jiraTask.SpentTimeCollection = new ObservableCollection <JiraTaskTime>();
                }

                JiraTaskTime currentTimer = new JiraTaskTime();
                currentTimer.DateWhen    = DateTime.Now;
                currentTimer.TimeHowLong = new TimeSpan();
                currentTimer.TimeHowLong = currentTimer.TimeHowLong.Add(TimeSpan.FromSeconds(jiraTask.CurrentTimer));

                jiraTask.SpentTimeCollection.Add(currentTimer);
                await saveJiraTaskDataAsync();
            }
        }
Ejemplo n.º 4
0
        //start stop timer
        public async void StartNewTimer(JiraTask jiraTask)
        {
            if (jiraTask.Timer == null)
            {
                jiraTask.Timer          = new DispatcherTimer();
                jiraTask.Timer.Interval = new TimeSpan(0, 0, 1);
                jiraTask.Timer.Tick    += new EventHandler <object>(jiraTask.Timer_Tick);
            }

            if (jiraTask.Timer.IsEnabled)
            {
                jiraTask.Timer.Stop();
                await saveCurrentTaskState(jiraTask);

                jiraTask.CurrentTimer = 0;
            }
            else
            {
                jiraTask.Timer.Start();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the  
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method 
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedTo(e);

            jiraTask = (JiraTask)e.Parameter;
            this.defaultViewModel["Task"] = jiraTask;

            taskNameHeadTextBox.Text = jiraTask.Name;
            idTextBox.Text = jiraTask.ID;
            nameTextBox.Text = jiraTask.Name;
            noteTextBox.Text = jiraTask.Note;
        }
Ejemplo n.º 6
0
 //Add New Task To Collection
 public async void AddJiraTask(JiraTask jiraTask)
 {
     _jiraTask.Add(jiraTask);
     await saveJiraTaskDataAsync();
 }
Ejemplo n.º 7
0
 public async void ResetTotalSpentTime(JiraTask jiraTask)
 {
     ResetTimer(jiraTask);
     jiraTask.TotalSpentTime = TimeSpan.FromSeconds(0);
     jiraTask.SpentTimeCollection = new ObservableCollection<JiraTaskTime>();
     jiraTask.NotifyPropertyChanged("TotalSpentTime");            
     await saveCurrentTaskState(jiraTask);
 }
Ejemplo n.º 8
0
 //reset current without save timer
 public void ResetTimer(JiraTask jiraTask)
 {
     jiraTask.CurrentTimeSpan = TimeSpan.FromSeconds(0);
     jiraTask.CurrentTimer = 0;
     jiraTask.NotifyPropertyChanged("CurrentTimeSpan");
     
 }
Ejemplo n.º 9
0
        //start stop timer
        public async void StartNewTimer(JiraTask jiraTask)
        {
            if (jiraTask.Timer == null)
            {
                jiraTask.Timer = new DispatcherTimer();
                jiraTask.Timer.Interval = new TimeSpan(0, 0, 1);
                jiraTask.Timer.Tick += new EventHandler<object>(jiraTask.Timer_Tick);
            }

            if (jiraTask.Timer.IsEnabled)
            {
                jiraTask.Timer.Stop();
                await saveCurrentTaskState(jiraTask);
                jiraTask.CurrentTimer = 0;
            }
            else
            {                
                jiraTask.Timer.Start();
            }
        }
Ejemplo n.º 10
0
        //Save 
        private async Task saveCurrentTaskState(JiraTask jiraTask)
        {
            if (jiraTask.CurrentTimer != 0)
            {
                if (jiraTask.SpentTimeCollection == null)
                    jiraTask.SpentTimeCollection = new ObservableCollection<JiraTaskTime>();

                JiraTaskTime currentTimer = new JiraTaskTime();
                currentTimer.DateWhen = DateTime.Now;
                currentTimer.TimeHowLong = new TimeSpan();
                currentTimer.TimeHowLong = currentTimer.TimeHowLong.Add(TimeSpan.FromSeconds(jiraTask.CurrentTimer));
                
                jiraTask.SpentTimeCollection.Add(currentTimer);
                await saveJiraTaskDataAsync();
                
            }

        }
Ejemplo n.º 11
0
 //Delete Task
 public async void DeleteJiraTask(JiraTask jiraTask)
 {
     
     _jiraTask.Remove(jiraTask);
     await saveJiraTaskDataAsync();
 }
Ejemplo n.º 12
0
        //Get One Task
        //public async Task<JiraTask> GetJiraTaskAsync(JiraTask jiraTask)
        //{
        //    await getJiraTaskDataAsync();
        //    var matches = _jiraTask.FirstOrDefault(p => p.ID == jiraTask.ID);

        //    return matches;

        //}



        //Change Task
        public async void ChangeJiraTask(JiraTask jiraTask)
        {
            var jTask = _jiraTask.FirstOrDefault(p => p.ID == jiraTask.ID);

            jTask.ID = jiraTask.ID;
            jTask.Name = jiraTask.Name;
            jTask.Note = jiraTask.Note;

            jiraTask.NotifyPropertyChanged("ID");
            jiraTask.NotifyPropertyChanged("Name");
            jiraTask.NotifyPropertyChanged("Note");
            
            await saveJiraTaskDataAsync();
        }
Ejemplo n.º 13
0
 private void addButton_Click(object sender, RoutedEventArgs e)
 {
     JiraTask jiraTask = new JiraTask();
     jiraTask.ID = idTextBox.Text;
     jiraTask.Name = nameTextBox.Text;
     jiraTask.Note = noteTextBox.Text;
     App.DataModel.AddJiraTask(jiraTask);
     Frame.Navigate(typeof(MainPage));
 }
Ejemplo n.º 14
0
 //Add New Task To Collection
 public async void AddJiraTask(JiraTask jiraTask)
 {
     _jiraTask.Add(jiraTask);
     await saveJiraTaskDataAsync();
 }
Ejemplo n.º 15
0
 //reset current without save timer
 public void ResetTimer(JiraTask jiraTask)
 {
     jiraTask.CurrentTimeSpan = TimeSpan.FromSeconds(0);
     jiraTask.CurrentTimer    = 0;
     jiraTask.NotifyPropertyChanged("CurrentTimeSpan");
 }
Ejemplo n.º 16
0
 //Delete Task
 public async void DeleteJiraTask(JiraTask jiraTask)
 {
     _jiraTask.Remove(jiraTask);
     await saveJiraTaskDataAsync();
 }