53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.IO;
|
|||
|
using System.Linq;
|
|||
|
using System.Net;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace NetTunnelApp
|
|||
|
{
|
|||
|
internal class WgCfgMenuItems
|
|||
|
{
|
|||
|
private static string _selItems = "";
|
|||
|
|
|||
|
private List<ToolStripMenuItem> _menuItems = new List<ToolStripMenuItem>();
|
|||
|
|
|||
|
public WgCfgMenuItems(List<FilePath> wgCfgArrays)
|
|||
|
{
|
|||
|
if (_menuItems.Count > 0)
|
|||
|
{
|
|||
|
_menuItems.Clear();
|
|||
|
}
|
|||
|
|
|||
|
foreach (var cfg in wgCfgArrays)
|
|||
|
{
|
|||
|
ToolStripMenuItem item = new ToolStripMenuItem();
|
|||
|
|
|||
|
item.Text = Path.GetFileName(cfg.CfgPath);
|
|||
|
item.Name = cfg.CfgPath;
|
|||
|
item.Click += delegate(object sender, EventArgs e)
|
|||
|
{
|
|||
|
var control = (ToolStripMenuItem)sender;
|
|||
|
_selItems = control.Name;
|
|||
|
|
|||
|
foreach (var v in _menuItems)
|
|||
|
{
|
|||
|
v.Checked = (_selItems == v.Name);
|
|||
|
}
|
|||
|
};
|
|||
|
|
|||
|
item.Checked = cfg.curUsed > 0;
|
|||
|
_menuItems.Add(item);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public List<ToolStripMenuItem> GetMenuItems()
|
|||
|
{
|
|||
|
return _menuItems;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|