add inno pack file

This commit is contained in:
Vector Von 2022-06-14 16:40:40 +08:00
parent 1d21654404
commit e7851cd2f6
6 changed files with 92 additions and 5 deletions

4
.gitignore vendored
View File

@ -360,4 +360,6 @@ MigrationBackup/
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd
Output

View File

@ -5,6 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Topuino_Client_Windows"
mc:Ignorable="d"
Closing="Window_Closing"
Title="Topuino 客户端" Height="150" Width="400">
<Grid>
<Grid.RowDefinitions>
@ -26,7 +27,7 @@
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="5">
<Button Content="保存" Click="Button_Save_Click" Height="20" Width="40" />
<Separator Width="10" Background="Transparent" />
<Button Content="隐藏" Height="20" Width="40" />
<Button Content="隐藏" Click="Button_Hide_Click" Height="20" Width="40" />
</StackPanel>
</Grid>
</Window>

View File

@ -6,6 +6,8 @@ using System.IO;
using System.Net.NetworkInformation;
using System.Collections.Generic;
using System.Windows.Input;
using System.Drawing;
using System.Windows.Forms;
using Newtonsoft.Json;
namespace Topuino_Client_Windows
@ -36,6 +38,8 @@ namespace Topuino_Client_Windows
if (File.Exists("Config.json"))
{
ShowInTaskbar = true;
Visibility = Visibility.Hidden;
LoadConfig();
}
else
@ -43,8 +47,15 @@ namespace Topuino_Client_Windows
ComboBox_Disk0.SelectedIndex = 0;
ComboBox_Disk1.SelectedIndex = 0;
}
trayIon.Icon = new Icon(@"Topuino.ico");
trayIon.Visible = true;
trayIon.Text = "Topuino";
trayIon.DoubleClick += TrayIcon_DoubleClick;
}
private NotifyIcon trayIon = new NotifyIcon();
private string sn = "";
private List<DriveInfo> allDrives;
private DriveInfo? drive0 = null;
@ -159,8 +170,8 @@ namespace Topuino_Client_Windows
public void ShowErrorBox(string msg)
{
MessageBox.Show(
Application.Current.MainWindow,
System.Windows.MessageBox.Show(
System.Windows.Application.Current.MainWindow,
msg,
"错误",
MessageBoxButton.OK,
@ -177,7 +188,7 @@ namespace Topuino_Client_Windows
private void StartRun()
{
Mouse.OverrideCursor = Cursors.Wait;
Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait;
if (refreshThread != null)
{
requestStop.Set();
@ -218,5 +229,24 @@ namespace Topuino_Client_Windows
SaveConfig();
StartRun();
}
private void TrayIcon_DoubleClick(object? sender, EventArgs e)
{
Visibility = Visibility.Visible;
}
private void Button_Hide_Click(object sender, RoutedEventArgs e)
{
Visibility = Visibility.Hidden;
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (refreshThread != null)
{
requestStop.Set();
stopDone.WaitOne();
}
}
}
}

BIN
Topuino.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -5,10 +5,15 @@
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy &quot;$(ProjectDir)Topuino.ico&quot; &quot;$(ProjectDir)$(OutDir)&quot; /y /f" />
</Target>
</Project>

49
pack.iss Normal file
View File

@ -0,0 +1,49 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "TopuinoClient"
#define MyAppVersion "0.1"
#define MyAppPublisher "VVZERO"
#define MyAppURL "https://iot.vvzero.com"
#define MyAppExeName "Topuino_Client_Windows.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{775354B5-2CB5-4689-B28C-534A1848B810}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DisableDirPage=yes
DisableProgramGroupPage=yes
; Remove the following line to run in administrative install mode (install for all users.)
PrivilegesRequired=lowest
OutputDir=Output
OutputBaseFilename=Topuino_Client
SetupIconFile=Topuino.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[Languages]
Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "bin\Release\net6.0-windows\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent