public SLRuntimeLogic(SLWebApiClient slWebApiClient, SLRuntimeApiClient slRuntimeApiClient, ALMApiClient almApiClient, string almDomain, string almProject) { this.slWebApiClient = slWebApiClient; this.slRuntimeApiClient = slRuntimeApiClient; this.slRuntimeApiClient.OnWebsocketOpened += new EventHandler <EventArgs>(OnWebsocketOpened); this.slRuntimeApiClient.OnWebsocketMessage += new EventHandler <SLRuntimeEventArgs>(OnWebsocketMessage); this.slRuntimeApiClient.OnWebsocketError += new EventHandler <SLExceptionEventArgs>(OnWebsocketError); this.slRuntimeApiClient.OnWebsocketClosed += new EventHandler <EventArgs>(OnWebsocketClosed); this.almApiClient = almApiClient; this.almDomain = almDomain; this.almProject = almProject; string assemblyFolderPath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); cDatabaseFolderPath = assemblyFolderPath + @"\Database\"; cReadmeFilePath = assemblyFolderPath + @"\Readme\Readme.txt"; }
private void ThreadStart() { try { string almServerUrl = null; string almUser = null; string almPassword = null; almServerUrl = Configuration.ReadAlmUrl(); Configuration.ReadAlmUserAndPassword(out almUser, out almPassword); Configuration.ReadALMDomainAndProject(out almDomain, out almProject); almApiClient = new ALMApiClient(almServerUrl, almUser, almPassword); string proxyUrl = Configuration.ReadProxyUrl(); string slWebApiToken = Configuration.ReadApiTokenFromFile(); slWebApiClient = new SLWebApiClient(slWebApiToken, proxyUrl); if (proxyUrl != null) { slRuntimeApiClient = new SLRuntimeApiClient(slWebApiToken, proxyUrl, "", ""); } else { slRuntimeApiClient = new SLRuntimeApiClient(slWebApiToken); } slLogic = new SLLogic(slWebApiClient, almApiClient); slRuntimeLogic = new SLRuntimeLogic(slWebApiClient, slRuntimeApiClient, almApiClient, almDomain, almProject); string emailServer = null; string emailUser = null; string emailPassword = null; string emailFolderPath = null; emailServer = Configuration.ReadEmailServer(); Configuration.ReadEmailUserAndPassword(out emailUser, out emailPassword); emailFolderPath = Configuration.ReadEmailFolderPath(); bsLogic = new BSLogic(slWebApiClient, emailServer, emailUser, emailPassword, true, emailFolderPath); string commitFolderPath = Configuration.ReadCommitFolderPath(); commitLogic = new CommitLogic(slWebApiClient, emailServer, emailUser, emailPassword, true, commitFolderPath); commitFileLogic = new CommitFileLogic(slWebApiClient, emailServer, emailUser, emailPassword, true, commitFolderPath); almTickCounter = 0; almPullInterval = Configuration.ReadAlmPullInterval(); almTimer = new System.Timers.Timer(cTimerInterval); almTimer.Elapsed += new ElapsedEventHandler(OnAlmTimerTick); almTimer.Enabled = true; almTimer.Start(); emailTickCounter = 0; emailPullInterval = Configuration.ReadEmailPullInterval(); emailTimer = new System.Timers.Timer(cTimerInterval); emailTimer.Elapsed += new ElapsedEventHandler(OnEmailTimerTick); emailTimer.Enabled = true; emailTimer.Start(); } catch (Exception ex) { System.IO.File.WriteAllText(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + @"\" + "dump.txt", ex.Message); } }
public Form1() { InitializeComponent(); this.Text = "Slack/QC integration"; button = new Button(); button.Location = new Point(10, 10); button.Size = new Size(470, 30); button.Text = "Get Slack groups and channels. After press - see " + cSlGroupsFilePath + " and " + cSlChannelsFilePath; button.Click += new EventHandler(OnSendButtonClick); this.Controls.Add(button); almProgressBar = new ProgressBar(); almProgressBar.Location = new Point(10, 100); almProgressBar.Size = new Size(515, 30); almProgressBar.Minimum = 0; almProgressBar.Maximum = 100; this.Controls.Add(almProgressBar); almProgressLabel = new Label(); almProgressLabel.Location = new Point(10, 130); almProgressLabel.Size = new Size(100, 15); almProgressLabel.Text = "0"; this.Controls.Add(almProgressLabel); slWebsocketStatusLabel = new Label(); slWebsocketStatusLabel.Location = new Point(540, 100); slWebsocketStatusLabel.Size = new Size(30, 30); slWebsocketStatusLabel.BackColor = Color.Red; this.Controls.Add(slWebsocketStatusLabel); emailProgressBar = new ProgressBar(); emailProgressBar.Location = new Point(10, 150); emailProgressBar.Size = new Size(515, 30); emailProgressBar.Minimum = 0; emailProgressBar.Maximum = 100; this.Controls.Add(emailProgressBar); emailProgressLabel = new Label(); emailProgressLabel.Location = new Point(10, 180); emailProgressLabel.Size = new Size(100, 30); emailProgressLabel.Text = "0"; this.Controls.Add(emailProgressLabel); string almServerUrl = null; string almUser = null; string almPassword = null; almServerUrl = Configuration.ReadAlmUrl(); Configuration.ReadAlmUserAndPassword(out almUser, out almPassword); Configuration.ReadALMDomainAndProject(out almDomain, out almProject); almApiClient = new ALMApiClient(almServerUrl, almUser, almPassword); string proxyUrl = Configuration.ReadProxyUrl(); string slWebApiToken = Configuration.ReadApiTokenFromFile(); slWebApiClient = new SLWebApiClient(slWebApiToken, proxyUrl); if (proxyUrl != null) { slRuntimeApiClient = new SLRuntimeApiClient(slWebApiToken, proxyUrl, "", ""); } else { slRuntimeApiClient = new SLRuntimeApiClient(slWebApiToken); } slLogic = new SLLogic(slWebApiClient, almApiClient); slRuntimeLogic = new SLRuntimeLogic(slWebApiClient, slRuntimeApiClient, almApiClient, almDomain, almProject); string emailServer = null; string emailUser = null; string emailPassword = null; string emailFolderPath = null; emailServer = Configuration.ReadEmailServer(); Configuration.ReadEmailUserAndPassword(out emailUser, out emailPassword); emailFolderPath = Configuration.ReadEmailFolderPath(); bsLogic = new BSLogic(slWebApiClient, emailServer, emailUser, emailPassword, true, emailFolderPath); string commitFolderPath = Configuration.ReadCommitFolderPath(); commitLogic = new CommitLogic(slWebApiClient, emailServer, emailUser, emailPassword, true, commitFolderPath); commitFileLogic = new CommitFileLogic(slWebApiClient, emailServer, emailUser, emailPassword, true, commitFolderPath); almTickCounter = 0; almPullInterval = Configuration.ReadAlmPullInterval(); almTimer = new System.Timers.Timer(cTimerInterval); almTimer.Elapsed += new ElapsedEventHandler(OnAlmTimerTick); almTimer.Start(); emailTickCounter = 0; emailPullInterval = Configuration.ReadEmailPullInterval(); emailTimer = new System.Timers.Timer(cTimerInterval); emailTimer.Elapsed += new ElapsedEventHandler(OnEmailTimerTick); emailTimer.Start(); }