コード例 #1
0
ファイル: GUIView.cs プロジェクト: Needix/Helper_SortProjects
 public void UpdateAll(GUIModel model)
 {
     UpdateEdits(model);
     UpdateProjectCategoryList(model);
     UpdateCategoryList(model);
     UpdateProjectList(model);
 }
コード例 #2
0
ファイル: GUIView.cs プロジェクト: Needix/Helper_SortProjects
        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;
        }
コード例 #3
0
ファイル: GUIView.cs プロジェクト: Needix/Helper_SortProjects
        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;
        }
コード例 #4
0
        public GUIController(GUIView view)
        {
            Serializer = new Serializer(this);
            Model = Serializer.Deserialize();
            if (Model == null) Model = new GUIModel();

            View = view;
            View.UpdateAll(Model);
        }
コード例 #5
0
ファイル: GUIView.cs プロジェクト: Needix/Helper_SortProjects
        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;
        }
コード例 #6
0
        /// <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();
        }
コード例 #7
0
ファイル: GUIView.cs プロジェクト: Needix/Helper_SortProjects
        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;
        }