private void btnConnectAgent_Click(object sender, EventArgs e) { var agentInfo = new EtlAgentInfo { EtlAgentType = cmbEtlAgentType.Text.Trim(), ConnectionString = txtConnectionString.Text.Trim(), SchemaName = txtSchemaName.Text.Trim(), }; IEtlAgent agent; var exc = TryCreateAgent(agentInfo, out agent); if (exc != null) { MessageForm.ShowMessage(MessageFormType.Error, exc.Message, "Cannot connect to ETL agent", new ExceptionInfo(exc), MessageBoxButtons.OK); } else { if (agent is ILocalEtlAgent) { _agentInfo = agentInfo; _agent = (ILocalEtlAgent)agent; SaveEtlAgentSettings(_agentInfo); LoadPackages(); UpdateButtons(); if (this.Connected != null) { this.Connected(this, EventArgs.Empty); } } else { MessageForm.ShowMessage(MessageFormType.Information, "This ETL agent does not supported", "Cannot connect to ETL agent", null, MessageBoxButtons.OK); } } }
public void Show(ILocalEtlAgent agent, EtlAgentInfo agentInfo, string packageId) { if (agent == null) { throw new ArgumentNullException("agent"); } if (agentInfo == null) { throw new ArgumentNullException("agentInfo"); } if (packageId == null) { throw new ArgumentNullException("packageId"); } _agent = agent; _agentInfo = agentInfo; _packageId = packageId; EtlPackage package; var exc = TryGetPackage(_packageId, out package); if (exc != null) { MessageForm.ShowMessage(MessageFormType.Error, exc.Message, "Cannot open package", new ExceptionInfo(exc), MessageBoxButtons.OK); } else { _currentPackage = package; UpdateButtons(); ResetLogView(); ShowCurrentPackage(); this.Show(); } }