Skip to content

Commit

Permalink
Add documentation. Allow to self-define hot key.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hedaozi committed Jul 6, 2021
1 parent 418152d commit fd10af1
Show file tree
Hide file tree
Showing 6 changed files with 440 additions and 24 deletions.
76 changes: 76 additions & 0 deletions QucikScreenShot/Documentation/Documentation.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Documentation of Quick-ScreenShot &vert; Quick-ScreenShot&#x6587;&#x6863;</title>
<style>
</style>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Microsoft/vscode/extensions/markdown-language-features/media/markdown.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Microsoft/vscode/extensions/markdown-language-features/media/highlight.css">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif;
font-size: 14px;
line-height: 1.6;
}
</style>
<style>
.task-list-item { list-style-type: none; } .task-list-item-checkbox { margin-left: -20px; vertical-align: middle; }
</style>



</head>
<body class="vscode-body vscode-light">
<h1 id="documentation-of-quick-screenshot--quick-screenshot文档">Documentation of Quick-ScreenShot | Quick-ScreenShot文档</h1>
<p>Quick-ScreenShot is a desktop application allows user to get screenshot quickly and save it automatically.</p>
<p>Quick-ScreenShot是允许用户快速获取截屏并自动保存的桌面应用。</p>
<h2 id="basic-usage--基本使用">Basic Usage | 基本使用</h2>
<ol>
<li>
<p>Click &quot;Start&quot; button.</p>
</li>
<li>
<p>While need to get a screenshot, press Ctrl+Alt+A and the screenshot will be catched and saved.</p>
</li>
<li>
<p>Click &quot;Stop&quot; button to stop.</p>
</li>
<li>
<p>Click &quot;Open&quot; button to show the screenshots.</p>
</li>
<li>
<p>点击“Start”按钮。</p>
</li>
<li>
<p>当需要截屏时,同时按下Ctrl+Alt+A。</p>
</li>
<li>
<p>点击“Stop”按钮停止自动捕获。</p>
</li>
<li>
<p>点击“Open”按钮打开文件存储的位置。</p>
</li>
</ol>
<h2 id="advanced-usage--进阶使用">Advanced Usage | 进阶使用</h2>
<ol>
<li>
<p>Click &quot;Select&quot; to change the save floder.</p>
</li>
<li>
<p>Choose hot keys. Remember that you can choose at most 3 keys and end your combination key with a non-modifier key (keys except Ctrl, Shift, Alt). And you can only set 1 non-modifier key.</p>
</li>
<li>
<p>点击“Select”按钮改变存储文件夹。</p>
</li>
<li>
<p>选择热键。用户最多可设置由3个键组成的组合键。组合键必须以非修改键(Ctrl、Shift、Alt以外的键)结束,且组合键只能包含1个非修改键。</p>
</li>
</ol>
<h2 id="about--关于">About | 关于</h2>
<p>This tools is developed by He Lingfeng. View source at <a href="https://github.com/Hedaozi/Quick-ScreenShot">https://github.com/Hedaozi/Quick-ScreenShot</a>. Click &quot;View&quot; button to open the web page in your default browser.</p>
<p>本工具由何凌锋开发。在https://github.com/Hedaozi/Quick-ScreenShot 可以查看源代码。点击“View”按钮即可在默认浏览器中打开该网页。</p>

</body>
</html>
31 changes: 31 additions & 0 deletions QucikScreenShot/Documentation/Documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Documentation of Quick-ScreenShot | Quick-ScreenShot文档

Quick-ScreenShot is a desktop application allows user to get screenshot quickly and save it automatically.

Quick-ScreenShot是允许用户快速获取截屏并自动保存的桌面应用。

## Basic Usage | 基本使用

1. Click "Start" button.
2. While need to get a screenshot, press Ctrl+Alt+A and the screenshot will be catched and saved.
3. Click "Stop" button to stop.
4. Click "Open" button to show the screenshots.

1. 点击“Start”按钮。
2. 当需要截屏时,同时按下Ctrl+Alt+A。
3. 点击“Stop”按钮停止自动捕获。
4. 点击“Open”按钮打开文件存储的位置。

## Advanced Usage | 进阶使用

1. Click "Select" to change the save floder.
2. Choose hot keys. Remember that you can choose at most 3 keys and end your combination key with a non-modifier key (keys except Ctrl, Shift, Alt). And you can only set 1 non-modifier key.

1. 点击“Select”按钮改变存储文件夹。
2. 选择热键。用户最多可设置由3个键组成的组合键。组合键必须以非修改键(Ctrl、Shift、Alt以外的键)结束,且组合键只能包含1个非修改键。

## About | 关于

This tools is developed by He Lingfeng. View source at https://github.com/Hedaozi/Quick-ScreenShot. Click "View" button to open the web page in your default browser.

本工具由何凌锋开发。在https://github.com/Hedaozi/Quick-ScreenShot 可以查看源代码。点击“View”按钮即可在默认浏览器中打开该网页。
184 changes: 184 additions & 0 deletions QucikScreenShot/HotKey.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
using System;
using System.Windows;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QucikScreenShot
{
public partial class MainWindow : Window
{
static class HotKey
{
public static readonly Dictionary<string, Keys> ModifierKeys =
new Dictionary<string, Keys>()
{
{ "Ctrl", Keys.Control },
{ "Alt", Keys.Alt },
{ "Shift", Keys.Shift }
};

public static readonly Dictionary<string, Keys> FunctionKeys =
new Dictionary<string, Keys>()
{
{ "F1", Keys.F1 },
{ "F2", Keys.F2 },
{ "F3", Keys.F3 },
{ "F4", Keys.F4 },
{ "F5", Keys.F5 },
{ "F6", Keys.F6 },
{ "F7", Keys.F7 },
{ "F8", Keys.F8 },
{ "F9", Keys.F9 },
{ "F10", Keys.F10 },
{ "F11", Keys.F11 },
{ "F12", Keys.F12 },
{ "Esc", Keys.Escape },
{ "Print Screen", Keys.PrintScreen },
{ "Scroll Lock", Keys.Scroll },
{ "Pause", Keys.Pause },
{ "Insert", Keys.Insert },
{ "Home", Keys.Home },
{ "End", Keys.End },
{ "Delete", Keys.Delete },
{ "Page Up", Keys.PageUp },
{ "Page Down", Keys.PageDown },
{ "Num Lock", Keys.NumLock },
{ "Caps Lock", Keys.CapsLock },
{ "Tab", Keys.Tab }
};

public static readonly Dictionary<string, Keys> LetterKeys =
new Dictionary<string, Keys>()
{
{ "Q", Keys.Q },
{ "W", Keys.W },
{ "E", Keys.E },
{ "R", Keys.R },
{ "T", Keys.T },
{ "Y", Keys.Y },
{ "U", Keys.U },
{ "I", Keys.I },
{ "O", Keys.O },
{ "P", Keys.P },
{ "A", Keys.A },
{ "S", Keys.S },
{ "D", Keys.D },
{ "F", Keys.F },
{ "G", Keys.G },
{ "H", Keys.H },
{ "J", Keys.J },
{ "K", Keys.K },
{ "L", Keys.L },
{ "Z", Keys.Z },
{ "X", Keys.X },
{ "C", Keys.C },
{ "V", Keys.V },
{ "B", Keys.B },
{ "N", Keys.N },
{ "M", Keys.M }
};

public static readonly Dictionary<string, Keys> NumberKeys =
new Dictionary<string, Keys>()
{
{ "1", Keys.D1 },
{ "2", Keys.D2 },
{ "3", Keys.D3 },
{ "4", Keys.D4 },
{ "5", Keys.D5 },
{ "6", Keys.D6 },
{ "7", Keys.D7 },
{ "8", Keys.D8 },
{ "9", Keys.D9 },
{ "0", Keys.D0 }
};

public static readonly Dictionary<string, Keys> SymbolKeys =
new Dictionary<string, Keys>()
{
{ "`", Keys.Oemtilde },
//{ "-", Keys.Subtract }, // cannot
//{ "=", Keys.Add }, // cannot
{ "{", Keys.OemOpenBrackets },
{ "}", Keys.OemCloseBrackets },
//{ "\\", Keys.OemBackslash }, // cannot
{ ";", Keys.OemSemicolon },
{ "'", Keys.OemQuotes },
{ ",", Keys.Oemcomma },
{ ".", Keys.OemPeriod }//,
//{ "/", Keys.D8 } // cannot
};

public static readonly Dictionary<string, Keys> SpecialKeys =
new Dictionary<string, Keys>()
{
{ "BackSpace", Keys.Back },
{ "Enter", Keys.Enter },
{ "SpaceBar", Keys.Space }
};

public static Keys StringToKeys(string keyName)
{
if (ModifierKeys.ContainsKey(keyName))
{
return ModifierKeys[keyName];
}
else if (FunctionKeys.ContainsKey(keyName))
{
return FunctionKeys[keyName];
}
else if (LetterKeys.ContainsKey(keyName))
{
return LetterKeys[keyName];
}
else if (NumberKeys.ContainsKey(keyName))
{
return NumberKeys[keyName];
}
else if (SymbolKeys.ContainsKey(keyName))
{
return SymbolKeys[keyName];
}
else
{
return SpecialKeys[keyName];
}
}

public static List<string> AllKeys()
{
List<string> allKeys = new List<string>(ModifierKeys.Keys);
allKeys.AddRange(FunctionKeys.Keys);
allKeys.AddRange(LetterKeys.Keys);
allKeys.AddRange(NumberKeys.Keys);
allKeys.AddRange(SymbolKeys.Keys);
allKeys.AddRange(SpecialKeys.Keys);
return allKeys;
}

public static List<string> SubKeys(string key, bool allowModifier)
{
List<string> subKeys = new List<string>();
if (allowModifier && ModifierKeys.ContainsKey(key))
{
subKeys.AddRange(ModifierKeys.Keys);
subKeys.Remove(key);
}
subKeys.AddRange(FunctionKeys.Keys);
subKeys.AddRange(LetterKeys.Keys);
subKeys.AddRange(NumberKeys.Keys);
subKeys.AddRange(SymbolKeys.Keys);
subKeys.AddRange(SpecialKeys.Keys);
return subKeys;
}

public static bool IsModifierKeys(string key)
{
return ModifierKeys.ContainsKey(key);
}
}
}
}
55 changes: 47 additions & 8 deletions QucikScreenShot/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:QucikScreenShot"
mc:Ignorable="d"
Title="Quick ScreenShot" Icon="Logo.png"
Height="300" Width="400" MinHeight="250" MinWidth="400"
Height="350" Width="500" MinHeight="300" MinWidth="420"
Closed="ClosedMainWindow"
FontSize="14" FontFamily="Times New Roman">
FontSize="14" FontFamily="Times New Roman" Loaded="Window_Loaded">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="10"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="10"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="10"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="10"/>
<RowDefinition Height="*"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
Expand All @@ -35,12 +38,48 @@
<Button Content="Select" Grid.Column="4" Grid.Row="1" Click="SelectSavePath"/>
<Button Content="Open" Grid.Column="6" Grid.Row="1" Click="OpenSavePath"/>

<Label Content="Status" Grid.Column="1" Grid.Row="3"/>
<Label x:Name="status_Label" Content="Stop" Grid.Column="2" Grid.Row="3"/>
<Button x:Name="changeStatus_Button" Content="Start" Grid.Column="6" Grid.Row="3" Click="ChangeStatus"/>
<Label Content="Hot Key" Grid.Row="3" Grid.Column="1"/>
<Grid Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="60"/>
</Grid.ColumnDefinitions>
<ComboBox x:Name="hotKey1_ComboBox" SelectionChanged="hotKey1_ComboBox_SelectionChanged"/>
<Label Content="+" Grid.Column="1"/>
<ComboBox x:Name="hotKey2_ComboBox" Grid.Column="2" SelectionChanged="hotKey2_ComboBox_SelectionChanged"/>
<Label Content="+" Grid.Column="3"/>
<ComboBox x:Name="hotKey3_ComboBox" Grid.Column="4"/>
</Grid>

<Label Content="Log" Grid.Column="1" Grid.Row="5"/>
<TextBox x:Name="Log_TextBox" IsReadOnly="True" Grid.Column="2" Grid.Row="5" Grid.ColumnSpan="5" VerticalScrollBarVisibility="Auto" TextChanged="Log_TextBox_TextChanged"/>
<Label Content="Status" Grid.Column="1" Grid.Row="5"/>
<Label x:Name="status_Label" Content="Stop" Grid.Column="2" Grid.Row="5"/>
<Button x:Name="changeStatus_Button" Content="Start" Grid.Column="6" Grid.Row="5" Click="ChangeStatus"/>

<Label Content="About" Grid.Column="1" Grid.Row="7"/>
<Grid Grid.Row="7" Grid.Column="2" Grid.ColumnSpan="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Content="Documentation"/>
<Button Content="Read" Grid.Column="1" Click="ViewDocumentation"/>
<Label Content="Developed by He Lingfeng" Grid.Row="1" Grid.ColumnSpan="2"/>
<Label Content="Source: https://github.com/Hedaozi/Quick-ScreenShot" Grid.Row="2"/>
<Button Content="View" Grid.Row="2" Grid.Column="1" Click="ViewSource"/>
</Grid>

<Label Content="Log" Grid.Column="1" Grid.Row="9"/>
<TextBox x:Name="Log_TextBox" IsReadOnly="True"
Grid.Column="2" Grid.Row="9" Grid.ColumnSpan="5"
VerticalScrollBarVisibility="Auto"
TextChanged="Log_TextBox_TextChanged"/>
</Grid>
</Window>
Loading

0 comments on commit fd10af1

Please sign in to comment.