/// <summary> /// 今日计划设定按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnTodayPlan_Click(object sender, EventArgs e) { if (btnTodayPlan.Text == "未设立") { FrmDayPlan day = new FrmDayPlan(); day.ShowDialog(); } }
/// <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(); } } }
/// <summary> /// 每日计划单击 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pbDay_Click(object sender, EventArgs e) { FrmDayPlan day = new FrmDayPlan(); day.ShowDialog(); }