// METHODS
        public void Build(EmotionsRepository repos)// EMPTY FORM, ADD
        {
            this.Text = "Create";
            data      = new Word();

            textTb.Clear();
            descriptionTb.Clear();

            emotionPm.Build(new EmotionsView(new Emotions(repos)));
            synonymsPm.Build(new SynonymsView(new Synonyms(verbs.Select(x => x.Text))));
        }
        public void Build(string filePath, EmotionsRepository repos)
        {
            this.filePath = filePath;
            this.repos    = repos;
            LoadData();
            this.dataView = new VerbsView(verbs);

            this.dataView.CollectionChanged += DataCollectionChange;
            this.synonymsPourer.Build(new Synonyms(dataView.Verbs.Select(x => x.Text)));
            this.emotionsPourer.Build(new Emotions(repos));

            UpdateInterface();
        }
        public void Build(Word data, EmotionsRepository repos)// CHANGE
        {
            this.Text = "Change";
            this.data = data;

            textTb.Text        = data.Text;
            descriptionTb.Text = data.Description;

            // Repository could be changed, edited...
            // ... change emotions list
            Algorithm.FullSet <string> setPickedAndUnpickedEmotions = Algorithm.DivideSetBySet(repos, data.Emotions.Picked);
            emotionPm.Build(new EmotionsView(
                                new Emotions(Unpicked: setPickedAndUnpickedEmotions.Except,
                                             Picked: setPickedAndUnpickedEmotions.Intersect)));

            // if new words were added or edited...
            // ... change words list
            string[] verbArr = verbs.Select(x => x.Text).Where(x => x != data.Text).ToArray();// words list without choosen word
            Algorithm.FullSet <string> setPickedAndUnpickedSynonym = Algorithm.DivideSetBySet(verbArr, data.Synonyms.Picked);
            synonymsPm.Build(new SynonymsView(
                                 new Synonyms(Unpicked: setPickedAndUnpickedSynonym.Except,
                                              Picked: setPickedAndUnpickedSynonym.Intersect)));
        }
Пример #4
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     treeView.ExpandAll();
     System.IO.Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "Resources\\Files");
     EmotionsRepository.Create(out emotionsRepository, AppDomain.CurrentDomain.BaseDirectory + "Resources\\Files\\Emotions.dat");
 }