示例#1
0
 /// <summary>
 /// 跟打完成 对 对照区的操作
 /// </summary>
 void DgetSourceModel_TypeEnd(TyInfo tyInfo, DateTime dateTime)
 {
     //显示回改地点
     if (TempData.Instance.BackReport.Count != 0)
     {
         foreach (var i in TempData.Instance.BackReport)
         {
             this.SelectionStart     = i.Key;
             this.SelectionLength    = 1;
             this.SelectionBackColor = GlobalModel.Instance.Theme.BackSpaceColor;
         }
     }
     //最高停留
     if (TempData.Instance.TypeReport.Count != 0)
     {
         var max  = TempData.Instance.TypeReport.Max(o => o.UseTime.TotalSeconds);
         var find = TempData.Instance.TypeReport.Find(o => o.UseTime.TotalSeconds == max);
         this.SelectionStart  = find.Start;
         this.SelectionLength = find.Word.Length;
         this.SelectionColor  = GlobalModel.Instance.Theme.MaxStay;
         TypeData.Instance.GetTypeAchievement().AchievementDic["停留"].TypeData.关连值 = string.Format("[{0}]{1}s", find.Word, find.UseTime.TotalSeconds.ToString("0.00"));
         var typeWords = TempData.Instance.TypeReport.Count(o => o.Word.Length >= 2);
         if (typeWords > 0)
         {
             var typeWordZs  = TempData.Instance.TypeReport.Where(o => o.Word.Length > 1).Sum(o => o.Word.Length);
             var typeWordJs  = TempData.Instance.TypeReport.Where(o => o.Word.Length > 1).Sum(o => o.Kicks);
             var typeWordUse =
                 TempData.Instance.TypeReport.Where(o => o.Word.Length > 1).Sum(o => o.UseTime.TotalSeconds);
             var 字数所占比例 = (typeWordZs * 100.0 / TypeData.Instance.TypeText.Length).ToString("0.00") + "%";
             var 打词击键   = (typeWordJs * 1.0 / typeWordUse).ToString("0.00");
             TypeData.Instance.GetTypeAchievement().AchievementDic["打词"].TypeData.关连值 = typeWords + "(" + 字数所占比例 +
                                                                                        "/" + 打词击键 + ")";
         }
         else
         {
             TypeData.Instance.GetTypeAchievement().AchievementDic["打词"].TypeData.关连值 = typeWords;
         }
     }
 }
示例#2
0
        /// <summary>
        /// 跟打完成
        /// </summary>
        void DgetSourceModel_TypeEnd(TyInfo tyInfo, DateTime dateTime)
        {
            TypeData.Instance.EndTime   = dateTime;
            TypeData.Instance.TypeState = tyInfo.TypeState;
            timer.Enabled = false;
            //错字超出总字数百分之十此不发送
            if (TypeData.Instance.ErrorWords.Count > TypeData.Instance.TypeText.Length * 0.1)
            {
                return;
            }
            var use     = TypeData.Instance.TotalUseTime.TotalSeconds;
            var realLen = TypeData.Instance.TypeText.Length - TypeData.Instance.ErrorWords.Count * 5;

            if (realLen > 0)
            {
                TypeData.Instance.GetTypeAchievement().Speed2 = TypeData.Instance.TypeText.Length * 60.0 / use;
                try
                {
                    TypeData.Instance.GetTypeAchievement().AchievementDic["速度"].TypeData.关连值 = realLen * 60.0 / use;
                    if (TempData.Instance.TypeReport.Count >= 5)
                    {
                        var useTime = TempData.Instance.TypeReport.Take(5).Sum(o => o.UseTime.TotalSeconds);
                        var ziCount = TempData.Instance.TypeReport.Take(5).Sum(o => o.Word.Length);
                        var jsCount = TempData.Instance.TypeReport.Take(5).Sum(o => o.Kicks);
                        TypeData.Instance.GetTypeAchievement().AchievementDic["起步"].TypeData.关连值 =
                            (ziCount * 60.0 / useTime).ToString("0.00") + "/" +
                            (jsCount * 1.0 / useTime).ToString("0.00") + "/" +
                            (jsCount * 1.0 / ziCount).ToString("0.00");
                    }
                    else
                    {
                        TypeData.Instance.GetTypeAchievement().AchievementDic["起步"].TypeData.关连值 = "";
                    }
                    TypeData.Instance.GetTypeAchievement().AchievementDic["击键"].TypeData.关连值 = TypeData.Instance.KickTimes * 1.0 /
                                                                                               use;
                    TypeData.Instance.GetTypeAchievement().AchievementDic["码长"].TypeData.关连值 = TypeData.Instance.KickTimes * 1.0 /
                                                                                               TypeData.Instance.TypeText.Length;
                    TypeData.Instance.GetTypeAchievement().AchievementDic["回改"].TypeData.关连值  = TypeData.Instance.BackTimes;
                    TypeData.Instance.GetTypeAchievement().AchievementDic["错字"].TypeData.关连值  = TypeData.Instance.ErrorWords.Count;
                    TypeData.Instance.GetTypeAchievement().AchievementDic["键数"].TypeData.关连值  = TypeData.Instance.KickTimes;
                    TypeData.Instance.GetTypeAchievement().AchievementDic["输入法"].TypeData.关连值 =
                        InputLanguage.CurrentInputLanguage.LayoutName;
                    TypeData.Instance.GetTypeAchievement().InputOperation(); //对输入法进行处理输出
                    if (TempData.Instance.BackReport.Count > 0)
                    {
                        var max = TempData.Instance.BackReport.Values.Max();
                        if (max > 1)
                        {
                            var backTimes =
                                TempData.Instance.BackReport.First(o => o.Value == max);
                            TypeData.Instance.GetTypeAchievement().AchievementDic["回次"].TypeData.关连值 = "[" + TypeData.Instance.TypeText[backTimes.Key] +
                                                                                                       "]" + backTimes.Value + "次";
                        }
                    }
                    if (TypeData.Instance.TypeState == TypeState.TypeOver)
                    {
                        this.DgetTextFromQQ.SendToQQ(TypeData.Instance.GetTypeAchievement().ToString());
                        this.Activate();
                        this.textBoxEx1.SelectionStart = this.textBoxEx1.TextLength;
                    }
                }
                catch (Exception err)
                {
                    TyLogModel.Instance.WriteLog(LogType.Error, err.Message);
                    MessageBox.Show(Resources.MainForm_DgetSourceModel_TypeEnd_TypeAchievementDic_Error);
                }
            }
        }
示例#3
0
 /// <summary>
 /// 跟打开始
 /// </summary>
 void DgetSourceModel_TypeStart(TyInfo tyInfo, DateTime dateTime)
 {
     timer.Enabled = true;
 }