public UserWelcome()
        {
            this.InitializeComponent();
            DateTime currentTime = DateTime.Now;
            int      year        = (int)DataUnit.GetData("7");
            int      month       = (int)DataUnit.GetData("8");
            int      day         = (int)DataUnit.GetData("9");
            DateTime StartTime   = new DateTime((int)DataUnit.GetData("7"), (int)DataUnit.GetData("8"), (int)DataUnit.GetData("9"));
            int      totalDiarys = DiaryManage.getCount();

            int totalDays = (int)currentTime.Subtract(StartTime).TotalDays;

            if (totalDays == 0)
            {
                cal.Text = "欢迎使用Life Tracer~愿与你共度未来的长久时光~";
            }
            else
            {
                cal.Text = "Life Tracer已经陪你走过了" + totalDays + "天,这些天里你一共写过" + totalDiarys +
                           "篇日记";
                float ratio = (float)totalDiarys / (float)totalDays;
                if (ratio >= 0.7)
                {
                    tips.Text = "当前写日记习惯非常良好,请继续保持~";
                }
                else if (ratio >= 0.4)
                {
                    tips.Text = "写日记是个好习惯,再接再厉~";
                }
                else
                {
                    tips.Text = "最近工作繁忙吗?最好不要放弃写日记的习惯~";
                }
            }
        }
Example #2
0
 public Welcome()
 {
     this.InitializeComponent();
     UserAccount = new UserAccount();
     if (DataUnit.GetData("5") != null)
     {
         AccountBox.Text = DataUnit.GetData("5").ToString();
     }
     else
     {
         AccountBox.Text = "";
     }
 }
Example #3
0
 private async void SignInButton_Click(object sender, RoutedEventArgs e)
 {
     //写一个判断是不是已经注册了的用户,或者用户和密码对不上,这里需要网络编程!
     //Whether account and password could match the info in the database
     if (DataUnit.GetData("5") != null && AccountBox.Text.Equals(DataUnit.GetData("5").ToString()) && PasswordBox.Password.Equals(DataUnit.GetData("6").ToString()))
     {
         DataUnit.IsSignUp = true;
         Frame.Navigate(typeof(UserWelcome), UserAccount);
     }
     else
     {
         MessageDialog save = new MessageDialog("Wrong account or password", "Message");
         save.Commands.Add(new UICommand("ok", uicommand =>
         {
             Frame.Navigate(typeof(Welcome));
         })
                           );
         await save.ShowAsync();
     }
 }
Example #4
0
        public tagChoose()
        {
            this.InitializeComponent();
            TagList    = new ListBoxItem[5];
            TagList[0] = tag1;
            TagList[1] = tag2;
            TagList[2] = tag3;
            TagList[3] = tag4;
            TagList[4] = tag5;

            int i = 0;

            while (DataUnit.GetData(i.ToString()) != null && i < 5)
            {
                TagList[i].Content = DataUnit.GetData(i.ToString()) as string;
                i++;
            }
            for (; i < 5; i++)
            {
                TagList[i].Content = "";
            }
        }