Beispiel #1
0
        private void queryOptionsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormOptions q = new FormOptions();

            if (q.ShowDialog() == DialogResult.OK)
            {
                p = q.ExcelXmlQueryResultsParams;
            }
            else if (q.c1 != null)
            {
                if (q.c1.Data.Contains("key"))
                {
                    toolStripStatusLabel2.Text = Resources.AppconfigBroken + " Missing key: " + (string)q.c1.Data["key"];
                }
                else
                {
                    toolStripStatusLabel2.Text = Resources.AppconfigBroken;
                }
                LockUnlockGUIControls(true);
            }
        }
Beispiel #2
0
        public FormEntrance()
        {
            InitializeComponent();

            saveFileDialog1.Filter = Resources.SaveDialogFilter;
            this.Text = Resources.Version;

            toolStripStatusLabel2.Text = Resources.Waiting;

            toolTip1.SetToolTip(label3, Resources.TooltipInitialFilename);
            toolTip1.AutoPopDelay = Settings1.Default.toolTipDelayBeforeFade;
            toolTip1.SetToolTip(textBox1, Resources.TooltipInitialFilename);

            ConfigManipulator c = new ConfigManipulator();

            try
            {
                p = FormOptions.LoadOpts();
            }
            catch (Exception e)
            {
                if (e is Exceptions.ConfigFileBroken || e is ArgumentNullException || e is ArgumentException || e is InvalidOperationException)
                {
                    MessageBox.Show(e.Message);
                    if (e is Exceptions.ConfigFileBroken)
                    {
                        if (e.Data.Contains("key"))
                        {
                            toolStripStatusLabel2.Text = Resources.AppconfigBroken + " Missing key: " + (string)e.Data["key"];
                        }
                        else
                        {
                            toolStripStatusLabel2.Text = Resources.AppconfigBroken;
                        }
                    }
                    LockUnlockGUIControls(true);
                }
                else
                {
                    MessageBox.Show(e.Message);
                    throw;
                }
            }

            string debugFilePath = Application.ExecutablePath;

            debugFilePath     = Path.GetDirectoryName(debugFilePath);
            userFileName.Text = debugFilePath + Path.DirectorySeparatorChar.ToString();
            textBox1.Text     = "a.xlsx";
            fileName          = userFileName.Text + textBox1.Text;

#if DEBUG
            string path = Assembly.GetExecutingAssembly().Location;
            if (!string.IsNullOrEmpty(path))
            {
                path = Path.GetDirectoryName(path);
            }
            if (!string.IsNullOrEmpty(path))
            {
                path = Path.GetDirectoryName(path);
            }
            if (!string.IsNullOrEmpty(path))
            {
                path = Path.GetDirectoryName(path);
            }
            if (!string.IsNullOrEmpty(path))
            {
                path = Path.GetDirectoryName(path);
            }
            if (!string.IsNullOrEmpty(path))
            {
                path = path + Path.DirectorySeparatorChar.ToString()
                       + "ExcelXmlWriterNTest" + Path.DirectorySeparatorChar.ToString()
                       + "Resources" + Path.DirectorySeparatorChar.ToString()
                       + "Sql exceeds filesize limit.sql";
            }
            if (File.Exists(path))
            {
                FileStream   fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
                StreamReader sr = new StreamReader(fs);
                richTextBox1.Text = sr.ReadToEnd();
                sr.Close();
                fs.Close();
            }
#endif
        }