private void TasksList_SelectionChanged(object sender, SelectionChangedEventArgs e) { TaskModel task = TasksList.SelectedItem as TaskModel; if (task != null) { TitleTxt.Text = task.TaskName; bool IsAlreadyFav = UserDB.IsFavouriteTask(task.TaskId, App.CurrentUser); if (!IsAlreadyFav) { UserDB.AddFavouriteTaskIds(task.TaskId, App.CurrentUser); } fav = UserDB.GetFavorite(task.TaskId, App.CurrentUser); StarBtnDetails.DataContext = fav; comments = CommentDB.GetComments(task.TaskId); CommentsList.ItemsSource = comments; AddButton.Tag = task.TaskId; DetailsFrame.Navigate(typeof(DetailView), task, new SuppressNavigationTransitionInfo()); } double Acutalwidth = this.ActualWidth; if (ActualWidth < 700) { TasksList.Visibility = Visibility.Collapsed; ComboboxPanel.Visibility = Visibility.Collapsed; DetailAndDiscussion.Visibility = Visibility.Visible; BackBtn.Visibility = Visibility.Visible; } if (ActualWidth >= 700) { TasksList.Visibility = Visibility.Visible; DetailAndDiscussion.Visibility = Visibility.Visible; } }
public void OnLoaded(TaskModel ZTask) { bool isAlreadyFav = UserDB.IsFavouriteTask(ZTask.TaskId, App.CurrentUser); if (!isAlreadyFav) { UserDB.AddFavouriteTaskIds(ZTask.TaskId, App.CurrentUser); } _favorite = UserDB.GetFavorite(ZTask.TaskId, App.CurrentUser); this.StarBtn.DataContext = _favorite; }
private void StarBtn_Click(object sender, RoutedEventArgs e) { if (fav.IsFavourite == true) { fav.IsFavourite = false; UserDB.RemoveFavouriteTaskIds(fav.TaskId, App.CurrentUser.ToString()); } else { fav.IsFavourite = true; UserDB.AddFavouriteTaskIds(fav.TaskId, App.CurrentUser.ToString()); } }
private void StarBtn_Click(object sender, RoutedEventArgs e) { var tag = (sender as Button).Tag; long taskId = (long)tag; bool isAlreadyFav = UserDB.IsFavouriteTask(taskId, App.CurrentUser); if (!isAlreadyFav) { UserDB.AddFavouriteTaskIds(taskId, App.CurrentUser); } if (this._favorite.IsFavourite == true) { this._favorite.IsFavourite = false; UserDB.RemoveFavouriteTaskIds(taskId, App.CurrentUser.ToString()); OnClick(taskId, false); } else { this._favorite.IsFavourite = true; UserDB.AddFavouriteTaskIds(taskId, App.CurrentUser.ToString()); OnClick(taskId, true); } }