diff --git a/Directory.Build.props b/Directory.Build.props
deleted file mode 100644
index a389e5f941..0000000000
--- a/Directory.Build.props
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Directory.Build.targets b/Directory.Build.targets
deleted file mode 100644
index 79faf752f2..0000000000
--- a/Directory.Build.targets
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- $(DefineConstants);DIMAUTO
-
-
\ No newline at end of file
diff --git a/Example/Example.cs b/Example/Example.cs
index 630e6560ff..13c7b9138b 100644
--- a/Example/Example.cs
+++ b/Example/Example.cs
@@ -6,19 +6,19 @@
using System;
using Terminal.Gui;
-var app = Application.Run ();
-
-Console.WriteLine ($"Username: {app.UserNameText.Text}");
-
-app.Dispose ();
+Application.Run ().Dispose ();
// Before the application exits, reset Terminal.Gui for clean shutdown
Application.Shutdown ();
+// To see this output on the screen it must be done after shutdown,
+// which restores the previous screen.
+Console.WriteLine ($@"Username: {ExampleWindow.UserName}");
+
// Defines a top-level window with border and title
public class ExampleWindow : Window
{
- public TextField UserNameText;
+ public static string UserName;
public ExampleWindow ()
{
@@ -27,7 +27,7 @@ public ExampleWindow ()
// Create input components and labels
var usernameLabel = new Label { Text = "Username:" };
- UserNameText = new TextField
+ var userNameText = new TextField
{
// Position text field adjacent to the label
X = Pos.Right (usernameLabel) + 1,
@@ -46,7 +46,7 @@ public ExampleWindow ()
Secret = true,
// align with the text box above
- X = Pos.Left (UserNameText),
+ X = Pos.Left (userNameText),
Y = Pos.Top (passwordLabel),
Width = Dim.Fill ()
};
@@ -64,19 +64,20 @@ public ExampleWindow ()
// When login button is clicked display a message popup
btnLogin.Accept += (s, e) =>
- {
- if (UserNameText.Text == "admin" && passwordText.Text == "password")
- {
- MessageBox.Query ("Logging In", "Login Successful", "Ok");
- Application.RequestStop ();
- }
- else
- {
- MessageBox.ErrorQuery ("Logging In", "Incorrect username or password", "Ok");
- }
- };
+ {
+ if (userNameText.Text == "admin" && passwordText.Text == "password")
+ {
+ MessageBox.Query ("Logging In", "Login Successful", "Ok");
+ UserName = userNameText.Text;
+ Application.RequestStop ();
+ }
+ else
+ {
+ MessageBox.ErrorQuery ("Logging In", "Incorrect username or password", "Ok");
+ }
+ };
// Add the views to the Window
- Add (usernameLabel, UserNameText, passwordLabel, passwordText, btnLogin);
+ Add (usernameLabel, userNameText, passwordLabel, passwordText, btnLogin);
}
}
diff --git a/FSharpExample/FSharpExample.fsproj b/FSharpExample/FSharpExample.fsproj
index 57b4cc7c00..82b2802e5d 100644
--- a/FSharpExample/FSharpExample.fsproj
+++ b/FSharpExample/FSharpExample.fsproj
@@ -13,4 +13,7 @@
+
+
+
\ No newline at end of file
diff --git a/FSharpExample/Program.fs b/FSharpExample/Program.fs
index bfeaef2ed7..88d801f04f 100644
--- a/FSharpExample/Program.fs
+++ b/FSharpExample/Program.fs
@@ -1,454 +1,48 @@
-open System
-open System.Diagnostics
-open System.Globalization
-open System.IO
-open NStack
-open Terminal.Gui
+open Terminal.Gui
-let ustr (x: string) = ustring.Make(x)
-let mutable ml2 = Unchecked.defaultof