mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
moved the setup of the tree image list to its own class
This commit is contained in:
@@ -53,7 +53,6 @@ namespace mRemoteNG.UI.Controls
|
||||
{
|
||||
CreateNameColumn();
|
||||
CreateImageList();
|
||||
FillImageList();
|
||||
LinkModelToView();
|
||||
SetupDropSink();
|
||||
SetEventHandlers();
|
||||
@@ -68,34 +67,7 @@ namespace mRemoteNG.UI.Controls
|
||||
|
||||
private void CreateImageList()
|
||||
{
|
||||
_imgListTree = new ImageList(components)
|
||||
{
|
||||
ColorDepth = ColorDepth.Depth32Bit,
|
||||
ImageSize = new System.Drawing.Size(16, 16),
|
||||
TransparentColor = System.Drawing.Color.Transparent
|
||||
};
|
||||
SmallImageList = _imgListTree;
|
||||
}
|
||||
|
||||
private void FillImageList()
|
||||
{
|
||||
try
|
||||
{
|
||||
_imgListTree.Images.Add(Resources.Root);
|
||||
_imgListTree.Images.SetKeyName(0, "Root");
|
||||
_imgListTree.Images.Add(Resources.Folder);
|
||||
_imgListTree.Images.SetKeyName(1, "Folder");
|
||||
_imgListTree.Images.Add(Resources.Play);
|
||||
_imgListTree.Images.SetKeyName(2, "Play");
|
||||
_imgListTree.Images.Add(Resources.Pause);
|
||||
_imgListTree.Images.SetKeyName(3, "Pause");
|
||||
_imgListTree.Images.Add(Resources.PuttySessions);
|
||||
_imgListTree.Images.SetKeyName(4, "PuttySessions");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionStackTrace("FillImageList (UI.Window.ConnectionTreeWindow) failed", ex);
|
||||
}
|
||||
SmallImageList = StatusImageList.GetImageList();
|
||||
}
|
||||
|
||||
private void LinkModelToView()
|
||||
|
||||
43
mRemoteV1/UI/Controls/StatusImageList.cs
Normal file
43
mRemoteV1/UI/Controls/StatusImageList.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using mRemoteNG.App;
|
||||
|
||||
|
||||
namespace mRemoteNG.UI.Controls
|
||||
{
|
||||
public class StatusImageList
|
||||
{
|
||||
public static ImageList GetImageList()
|
||||
{
|
||||
var imageList = new ImageList
|
||||
{
|
||||
ColorDepth = ColorDepth.Depth32Bit,
|
||||
ImageSize = new System.Drawing.Size(16, 16),
|
||||
TransparentColor = System.Drawing.Color.Transparent
|
||||
};
|
||||
FillImageList(imageList);
|
||||
return imageList;
|
||||
}
|
||||
|
||||
private static void FillImageList(ImageList imageList)
|
||||
{
|
||||
try
|
||||
{
|
||||
imageList.Images.Add(Resources.Root);
|
||||
imageList.Images.SetKeyName(0, "Root");
|
||||
imageList.Images.Add(Resources.Folder);
|
||||
imageList.Images.SetKeyName(1, "Folder");
|
||||
imageList.Images.Add(Resources.Play);
|
||||
imageList.Images.SetKeyName(2, "Play");
|
||||
imageList.Images.Add(Resources.Pause);
|
||||
imageList.Images.SetKeyName(3, "Pause");
|
||||
imageList.Images.Add(Resources.PuttySessions);
|
||||
imageList.Images.SetKeyName(4, "PuttySessions");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Runtime.MessageCollector.AddExceptionStackTrace($"Unable to fill the image list of type {nameof(StatusImageList)}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,6 +243,7 @@
|
||||
<Compile Include="UI\Controls\QuickConnectComboBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\Controls\StatusImageList.cs" />
|
||||
<Compile Include="UI\Controls\ToolStripSplitButton.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
||||
Reference in New Issue
Block a user