示例#1
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            SaveTable();

            this.Dispose();
            Exec exec = new Exec();
            exec.ShowDialog();
        }
示例#2
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            if(string.IsNullOrEmpty(cbSagraName.Text))
            {
                MessageBox.Show("Inserire il nome della sagra", "Attenzione", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            String dir = sagra_path + "\\" + cbSagraName.Text;

            String date = dtpDate.Value.Date.ToShortDateString();
            date = date.Replace('/', '-');

            String file = dir + "\\" + date + ".txt";
            actualfile = file;

            if (!Directory.Exists(dir))
            {
                try
                {
                    Directory.CreateDirectory(dir);
                }
                catch (Exception)
                {
                    MessageBox.Show("Il nome non può contenere i seguenti caratteri:\n\\ / : * ? < > |", "Attenzione", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                File.CreateText(file).Close();
            }
            else
            {
                if (!File.Exists(file))
                    File.CreateText(file).Close();
            }

            if (!File.Exists(actualfile.Replace(".txt", "C.cnt")))
            {
                FileStream fsC = new FileStream(actualfile.Replace(".txt", "C.cnt"), FileMode.Create);
                StreamWriter sw = new StreamWriter(fsC);
                sw.WriteLine("0");
                sw.Close();
                fsC.Close();
            }

            Exec exec = new Exec();
            exec.ShowDialog();

            cbSagraName.Items.Clear();
            load_Sagra_Names();
        }