private void ContentDialog_Closing(ContentDialog sender, ContentDialogClosingEventArgs args)
        {
            // Note: There is a flicker when closing this dialog
            // Can't fully tell if it's memory leak or control issue
            // Adding stop timer and clearing of tasks to try and help with flickering for now
            CalendarViewModel.StopTimer();
            CalendarViewModel.ScheudledTasks.Clear();

            if (SelectedTask != null)
            {
                // Set CurrentTask and open EditPane
                ViewModel.CurrentBoard.EditTask(SelectedTask.ID);
                SelectedTask = null;
            }
        }
        /// <summary>
        /// Initializes the commands and tasks for the current board.
        /// </summary>
        public BoardViewModel(
            PresentationBoard board,
            IAdaptiveClient <IServiceManifest> dataProvider,
            IAppNotificationService appNotificationService,
            IToastService toastService)
        {
            Board                   = board;
            DataProvider            = dataProvider;
            _appNotificationService = appNotificationService;
            _toastService           = toastService;

            CurrentTask         = new PresentationTask(new TaskDTO());
            NewTaskCommand      = new RelayCommand <ColumnTag>(NewTask, () => true);
            EditTaskCommand     = new RelayCommand <int>(EditTask, () => true);
            SaveTaskCommand     = new RelayCommand(SaveTask, () => true);
            DeleteTaskCommand   = new RelayCommand <int>(DeleteTask, () => PaneTitle.Equals("Edit Task") || PaneTitle.Equals(""));
            DeleteTagCommand    = new RelayCommand <string>(DeleteTag, () => true);
            CancelEditCommand   = new RelayCommand(CancelEdit, () => true);
            UpdateColumnCommand = new RelayCommand <string>(UpdateColumn, () => true);

            Columns = new ObservableCollection <PresentationColumn>();

            ColorKeys = new ObservableCollection <string>
            {
                "Low", "Medium", "High"
            };

            ReminderTimes = new ObservableCollection <string>
            {
                "None",
                "At Time of Due Date",
                "5 Minutes Before",
                "10 Minutes Before",
                "15 Minutes Before",
                "1 Hour Before",
                "2 Hours Before",
                "1 Day Before",
                "2 Days Before"
            };

            PaneTitle = "New Task";

            //ConfigureBoardColumns();
        }
Example #3
0
        public void ShowContextMenu(PresentationTask selectedModel)
        {
            // Workaround to show context menu next to selected card model
            foreach (var column in kanbanBoard.ActualColumns)
            {
                if (column.Categories.Contains(selectedModel.Category.ToString()))
                {
                    foreach (var card in column.Cards)
                    {
                        var cardModel = card.Content as PresentationTask;

                        if (cardModel.ID == selectedModel.ID)
                        {
                            // Get current index of card and set on selected card
                            int cardIndex = column.Cards.IndexOf(card);
                            FlyoutShowOptions myOption = new FlyoutShowOptions();
                            myOption.ShowMode = FlyoutShowMode.Transient;
                            taskFlyout.ShowAt(column.Cards[cardIndex], myOption);
                        }
                    }
                }
            }
        }
 private void lstView_ItemClick(object sender, ItemClickEventArgs e)
 {
     SelectedTask = e.ClickedItem as PresentationTask;
     this.Hide();
 }
        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);
        }