Ejemplo n.º 1
0
        /// <summary>
        /// Создает внешний вид пинарика в соответствии с настройками.
        /// </summary>
        /// <returns></returns>
        public string CreateView()
        {
            PinarikView.InitTemplate();

            Uri uriStyle     = new Uri(Path.GetFullPath(ConfigurationManager.AppSettings["templateStyle"]));
            Uri uriBootstrap = new Uri(Path.GetFullPath(ConfigurationManager.AppSettings["templateBootstrap"]));

            string content    = "";
            int    monthBegin = this.pinarikData.AllYear ? 1 : this.pinarikData.MonthFrom;
            int    monthEnd   = this.pinarikData.AllYear ? 12 : this.pinarikData.MonthTo;
            string month      = "";
            string monthRow   = "";


            int numRow = 1;

            string[] monthes = new string[3] {
                "", "", ""
            };
            for (int numMonth = monthBegin; numMonth <= monthEnd; numMonth++)
            {
                string row = "";
                //if ((numMonth - 1) % this.numMonthInRow == 0)
                //{

                //}
                monthes[(numMonth - 1) % this.numMonthInRow] = templateMonth
                                                               .Replace("$titleMonth", DateTimeEx.getNameMonth(numMonth))
                                                               .Replace("$days", this.GetDays(numMonth));
                if ((numMonth % this.numMonthInRow == 0) || (numMonth + 1) > monthEnd)
                {
                    monthRow += templateMonthRow
                                .Replace("$month1", monthes[0])
                                .Replace("$month2", monthes[1])
                                .Replace("$month3", monthes[2]);
                    numRow++;
                    monthes = new string[3] {
                        "", "", ""
                    };
                }


                //string days = this.GetDays(numMonth);
                //month += templateMonth
                //    .Replace("$titleMonth", DateTimeEx.getNameMonth(numMonth))
                //    .Replace("$days", days);
            }

            content = templateIndex
                      .Replace("$langPage", "ru")
                      .Replace("$titlePage", "Пинарик")
                      .Replace("$style", uriStyle.AbsoluteUri)
                      .Replace("$bootstrap", uriBootstrap.AbsoluteUri)
                      .Replace("$title", this.pinarikData.Year + (!String.IsNullOrEmpty(this.pinarikData.Name) ? " - " + this.pinarikData.Name : ""))
                      .Replace("$monthRow", monthRow);

            return(content);
        }
Ejemplo n.º 2
0
 private void SetOptions(PinarikData data)
 {
     this.pinarikData = data;
     this.pinarikView = new PinarikView(this.pinarikData);
 }
Ejemplo n.º 3
0
 private void SetOptions(PinarikData data)
 {
     this.pinarikData = data;
     this.pinarikView = new PinarikView(this.pinarikData);
 }