Esempio n. 1
0
        private void KanbanBoard_CardDragEnd(object sender, KanbanDragEndEventArgs e)
        {
            // Change column and category of task when dragged to new column
            // ObservableCollection Tasks already updated
            var targetCategory    = e.TargetKey.ToString();
            var selectedCardModel = e.SelectedCard.Content as CustomKanbanModel;
            int sourceCardIndex   = e.SelectedCardIndex;
            int targetCardIndex   = e.TargetCardIndex;

            ViewModel.UpdateCardColumn(targetCategory, selectedCardModel, targetCardIndex.ToString());

            // Reorder cards when dragging to & from same column
            if (e.TargetColumn.Title.ToString() == e.SelectedColumn.Title.ToString())
            {
                // Update every card index in the column after rearrange
                foreach (var card in e.TargetColumn.Cards)
                {
                    int currentIndex = e.TargetColumn.Cards.IndexOf(card);
                    if (currentIndex != Convert.ToInt32(targetCardIndex))
                    {
                        var currentModel = card.Content as CustomKanbanModel;
                        ViewModel.UpdateCardIndex(currentModel.ID, currentIndex);
                    }
                }
            }
            // Reorder cards when dragging from one column to another
            else
            {
                // Reorder target col after drop
                // Only items below the targetCardIndex need to be updated
                if (e.TargetColumn.Cards.Count != 0)
                {
                    foreach (var card in e.TargetColumn.Cards)
                    {
                        int currentIndex = e.TargetColumn.Cards.IndexOf(card);
                        if (currentIndex > Convert.ToInt32(targetCardIndex))
                        {
                            var currentModel = card.Content as CustomKanbanModel;
                            ViewModel.UpdateCardIndex(currentModel.ID, currentIndex);
                        }
                    }
                }

                // Reorder source column after dragged card is removed
                if (e.SelectedColumn.Cards.Count != 0)
                {
                    foreach (var card in e.SelectedColumn.Cards)
                    {
                        int currentIndex = e.SelectedColumn.Cards.IndexOf(card);
                        var currentModel = card.Content as CustomKanbanModel;
                        ViewModel.UpdateCardIndex(currentModel.ID, currentIndex);
                    }
                }
            }
        }
 private void Kanban_DragEnd(object sender, KanbanDragEndEventArgs e)
 {
     if (e.TargetColumn == order)
     {
         e.Cancel = true;
         if (e.TargetColumn.IsExpanded)
         {
             e.TargetColumn.InsertItem(CloneModel(e.Data as CustomKanbanModel, e.TargetCategory), 0);
         }
     }
 }
        public void ItemMoved(KanbanDragEndEventArgs args)
        {
            var model = (KanbanModel)args.SelectedCard.Content;

            if (args.TargetKey.ToString() != OrderStatus.Prepared.ToString())
            {
                return;
            }
            var message = model.Tags[0] + "," + model.Tags[1];

            _websocket.GetResponse(message, s => true);
        }
Esempio n. 4
0
        private void Kanban_CardDragEnd(object sender, KanbanDragEndEventArgs e)
        {
            SQLiteConnection Connection = new SQLiteConnection("Data Source=" + Environment.CurrentDirectory + Properties.Settings.Default.DBPath);

            Connection.Open();
            DataContext db = new DataContext(Connection);

            // Get a typed table to run queries.
            Table <SprintTask> SprintTsks = db.GetTable <SprintTask>();

            int SprintTaskID;

            Int32.TryParse((e.SelectedCard.Content as KanbanModel).ID, out SprintTaskID);
            SprintTask tsk = (from sp in SprintTsks
                              where sp.ID == SprintTaskID
                              select sp).SingleOrDefault();

            tsk.State = e.TargetKey.ToString();

            if (e.TargetKey.ToString().Equals("Closed") ||
                e.TargetKey.ToString().Equals("Review"))
            {
                int bp = 0;
                switch (e.TargetKey.ToString())
                {
                case "Review":
                    bp = Convert.ToInt32(Math.Round(tsk.Cost * 0.8));
                    break;

                case "Closed":
                    bp = Convert.ToInt32(Math.Round(tsk.Cost * 0.2));
                    break;
                }
                ;


                Table <SprintBurnData> SprintBrnDt = db.GetTable <SprintBurnData>();
                SprintBurnData         brnDat      = new SprintBurnData
                {
                    SprintID     = 3,
                    BurnDate     = DateTime.Today,
                    BurnPoint    = bp,
                    SprintTaskID = SprintTaskID
                };


                SprintBrnDt.InsertOnSubmit(brnDat);
            }


            db.SubmitChanges();
        }
        void Handle_DragEnd(object sender, KanbanDragEndEventArgs e)
        {
            if (e.TargetColumn != null && e.SourceColumn.Title.ToString() == "Menu" && e.TargetColumn.Title.ToString() == "Order")
            {
                e.Cancel = true;
                model.Cards.Add(CloneModel((e.Data as KanbanModel), e.TargetCategory));
            }

            else if (e.TargetColumn != null && e.TargetCategory != null)
            {
                (e.Data as KanbanModel).Category = e.TargetCategory;
            }
        }
        void Handle_DragEnd(object sender, KanbanDragEndEventArgs e)
        {
            if (e.TargetColumn != null && e.SourceColumn.Title.ToString() == "Menu" && e.TargetColumn.Title.ToString() == "Order")
            {
                e.Cancel           = true;
                model.LastOrderID += 1;
                model.Cards.Add(CloneModel((e.Data as CustomKanbanModel), e.TargetCategory));
            }

            else if (e.TargetColumn != null && e.TargetCategory != null && Device.RuntimePlatform != Device.UWP)
            {
                (e.Data as CustomKanbanModel).Category = e.TargetCategory;
            }
        }
Esempio n. 7
0
        private void kanban_DragEnd(object sender, KanbanDragEndEventArgs e)
        {
            if (e.SelectedColumn.Title.ToString() == "Menu" && e.SelectedColumn != e.TargetColumn &&
                e.TargetColumn.Title.ToString() == "Order")
            {
                e.IsCancel = true;

                KanbanModel selectedCard = e.SelectedCard.Content as KanbanModel;

                KanbanModel model = new KanbanModel();
                model.Category    = e.TargetKey;
                model.Description = selectedCard.Description;
                model.ImageURL    = selectedCard.ImageURL;
                model.ColorKey    = selectedCard.ColorKey;
                model.Tags        = selectedCard.Tags;
                model.ID          = selectedCard.ID;
                model.Title       = selectedCard.Title;

                (kanban.ItemsSource as ObservableCollection <KanbanModel>).Add(model);
            }
        }
Esempio n. 8
0
        internal async Task OnCardDragEnd(KanbanDragEndEventArgs e)
        {
            // If the drag was cancelled or dragged to the same column
            if (e.IsCancel || e.SelectedColumnIndex == e.TargetColumnIndex)
            {
                return;
            }

            var card = e.SelectedCard.Content as KanbanModel;

            // Get the scraperText model from the db for this card
            var scraperText = await scraperClient.GetEntity(Convert.ToInt32(card.ID));

            // Update the cards category to the dropped category
            scraperText.Category = new PS.Shared.Models.TextCategory
            {
                Name = card.Category.ToString()
            };

            // Update the database
            await scraperClient.UpdateEntity(scraperText);
        }
Esempio n. 9
0
 private void CardDragEnd(object sender, KanbanDragEndEventArgs e)
 {
     CardDragEndCommand.Execute(e);
 }
Esempio n. 10
0
        private void KanbanBoard_CardDragEnd(object sender, KanbanDragEndEventArgs e)
        {
            // Change column and category of task when dragged to new column
            // ObservableCollection Tasks already updated
            var targetCategory    = e.TargetKey.ToString();
            var selectedCardModel = e.SelectedCard.Content as PresentationTask;
            int sourceCardIndex   = e.SelectedCardIndex;
            int targetCardIndex   = e.TargetCardIndex;

            ViewModel.UpdateCardColumn(targetCategory, selectedCardModel, targetCardIndex);

            // Reorder cards when dragging to & from same column
            if (e.TargetColumn.Title.ToString() == e.SelectedColumn.Title.ToString())
            {
                // Update every card index in the column after rearrange
                foreach (var card in e.TargetColumn.Cards)
                {
                    int currentIndex = e.TargetColumn.Cards.IndexOf(card);
                    if (currentIndex != Convert.ToInt32(targetCardIndex))
                    {
                        var currentModel = card.Content as PresentationTask;
                        currentModel.ColumnIndex = currentIndex;
                        ViewModel.UpdateCardIndex(currentModel.ID, currentIndex);

                        // NOTE FROM DEBUGGING:

                        //  After its updated in the database, it's not updating the Tasks list? so next iteration when I delete second card, it's using old tasks?
                        // Found inside of (this) at runtime by viewing the ViewModel and PresentationBoard inside it
                        // Part of the bug explained in BoardViewModel.cs, Line 222. Low severity, current fixes stops the major crashing, this is just a hidden issue
                    }
                }
            }
            // Reorder cards when dragging from one column to another
            else
            {
                // Reorder target col after drop
                // Only items above the targetCardIndex need to be updated
                if (e.TargetColumn.Cards.Count != 0)
                {
                    foreach (var card in e.TargetColumn.Cards)
                    {
                        int currentIndex = e.TargetColumn.Cards.IndexOf(card);
                        if (currentIndex > Convert.ToInt32(targetCardIndex))
                        {
                            var currentModel = card.Content as PresentationTask;
                            currentModel.ColumnIndex = currentIndex;
                            ViewModel.UpdateCardIndex(currentModel.ID, currentIndex);
                        }
                    }
                }

                // Reorder source column after dragged card is removed
                if (e.SelectedColumn.Cards.Count != 0)
                {
                    foreach (var card in e.SelectedColumn.Cards)
                    {
                        int currentIndex = e.SelectedColumn.Cards.IndexOf(card);
                        var currentModel = card.Content as PresentationTask;
                        currentModel.ColumnIndex = currentIndex;
                        ViewModel.UpdateCardIndex(currentModel.ID, currentIndex);
                    }
                }
            }
        }
Esempio n. 11
0
        private void KanbanBoard_CardDragEnd(object sender, KanbanDragEndEventArgs e)
        {
            // Change column and category of task when dragged to new column
            // ObservableCollection Tasks already updated
            var targetCategory    = e.TargetKey.ToString();
            var selectedCardModel = e.SelectedCard.Content as PresentationTask;
            int sourceCardIndex   = e.SelectedCardIndex;
            int targetCardIndex   = e.TargetCardIndex;

            // Update item in collection and database
            var selectedTask = ViewModel.Board.Tasks.FirstOrDefault(x => x.ID == selectedCardModel.ID);

            selectedTask.ColumnIndex = targetCardIndex;
            //t2.Category = targetCategory;

            ViewModel.UpdateCardColumn(targetCategory, selectedCardModel, targetCardIndex);

            // Reorder cards when dragging to & from same column
            if (e.TargetColumn.Title.ToString() == e.SelectedColumn.Title.ToString())
            {
                // Update every card index in the column after rearrange
                foreach (var card in e.TargetColumn.Cards)
                {
                    int currentIndex = e.TargetColumn.Cards.IndexOf(card);
                    if (currentIndex != Convert.ToInt32(targetCardIndex))
                    {
                        var currentModel = card.Content as PresentationTask;

                        if (currentModel == null)
                        {
                            return;
                        }

                        // Update task in collection, otherwise stale data
                        var task = ViewModel.Board.Tasks
                                   .FirstOrDefault(x => x.ID == currentModel.ID);
                        task.ColumnIndex = currentIndex;

                        ViewModel.UpdateCardIndex(currentModel.ID, currentIndex);
                    }
                }
            }
            // Reorder cards when dragging from one column to another
            else
            {
                // Reorder target col after drop
                // Only items above the targetCardIndex need to be updated
                if (e.TargetColumn.Cards.Count != 0)
                {
                    foreach (var card in e.TargetColumn.Cards)
                    {
                        int currentIndex = e.TargetColumn.Cards.IndexOf(card);
                        if (currentIndex > Convert.ToInt32(targetCardIndex))
                        {
                            var currentModel = card.Content as PresentationTask;

                            if (currentModel == null)
                            {
                                return;
                            }

                            // Update task in collection, otherwise stale data
                            var task = ViewModel.Board.Tasks
                                       .FirstOrDefault(x => x.ID == currentModel.ID);
                            task.ColumnIndex = currentIndex;

                            ViewModel.UpdateCardIndex(currentModel.ID, currentIndex);
                        }
                    }
                }

                // Reorder source column after dragged card is removed
                if (e.SelectedColumn.Cards.Count != 0)
                {
                    foreach (var card in e.SelectedColumn.Cards)
                    {
                        int currentIndex = e.SelectedColumn.Cards.IndexOf(card);
                        var currentModel = card.Content as PresentationTask;

                        // Update task in collection, otherwise stale data
                        var task = ViewModel.Board.Tasks
                                   .FirstOrDefault(x => x.ID == currentModel.ID);
                        task.ColumnIndex = currentIndex;

                        ViewModel.UpdateCardIndex(currentModel.ID, currentIndex);
                    }
                }
            }
        }
Esempio n. 12
0
 private void SfKanban_CardDragEnd(object sender, KanbanDragEndEventArgs e)
 {
     //updata state
     var    viewModel = (BoardViewModel)DataContext;
     string cate      = e.TargetKey.ToString();
 }
Esempio n. 13
0
 private void SfKanban_OnCardDragEnd(object sender, KanbanDragEndEventArgs e)
 {
     SaveBoard();
 }
Esempio n. 14
0
 private void SfKanban_OnCardDragEnd(object sender, KanbanDragEndEventArgs e)
 {
     ((MainPageViewModel)DataContext).ItemMoved(e);
 }
        private void KanbanBoard_CardDragEnd(object sender, KanbanDragEndEventArgs e)
        {
            // Create these variables BEFORE modifying the current card
            var targetCategory = e.TargetKey.ToString();

            int toColumn          = e.TargetColumnIndex;
            int toRow             = e.TargetCardIndex;
            int toColumnCardCount = e.TargetColumn.Cards.Count;
            List <KanbanCardItem> toColumnCards = e.TargetColumn.Cards.ToList();

            int fromColumn          = e.SelectedColumnIndex;
            int fromRow             = e.SelectedCardIndex;
            int fromColumnCardCount = e.SelectedColumn.Cards.Count;
            List <KanbanCardItem> fromColumnCards = e.SelectedColumn.Cards.ToList();

            // Update the card that was moved
            PresentationTask movedCard = e.SelectedCard.Content as PresentationTask;

            ViewModel.UpdateCardColumn(targetCategory, movedCard, toRow);

            // renumber cards in the TO column
            foreach (KanbanCardItem card in toColumnCards)
            {
                var currentModel = card.Content as PresentationTask;

                if (currentModel == null)
                {
                    continue;
                }

                int row = toColumnCards.IndexOf(card);

                if (currentModel.ColumnIndex != row || currentModel.Category != targetCategory)
                {
                    ViewModel.UpdateCardColumn(currentModel.Category, currentModel, row);
                }
            }

            // if the from FROM column is different from the TO column, renumber the from column also

            if (fromColumn != toColumn)
            {
                foreach (KanbanCardItem card in fromColumnCards)
                {
                    var currentModel = card.Content as PresentationTask;

                    if (currentModel == null)
                    {
                        continue;
                    }

                    int row = fromColumnCards.IndexOf(card);

                    if (currentModel.ColumnIndex != row)
                    {
                        ViewModel.UpdateCardColumn(currentModel.Category, currentModel, row);
                    }
                }
            }

            // SyncFusion control has bugs.  Need to reload data from disk
            ViewModel.LoadTasksForBoard(ViewModel.Board.ID);
        }