Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Squashed commit of the following: #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"cSpell.enableFiletypes": [
"COBOL",
"Log",
"aspnetcorerazor",
"bat",
"bibtex",
"buildtarget",
"clojure",
"cmake",
"cmake-cache",
"code-runner-output",
"code-text-binary",
"coffeescript",
"cpp_embedded_latex",
"cuda-cpp",
"dart",
"diff",
"django-html",
"django-txt",
"dockercompose",
"dockerfile",
"dotnet-interactive",
"dotnet-interactive.csharp",
"dotnet-interactive.fsharp",
"dotnet-interactive.html",
"dotnet-interactive.javascript",
"dotnet-interactive.kql",
"dotnet-interactive.magic-commands",
"dotnet-interactive.markdown",
"dotnet-interactive.mermaid",
"dotnet-interactive.pwsh",
"dotnet-interactive.sql",
"editorconfig",
"eex",
"elfcode",
"fsharp",
"git-rebase",
"go.mod",
"go.sum",
"go.work",
"gotmpl",
"groovy",
"hack",
"hlsl",
"html-eex",
"ignore",
"ini",
"javap",
"javap-verbose",
"jinja",
"jsx-tags",
"julia",
"juliamarkdown",
"lldb.disassembly",
"log",
"lua",
"makefile",
"markdown-math",
"markdown_latex_combined",
"microprofile-properties",
"nft",
"niosii",
"objective-c",
"objective-cpp",
"perl",
"perl6",
"pip-requirements",
"powershell",
"properties",
"quarkus-properties",
"qute-html",
"qute-json",
"qute-txt",
"qute-yaml",
"r",
"raw",
"razor",
"ros.msg",
"ruby",
"search-result",
"shaderlab",
"shellscript",
"sql",
"tasty",
"tex",
"toml",
"vb",
"xml",
"xquery",
"xsl"
],
"cSpell.language": "en,en-US,en-GB,lorem"
}
138 changes: 0 additions & 138 deletions README.md

This file was deleted.

57 changes: 54 additions & 3 deletions WindowsHacks/OtherFunctions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -99,12 +99,63 @@ public static void Hide()
{
IntPtr hWnd = GetFocusedWindow();
Window.Hide(hWnd);
HidenWindows.Add((Window.GetTitle(hWnd), hWnd));
Console.WriteLine(@"You can reshow it by select 'Show'(20.Show).");
}

//Need to install Nuget Package "System.ValueTuple"
static List<(string, IntPtr)> HidenWindows = new List<(string, IntPtr)>();

public static void Show()
{
IntPtr hWnd = GetFocusedWindow();
Window.Show(hWnd);
try
{
//There is an error in the past version.That method need to show the hiden window,
//but a window cannot be selected when its hiden.
//IntPtr hWnd = GetFocusedWindow();
(string, IntPtr) hide = GetHidenWindow();
//Using Window.Show(IntPtr) will let thw window turn to the smallest size.
//I don't know why it happens or how to deal with it.
Window.Show(hide.Item2);
HidenWindows.Remove(hide);
}
catch (ArgumentException a)
{
if (a.Message == "InvalidInput")
{
return;
}
else
throw;
}
}

private static (string, IntPtr) GetHidenWindow()
{
if (HidenWindows.Count > 0)
{
Console.WriteLine("-----------------------------SELECT WINDOW-----------------------------");
for (int i = 0; i < HidenWindows.Count; i++)
{
Console.WriteLine("{0}.{1}", i + 1, HidenWindows[i].Item1);
}
Console.Write("Input:");
bool canindex = int.TryParse(Console.ReadLine(), out int index);
if (canindex)
{
return HidenWindows[index - 1];
}
else
{
Console.WriteLine("Invalid Input.");
throw new ArgumentException("InvalidInput");
}
}
else
{
Console.WriteLine("No hiden windows.");
throw new ArgumentException("InvalidInput");
}
}

public static void FlipLeft()
Expand Down
1 change: 1 addition & 0 deletions WindowsHacks/tempCodeRunnerFile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ex