public async void ResetTotalSpentTime(JiraTask jiraTask) { ResetTimer(jiraTask); jiraTask.TotalSpentTime = TimeSpan.FromSeconds(0); jiraTask.SpentTimeCollection = new ObservableCollection <JiraTaskTime>(); jiraTask.NotifyPropertyChanged("TotalSpentTime"); await saveCurrentTaskState(jiraTask); }
//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(); }
//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(); } }
//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(); } }
/// <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; }
//Add New Task To Collection public async void AddJiraTask(JiraTask jiraTask) { _jiraTask.Add(jiraTask); await saveJiraTaskDataAsync(); }
public async void ResetTotalSpentTime(JiraTask jiraTask) { ResetTimer(jiraTask); jiraTask.TotalSpentTime = TimeSpan.FromSeconds(0); jiraTask.SpentTimeCollection = new ObservableCollection<JiraTaskTime>(); jiraTask.NotifyPropertyChanged("TotalSpentTime"); await saveCurrentTaskState(jiraTask); }
//reset current without save timer public void ResetTimer(JiraTask jiraTask) { jiraTask.CurrentTimeSpan = TimeSpan.FromSeconds(0); jiraTask.CurrentTimer = 0; jiraTask.NotifyPropertyChanged("CurrentTimeSpan"); }
//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(); } }
//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(); } }
//Delete Task public async void DeleteJiraTask(JiraTask jiraTask) { _jiraTask.Remove(jiraTask); await saveJiraTaskDataAsync(); }
//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(); }
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)); }
//Add New Task To Collection public async void AddJiraTask(JiraTask jiraTask) { _jiraTask.Add(jiraTask); await saveJiraTaskDataAsync(); }
//reset current without save timer public void ResetTimer(JiraTask jiraTask) { jiraTask.CurrentTimeSpan = TimeSpan.FromSeconds(0); jiraTask.CurrentTimer = 0; jiraTask.NotifyPropertyChanged("CurrentTimeSpan"); }
//Delete Task public async void DeleteJiraTask(JiraTask jiraTask) { _jiraTask.Remove(jiraTask); await saveJiraTaskDataAsync(); }