public void UpdateAll(GUIModel model) { UpdateEdits(model); UpdateProjectCategoryList(model); UpdateCategoryList(model); UpdateProjectList(model); }
public void Load(object sender, EventArgs e) { GUIModel loadedModel = Deserialize(); if (loadedModel == null) { return; } _controller.Model = loadedModel; }
public GUI() { InitializeComponent(); Settings settings = new EmotionalGUI.Settings(); settings.Owner = this; model = new GUIModel(this, settings); settings.setModel(model); }
public GUIController(GUIView view) { Serializer = new Serializer(this); Model = Serializer.Deserialize(); if (Model == null) { Model = new GUIModel(); } View = view; View.UpdateAll(Model); }
/// <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(); }
/// <summary> /// Loads the GUIModel from the XML file and sets/replaces the model instance /// </summary> /// <returns>The loaded model, or null if loading failed</returns> public GUIModel Deserialize() { if (!File.Exists(SAVE_PATH)) { return(null); } XmlSerializer serializer = new XmlSerializer(typeof(GUIModel)); FileStream fs = new FileStream(SAVE_PATH, FileMode.Open); GUIModel obj = (GUIModel)serializer.Deserialize(fs); fs.Close(); return(obj); }
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 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 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; } }
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; }
public void setModel(GUIModel model) { this.model = model; }
public void setModel(GUIModel mod) { model = mod; }