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();
 }
        public Projects()
        {
            _model = new ProjectDescriptionModel();
            _projects = new ObservableCollection<ProjectDescription>();

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