private void btnAddProject_Click(object sender, RoutedEventArgs e)
 {
     if (Name == null)
     {
         MessageBox.Show("Fill in Name field");
         return;
     }
     _currentProject = new ProjectDescription { ProjectDescriptionText = new TextRange(projectDescriptionTb.Document.ContentStart, projectDescriptionTb.Document.ContentEnd).Text, ProjectName = textBoxName.Text };
     foreach (var item in Application.Current.Windows)
     {
         if (item.GetType() == typeof(Projects))
             _projectsUI = (Projects)item;
     }
     if (_projectsUI == null)
     {
         _projectsUI = new Projects();
         _projectsUI.Show();
     }
     _model = new ProjectDescriptionModel();
     _model.InsertSession(_currentProject);
     _projectsUI.ListOfProjects.Add(_currentProject);
     //_projectsUI.ListOfProjects.Add(_currentProject);
     //_projectsUI.AddingToNameAndDescriptionList(_projectsUI.ListOfProjects);
     this.Close();
 }
예제 #2
0
        public Projects()
        {
            _model = new ProjectDescriptionModel();
            _projects = new ObservableCollection<ProjectDescription>();

            InitializeComponent();
            LoadProjects(_model);
            this.DataContext = this;
        }
예제 #3
0
 private void LoadProjects(ProjectDescriptionModel model)
 {
     var projects = model.LoadSession();
     foreach (var proj in projects)
     {
         this.ListOfProjects.Add(proj);
     }
     AddingToNameAndDescriptionList(this.ListOfProjects);
 }