public void UpdateAll(GUIModel model) { UpdateEdits(model); UpdateProjectCategoryList(model); UpdateCategoryList(model); UpdateProjectList(model); }
public void UpdateProjectList(GUIModel model) { int selectedIndex = listBox_projects.SelectedIndex; listBox_projects.Items.Clear(); foreach (Project project in model.AllProjects) listBox_projects.Items.Add(project); if(selectedIndex<listBox_projects.Items.Count) listBox_projects.SelectedIndex = selectedIndex; }
public void UpdateCategoryList(GUIModel model) { int selectedIndex = listBox_categories.SelectedIndex; listBox_categories.Items.Clear(); foreach(ProjectCategory project in model.AllCategories) listBox_categories.Items.Add(project); if(selectedIndex<listBox_categories.Items.Count) listBox_categories.SelectedIndex = selectedIndex; }
public GUIController(GUIView view) { Serializer = new Serializer(this); Model = Serializer.Deserialize(); if (Model == null) Model = new GUIModel(); View = view; View.UpdateAll(Model); }
public void UpdateProjectCategoryList(GUIModel model) { int selectedIndex = listBox_editProject_projectCategories.SelectedIndex; listBox_editProject_projectCategories.Items.Clear(); if(model.CurrentProject == null) return; foreach(ProjectCategory project in model.CurrentProject.ProjectCategories) listBox_editProject_projectCategories.Items.Add(project); if(selectedIndex<listBox_editProject_projectCategories.Items.Count) listBox_editProject_projectCategories.SelectedIndex = selectedIndex; }
/// <summary> /// Serializes the GUIModel /// </summary> /// <param name="model">The model to serialize</param> public void Serialize(GUIModel model) { if(File.Exists(SAVE_PATH)) File.Delete(SAVE_PATH); XmlSerializer serializer = new XmlSerializer(typeof(GUIModel)); FileStream stream = new FileStream(SAVE_PATH, FileMode.Create); serializer.Serialize(stream, model); stream.Close(); }
public void UpdateEdits(GUIModel model) { //Project if (model.CurrentProject == null) return; tb_editProject_projectName.Text = model.CurrentProject.ProjectName; tb_editProject_projectPath.Text = model.CurrentProject.ProjectPath; checkBox_editProject_finished.Checked = model.CurrentProject.Finished; //Category if (model.CurrentSelectedCategory == null) return; tb_editCategory_categoryName.Text = model.CurrentSelectedCategory.CategoryName; }