mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
moved the setup of the name column to its own class
This commit is contained in:
@@ -61,14 +61,7 @@ namespace mRemoteNG.UI.Controls
|
||||
|
||||
private void CreateNameColumn()
|
||||
{
|
||||
_olvNameColumn = new OLVColumn
|
||||
{
|
||||
AspectName = "Name",
|
||||
FillsFreeSpace = true,
|
||||
IsButton = true,
|
||||
AspectGetter = item => ((ConnectionInfo)item).Name,
|
||||
ImageGetter = ConnectionImageGetter
|
||||
};
|
||||
_olvNameColumn = new NameColumn();
|
||||
Columns.Add(_olvNameColumn);
|
||||
AllColumns.Add(_olvNameColumn);
|
||||
}
|
||||
@@ -116,16 +109,6 @@ namespace mRemoteNG.UI.Controls
|
||||
//ContextMenuStrip = _contextMenu;
|
||||
}
|
||||
|
||||
private static object ConnectionImageGetter(object rowObject)
|
||||
{
|
||||
if (rowObject is RootPuttySessionsNodeInfo) return "PuttySessions";
|
||||
if (rowObject is RootNodeInfo) return "Root";
|
||||
if (rowObject is ContainerInfo) return "Folder";
|
||||
var connection = rowObject as ConnectionInfo;
|
||||
if (connection == null) return "";
|
||||
return connection.OpenConnections.Count > 0 ? "Play" : "Pause";
|
||||
}
|
||||
|
||||
private void SetupDropSink()
|
||||
{
|
||||
DropSink = new SimpleDropSink
|
||||
|
||||
30
mRemoteV1/UI/Controls/NameColumn.cs
Normal file
30
mRemoteV1/UI/Controls/NameColumn.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using BrightIdeasSoftware;
|
||||
using mRemoteNG.Connection;
|
||||
using mRemoteNG.Container;
|
||||
using mRemoteNG.Tree.Root;
|
||||
|
||||
|
||||
namespace mRemoteNG.UI.Controls
|
||||
{
|
||||
public class NameColumn : OLVColumn
|
||||
{
|
||||
public NameColumn()
|
||||
{
|
||||
AspectName = "Name";
|
||||
FillsFreeSpace = true;
|
||||
IsButton = true;
|
||||
AspectGetter = item => ((ConnectionInfo) item).Name;
|
||||
ImageGetter = ConnectionImageGetter;
|
||||
}
|
||||
|
||||
private static object ConnectionImageGetter(object rowObject)
|
||||
{
|
||||
if (rowObject is RootPuttySessionsNodeInfo) return "PuttySessions";
|
||||
if (rowObject is RootNodeInfo) return "Root";
|
||||
if (rowObject is ContainerInfo) return "Folder";
|
||||
var connection = rowObject as ConnectionInfo;
|
||||
if (connection == null) return "";
|
||||
return connection.OpenConnections.Count > 0 ? "Play" : "Pause";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -237,6 +237,9 @@
|
||||
<Compile Include="UI\Controls\IPTextBox.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\Controls\NameColumn.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\Controls\QuickConnectComboBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
||||
Reference in New Issue
Block a user