Ejemplo n.º 1
0
        /// <summary>
        /// Initializes each board, if any exist, with tasks and sets the current board
        /// to the first.
        /// </summary>
        private void InitializeBoards()
        {
            BoardList = new ObservableCollection <BoardViewModel>();
            List <BoardDTO> boardDTOs = dataProvider.Call(x => x.BoardServices.GetBoards());

            foreach (BoardDTO dto in boardDTOs)
            {
                PresentationBoard presBoard = new PresentationBoard(dto);

                // Fill board with tasks
                if (dto.Tasks?.Any() ?? false)
                {
                    foreach (TaskDTO taskDTO in dto.Tasks.OrderBy(x => x.ColumnIndex))
                    {
                        presBoard.Tasks.Add(new PresentationTask(taskDTO));

                        // Fill TagsCollection on Board for AutoSuggestBox
                        foreach (var tag in taskDTO.Tags.Split(','))
                        {
                            if (!string.IsNullOrEmpty(tag) && !presBoard.TagsCollection.Contains(tag))
                            {
                                presBoard.TagsCollection.Add(tag);
                            }
                        }
                    }
                }
                BoardList.Add(boardViewModelFactory(presBoard, _appNotificationService));
            }
            CurrentBoard = BoardList.Any() ? BoardList.First() : null;
        }
        private void Edit_Task_Click(object sender, RoutedEventArgs e)
        {
            if (selectedTask != null)
            {
                Edit TaskEdit = new Edit(userName, selectedTask, this);

                if (!(this.selectedTask.getTasColumn() == columns.Count))
                {
                    TaskEdit.Show();
                    this.selectedTask = null;
                }
                else
                {
                    MessageBox.Show("Cant edit task in last column");

                    if (!(this.selectedTask.getTasColumn().Equals(columns.Count)))
                    {
                        TaskEdit.Show();
                    }
                }
            }
            else
            {
                MessageBox.Show("Please select task");
            }
        }
Ejemplo n.º 3
0
        public void show(Board MainB)
        {
            setBaordNames();
            addMenuItem(MainB.getBoardName());
            this.columns = new ObservableCollection <DataGrid>();
            this.tasks   = new ObservableCollection <PresentationBoard>();
            var hashColumns = MainB.getColumns();

            this.columnCounter = MainB.getCurrColumnCount();
            foreach (var c in hashColumns.Values)
            {
                this.col = new DataGrid();
                var hashTasks           = ((Column)c).getTasksHash();
                DataGridTextColumn colm = new DataGridTextColumn();
                col.AutoGenerateColumns = false;
                String cp;
                if (((Column)c).getColumnMaxTasks() != int.MaxValue)
                {
                    cp = ((Column)c).getName().ToString() + " (" + ((Column)c).getCurrentTaskCount() + "/" + ((Column)c).getColumnMaxTasks() + ")";
                }
                else
                {
                    cp = ((Column)c).getName().ToString() + " " + "(Unlimited capacity)";
                }
                foreach (var t in hashTasks.Values)
                {
                    PresentationBoard p = new PresentationBoard(((Column)c).getName(), this.columnCounter, ((Task)t).getTitle(), ((Task)t).getDescription(), DateTime.Parse(((Task)t).getDueDate()), ((Task)t).getCreationDate(), ((Task)t).getTaskUID().ToString());
                    tasks.Add(p);
                }
                colm.MinWidth       = 350;
                colm.Header         = cp;
                colm.Binding        = new Binding("Task");
                colm.CanUserSort    = true;
                colm.SortMemberPath = "DueDate";
                col.Columns.Add(colm);
                col.IsReadOnly = true;
                col.FontSize   = 12;
                col.Name       = ((Column)c).getName().ToString().Replace(" ", "_");
                col.Tag        = this.columnCounter;
                this.columns.Insert(0, col);
                if (this.columnCounter != MainB.getCurrColumnCount())
                {
                    col.LoadingRow += Col_LoadingRow;
                }
                col.AllowDrop                   = true;
                col.SelectionChanged           += Col_SelectionChanged;
                col.PreviewMouseLeftButtonDown += Col_PreviewMouseLeftButtonDown;
                col.PreviewMouseMove           += Col_PreviewMouseMove;
                col.PreviewMouseUp             += Col_PreviewMouseUp;
                col.Drop       += Col_Drop;
                col.ItemsSource = tasks;
                this.columnCounter--;
                this.tasks = new ObservableCollection <PresentationBoard>();
            }
            this.columnCounter          = MainB.getCurrColumnCount();
            MainBoard.SelectionChanged += MainBoard_SelectionChanged;
            MainBoard.ItemsSource       = columns;
        }
 private void Col_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (((PresentationBoard)((DataGrid)sender).SelectedValue) != null)
     {
         this.selectedTask = ((PresentationBoard)((DataGrid)sender).SelectedValue);
     }
     else
     {
         this.selectedTask = null;
     }
 }
 public Edit(string userName, PresentationBoard PTask, MainWindow main)
 {
     InitializeComponent();
     this.userName       = userName;
     this.CurrTaskStatus = PTask.getTasColumn();
     this.currTaskUID    = PTask.getTaskUID();
     EDC              = new EditDataContext();
     EDC.Title        = PTask.Title;
     EDC.Description  = PTask.Description;
     EDC.DueDate      = PTask.DueDate;
     this.main        = main;
     this.DataContext = EDC;
 }
Ejemplo n.º 6
0
        /// <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();
        }
 private void Move_Task_Click(PresentationBoard currRow)
 {
     if (selectedTask != null)
     {
         InfoObject info = SystemInterface.moveTask(userName, currRow.getTaskUID(), currRow.getTasColumn());
         if (info.getIsSucceeded())
         {
             this.show(SystemInterface.getBoard(userName));
             this.selectedTask = null;
         }
         else
         {
             MessageBox.Show(info.getMessage());
         }
     }
     else
     {
         MessageBox.Show("Please select task");
     }
 }
 private void Move_Task_Click(object sender, RoutedEventArgs e)
 {
     if (selectedTask != null)
     {
         InfoObject info = SystemInterface.moveTask(userName, selectedTask.getTaskUID(), selectedTask.getTasColumn());
         if (info.getIsSucceeded())
         {
             this.show(SystemInterface.getBoard(userName));
             this.selectedTask = null;
         }
         else
         {
             MessageBox.Show(info.getMessage());
         }
     }
     else
     {
         MessageBox.Show("Please select task");
     }
 }
Ejemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     pBoard = GameObject.FindGameObjectsWithTag("pBoard")[0];
     script = pBoard.GetComponent <PresentationBoard>();
 }