GUI: Bump .NET Framework version to 4.7.2 + make it possible to resize window (horizontally).
This commit is contained in:
parent
7996869e3c
commit
df235ca050
@ -32,7 +32,7 @@ The SlunkCrypt library and the command-line application currently run on the fol
|
|||||||
|
|
||||||
The SlunkCrypt GUI application currently runs on the following platforms:
|
The SlunkCrypt GUI application currently runs on the following platforms:
|
||||||
|
|
||||||
* **Microsoft Windows** with .NET Framework 4.5 — can be installed on Windows Vista, or later
|
* **Microsoft Windows** with .NET Framework 4.7.2 — can be installed on Windows 7 SP1, or later
|
||||||
|
|
||||||
|
|
||||||
GUI Usage
|
GUI Usage
|
||||||
@ -45,10 +45,10 @@ This is how the graphical user interface (GUI) for SlunkCrypt looks on [Windows
|
|||||||
Prerequisites
|
Prerequisites
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
Please be sure to install the **.NET Framework 4.5**, or any later *.NET Framework 4.x* version, before running the SlunkCrypt GUI application:
|
Please be sure to install the **.NET Framework 4.7.2**, or any later *.NET Framework 4.x* version, before running the SlunkCrypt **Windows GUI** application:
|
||||||
<https://dotnet.microsoft.com/download/dotnet-framework>
|
<https://dotnet.microsoft.com/download/dotnet-framework>
|
||||||
|
|
||||||
***Note:*** If you are running Windows 8 or later, then almost certainly a suitable version of the .NET Framework is already installed 😎
|
***Note:*** If you are running Windows 8.1 or later, then almost certainly a suitable version of the .NET Framework is already installed 😎
|
||||||
|
|
||||||
Settings
|
Settings
|
||||||
--------
|
--------
|
||||||
|
@ -47,14 +47,10 @@ Section
|
|||||||
DetailPrint ".NET Framework not found!"
|
DetailPrint ".NET Framework not found!"
|
||||||
${Endif}
|
${Endif}
|
||||||
|
|
||||||
!insertmacro PrintStatusMessage "Installing .NET Framework 4.8, please wait..."
|
!insertmacro PrintStatusMessage "Installing .NET Framework 4.7.2, please wait..."
|
||||||
${Do}
|
${Do}
|
||||||
ClearErrors
|
ClearErrors
|
||||||
${If} ${AtLeastBuild} 19042
|
ExecShellWait /ALLOWERRORUI "open" "$EXEDIR\ndp472-kb4054531-web.exe" /passive
|
||||||
ExecShellWait /ALLOWERRORUI "runas" "$EXEDIR\ndp481-web.exe" /passive
|
|
||||||
${Else}
|
|
||||||
ExecShellWait /ALLOWERRORUI "runas" "$EXEDIR\ndp48-web.exe" /passive
|
|
||||||
${EndIf}
|
|
||||||
${IfNot} ${Errors}
|
${IfNot} ${Errors}
|
||||||
${OrIf} ${Cmd} `MessageBox MB_ICONEXCLAMATION|MB_RETRYCANCEL|MB_TOPMOST "Failed to launch .NET Framework installer!" IDCANCEL`
|
${OrIf} ${Cmd} `MessageBox MB_ICONEXCLAMATION|MB_RETRYCANCEL|MB_TOPMOST "Failed to launch .NET Framework installer!" IDCANCEL`
|
||||||
${ExitDo}
|
${ExitDo}
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
||||||
</startup>
|
</startup>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="DisableBusyIndicator" value="false"/>
|
<add key="DisableBusyIndicator" value="false"/>
|
||||||
<add key="ThreadCount" value="0"/>
|
<add key="ThreadCount" value="0"/>
|
||||||
<add key="KeepIncompleteFiles" value="false"/>
|
<add key="KeepIncompleteFiles" value="false"/>
|
||||||
|
<add key="LegacyCompat" value="false"/>
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>com.muldersoft.slunkcrypt.gui</RootNamespace>
|
<RootNamespace>com.muldersoft.slunkcrypt.gui</RootNamespace>
|
||||||
<AssemblyName>slunkcrypt-gui</AssemblyName>
|
<AssemblyName>slunkcrypt-gui</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
@ -11,12 +11,15 @@
|
|||||||
Icon="pack://application:,,,/slunkcrypt-gui;component/Resources/Application.ico"
|
Icon="pack://application:,,,/slunkcrypt-gui;component/Resources/Application.ico"
|
||||||
SizeToContent="WidthAndHeight"
|
SizeToContent="WidthAndHeight"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
ResizeMode="NoResize"
|
ResizeMode="CanMinimize"
|
||||||
WindowStyle="ThreeDBorderWindow"
|
WindowStyle="ThreeDBorderWindow"
|
||||||
UseLayoutRounding="True"
|
UseLayoutRounding="True"
|
||||||
AllowDrop="True"
|
AllowDrop="True"
|
||||||
Loaded="Window_Loaded" Closing="Window_Closing"
|
Closing="Window_Closing"
|
||||||
PreviewDragEnter="Window_PreviewDragEnter" PreviewDragOver="Window_PreviewDragEnter" PreviewDragLeave="Window_PreviewDragLeave" PreviewDrop="Window_PreviewDrop"
|
PreviewDragEnter="Window_PreviewDragEnter"
|
||||||
|
PreviewDragOver="Window_PreviewDragEnter"
|
||||||
|
PreviewDragLeave="Window_PreviewDragLeave"
|
||||||
|
PreviewDrop="Window_PreviewDrop"
|
||||||
PreviewKeyDown="Window_PreviewKeyDown">
|
PreviewKeyDown="Window_PreviewKeyDown">
|
||||||
|
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
@ -43,9 +46,9 @@
|
|||||||
</Window.TaskbarItemInfo>
|
</Window.TaskbarItemInfo>
|
||||||
|
|
||||||
<StackPanel Style="{StaticResource WaitCursorWhileBusy}" Background="Transparent">
|
<StackPanel Style="{StaticResource WaitCursorWhileBusy}" Background="Transparent">
|
||||||
<Grid>
|
<Grid Background=" #2A3439">
|
||||||
<Image Source="{StaticResource ImageSource_Banner}" Stretch="None" MouseLeftButtonDown="Image_MouseLeftButtonDown" Name="Banner"/>
|
<Image Source="{StaticResource ImageSource_Banner}" Stretch="None" MouseLeftButtonDown="Image_MouseLeftButtonDown" Name="Banner"/>
|
||||||
<Canvas x:Name="Canvas" IsHitTestVisible="False" Visibility="{Binding IsBusyIndicatorVisible, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}, Converter={StaticResource VisibilityConverter}}" Opacity="0.8"/>
|
<Canvas x:Name="Canvas" IsHitTestVisible="False" Visibility="{Binding IsBusyIndicatorVisible, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}, Converter={StaticResource VisibilityConverter}}" Width="{Binding Path=ActualWidth, ElementName=Banner}" Opacity="0.8"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Separator Margin="0"/>
|
<Separator Margin="0"/>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
|
@ -12,6 +12,7 @@ using System.Globalization;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Media;
|
using System.Media;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
@ -45,6 +46,7 @@ namespace com.muldersoft.slunkcrypt.gui
|
|||||||
private readonly DispatcherTimer m_dispatcherTimer;
|
private readonly DispatcherTimer m_dispatcherTimer;
|
||||||
private readonly ReadOnlyObservableCollection<string> m_logFileReadOnly;
|
private readonly ReadOnlyObservableCollection<string> m_logFileReadOnly;
|
||||||
|
|
||||||
|
private volatile int m_isInitialized = 0;
|
||||||
private volatile ModeOfOperation m_modeOfOperation = (ModeOfOperation)(-1);
|
private volatile ModeOfOperation m_modeOfOperation = (ModeOfOperation)(-1);
|
||||||
private volatile bool m_busyFlag = false, m_checksumError = false, m_processReceived = false, m_disableAnimation = false;
|
private volatile bool m_busyFlag = false, m_checksumError = false, m_processReceived = false, m_disableAnimation = false;
|
||||||
private volatile SlunkCryptRunner m_processRunner = null;
|
private volatile SlunkCryptRunner m_processRunner = null;
|
||||||
@ -62,7 +64,7 @@ namespace com.muldersoft.slunkcrypt.gui
|
|||||||
m_defaultStatusText = Label_Status.Text;
|
m_defaultStatusText = Label_Status.Text;
|
||||||
m_dispatcherTimer = new DispatcherTimer(DispatcherPriority.ApplicationIdle, Dispatcher);
|
m_dispatcherTimer = new DispatcherTimer(DispatcherPriority.ApplicationIdle, Dispatcher);
|
||||||
m_dispatcherTimer.Tick += DispatcherTimer_Tick;
|
m_dispatcherTimer.Tick += DispatcherTimer_Tick;
|
||||||
m_dispatcherTimer.Interval = TimeSpan.FromMilliseconds(200);
|
m_dispatcherTimer.Interval = TimeSpan.FromMilliseconds(331);
|
||||||
m_logFileReadOnly = new ReadOnlyObservableCollection<string>(m_logFile);
|
m_logFileReadOnly = new ReadOnlyObservableCollection<string>(m_logFile);
|
||||||
m_disableAnimation = m_config.DisableBusyIndicator;
|
m_disableAnimation = m_config.DisableBusyIndicator;
|
||||||
}
|
}
|
||||||
@ -111,11 +113,21 @@ namespace com.muldersoft.slunkcrypt.gui
|
|||||||
protected override void OnContentRendered(EventArgs e)
|
protected override void OnContentRendered(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnContentRendered(e);
|
base.OnContentRendered(e);
|
||||||
|
if (Interlocked.CompareExchange(ref m_isInitialized, 1, 0) == 0)
|
||||||
|
{
|
||||||
TabControl.MinHeight = TabControl.MaxHeight = TabControl.ActualHeight;
|
TabControl.MinHeight = TabControl.MaxHeight = TabControl.ActualHeight;
|
||||||
MinWidth = MaxWidth = ActualWidth;
|
MinWidth = ActualWidth;
|
||||||
MinHeight = MaxHeight = ActualHeight;
|
MinHeight = MaxHeight = ActualHeight;
|
||||||
|
CreateIndicatorElements();
|
||||||
|
CreateSystemMenu();
|
||||||
|
if (m_config.LegacyCompat)
|
||||||
|
{
|
||||||
|
Checkbox_Encrypt_LegacyCompat.IsChecked = Checkbox_Decrypt_LegacyCompat.IsChecked = true;
|
||||||
|
}
|
||||||
|
this.EnableResize(true);
|
||||||
this.BringWindowToTop();
|
this.BringWindowToTop();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Button_Encrypt_InputFile_Click(object sender, RoutedEventArgs e)
|
private void Button_Encrypt_InputFile_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@ -372,19 +384,6 @@ namespace com.muldersoft.slunkcrypt.gui
|
|||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void Window_Loaded(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
await Task.Yield();
|
|
||||||
SystemMenu systemMenu = new SystemMenu(this, SystemMenu_Activated);
|
|
||||||
m_menuId_disableAnimation = systemMenu.AppendMenu("Disable Busy Indicator");
|
|
||||||
m_menuId_enableExpertMode = systemMenu.AppendMenu("Expert Settings");
|
|
||||||
if (m_disableAnimation && m_menuId_disableAnimation.HasValue)
|
|
||||||
{
|
|
||||||
systemMenu.ModifyMenu(m_menuId_disableAnimation.Value, m_disableAnimation);
|
|
||||||
}
|
|
||||||
CreateIndicatorElements();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Window_Closing(object sender, CancelEventArgs e)
|
private void Window_Closing(object sender, CancelEventArgs e)
|
||||||
{
|
{
|
||||||
if (IsBusy)
|
if (IsBusy)
|
||||||
@ -544,7 +543,7 @@ namespace com.muldersoft.slunkcrypt.gui
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (enableLegacyCompat)
|
if (enableLegacyCompat && (!m_config.LegacyCompat))
|
||||||
{
|
{
|
||||||
if (MessageBox.Show(this, "Legacy compat-mode should not be used to encrypt new files!", "Legacy Compatibility", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel) != MessageBoxResult.OK)
|
if (MessageBox.Show(this, "Legacy compat-mode should not be used to encrypt new files!", "Legacy Compatibility", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel) != MessageBoxResult.OK)
|
||||||
{
|
{
|
||||||
@ -772,6 +771,17 @@ namespace com.muldersoft.slunkcrypt.gui
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CreateSystemMenu()
|
||||||
|
{
|
||||||
|
SystemMenu systemMenu = new SystemMenu(this, SystemMenu_Activated);
|
||||||
|
m_menuId_disableAnimation = systemMenu.AppendMenu("Disable Busy Indicator");
|
||||||
|
m_menuId_enableExpertMode = systemMenu.AppendMenu("Expert Settings");
|
||||||
|
if (m_disableAnimation && m_menuId_disableAnimation.HasValue)
|
||||||
|
{
|
||||||
|
systemMenu.ModifyMenu(m_menuId_disableAnimation.Value, m_disableAnimation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CreateIndicatorElements()
|
private void CreateIndicatorElements()
|
||||||
{
|
{
|
||||||
FontFamily hackFont = new FontFamily(new Uri("pack://application:,,,/"), "./Resources/Fonts/#Hack");
|
FontFamily hackFont = new FontFamily(new Uri("pack://application:,,,/"), "./Resources/Fonts/#Hack");
|
||||||
@ -786,6 +796,7 @@ namespace com.muldersoft.slunkcrypt.gui
|
|||||||
int numY = (int)Math.Floor(actualHeight / lenY);
|
int numY = (int)Math.Floor(actualHeight / lenY);
|
||||||
int offX = (int)Math.Round((actualWidth - (numX * lenX)) / 2.0);
|
int offX = (int)Math.Round((actualWidth - (numX * lenX)) / 2.0);
|
||||||
int offY = (int)Math.Round((actualHeight - (numY * lenY)) / 2.0);
|
int offY = (int)Math.Round((actualHeight - (numY * lenY)) / 2.0);
|
||||||
|
Canvas.Children.Clear();
|
||||||
for (int i = 0; i < numX; ++i)
|
for (int i = 0; i < numX; ++i)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < numY; ++j)
|
for (int j = 0; j < numY; ++j)
|
||||||
|
@ -38,6 +38,14 @@ namespace com.muldersoft.slunkcrypt.gui.utils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool LegacyCompat
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ComputeIfAbsent("LegacyCompat", (key) => AppConfHelper.GetConfigValueAsBool(key).GetValueOrDefault(false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Internal methods
|
// Internal methods
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
|
|
||||||
@ -31,6 +30,25 @@ namespace com.muldersoft.slunkcrypt.gui.utils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void EnableResize(this Window window, bool enable)
|
||||||
|
{
|
||||||
|
if (!ReferenceEquals(window, null))
|
||||||
|
{
|
||||||
|
const int GWL_STYLE = -16;
|
||||||
|
const uint WS_SIZEBOX = 0x40000;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
WindowInteropHelper interopHelper = new WindowInteropHelper(window);
|
||||||
|
uint value = NativeMethods.GetWindowLong(interopHelper.Handle, GWL_STYLE);
|
||||||
|
if (value != 0)
|
||||||
|
{
|
||||||
|
NativeMethods.SetWindowLong(interopHelper.Handle, GWL_STYLE, enable ? (value | WS_SIZEBOX) : (value & (~WS_SIZEBOX)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static class NativeMethods
|
private static class NativeMethods
|
||||||
{
|
{
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
@ -38,6 +56,12 @@ namespace com.muldersoft.slunkcrypt.gui.utils
|
|||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||||
|
|
||||||
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
|
public static extern uint GetWindowLong(IntPtr hWnd, int nIndex);
|
||||||
|
|
||||||
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
|
public static extern uint SetWindowLong(IntPtr hWnd, int nIndex, uint dwNewLong);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user