Esempio n. 1
0
        private void SetPage(int newPage) //This creates new pages or sends you to a page
        {
            if (!this.diaryData.ContainsKey(currentDate.ToString()))
            {
                this.diaryData.Add(currentDate.ToString(), new List <string> {
                    "",
                });
            }
            // set page number
            this.currentPage = Math.Max(0, newPage);

            // get current page
            List <string> pages = this.diaryData[currentDate.ToString()];

            if (this.currentPage >= pages.Count)
            {
                pages.Add("");
            }
            string pageText = pages[this.currentPage];

            // update display text
            this.displayedText.Text = pageText;
        }
Esempio n. 2
0
        private void SetPage(int newPage) //This creates new pages or sends you to a page
        {
            if (!this.diaryData.ContainsKey(currentDate.ToString()) && currentDate == SDate.Now())
            {
                this.diaryData.Add(currentDate.ToString(), new List <string> {
                    "",
                });
            }
            // set page number
            this.currentPage = Math.Max(0, newPage);

            // get current page
            while (!this.diaryData.ContainsKey(currentDate.ToString()))
            {
                if (dateDown == true)
                {
                    currentDate = this.currentDate.AddDays(-1);
                }
                if (dateUp == true)
                {
                    currentDate = this.currentDate.AddDays(1);
                }
            }

            if (this.diaryData.ContainsKey(currentDate.ToString()))
            {
                dateDown = false;
                dateUp   = false;
            }
            List <string> pages = this.diaryData[currentDate.ToString()];

            if (this.currentPage >= pages.Count)
            {
                pages.Add("");
            }
            string pageText = pages[this.currentPage];

            // update display text
            this.displayedText.Text = pageText;
        }