示例#1
0
        private void RandomBtn_Click(object sender, EventArgs e)
        {
            /*
             * string[] fileName = Directory.GetFiles(selectFolder, "*.txt");
             * if (fileName.Length ==0)
             * {
             *  MessageBox.Show("這邊沒有藉口檔,需要指定新資料夾");
             * }
             * else
             * {*/
            try
            {
                if (CheckChange() == true)
                {
                    CurrentExcuse = new Excuse(random, selectFolder);
                    UpdateForm(false);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("這邊沒有藉口檔,需要指定新資料夾");
            }

            //}
        }
示例#2
0
 private void RandomBtn_Click(object sender, EventArgs e)
 {
     if (CheckChange())
     {
         CurrentExcuse = new Excuse(random, selectFolder);
         UpdateForm(false);
     }
 }
示例#3
0
        private void OpenBtn_Click(object sender, EventArgs e)
        {
            if (CheckChange())
            {
                openFileDialog1.InitialDirectory = selectFolder;
                openFileDialog1.Filter           = "Text File (*.txt)|*.txt | All File(*.*)|*.*";
                openFileDialog1.FileName         = ExcuseBox.Text + ".txt";
                DialogResult result = openFileDialog1.ShowDialog();

                if (result == DialogResult.OK)
                {
                    CurrentExcuse = new Excuse(openFileDialog1.FileName);
                    UpdateForm(false);
                    MessageBox.Show("藉口載入!");
                }
            }
        }