浏览代码

made View.LineCanvas read only and non-virtual

Tigger Kindel 1 年之前
父节点
当前提交
6efad45145
共有 2 个文件被更改,包括 14 次插入14 次删除
  1. 13 13
      Terminal.Gui/ConsoleDrivers/WindowsDriver.cs
  2. 1 1
      Terminal.Gui/View/ViewDrawing.cs

+ 13 - 13
Terminal.Gui/ConsoleDrivers/WindowsDriver.cs

@@ -1736,7 +1736,7 @@ internal class WindowsDriver : ConsoleDriver {
 		if (_mainLoop != null) {
 		if (_mainLoop != null) {
 			_mainLoop.ProcessInput -= ProcessInput;
 			_mainLoop.ProcessInput -= ProcessInput;
 			_mainLoop.WinChanged -= ChangeWin;
 			_mainLoop.WinChanged -= ChangeWin;
-			_mainLoop.Dispose ();
+			//_mainLoop.Dispose ();
 		}
 		}
 		_mainLoop = null;
 		_mainLoop = null;
 		
 		
@@ -1764,7 +1764,7 @@ internal class WindowsDriver : ConsoleDriver {
 /// <remarks>
 /// <remarks>
 /// This implementation is used for WindowsDriver.
 /// This implementation is used for WindowsDriver.
 /// </remarks>
 /// </remarks>
-internal class WindowsMainLoop : IMainLoopDriver, IDisposable {
+internal class WindowsMainLoop : IMainLoopDriver {
 	ManualResetEventSlim _eventReady = new ManualResetEventSlim (false);
 	ManualResetEventSlim _eventReady = new ManualResetEventSlim (false);
 	ManualResetEventSlim _waitForProbe = new ManualResetEventSlim (false);
 	ManualResetEventSlim _waitForProbe = new ManualResetEventSlim (false);
 	ManualResetEventSlim _winChange = new ManualResetEventSlim (false);
 	ManualResetEventSlim _winChange = new ManualResetEventSlim (false);
@@ -1911,17 +1911,17 @@ internal class WindowsMainLoop : IMainLoopDriver, IDisposable {
 			WinChanged?.Invoke (this, new SizeChangedEventArgs (_windowSize));
 			WinChanged?.Invoke (this, new SizeChangedEventArgs (_windowSize));
 		}
 		}
 	}
 	}
-	public void Dispose ()
-	{
-		_eventReadyTokenSource?.Cancel ();
-		_eventReadyTokenSource?.Dispose ();
-		_eventReady?.Dispose ();
-
-		_mainLoop = null;
-		_winChange?.Dispose ();
-		_waitForProbe?.Dispose ();
-
-	}
+	
+	//public void Dispose ()
+	//{
+	//	_eventReadyTokenSource?.Cancel ();
+	//	_eventReadyTokenSource?.Dispose ();
+	//	_eventReady?.Dispose ();
+
+	//	_mainLoop = null;
+	//	_winChange?.Dispose ();
+	//	_waitForProbe?.Dispose ();
+	//}
 }
 }
 
 
 class WindowsClipboard : ClipboardBase {
 class WindowsClipboard : ClipboardBase {

+ 1 - 1
Terminal.Gui/View/ViewDrawing.cs

@@ -288,7 +288,7 @@ namespace Terminal.Gui {
 		/// The canvas that any line drawing that is to be shared by subviews of this view should add lines to.
 		/// The canvas that any line drawing that is to be shared by subviews of this view should add lines to.
 		/// </summary>
 		/// </summary>
 		/// <remarks><see cref="Border"/> adds border lines to this LineCanvas.</remarks>
 		/// <remarks><see cref="Border"/> adds border lines to this LineCanvas.</remarks>
-		public virtual LineCanvas LineCanvas { get; internal set; } = new LineCanvas ();
+		public LineCanvas LineCanvas { get; } = new LineCanvas ();
 
 
 		/// <summary>
 		/// <summary>
 		/// Gets or sets whether this View will use it's SuperView's <see cref="LineCanvas"/> for
 		/// Gets or sets whether this View will use it's SuperView's <see cref="LineCanvas"/> for