Beispiel #1
0
        static void Main()
        {
            DBConverter.DBConverterForm convForm = new DBConverter.DBConverterForm();
            convForm.ShowDialog();
            return;

            string mode = "SERVICE";

            System.Windows.Forms.DialogResult result;

            string exceptionMessage = "";

            if (mode.ToUpper() == "SQL")
            {
                SqlSettingsForm form = new SqlSettingsForm();
                result           = form.ShowDialog();
                exceptionMessage = form.ExceptionMessage;
            }
            else if (mode.ToUpper() == "SERVICE")
            {
                ServiceSettingsForm form = new ServiceSettingsForm();
                result           = form.ShowDialog();
                exceptionMessage = form.ExceptionMessage;
            }
            else if (mode.ToUpper() == "WEB")
            {
                WebSettingsForm form = new WebSettingsForm();
                result           = form.ShowDialog();
                exceptionMessage = form.ExceptionMessage;
            }
            else
            {
                throw new Exception("Unknown install mode");
            }


            if (result == System.Windows.Forms.DialogResult.Abort)
            {
                throw new Exception(exceptionMessage);
            }

            if (exceptionMessage != "")
            {
                MessageBox.Show(exceptionMessage);
            }
        }
        public override void Install(IDictionary stateSaver)
        {
            System.Windows.Forms.DialogResult result;
            string exceptionMessage = "";

            if (this.Context.Parameters["Mode"].ToUpper() == "SQL")
            {
                SqlSettingsForm form = new SqlSettingsForm();
                result           = form.ShowDialog();
                exceptionMessage = form.ExceptionMessage;
            }
            else if (this.Context.Parameters["Mode"].ToUpper() == "SERVICE")
            {
                ServiceSettingsForm form = new ServiceSettingsForm();
                result           = form.ShowDialog();
                exceptionMessage = form.ExceptionMessage;
            }
            else if (this.Context.Parameters["Mode"].ToUpper() == "WEB")
            {
                WebSettingsForm form = new WebSettingsForm();
                result           = form.ShowDialog();
                exceptionMessage = form.ExceptionMessage;
            }
            else
            {
                throw new InstallException("Unknown install mode");
            }


            if (result == System.Windows.Forms.DialogResult.Abort)
            {
                throw new InstallException(exceptionMessage);
            }

            base.Install(stateSaver);
        }