本文整理汇总了C#中Service.SaveUserVocabulary方法的典型用法代码示例。如果您正苦于以下问题:C# Service.SaveUserVocabulary方法的具体用法?C# Service.SaveUserVocabulary怎么用?C# Service.SaveUserVocabulary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Service
的用法示例。
在下文中一共展示了Service.SaveUserVocabulary方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnSyncNewWords_Click
private void btnSyncNewWords_Click(object sender, EventArgs e)
{
var uid = Convert.ToInt32(txbUserId.Text);
ShowMessage("读取用户生词本...");
//读取用户不认识的词
var newWordList = HujiangWebService.GetUserItems(uid, Convert.ToDateTime("2000-1-1"));
ShowMessage("生词:" + newWordList.Count + "个");
//dbOperator.SaveUserNewWords(newWordList);
ShowMessage("读取用户背诵记录...");
//读取用户背诵过的书和单元,得到用户已认识词列表
var histories = new Dictionary<int, int>();
var userBooks = HujiangWebService.GetPublicBooks(uid, "en");
foreach (var userBook in userBooks)
{
var unitId = HujiangWebService.GetUserUnitMax(uid, userBook.BookID);
if (unitId > 0)
{
richTextBox1.AppendText(userBook.BookName + " UnitId:" + unitId + "\r\n");
histories.Add(userBook.BookID, unitId);
}
}
//将用户记录写入数据库
//dbOperator.SaveUserLearnHistory(histories);
ShowMessage("统计用户的已知和未知词汇...");
var list = CalcUserVocabulary(newWordList, histories);
foreach (var vocabulary in list)
{
ShowMessage(vocabulary.ToString());
}
ShowMessage("开始同步到本地");
Service service = new Service();
service.SaveUserVocabulary(list,"开心词场");
ShowMessage("同步完成");
}
示例2: Import_Click
protected override void Import_Click(object sender, EventArgs e)
{
var list = CibaTxtParseHelper.Parse(txbFilePath.Text);
var result = new List<Vocabulary>();
foreach (var str in list)
{
result.Add(new Vocabulary() { Word = str, IsKnown = false });
}
Service service = new Service();
service.SaveUserVocabulary(result, "金山词霸");
}