71 lines
1.9 KiB
C#
71 lines
1.9 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.Resources;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Remontor
|
|
{
|
|
internal partial class BarSessionControl : UserControl
|
|
{
|
|
public delegate bool HideWors();
|
|
public HideWors hideWors;
|
|
public List<BarButtonControl> buttons;
|
|
|
|
public BarSessionControl()
|
|
{
|
|
InitializeComponent();
|
|
SConnector.Update += UpdateBar;
|
|
buttons = new List<BarButtonControl>();
|
|
}
|
|
|
|
public void UpdateBar(List<Connect> connects)
|
|
{
|
|
bool GreyBackground = false;
|
|
buttons.Clear();
|
|
FlowButton.Controls.Clear();
|
|
foreach (var item in connects)
|
|
{
|
|
BarButtonControl button = new BarButtonControl(item, GreyBackground);
|
|
buttons.Add(button);
|
|
GreyBackground = !GreyBackground;
|
|
FlowButton.Controls.Add(button);
|
|
}
|
|
|
|
FlowButton.Controls.Add(NewBtn);
|
|
}
|
|
|
|
|
|
|
|
private void ShowBar_Click(object sender, EventArgs e)
|
|
{
|
|
if (!hideWors())
|
|
{
|
|
ShowBar.BackgroundImage = global::Remontor.Properties.Resources.
|
|
down_min11;
|
|
}
|
|
else
|
|
{
|
|
ShowBar.BackgroundImage = global::Remontor.Properties.Resources.up_min1;
|
|
}
|
|
}
|
|
|
|
private void NewBtn_Click(object sender, EventArgs e)
|
|
{
|
|
Finder.Finder finder = new Finder.Finder();
|
|
finder.ShowDialog();
|
|
}
|
|
|
|
private void FlowButton_ControlRemoved(object sender, ControlEventArgs e)
|
|
{
|
|
if(e.Control is BarButtonControl) e.Control.Dispose();
|
|
}
|
|
}
|
|
}
|