コード例 #1
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     JSsetTimeout.SetTimeout(() =>
     {
         if (tbOutput.Text.IsEmpty())
         {
             tbOutput.Text = Application.StartupPath;
         }
     }, 500);
 }
コード例 #2
0
        private void btnGenerateCode_Click(object sender, EventArgs e)
        {
            if (DataIsValid())
            {
                var code = CodeGenerator.GenerateCsharpClass(tbConnectionString.Text, tbSqlQuery.Text, tbClassname.Text, chNormalizeColumnNames.Checked);

                tbPreview.Text = code;

                var filepath = Path.Combine(tbOutput.Text, $"{tbClassname.Text}.cs");

                File.WriteAllText(filepath, code, Encoding.UTF8);

                lblFileNote.Text = $"A CSharp file has been made at: {filepath}";

                JSsetTimeout.SetTimeout(() =>
                {
                    lblFileNote.Text = string.Empty;
                }, 5000);
            }
            else
            {
                MessageBox.Show(ValidationMessage);
            }
        }