private Label BuildTitle(InfraAdapter component) { Label lblTitle = new Label(); lblTitle.BackColor = Color.Transparent; lblTitle.Top = 5; lblTitle.Left = 31; lblTitle.Text = component.Name; lblTitle.AutoSize = false; lblTitle.Width = 80; lblTitle.ForeColor = Color.White; lblTitle.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); return(lblTitle); }
private void _viewInfraEdit_OnComponentSave(object o) { InfraAdapter ic = (InfraAdapter)o; if (o != null) { if (_infraFarm.Adapters.Where(c => c.Id.Equals(ic.Id)).Count() != 0) { _infraFarm.Adapters.Remove(_infraFarm.Adapters.Where(c => c.Id.Equals(ic.Id)).FirstOrDefault()); } _infraFarm.Adapters.Add(ic); } _tsm.RefreshData(this); LaunchInfraSetting(); }
private UserControlCustom BuildPanel(InfraAdapter component, Label lblTitle, PictureBox pb, List <Point> points, Component cpn) { UserControlCustom p = new UserControlCustom(); p.Width = 100; p.Height = 100; p.Top = points[_intInfra.InfraFarm.Adapters.IndexOf(component)].Y - OFFSETY; p.Left = points[_intInfra.InfraFarm.Adapters.IndexOf(component)].X - OFFSETX; p.BackgroundImage = component.Online ? Properties.Resources.component : Properties.Resources.componentOffline; p.Controls.Add(lblTitle); p.Controls.Add(pb); p.Controls.Add(cpn); p.Name = component.Name; return(p); }
private UserControlCustom AddComponent(InfraAdapter component, List <Point> points) { UserControlCustom ucc; Label lblTitle; PictureBox pb; Component c; component.RefreshStatus(); lblTitle = BuildTitle(component); pb = BuildPictureBox(component); c = BuildComponent(component); ucc = BuildPanel(component, lblTitle, pb, points, c); component.Panel = ucc; return(ucc); }
private System.Drawing.Image GetImage(InfraAdapter component) { switch (component.Techno.ToString()) { case "BITBUCKET": return(Properties.Resources.bitbucket); case "DOCKER": return(Properties.Resources.docker); case "GITHUB": return(Properties.Resources.github); case "JENKINS": return(Properties.Resources.jenkins); case "JIRA": return(Properties.Resources.jira); case "MYSQL": return(Properties.Resources.mysql2); case "OPENVPN": return(Properties.Resources.VPN); case "POSTGRE": return(Properties.Resources.postgresql); case "SERVER": return(Properties.Resources.Serveur); case "SONARQUBE": return(Properties.Resources.sonar); case "TEAMCITY": return(Properties.Resources.teamcity); case "YOUTRACK": return(Properties.Resources.youtrack); default: return(Properties.Resources.unknown); } }
public void AddInfra(string type, string name = null, string url = null) { if (string.IsNullOrEmpty(type)) { return; } InfraAdapter ia = null; switch (type.ToLower()) { case "server": ia = new ComputerAdapter(this); break; case "sonarqube": ia = new SonarAdapter(this); break; case "sql": ia = new SqlAdapter(this); break; //case "vpn": // ia = _openvpnAdapter; // break; //case "docker": // ia = _dockerAdapter; // break; case "team city": ia = new TeamCityAdapter(this); break; case "bitbucket": ia = new BitbucketAdapter(this); break; case "postgresql": ia = new PostGreAdapter(this); break; case "syncany": ia = new SyncanyAdapter(this); break; default: break; } if (ia != null) { try { ia.Name = name != null ? name : ia.GetType().ToString().Split('.')[ia.GetType().ToString().Split('.').Length - 1].Replace("Adapter", string.Empty); ia.Url = url; InfraFarm.Add(ia); //GoAction("Infra_Save"); } catch (Exception e) { } } }
private Component BuildComponent(InfraAdapter component) { Component c; switch (component.GetType().ToString()) { case "Droid.Infra.BitbucketAdapter": c = new ComponentBitbucket(component as BitbucketAdapter); break; case "Droid.Infra.ComputerAdapter": c = new ComponentComputer((ComputerAdapter)_intInfra.InfraFarm.GetAdapter(AdapterType.ComputerAdapter)); break; case "Droid.Infra.DockerAdapter": c = new ComponentDocker((DockerAdapter)_intInfra.InfraFarm.GetAdapter(AdapterType.DockerAdapter)); break; case "Droid.Infra.GitHubAdapter": c = new ComponentGithub(); break; case "Droid.Infra.JenkinsAdapter": c = new ComponentJenkins(); break; case "Droid.Infra.JiraAdapter": c = new ComponentJira(); break; case "Droid.Infra.ServiceAdapter": c = new Component(); break; case "Droid.Infra.SonarAdapter": c = new ComponentSonar(); break; case "Droid.Infra.SqlAdapter": c = new ComponentSql(); break; case "Droid.Infra.SyncanyAdapter": c = new ComponentSyncany(); break; case "Droid.Infra.PostGreAdapter": c = new ComponentPostGre(); break; case "Droid.Infra.TeamCityAdapter": c = new ComponentTeamCity(); break; case "Droid.Infra.OpenVpnAdapter": c = new ComponentVPN((OpenVpnAdapterUI)_intInfra.InfraFarm.GetAdapter(AdapterType.OpenVpnAdapter)); break; default: c = new Component(); break; } c.Name = component.GetType().ToString(); c.Top = 31; c.Left = 1; return(c); }
private PictureBox BuildPictureBox(InfraAdapter component) { PictureBox pb = new PictureBox(); pb.Top = 5; pb.Left = 5; switch (component.GetType().ToString()) { case "Droid.Infra.BitbucketAdapter": pb.BackgroundImage = Properties.Resources.bitbucket; break; case "Droid.Infra.ComputerAdapter": pb.BackgroundImage = Properties.Resources.Serveur; break; case "Droid.Infra.DockerAdapter": pb.BackgroundImage = Properties.Resources.docker; break; case "Droid.Infra.GitHubAdapter": pb.BackgroundImage = Properties.Resources.github; break; case "Droid.Infra.JenkinsAdapter": pb.BackgroundImage = Properties.Resources.jenkins; break; case "Droid.Infra.JiraAdapter": pb.BackgroundImage = Properties.Resources.jira; break; case "Droid.Infra.ServiceAdapter": pb.BackgroundImage = Properties.Resources.Serveur; break; case "Droid.Infra.SonarAdapter": pb.BackgroundImage = Properties.Resources.sonar; break; case "Droid.Infra.SqlAdapter": pb.BackgroundImage = Properties.Resources.SQL; break; case "Droid.Infra.SyncanyAdapter": pb.BackgroundImage = Properties.Resources.syncany; break; case "Droid.Infra.TeamCityAdapter": pb.BackgroundImage = Properties.Resources.teamcity; break; case "Droid.Infra.PostGreAdapter": pb.BackgroundImage = Properties.Resources.postgresql; break; default: pb.BackgroundImage = Properties.Resources.unknown; break; } pb.BackgroundImageLayout = ImageLayout.Zoom; pb.Width = 22; pb.Height = 22; return(pb); }
private void Save() { switch (comboBoxInfra.SelectedItem.ToString()) { case "BITBUCKET": _currentAdapter = new BitbucketAdapter(_intInfra); break; case "DOCKER": _currentAdapter = new DockerAdapter(_intInfra); break; case "GITHUB": _currentAdapter = new GitHubAdapter(_intInfra); break; case "JENKINS": _currentAdapter = new JenkinsAdapter(_intInfra); break; case "JIRA": _currentAdapter = new JiraAdapter(_intInfra); break; case "MYSQL": _currentAdapter = new MysqlAdapter(_intInfra); break; case "OPENVPN": _currentAdapter = new OpenVpnAdapterUI(_intInfra); break; case "POSTGRE": _currentAdapter = new PostGreAdapter(_intInfra); break; case "SERVER": _currentAdapter = new ComputerAdapter(_intInfra); break; case "SONARQUBE": _currentAdapter = new SonarAdapter(_intInfra); break; case "TEAMCITY": _currentAdapter = new TeamCityAdapter(_intInfra); break; case "YOUTRACK": _currentAdapter = new YoutrackAdapter(_intInfra); break; default: //_currentAdapter = new InfraAdapter(); break; } _currentAdapter.Domain = textBoxDomain.Text; _currentAdapter.Login = textBoxLogin.Text; _currentAdapter.Password = textBoxPassword.Text; _currentAdapter.Token = textBoxToken.Text; _currentAdapter.Name = textBoxName.Text; _currentAdapter.Ip = textBoxIp.Text; _currentAdapter.Port = textBoxPort.Text; _currentAdapter.Env = (InfraAdapter.ENV)Enum.Parse(typeof(InfraAdapter.ENV), comboBoxEnv.Text); _currentAdapter.Techno = (InfraAdapter.TECHNO)Enum.Parse(typeof(InfraAdapter.TECHNO), comboBoxInfra.Text); OnComponentSave?.Invoke(_currentAdapter); }