57 lines
1.4 KiB
C#
57 lines
1.4 KiB
C#
using Remontor.Connector;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Remontor
|
|
{
|
|
internal partial class BarButtonControl : UserControl
|
|
{
|
|
Connect connect = null;
|
|
Color Background;
|
|
public BarButtonControl()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
public BarButtonControl(Connect connect, bool backColor)
|
|
{
|
|
InitializeComponent();
|
|
if(backColor) this.BackColor = Color.Gainsboro;
|
|
this.connect = connect;
|
|
NameBtn.Text = connect.toString();
|
|
this.Width = NameBtn.Width + 32;
|
|
Background = this.BackColor;
|
|
connect.Update += UpdateAct;
|
|
}
|
|
|
|
private void UpdateAct()
|
|
{
|
|
if (connect.ActiveOn)
|
|
{
|
|
this.BackColor = SystemColors.ActiveCaption;
|
|
}
|
|
else
|
|
{
|
|
this.BackColor = Background;
|
|
}
|
|
}
|
|
|
|
|
|
private void NameBtn_Click(object sender, EventArgs e)
|
|
{
|
|
SConnector.Activ(connect);
|
|
}
|
|
|
|
private void CloseBtn_Click(object sender, EventArgs e)
|
|
{
|
|
SConnector.DeleteConnect(connect);
|
|
}
|
|
}
|
|
}
|