/// <summary> /// İlgili istatistiğin tam adını getirir. /// </summary> /// <returns></returns> public string GetFullName() { StringBuilder SB = new StringBuilder(); SB.Insert(0, this.Name); IProfileStatistics parent = this.Parent; while (parent != null && !parent.IsBaseContainer) { ProfileStatistic pstatistic = parent as ProfileStatistic; SB.Insert(0, pstatistic.Name + "."); parent = pstatistic.Parent; } return(SB.ToString()); }
public ProfileStatistics(IProfileStatistics parent) { allStatistics = new List <ProfileStatistic>(); this.Parent = parent; }
public ProfileStatistic(IProfileStatistics parent) { stats = new ProfileStatistics(this); this.Parent = parent; }
private Task loadUserStatistics() { return(Task.Factory.StartNew <string>( () => { string fmttext = "<b>{0}</b>: {1}"; string fmttext_num = "<b>{0}</b>: {1:0.##}"; string fmttextex = "<b>{0}</b>"; StringBuilder SB = new StringBuilder(); SB.AppendFormat(fmttext, String.GetLangText("STS_ACT_PRF"), ActiveProfile.ProfileName); SB.AppendLine(); SB.AppendFormat(fmttext, String.GetLangText("STT_CREATE_DATE"), ActiveProfile.CreationDate); SB.AppendLine(); SB.AppendFormat(fmttext, String.GetLangText("STT_LAST_ACTIVITY"), ActiveProfile.LastactivityDate); SB.AppendLine(); IEnumerable <ProfileStatistic> allStatistics = ActiveProfile.Statistics.GetAllStats(true); int prevdepth = 0; IProfileStatistics nocontinue = null; foreach (var statistic in allStatistics) { if (statistic == null) { continue; } string gfmt = fmttext; int currentdepth = statistic.Depth; if (currentdepth < prevdepth) { for (int i = 0; i < prevdepth - currentdepth; i++) { SB.Append("</ol>"); } prevdepth = currentdepth; } if (nocontinue != null) { if (statistic.BaseStatistic != null && statistic.BaseStatistic == nocontinue) { //prevdepth = currentdepth; continue; } } if (statistic.SubStatsNullOrEmpty() && string.IsNullOrEmpty(statistic.ValueString)) { nocontinue = statistic; continue; } SB.AppendLine(); object svalue = ""; if (statistic.Value != null) { svalue = statistic.Value; } //if(statistic.Stats.StatsCount > 0) //{ // svalue =null; //} //else //{ // svalue = statistic.Value; //} if (currentdepth > 0) { SB.Append("<li>"); } //for (int i = 0; i < currentdepth; i++) //{ // SB.Append("--"); //} //if (currentdepth > 0) SB.Append(">"); if (statistic.Stats.StatsCount > 0 && (statistic.Value == null || statistic.ValueString == "" || statistic.ValueString == "***")) { SB.AppendFormat(fmttextex, String.GetLangTextOrDefault(statistic.GetFullName(), statistic.Name)); } else { if (svalue != null) { if (svalue.IsNumeric()) { gfmt = fmttext_num; } } SB.AppendFormat(gfmt, String.GetLangTextOrDefault(statistic.GetFullName(), statistic.Name), svalue); } if (currentdepth > 0) { SB.Append("</li>"); } prevdepth = currentdepth; if (statistic.Stats.StatsCount > 0) { SB.Append("<ol>"); } } return SB.ToString(); }).ContinueWith((t) => { string lastresults = t.Result; ToRtf toRtf = new ToRtf(); toRtf.KaynakMetin = lastresults; this.Invoke((MethodInvoker) delegate { rtbStats.Rtf = toRtf.HtmlToRtf(); }); //toRtf.HtmlToRtf(); }); })); }