/// <summary>
        /// Filters task list based on the new options selected from the GUI
        /// </summary>
        internal void RefilterTaskList()
        {
            if (SelectedToken == null)
            {
                return;
            }

            TaskViewModel.CreateFilteredTaskCollection(SelectedToken, SelectedScopeIndex);
        }
        private void RemoveTokenExecute()
        {
            // Add the new token to the list and control
            TokenViewModel.RemoveToken(SelectedToken);

            // Select the default "ALL" token from the list
            SelectedToken = "ALL";

            // Force update of tokens
            TaskViewModel.GetTasksFromApplicationObject();
            TaskViewModel.CreateFilteredTaskCollection(SelectedToken, SelectedScopeIndex);
        }
        /// <summary>
        /// Filters task list when the current open file changes
        /// </summary>
        internal void RefilterTaskListOnFileChange()
        {
            if (SelectedToken == null)
            {
                return;
            }

            // Check to see if the file has changed. If it has, update the variable and call method to refilter
            if (!openFile.Equals(TaskViewModel.GetCurrentFile()))
            {
                openFile = TaskViewModel.GetCurrentFile();
                TaskViewModel.CreateFilteredTaskCollection(SelectedToken, SelectedScopeIndex);
            }
        }
        /// <summary>
        /// Command for adding a token button the GUI
        /// Token must have only alphanumeric characters, _, $, ( or )
        /// </summary>
        public void RemoveToken()
        {
            // TODO cannot be removed for some reason
            if (!CanRemoveToken())
            {
                System.Windows.MessageBox.Show(String.Format("Cannot remove {0} token.", SelectedToken), "TaskListPlus");
                return;
            }

            // Add the new token to the list and control
            TokenViewModel.RemoveToken(SelectedToken);

            // Select the default "ALL" token from the list
            SelectedToken = "ALL";

            // Force update of tokens
            TaskViewModel.GetTasksFromApplicationObject();
            TaskViewModel.CreateFilteredTaskCollection(SelectedToken, SelectedScopeIndex);
        }
        private void AddTokenExecute()
        {
            // Open the token editor window
            TokenEditor tokenEditor = new TokenEditor();

            tokenEditor.ShowDialog();

            // If the OK button was pressed, add the token to the list
            if (tokenEditor.DialogResult == true)
            {
                TokenViewModel.AddToken(tokenEditor.Token);
            }

            // Select the new token from the list
            SelectedToken = tokenEditor.Token;

            // Force update of tokens
            TaskViewModel.GetTasksFromApplicationObject();
            TaskViewModel.CreateFilteredTaskCollection(SelectedToken, SelectedScopeIndex);
        }
 public void ReadAllTasksAndFilter()
 {
     TaskViewModel.GetTasksFromApplicationObject();
     TaskViewModel.CreateFilteredTaskCollection(SelectedToken, SelectedScopeIndex);
 }