Exemplo n.º 1
0
 /// <summary>
 /// 窗体加载事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FrmMain_Load(object sender, EventArgs e)
 {
     //窗体加载时检测数据库文件是否存在,存在->读取信息 ,不存在->提示新建计划
     //bin目录用于存放配置文件
     if (!Directory.Exists("bin"))
     {
         Directory.CreateDirectory("bin");
         this.btnTodayPlan.Text    = "未设立";
         this.btnTodayPlan.Enabled = true;
         //初次运行
         FrmFirstInfo first = new FrmFirstInfo();
         //first.ShowDialog();
         if (!File.Exists("bin/plan.db"))
         {
             DataOperation.CreateDB(Config.path, Config.pwd);
         }
         first.ShowDialog();
         DialogResult result = MessageBox.Show("系统检测到您还没有计划信息,是否要创建?", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         if (result == DialogResult.OK)
         {
             //打开创建计划窗口
             FrmLongPlan frm = new FrmLongPlan();
             frm.ShowDialog();
         }
     }
     else
     {
         InitialQuestionType();
         this.timerOfTime.Start();
         //每次运行时展示励志句子
         List <Plan> sentence = dp.GetAllHistoryPlan(PlanType.Sentence);
         if (sentence.Count > 0)
         {
             int         rand     = new Random().Next(0, sentence.Count);
             FrmShowInfo showInfo = new FrmShowInfo(sentence[rand].PlanContent, PlanType.Sentence);
             showInfo.Show();
         }
         ProgressInitial();
         if (!todayPlanIsCreate)
         {
             this.btnTodayPlan.Text    = "未设立";
             this.btnTodayPlan.Enabled = true;
             MessageBox.Show("今日计划还没有规划呢!快去做计划吧", "提示!");
             FrmDayPlan frm = new FrmDayPlan();
             frm.ShowDialog();
         }
         else
         {
             timerOfOneHour.Start();
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 长期计划单击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pbLong_Click(object sender, EventArgs e)
        {
            FrmLongPlan longPlan = new FrmLongPlan();

            longPlan.ShowDialog();
        }
Exemplo n.º 3
0
 public FrmUpdateWhy(FrmLongPlan frm)
 {
     InitializeComponent();
     this.frm = frm;
 }