⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmain.cs

📁 LLBLGen 1.21 Sourcecode
💻 CS
📖 第 1 页 / 共 3 页
字号:
				m_lgGenerator.bNETIncludeJITSupport = chkNET_IncludeJITSupport.Checked;
				m_lgGenerator.bNETIncludeLoadBalancingSupport = chkNET_IncludeLoadBalancingSupport.Checked;
				m_lgGenerator.bNETIncludeNullValueSupport = chkNET_IncludeNullValueSupport.Checked;
				m_lgGenerator.bNETIncludeTransactionSupport = chkNET_IncludeTransactionSupport.Checked;
				m_lgGenerator.bNETIncludeObjectPoolingSupport = chkNET_IncludeObjectPoolingSupport.Checked;
				m_lgGenerator.bNETIncludeConnectionProviderSupport = chkNET_IncludeConnectionProviderSupport.Checked;
				m_lgGenerator.bNETPrefixProperties = chkNET_PrefixProperties.Checked;
				m_lgGenerator.bNETStyleHungarian = rbtNET_StyleHungarian.Checked;
				m_lgGenerator.bSPGenerateDeleteSPs = chkSP_GenerateDeleteSPs.Checked;
				m_lgGenerator.bSPGenerateInsertSPs = chkSP_GenerateInsertSPs.Checked;
				m_lgGenerator.bSPGenerateSelectAllSPs = chkSP_GenerateSelectAllSPs.Checked;
				m_lgGenerator.bSPGenerateSelectSPs = chkSP_GenerateSelectSPs.Checked;
				m_lgGenerator.bSPGenerateUpdateSPs = chkSP_GenerateUpdateSPs.Checked;
				m_lgGenerator.bSPIncludeComments = chkSP_IncludeSPComments.Checked;
				m_lgGenerator.bSPIncludeDrops = chkSP_IncludeDrops.Checked;
				m_lgGenerator.bSPIncludeErrorCodeSupport = chkSP_IncludeErrorCodeSupport.Checked;
				m_lgGenerator.bSPIncludeNoCountStatements = chkSP_IncludeNoCountStatements.Checked;
				m_lgGenerator.bSPPrefixParams = chkSP_PrefixParams.Checked;
				m_lgGenerator.bSPUseFieldListSelectClause = rbtSP_UseFieldListSelectClause.Checked;
				m_lgGenerator.sNETClassPrefix = tbxNET_ClassPrefix.Text.Trim();
				m_lgGenerator.sNETNamespace = tbxNET_Namespace.Text.Trim();
				m_lgGenerator.sSPNamePrefix = tbxSP_SPPrefix.Text.Trim();
				m_lgGenerator.sSQLCatalog = tbxC_Catalog.Text.Trim();
				m_lgGenerator.sNETOutputPath = tbxG_NETOutputPath.Text.Trim();
				m_lgGenerator.sSPOutputPath = tbxG_SPOutputPath.Text.Trim();
				m_lgGenerator.sAppVersion = m_sAppVersion;
				
				if(rbtNET_ConnectionStringRetrieval_AppConfig.Checked)
				{
					m_lgGenerator.iNETConnectionStringRetrieval = (int)eConnectionStringRetrieval.AppConfig;
				}
				if(rbtNET_ConnectionStringRetrieval_COMPlus.Checked)
				{
					m_lgGenerator.iNETConnectionStringRetrieval = (int)eConnectionStringRetrieval.ConstructionString;
				}
				if(rbtNET_ConnectionStringRetrieval_Property.Checked)
				{
					m_lgGenerator.iNETConnectionStringRetrieval = (int)eConnectionStringRetrieval.Property;
				}
				m_lgGenerator.iNETOutputLanguage = cbxNET_OutputLanguage.SelectedIndex;

				// for each checked table, add it to the generator's table list.
				foreach(ListViewItem lvItem in lvT_Tables.CheckedItems)
				{
					m_lgGenerator.AddTable(lvItem.Text, (eSQLObjectType)lvItem.Tag);
				}
				
				// for each checked excluded field, add it to the generator's excluded field list
				foreach(ListViewItem lvItem in lvSP_ExcludedFields.CheckedItems)
				{
					m_lgGenerator.AddExcludedField(lvItem.Text);
				}
				
				// Start the generation
				bool bResult = m_lgGenerator.StartCodeGeneration();
				
				if(!bResult)
				{
					// not succeeded.
					throw new Exception("frmMain::StartCodeGeneration::Code generation failed.");
				}
				// All done.
			}
			catch(Exception ex)
			{
				// View exception
				frmException wExceptionViewer = new frmException(ex);
				wExceptionViewer.ShowDialog();
			}
			finally
			{
				// All done. Enable buttons
				btnG_Close.Enabled=true;
				btnG_Start.Enabled=true;
				
				// call cleanup routine in Generator
				m_lgGenerator.CleanUp();
			}
		}

		
		/// <summary>
		/// Purpose: Adds a single line to the feedback textarea.
		/// </summary>
		/// <param name="sLineToAdd">Line that will be added</param>
		public void AddLineToFeedback(string sLineToAdd)
		{
			tbxG_Feedback.Text += sLineToAdd + Environment.NewLine;
			// select last char to scroll down.
			tbxG_Feedback.SelectionStart = tbxG_Feedback.Text.Length;
			tbxG_Feedback.SelectionLength = 0;
			tbxG_Feedback.ScrollToCaret();
			Application.DoEvents();
		}

		
		/// <summary>
		/// Purpose: Sets the value of the progressbar.
		/// </summary>
		/// <param name="iValue">The value the progressbar should have. Keep this value between 0 and 100</param>
		public void SetProgressBarValue(short iValue)
		{
			m_siProgressPct=iValue;
			tbxG_OverallPct.Text = m_siProgressPct.ToString() + " %";
			pbG_Main.Value=iValue;
			Application.DoEvents();
		}


		/// <summary>
		/// Purpose: Sets the current table name in the feedback area
		/// </summary>
		/// <param name="sCurrentTable">Name of the table</param>
		public void SetCurrentTableInFeedback(string sCurrentTable)
		{
			tbxG_CurrentTable.Text = sCurrentTable;
			Application.DoEvents();
		}

		
		/// <summary>
		/// Purpose: initialize the progresscontrols.
		/// </summary>
		private void InitProgressControls()
		{
			pbG_Main.Maximum=100;
			pbG_Main.Minimum=0;
			pbG_Main.Value=0;
			m_siProgressPct=0;
			tbxG_OverallPct.Text = m_siProgressPct.ToString() + " %";
			Application.DoEvents();
		}


		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}


		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain));
			this.sbMain = new System.Windows.Forms.StatusBar();
			this.sbpServer = new System.Windows.Forms.StatusBarPanel();
			this.sbpCatalog = new System.Windows.Forms.StatusBarPanel();
			this.sbpCopyright = new System.Windows.Forms.StatusBarPanel();
			this.tclMain = new System.Windows.Forms.TabControl();
			this.tbpConnection = new System.Windows.Forms.TabPage();
			this.grpConnection = new System.Windows.Forms.GroupBox();
			this.btnC_Disconnect = new System.Windows.Forms.Button();
			this.btnC_Connect = new System.Windows.Forms.Button();
			this.label11 = new System.Windows.Forms.Label();
			this.tbxC_Catalog = new System.Windows.Forms.TextBox();
			this.grpC_SQLServerCredentials = new System.Windows.Forms.GroupBox();
			this.tbxC_Password = new System.Windows.Forms.TextBox();
			this.tbxC_LoginID = new System.Windows.Forms.TextBox();
			this.label12 = new System.Windows.Forms.Label();
			this.label13 = new System.Windows.Forms.Label();
			this.rbtC_SQLAuthentication = new System.Windows.Forms.RadioButton();
			this.rbtC_WindowsAuthentication = new System.Windows.Forms.RadioButton();
			this.label14 = new System.Windows.Forms.Label();
			this.tbxC_Server = new System.Windows.Forms.TextBox();
			this.tbpTables = new System.Windows.Forms.TabPage();
			this.grpTablesViews = new System.Windows.Forms.GroupBox();
			this.btnT_ToggleSelected = new System.Windows.Forms.Button();
			this.label15 = new System.Windows.Forms.Label();
			this.lvT_Tables = new System.Windows.Forms.ListView();
			this.lvcT_TableHeader = new System.Windows.Forms.ColumnHeader();
			this.lvcT_TableTypeHeader = new System.Windows.Forms.ColumnHeader();
			this.tbpNETParams = new System.Windows.Forms.TabPage();
			this.grpNETCode = new System.Windows.Forms.GroupBox();
			this.chkNET_IncludeConnectionProviderSupport = new System.Windows.Forms.CheckBox();
			this.cbxNET_OutputLanguage = new System.Windows.Forms.ComboBox();
			this.label17 = new System.Windows.Forms.Label();
			this.groupBox4 = new System.Windows.Forms.GroupBox();
			this.rbtNET_ConnectionStringRetrieval_COMPlus = new System.Windows.Forms.RadioButton();
			this.rbtNET_ConnectionStringRetrieval_Property = new System.Windows.Forms.RadioButton();
			this.rbtNET_ConnectionStringRetrieval_AppConfig = new System.Windows.Forms.RadioButton();
			this.chkNET_IncludeCOMPlusSupport = new System.Windows.Forms.CheckBox();
			this.chkNET_IncludeNullValueSupport = new System.Windows.Forms.CheckBox();
			this.grpNET_COMPlusOptions = new System.Windows.Forms.GroupBox();
			this.chkNET_IncludeTransactionSupport = new System.Windows.Forms.CheckBox();
			this.chkNET_IncludeObjectPoolingSupport = new System.Windows.Forms.CheckBox();
			this.chkNET_IncludeLoadBalancingSupport = new System.Windows.Forms.CheckBox();
			this.chkNET_IncludeJITSupport = new System.Windows.Forms.CheckBox();
			this.chkNET_IncludeAutoComplete = new System.Windows.Forms.CheckBox();
			this.tbxNET_ClassPrefix = new System.Windows.Forms.TextBox();
			this.label9 = new System.Windows.Forms.Label();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.chkNET_PrefixProperties = new System.Windows.Forms.CheckBox();
			this.rbtNET_StyleHungarian = new System.Windows.Forms.RadioButton();
			this.rbtNET_StyleMicrosoft = new System.Windows.Forms.RadioButton();
			this.chkNET_IncludeCSComments = new System.Windows.Forms.CheckBox();
			this.tbxNET_Namespace = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.tbpSPParams = new System.Windows.Forms.TabPage();
			this.grpTSQLCode = new System.Windows.Forms.GroupBox();
			this.groupBox9 = new System.Windows.Forms.GroupBox();
			this.lvSP_ExcludedFields = new System.Windows.Forms.ListView();
			this.lvcSP_FieldName = new System.Windows.Forms.ColumnHeader();
			this.lvcSP_FieldType = new System.Windows.Forms.ColumnHeader();
			this.label10 = new System.Windows.Forms.Label();
			this.btnSP_RefreshExcludedFieldsList = new System.Windows.Forms.Button();
			this.btnSP_ToggleSelected = new System.Windows.Forms.Button();
			this.groupBox3 = new System.Windows.Forms.GroupBox();
			this.rbtSP_UseFieldListSelectClause = new System.Windows.Forms.RadioButton();
			this.rbtSP_UseAsterixSelectClause = new System.Windows.Forms.RadioButton();
			this.chkSP_IncludeNoCountStatements = new System.Windows.Forms.CheckBox();
			this.tbxSP_SPPrefix = new System.Windows.Forms.TextBox();
			this.label6 = new System.Windows.Forms.Label();
			this.chkSP_GenerateSelectAllSPs = new System.Windows.Forms.CheckBox();
			this.chkSP_PrefixParams = new System.Windows.Forms.CheckBox();
			this.chkSP_GenerateDeleteSPs = new System.Windows.Forms.CheckBox();
			this.chkSP_GenerateInsertSPs = new System.Windows.Forms.CheckBox();
			this.chkSP_GenerateUpdateSPs = new System.Windows.Forms.CheckBox();
			this.chkSP_GenerateSelectSPs = new System.Windows.Forms.CheckBox();
			this.chkSP_IncludeSPComments = new System.Windows.Forms.CheckBox();
			this.chkSP_IncludeDrops = new System.Windows.Forms.CheckBox();
			this.chkSP_IncludeErrorCodeSupport = new System.Windows.Forms.CheckBox();
			this.tbpGenerator = new System.Windows.Forms.TabPage();
			this.btnG_About = new System.Windows.Forms.Button();
			this.btnG_Close = new System.Windows.Forms.Button();
			this.grpGenerator_Progress = new System.Windows.Forms.GroupBox();
			this.tbxG_OverallPct = new System.Windows.Forms.TextBox();
			this.tbxG_CurrentTable = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.tbxG_Feedback = new System.Windows.Forms.TextBox();
			this.label3 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.pbG_Main = new System.Windows.Forms.ProgressBar();
			this.btnG_Start = new System.Windows.Forms.Button();
			this.grpGenerator_Params = new System.Windows.Forms.GroupBox();
			this.label16 = new System.Windows.Forms.Label();
			this.btnG_BrowseForSPPath = new System.Windows.Forms.Button();
			this.btnG_BrowseForNETPath = new System.Windows.Forms.Button();
			this.tbxG_SPOutputPath = new System.Windows.Forms.TextBox();
			this.tbxG_NETOutputPath = new System.Windows.Forms.TextBox();
			this.label8 = new System.Windows.Forms.Label();
			this.label7 = new System.Windows.Forms.Label();
			((System.ComponentModel.ISupportInitialize)(this.sbpServer)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.sbpCatalog)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.sbpCopyright)).BeginInit();
			this.tclMain.SuspendLayout();
			this.tbpConnection.SuspendLayout();
			this.grpConnection.SuspendLayout();
			this.grpC_SQLServerCredentials.SuspendLayout();
			this.tbpTables.SuspendLayout();
			this.grpTablesViews.SuspendLayout();
			this.tbpNETParams.SuspendLayout();
			this.grpNETCode.SuspendLayout();
			this.groupBox4.SuspendLayout();
			this.grpNET_COMPlusOptions.SuspendLayout();
			this.groupBox1.SuspendLayout();
			this.tbpSPParams.SuspendLayout();
			this.grpTSQLCode.SuspendLayout();
			this.groupBox9.SuspendLayout();
			this.groupBox3.SuspendLayout();
			this.tbpGenerator.SuspendLayout();
			this.grpGenerator_Progress.SuspendLayout();
			this.grpGenerator_Params.SuspendLayout();
			this.SuspendLayout();
			// 
			// sbMain
			// 
			this.sbMain.Location = new System.Drawing.Point(0, 458);
			this.sbMain.Name = "sbMain";
			this.sbMain.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
																					  this.sbpServer,
																					  this.sbpCatalog,
																					  this.sbpCopyright});
			this.sbMain.ShowPanels = true;
			this.sbMain.Size = new System.Drawing.Size(547, 22);
			this.sbMain.TabIndex = 1;
			// 
			// sbpServer
			// 
			this.sbpServer.Text = "Not Connected";
			// 
			// sbpCatalog
			// 
			this.sbpCatalog.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
			this.sbpCatalog.Text = "No Catalog";
			this.sbpCatalog.Width = 71;
			// 
			// sbpCopyright
			// 
			this.sbpCopyright.Alignment = System.Windows.Forms.HorizontalAlignment.Right;
			this.sbpCopyright.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
			this.sbpCopyright.BorderStyle = System.Windows.Forms.StatusBarPanelBorderStyle.None;
			this.sbpCopyright.Text = "

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -