public void LoadApp() { ActiveForm.ClearDisplay(); var obj = categoryFactory.GetCategory(ECategory.Standard); // Add extra tab for default task list: obj.Name = Resources.DefaultTaskCategoryName; obj.Tasks = new List <ITask>(); Categories.Add(obj); ActiveForm.AddCategoryToDisplay(obj); // Add extra tab for completed task list, but don't show it to user: obj = categoryFactory.GetCategory(ECategory.Standard); obj.Name = Resources.CompletedTaskListText; obj.Tasks = new List <ITask>(); Categories.Add(obj); // Create all categories to tab controller: foreach (string item in Settings.Default.Categories) { obj = categoryFactory.GetCategory(ECategory.Standard); obj.Name = item; obj.Tasks = new List <ITask>(); // TODO: Storage should load tasks to this list. Categories.Add(obj); ActiveForm.AddCategoryToDisplay(obj); } }
public void AddCategory() { // TODO: Untestable, rewrite for unit testing. // Ask user for category data: DataInputDialog = dialogFactory.GetDialog(EDialog.StringInput, Resources.CategoryNameInputDialogText); DataInputDialog.AskUser(); if (DataInputDialog.IsDataProvided()) { var addedCategory = categoryFactory.GetCategory(ECategory.Standard); addedCategory.Name = (string)DataInputDialog.ReturnValue; addedCategory.Tasks = new List <ITask>(); // Check if user tries to add category that already exists: var equalSearchCategory = QueryCategory((string)DataInputDialog.ReturnValue); if (equalSearchCategory != null) { messageBoxFactory.ShowMessageBox( EMessageBox.Standard, Resources.CategoryAlreadyExistsErrorMessage, Settings.Default.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Categories.Add(addedCategory); Settings.Default.Categories.Add(addedCategory.Name); Settings.Default.Save(); ActiveForm.AddCategoryToDisplay(addedCategory); // TODO: Prepare storage access for new categories! } else { messageBoxFactory.ShowMessageBox( EMessageBox.Standard, Resources.NoDataProvidedErrorText, Settings.Default.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error); } var dialog = (Form)DataInputDialog; dialog.Dispose(); }
public void ShowCompletedTaskList() { var result = QueryCategory(Resources.CompletedTaskListText); ActiveForm.AddCategoryToDisplay(result); }