浏览代码

Move Example into a separate directory

miguel 7 年之前
父节点
当前提交
4043be102c
共有 4 个文件被更改,包括 5 次插入280 次删除
  1. 4 0
      Example/packages.config
  2. 0 52
      Terminal.csproj
  3. 1 1
      Terminal.sln
  4. 0 227
      demo.cs

+ 4 - 0
Example/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="NStack.Core" version="0.11.0" targetFramework="net461" />
+</packages>

+ 0 - 52
Terminal.csproj

@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
-    <ProjectGuid>{B0A602CD-E176-449D-8663-64238D54F857}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>Terminal</RootNamespace>
-    <AssemblyName>Terminal</AssemblyName>
-    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG;</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ExternalConsole>true</ExternalConsole>
-    <PlatformTarget>x86</PlatformTarget>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <DocumentationFile>bin\Release\Terminal.xml</DocumentationFile>
-    <ExternalConsole>true</ExternalConsole>
-    <PlatformTarget>x86</PlatformTarget>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="NStack">
-      <HintPath>packages\NStack.Core.0.8.0\lib\netstandard1.5\NStack.dll</HintPath>
-      <Private>False</Private>
-    </Reference>
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="demo.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="Terminal.Gui\Terminal.Gui.csproj">
-      <Project>{00F366F8-DEE4-482C-B9FD-6DB0200B79E5}</Project>
-      <Name>Terminal.Gui</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="packages.config" />
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-</Project>

+ 1 - 1
Terminal.sln

@@ -1,7 +1,7 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio 2012
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Terminal", "Terminal.csproj", "{B0A602CD-E176-449D-8663-64238D54F857}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example\Example", "Example\Example.csproj", "{B0A602CD-E176-449D-8663-64238D54F857}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Terminal.Gui", "Terminal.Gui\Terminal.Gui.csproj", "{00F366F8-DEE4-482C-B9FD-6DB0200B79E5}"
 EndProject

+ 0 - 227
demo.cs

@@ -1,227 +0,0 @@
-using Terminal.Gui;
-using System;
-using Mono.Terminal;
-
-static class Demo {
-	class Box10x : View {
-		public Box10x (int x, int y) : base (new Rect (x, y, 10, 10))
-		{
-		}
-
-		public override void Redraw (Rect region)
-		{
-			Driver.SetAttribute (ColorScheme.Focus);
-
-			for (int y = 0; y < 10; y++) {
-				Move (0, y);
-				for (int x = 0; x < 10; x++) {
-
-					Driver.AddRune ((Rune)('0' + (x + y) % 10));
-				}
-			}
-
-		}
-	}
-
-	class Filler : View {
-		public Filler (Rect rect) : base (rect)
-		{
-		}
-
-		public override void Redraw (Rect region)
-		{
-			Driver.SetAttribute (ColorScheme.Focus);
-			var f = Frame;
-
-			for (int y = 0; y < f.Width; y++) {
-				Move (0, y);
-				for (int x = 0; x < f.Height; x++) {
-					Rune r;
-					switch (x % 3) {
-					case 0:
-						r = '.';
-						break;
-					case 1:
-						r = 'o';
-						break;
-					default:
-						r = 'O';
-						break;
-					}
-					Driver.AddRune (r);
-				}
-			}
-		}
-	}
-
-
-	static void ShowTextAlignments (View container)
-	{
-		container.Add (
-			new Label (new Rect (0, 0, 40, 3), "1-Hello world, how are you doing today") { TextAlignment = TextAlignment.Left },
-			new Label (new Rect (0, 4, 40, 3), "2-Hello world, how are you doing today") { TextAlignment = TextAlignment.Right },
-			new Label (new Rect (0, 8, 40, 3), "3-Hello world, how are you doing today") { TextAlignment = TextAlignment.Centered },
-			new Label (new Rect (0, 12, 40, 3), "4-Hello world, how are you doing today") { TextAlignment = TextAlignment.Justified });
-	}
-
-	static void ShowEntries (View container)
-	{
-		var scrollView = new ScrollView (new Rect (50, 10, 20, 8)) {
-			ContentSize = new Size (100, 100),
-			ContentOffset = new Point (-1, -1),
-			ShowVerticalScrollIndicator = true,
-			ShowHorizontalScrollIndicator = true
-		};
-
-		scrollView.Add (new Box10x (0, 0));
-		//scrollView.Add (new Filler (new Rect (0, 0, 40, 40)));
-
-		// This is just to debug the visuals of the scrollview when small
-		var scrollView2 = new ScrollView (new Rect (72, 10, 3, 3)) {
-			ContentSize = new Size (100, 100),
-			ShowVerticalScrollIndicator = true,
-			ShowHorizontalScrollIndicator = true
-		};
-		scrollView2.Add (new Box10x (0, 0));
-		var progress = new ProgressBar (new Rect (68, 1, 10, 1));
-		bool timer (MainLoop caller)
-		{
-			progress.Pulse ();
-			return true;
-		}
-
-		Application.MainLoop.AddTimeout (TimeSpan.FromMilliseconds (300), timer);
-
-		// Add some content
-		container.Add (
-			new Label (3, 6, "Login: "),
-			new TextField (14, 6, 40, ""),
-			new Label (3, 8, "Password: "),
-			new TextField (14, 8, 40, "") { Secret = true },
-			new FrameView (new Rect (3, 10, 25, 6), "Options"){
-				new CheckBox (1, 0, "Remember me"),
-				new RadioGroup (1, 2, new [] { "_Personal", "_Company" }),
-			},
-			new ListView (new Rect (60, 6, 16, 4), new string [] {
-				"First row",
-				"<>",
-				"This is a very long row that should overflow what is shown",
-				"4th",
-				"There is an empty slot on the second row",
-				"Whoa",
-				"This is so cool"
-			}),
-			scrollView,
-			//scrollView2,
-			new Button (3, 19, "Ok"),
-			new Button (10, 19, "Cancel"),
-			progress,
-			new Label (3, 22, "Press ESC and 9 to activate the menubar")
-		);
-
-	}
-
-	public static Label ml2;
-
-	static void NewFile ()
-	{
-		var d = new Dialog (
-			"New File", 50, 20,
-			new Button ("Ok", is_default: true) { Clicked = () => { Application.RequestStop (); } },
-			new Button ("Cancel") { Clicked = () => { Application.RequestStop (); } });
-		ml2 = new Label (1, 1, "Mouse Debug Line");
-		d.Add (ml2);
-		Application.Run (d);
-	}
-
-	// 
-	// Creates a nested editor
-	static void Editor (Toplevel top)
-	{
-		var tframe = top.Frame;
-		var ntop = new Toplevel (tframe);
-		var menu = new MenuBar (new MenuBarItem [] {
-			new MenuBarItem ("_File", new MenuItem [] {
-				new MenuItem ("_Close", "", () => {Application.RequestStop ();}),
-			}),
-			new MenuBarItem ("_Edit", new MenuItem [] {
-				new MenuItem ("_Copy", "", null),
-				new MenuItem ("C_ut", "", null),
-				new MenuItem ("_Paste", "", null)
-			}),
-		});
-		ntop.Add (menu);
-
-		var win = new Window (new Rect (0, 1, tframe.Width, tframe.Height - 1), "/etc/passwd");
-		ntop.Add (win);
-
-		var text = new TextView (new Rect (0, 0, tframe.Width - 2, tframe.Height - 3));
-		text.Text = System.IO.File.ReadAllText ("/etc/passwd");
-		win.Add (text);
-
-		Application.Run (ntop);
-	}
-
-	static bool Quit ()
-	{
-		var n = MessageBox.Query (50, 7, "Quit Demo", "Are you sure you want to quit this demo?", "Yes", "No");
-		return n == 0;
-	}
-
-	static void Close ()
-	{
-		MessageBox.ErrorQuery (50, 5, "Error", "There is nothing to close", "Ok");
-	}
-
-	// Watch what happens when I try to introduce a newline after the first open brace
-	// it introduces a new brace instead, and does not indent.  Then watch me fight
-	// the editor as more oddities happen.
-
-	public static void Open ()
-	{
-		var d = new OpenDialog ("Open", "Open a file");
-		Application.Run (d);
-	}
-
-	public static Label ml;
-	static void Main ()
-	{
-		//Application.UseSystemConsole = true;
-		Application.Init ();
-
-		var top = Application.Top;
-		var tframe = top.Frame;
-
-		var win = new Window (new Rect (0, 1, tframe.Width, tframe.Height-1), "Hello");
-		var menu = new MenuBar (new MenuBarItem [] {
-			new MenuBarItem ("_File", new MenuItem [] {
-				new MenuItem ("Text Editor Demo", "", () => { Editor (top); }),
-				new MenuItem ("_New", "Creates new file", NewFile),
-				new MenuItem ("_Open", "", Open),
-				new MenuItem ("_Close", "", () => Close ()),
-				new MenuItem ("_Quit", "", () => { if (Quit ()) top.Running = false; })
-			}),
-			new MenuBarItem ("_Edit", new MenuItem [] {
-				new MenuItem ("_Copy", "", null),
-				new MenuItem ("C_ut", "", null),
-				new MenuItem ("_Paste", "", null)
-			}),
-		});
-
-		ShowEntries (win);
-
-		int count = 0;
-		ml = new Label (new Rect (3, 17, 47, 1), "Mouse: ");
-		Application.RootMouseEvent += delegate (MouseEvent me) {
-
-			ml.Text = $"Mouse: ({me.X},{me.Y}) - {me.Flags} {count++}";
-		};
-
-		win.Add (ml);
-
-		// ShowTextAlignments (win);
-		top.Add (win);
-		top.Add (menu);
-		Application.Run ();
-	}
-}