mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
code clean up
This commit is contained in:
@@ -1,32 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using mRemoteNG.Controls;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Extensions.Forms;
|
||||
using System.Windows.Forms;
|
||||
using NUnit.Framework;
|
||||
using ListView = mRemoteNG.UI.Controls.ListView;
|
||||
|
||||
namespace mRemoteNGTests.UI.Controls
|
||||
{
|
||||
public class CustomListViewTests
|
||||
{
|
||||
mRemoteNG.Controls.ListView _listView;
|
||||
ListView _listView;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_listView = new mRemoteNG.Controls.ListView();
|
||||
_listView.Name = "myTestListView";
|
||||
_listView.View = System.Windows.Forms.View.Tile;
|
||||
_listView = new ListView
|
||||
{
|
||||
Name = "myTestListView",
|
||||
View = System.Windows.Forms.View.Tile
|
||||
};
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void Teardown()
|
||||
{
|
||||
_listView.Dispose();
|
||||
while (_listView.Disposing) ;
|
||||
while (_listView.Disposing)
|
||||
{
|
||||
}
|
||||
_listView = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.ComponentModel;
|
||||
|
||||
|
||||
namespace mRemoteNG.Controls
|
||||
namespace mRemoteNG.UI.Controls
|
||||
{
|
||||
public class ListView : System.Windows.Forms.ListView
|
||||
{
|
||||
Brush foreColorBrush = null;
|
||||
Brush backColorBrush = null;
|
||||
Pen borderPen = null;
|
||||
Brush foreColorBrush;
|
||||
Brush backColorBrush;
|
||||
Pen borderPen;
|
||||
|
||||
#region Public Properties
|
||||
[Category("Appearance"), DefaultValue(typeof(Color), "HighlightText")]
|
||||
@@ -172,12 +171,9 @@ namespace mRemoteNG.Controls
|
||||
|
||||
private void DisposeBrushesAndPens()
|
||||
{
|
||||
if (foreColorBrush != null)
|
||||
foreColorBrush.Dispose();
|
||||
if (backColorBrush != null)
|
||||
backColorBrush.Dispose();
|
||||
if (borderPen != null)
|
||||
borderPen.Dispose();
|
||||
foreColorBrush?.Dispose();
|
||||
backColorBrush?.Dispose();
|
||||
borderPen?.Dispose();
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -210,14 +206,14 @@ namespace mRemoteNG.Controls
|
||||
format.Alignment = StringAlignment.Far;
|
||||
break;
|
||||
}
|
||||
|
||||
if (RightToLeft.ToString() != null)
|
||||
format.FormatFlags = (StringFormatFlags) (format.FormatFlags | StringFormatFlags.DirectionRightToLeft);
|
||||
|
||||
if (RightToLeftLayout)
|
||||
format.FormatFlags = format.FormatFlags | StringFormatFlags.DirectionRightToLeft;
|
||||
|
||||
if (LabelWrap)
|
||||
format.FormatFlags = (StringFormatFlags) (format.FormatFlags & ~StringFormatFlags.NoWrap);
|
||||
format.FormatFlags = format.FormatFlags & ~StringFormatFlags.NoWrap;
|
||||
else
|
||||
format.FormatFlags = (StringFormatFlags) (format.FormatFlags | StringFormatFlags.NoWrap);
|
||||
format.FormatFlags = format.FormatFlags | StringFormatFlags.NoWrap;
|
||||
|
||||
return format;
|
||||
}
|
||||
@@ -258,7 +254,7 @@ namespace mRemoteNG.Controls
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}, {1}", Vertical, Horizontal);
|
||||
return $"{Vertical}, {Horizontal}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user