Beispiel #1
0
 /// <summary>
 /// Adds a list of translated descriptions stored in a ILanguageMap.
 /// </summary>
 /// <param name="languageMap">The language map containing descriptions in multiple languages.</param>
 /// <returns>The activity builder, to continue the fluent configuration.</returns>
 public IActivityBuilder AddDescription(ILanguageMap languageMap)
 {
     foreach (var item in languageMap)
     {
         _descriptionLanguageMap.Add(item.Key, item.Value);
     }
     return(this);
 }
Beispiel #2
0
 /// <summary>
 /// Adds a list of translated names stored in a ILanguageMap.
 /// </summary>
 /// <param name="languageMap">The language map containing descriptions in multiple languages.</param>
 /// <returns>The activity builder, to continue the fluent configuration.</returns>
 public IActivityBuilder AddName(ILanguageMap languageMap)
 {
     foreach (var item in languageMap)
     {
         _nameLanguageMap.Add(item.Key, item.Value);
     }
     return(this);
 }
Beispiel #3
0
 /// <summary>
 /// The human readable representation of the Verb in one or more languages.
 /// <para>This does not have any impact on the meaning of the Statement, but serves to give a human-readable display of the meaning already determined by the chosen Verb.</para>
 /// </summary>
 /// <param name="languageMap">A language map defining the verb in multiple languages</param>
 /// <returns>The statement builder, to continue the fluent configuration.</returns>
 public IVerbBuilder AddDisplay(ILanguageMap languageMap)
 {
     foreach (var item in languageMap)
     {
         _languageMap.Add(item.Key, item.Value);
     }
     return(this);
 }
Beispiel #4
0
        public void LanguageMapMapping()
        {
            var languageMap = new LanguageMap();

            languageMap.Add("en-US", "some american description");
            languageMap.Add("en-GB", "some british description");

            var collection = _mapper.Map <LanguageMapCollection>(languageMap);

            collection.ShouldContainKey("en-US");
            collection.ShouldContainKey("en-GB");
        }
        public object Deserialize(string value, JsonConverter converter)
        {
            LanguageMap langDict = new LanguageMap();
            IDictionary objMap = converter.DeserializeJSONToMap(value);
            foreach (object key in objMap.Keys)
            {
                langDict.Add((string)key, (string)objMap[key]);
            }

            return langDict;
        }
Beispiel #6
0
        public object Deserialize(string value, JsonConverter converter)
        {
            LanguageMap langDict = new LanguageMap();
            IDictionary objMap   = converter.DeserializeJSONToMap(value);

            foreach (object key in objMap.Keys)
            {
                langDict.Add((string)key, (string)objMap[key]);
            }

            return(langDict);
        }
Beispiel #7
0
        public static void SendStatement(string activity)
        {
            string email = "mailto:";
            email += username;

            Statement[] statements = new Statement[1];
            Activity newAct = new Activity("http://35.9.22.105/xapi");

            LanguageMap inter = new LanguageMap();
            inter.Add("en-US", "Interacted");
            System.Uri verbURI = new System.Uri("http://verbs/interaction/");
            StatementVerb interact = new StatementVerb(verbURI, inter);

            newAct.Definition = new ActivityDefinition();
            newAct.Definition.Name = new LanguageMap();
            newAct.Definition.Description = new LanguageMap();
            newAct.Definition.Description.Add("type", "Desktop Application Learning Activity");
            newAct.Definition.Name.Add("en-US", activity);
            Random rand = new Random();
            int random = rand.Next();
            newAct.Id = "http://" + random.ToString() + "/desktopapp/" + activity;

            statements[0] = new Statement(new Actor(username, email), interact, newAct);

            try
            {
                tincan.StoreStatements(statements);
            }
            catch (Exception e)
            {
                _offlineQueuedStatements.Enqueue(statements[0]);
            }
        }