<commit_before>﻿using System;
using GalaSoft.MvvmLight;
using Solutionizer.Models;

namespace Solutionizer.ViewModels {
    public class ProjectViewModel : ViewModelBase, IDisposable {
        private readonly Project _project;

        public ProjectViewModel(Project project) {
            _project = project;
            _project.Loaded += ProjectOnLoaded;
        }

        void IDisposable.Dispose() {
            _project.Loaded -= ProjectOnLoaded;
        }

        private void ProjectOnLoaded(object sender, EventArgs eventArgs) {
            RaisePropertyChanged(() => IsLoaded);
        }

        public Project Project {
            get { return _project; }
        }

        public string Name {
            get { return _project.Name; }
        }

        public string Path {
            get { return _project.Filepath; }
        }

        public bool IsLoaded {
            get { return _project.IsLoaded; }
        }
    }
}<commit_msg>more careful event handling<commit_after>﻿using System;
using GalaSoft.MvvmLight;
using Solutionizer.Models;

namespace Solutionizer.ViewModels {
    public class ProjectViewModel : ViewModelBase, IDisposable {
        private readonly Project _project;

        public ProjectViewModel(Project project) {
            _project = project;
            if (!_project.IsLoaded) {
                _project.Loaded += ProjectOnLoaded;
            }
        }

        void IDisposable.Dispose() {
            _project.Loaded -= ProjectOnLoaded;
        }

        private void ProjectOnLoaded(object sender, EventArgs eventArgs) {
            _project.Loaded -= ProjectOnLoaded;
            RaisePropertyChanged(() => IsLoaded);
        }

        public Project Project {
            get { return _project; }
        }

        public string Name {
            get { return _project.Name; }
        }

        public string Path {
            get { return _project.Filepath; }
        }

        public bool IsLoaded {
            get { return _project.IsLoaded; }
        }
    }
}
{'fraction_non_alphanumeric': 0.07472959685349066, 'fraction_numerical': 0.0, 'mean_word_length': 1.8342618384401115, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '241523', 'n_tokens_mistral': 522, 'n_tokens_neox': 497, 'n_words': 127}