public static void RemoveCard(Card Card, ObservableCollection<Card> JobCollection) { if (JobCollection != null && Card != null) { project_flux.API.Card.Archive(Card.ID); JobCollection.Remove(Card); } }
private void btnAddCard_Click(object sender, RoutedEventArgs e) { Card NewCard = new Card(); NewCard.Name = txtbxCardAddTitle.Text; NewCard.Description = txtbxCardAddDesc.Text; NewCard.AssignedColor = txtbxCardAddColor.Text; NewCard.DueDate = dtpckrCardAddDueDate.Date.DateTime; CurrentJob.Add(NewCard); OpenPopupReference.Visibility = Visibility.Collapsed; }
public static Comment AddComment(string newCommentText, Card thisCard, List<Comment> comments) { Comment NewComment = new Comment(); NewComment.CardID = thisCard.ID; NewComment.Description = newCommentText; NewComment.Weight = (short) (comments.Count + 1); comments.Add(NewComment); return NewComment; }
public List<Comment> GetAllCommentsByCardID(Card Card) { List<Comment> filteredComments = new List<Comment>(); foreach (Comment comment in this.AllComments) { if (comment.CardID.Equals(Card.ID)) { filteredComments.Add(comment); } } return filteredComments; }
public static void AddCard(String Name, String Description, String Color, DateTime DueDate, ObservableCollection<Card> JobsCollection, Guid JobId) { Card _newCard = new Card(); Task.Run(async () => { var createdGuid = Guid.Parse(await project_flux.API.Card.Add(JobId, Name, Description, 0, DueDate, Color)); _newCard.Name = Name; _newCard.Description = Description; _newCard.ID = createdGuid; _newCard.JobID = JobId; _newCard.DueDate = DueDate; _newCard.AssignedColor = Color; }).Wait(); JobsCollection.Add(_newCard); }
private Card EditCardCheck(Card Card, TextBox Title, TextBox Description, String selectedColor) { var textBoxes = new TextBox[] { Title, Description }; foreach (TextBox textBox in textBoxes) { if (textBox.Text.Equals("")) { switch (textBox.Name) { case "txtbxTitle": Card.Name = Card.Name; break; case "txtbxDesc": Card.Description = Card.Description; break; } } else { switch (textBox.Name) { case "txtbxTitle": Card.Name = Title.Text; break; case "txtbxDesc": Card.Description = Description.Text; break; } } } if (selectedColor.Equals("#FFFFFF")) { Card.AssignedColor = Card.AssignedColor; } else { Card.AssignedColor = selectedColor; } return Card; }
private static async Task<List<Card>> PopulatedCardsList(Guid JobId) { List<Card> _cards = new List<Card>(); try { var _onlineCards = await project_flux.API.Card.GetCardsByJobId(JobId); foreach (var _onlineCard in _onlineCards) { Card _newCard = new Card(); _newCard.ID = _onlineCard.Id; _newCard.JobID = _onlineCard.JobId; _newCard.Name = _onlineCard.Name; _newCard.Description = _onlineCard.Description; _newCard.Weight = _newCard.Weight; _newCard.DueDate = _onlineCard.DueDate; _newCard.AssignedColor = _onlineCard.Color; _cards.Add(_newCard); } } catch { } return _cards; }
public static void EditCard(Card Card, DatePicker dtpckrDueDate, ObservableCollection<Card> CardsCollection) { Card.Name = Card.Name; Card.Description = Card.Description; Card.DueDate = dtpckrDueDate.Date.Date; Card.AssignedColor = Card.AssignedColor; short _counter = 0; try { foreach (var _card in CardsCollection) { if (Card == _card) { CardsCollection[_counter] = Card; } _counter++; } } catch { } project_flux.API.Card.Update(Card.ID, Card.JobID, Card.Name, Card.Description, Card.Weight, Card.DueDate, Card.AssignedColor); }
private void BtnAddComment_Click(object sender, RoutedEventArgs e, TextBox txtbxComment, Card thisCard, List<Comment> comments, ListBox lstbxCardComments) { if (txtbxComment.Text != String.Empty) { lstbxCardComments.Items.Clear(); Comment comment = Helpers.CommentsHelper.AddComment(txtbxComment.Text, thisCard, comments); //comments.Add(comment; foreach (Comment comment1 in comments) { lstbxCardComments.Items?.Add(comment1.Description); } } }
//Comments private async void CommentsPopupShow(Card thisCard) { var panel = new StackPanel(); CommentsViewModel _CommentsViewModel = new CommentsViewModel(); List<Comment> comments = _CommentsViewModel.GetAllCommentsByCardID(thisCard); var lstbxCardComments = new ListBox { Name = "lstbxAllComments", Height = 100, }; foreach (var comment in comments) { if (comment != null) { lstbxCardComments.Items?.Add(comment.Description); } } var txtbxComment = new TextBox { Name = "txtbxComment", Height = 100, Margin = new Thickness(0, 0, 0, 10), AcceptsReturn = true, TextWrapping = TextWrapping.Wrap, PlaceholderText = "Comment.." }; var BtnAddComment = new Button { Name = "BtnaddComment", Content = "Add", }; panel.Children.Add(lstbxCardComments); panel.Children.Add(txtbxComment); panel.Children.Add(BtnAddComment); BtnAddComment.Click += (sender, e) => BtnAddComment_Click(sender, e, txtbxComment, thisCard, comments, lstbxCardComments); var dialog = new ContentDialog() { Title = "Comments", MaxWidth = this.ActualWidth, Content = panel }; dialog.PrimaryButtonText = "OK"; dialog.PrimaryButtonClick += delegate { }; dialog.SecondaryButtonText = "Cancel"; dialog.SecondaryButtonClick += delegate { }; var result = await dialog.ShowAsync(); }
private async void EditCardPopupShow(Card Card) { if (Card != null) { var panel = new StackPanel { MaxWidth = 300, }; var txtbxTitle = new TextBox { Name = "txtbxTitle", Margin = new Thickness(0, 0, 0, 10), Text = Card.Name, PlaceholderText = "Card Title:", }; var txtbxDesc = new TextBox { Name = "txtbxDesc", Height = 100, Margin = new Thickness(0, 0, 0, 10), AcceptsReturn = true, TextWrapping = TextWrapping.Wrap, Text = Card.Description, PlaceholderText = "Card Description:" }; var dtpckrDueDate = new DatePicker { Name = "dtpckrDueDate", Margin = new Thickness(0, 0, 0, 10), Date = Card.DueDate.ToLocalTime() }; var cmbbxColors = new ComboBox { Name = "cmbbxColors", Margin = new Thickness(0, 0, 0, 10), HorizontalAlignment = HorizontalAlignment.Stretch, PlaceholderText = "Color", }; var colors = typeof(Colors).GetTypeInfo().DeclaredProperties; foreach (PropertyInfo color in colors) { ComboBoxItem _item = new ComboBoxItem(); _item.Content = color.Name; _item.Background = new SolidColorBrush((Color)color.GetValue(null, null)); cmbbxColors.Items.Add(_item); } var cb = new CheckBox { Content = "Agree" }; var dialog = new ContentDialog() { Title = Card.Name, Content = panel, MaxWidth = this.ActualWidth }; panel.Children.Add(txtbxTitle); panel.Children.Add(txtbxDesc); panel.Children.Add(dtpckrDueDate); panel.Children.Add(cmbbxColors); panel.Children.Add(cb); cb.SetBinding(CheckBox.IsCheckedProperty, new Binding { Source = dialog, Path = new PropertyPath("IsPrimaryButtonEnabled"), Mode = BindingMode.TwoWay, }); dialog.PrimaryButtonText = "Save"; dialog.IsPrimaryButtonEnabled = false; dialog.PrimaryButtonClick += delegate { var _selectedItem = cmbbxColors.SelectedItem as ComboBoxItem; SolidColorBrush _selectedBackground; if (_selectedItem != null) _selectedBackground = _selectedItem.Background as SolidColorBrush; else _selectedBackground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)); Color SelectedColor = _selectedBackground.Color; String color = ColorsHelper.GetHexFromColor(SelectedColor); Card = EditCardCheck(Card, txtbxTitle, txtbxDesc, color); Helpers.CardsHelper.EditCard(Card, dtpckrDueDate, CurrentJob); }; dialog.SecondaryButtonText = "Cancel"; dialog.SecondaryButtonClick += delegate { }; var result = await dialog.ShowAsync(); } //RefreshUI(); }
private async void ArchiveCardPopupShow(Card Card) { if (Card != null) { var dialog = new ContentDialog() { Title = "Archive card", Content = "Please confirm archiving \"" + Card.Name + "\"", MaxWidth = this.ActualWidth }; dialog.PrimaryButtonText = "Confirm"; dialog.PrimaryButtonClick += delegate { CardsHelper.RemoveCard(Card, CurrentJob); }; dialog.SecondaryButtonText = "Cancel"; dialog.SecondaryButtonClick += delegate { }; var result = await dialog.ShowAsync(); } }