/// <summary>
        /// Method for creating of list of value groups and their corresponding special teasps.
        /// </summary>
        /// <param name="dc">user data category</param>
        /// <returns>List of Value Groups</returns>
        private (List <ValueGroup>, List <Teasp>) handleSplitContents(string dc, bool hasPicklist = false)
        {
            TBXContentMap cm = mappingDict.getTBXContentMap(dc);

            string[] tbx_keys = Methods.getKeyArray(tbx_picklists.Keys);

            List <ValueGroup> vgs    = new List <ValueGroup>();
            List <Teasp>      teasps = new List <Teasp>();

            foreach (string tbx_dc in mappingDict.getTBXMappingList(dc))
            {
                if (Methods.inArray(ref tbx_keys, tbx_dc))
                {
                    Teasp teasp = new Teasp();

                    (string target, string eltAtt) = getEltTgtEltAtt(tbx_dc);

                    if (hasPicklist)
                    {
                        teasp.setAll(target, eltAtt, mappingDict.getPicklistMap(dc));
                    }
                    else
                    {
                        teasp.setAll(target, eltAtt);
                    }

                    ValueGroup vg = new ValueGroup();

                    foreach (string content in cm.Keys)
                    {
                        if (cm[content] == tbx_dc)
                        {
                            vg.Add(content);
                        }
                    }
                    vgs.Add(vg);
                    teasps.Add(teasp);
                }
                else
                {
                    Teasp teasp = new Teasp();
                    (string target, string eltAtt) = getEltTgtEltAtt(tbx_dc);
                    teasp.setAll(target, eltAtt);
                    ValueGroup vg = new ValueGroup();
                    foreach (string content in cm.Keys)
                    {
                        if (cm[content] == tbx_dc)
                        {
                            vg.Add(content);
                        }
                    }
                    vgs.Add(vg);
                    teasps.Add(teasp);
                }
            }

            return(vgs, teasps);
        }
        private void display()
        {
            lbl_user_dc.Content = datcats[index];
            mapControl.clear();

            if (mapping.getTBXMappingList(datcats[index])?.Count > 0)
            {
                mapControl.fillItems(mapping.getTBXMappingList(datcats[index]));
            }

            if (!Methods.inArray(ref indexes_visited, index.ToString()))
            {
                mapControl.findBest(datcats[index]);
                indexes_visited[index] = index.ToString();
            }

            updateCounter();
        }
Example #3
0
 private void display()
 {
     if (datcats.Count > 0)
     {
         textblock_user_dc.Text = datcats[index];
         vpmc.clear();
         vpmc.fillListBoxes(mapping.getTBXMappingList(datcats[index]), mapping.getContentList(datcats[index]) as List <string>);
     }
 }
Example #4
0
 /// <summary>
 /// Fills the mappedPicklists Dictionary with a key that is the combination of a data category and a content, and a boolean value.
 /// <para>
 /// Any content values which are mapped to TBX data categories which do not have picklists will be skipped.
 /// </para>
 /// <para>
 /// <code>{ 'part of speech_noun' : false }</code>
 /// </para>
 /// <para>
 /// This means that the content "noun" of "part of speech" has not been mapped to a TBX picklist value yet.
 /// </para>
 /// </summary>
 private void fillMappedPicklistsDict()
 {
     dcs_with_picklists.ForEach(delegate(string dc)
     {
         foreach (string val in mapping.getContentList(dc))
         {
             string[] keys = Methods.getKeyArray(tbx_picklists.Keys);
             if (mapping.getTBXMappingList(dc).Count < 2 || Methods.inArray(ref keys, mapping.getTBXContentMap(dc)?.Get(val)))
             {
                 try
                 {
                     mappedPicklists.Add(dc + "_" + val, false);
                 }
                 catch (System.ArgumentException e)
                 {
                     continue;
                 }
             }
         }
     });
 }