Skip to content

Commit

Permalink
v1.1.0.0
Browse files Browse the repository at this point in the history
禁止重复运行
优化启动逻辑
  • Loading branch information
SeaLoong committed Sep 30, 2020
1 parent bef8526 commit 1024178
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 8 deletions.
36 changes: 30 additions & 6 deletions drcom4scutGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ private void InitNetworkInterface()
}
}
}
if (this.mac != null && this.comboBox_MAC.SelectedIndex < 0)
{
this.comboBox_MAC.SelectedIndex = this.comboBox_MAC.Items.Add(this.mac);
}
}

private void InitUI()
Expand Down Expand Up @@ -181,21 +185,29 @@ private void GetCoreVersion()

private void Window_Loaded(object sender, RoutedEventArgs e)
{
LoadConfig();
InitTray();
InitUI();
if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length > 1)
{
this.IsEnabled = false;
MessageBox.Show("程序已在运行!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
System.Windows.Application.Current.Shutdown(0);
return;
}
GetCoreVersion();
QuitPreviousCore();
if (this.core == null)
{
this.IsEnabled = false;
MessageBox.Show("未找到核心程序 drcom4scut.exe,无法使用!", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
label.Content = "未找到核心程序 drcom4scut.exe,无法使用!";
System.Windows.Application.Current.Shutdown(0);
return;
}
else
{
this.Title = "drcom4scutGUI - core: " + this.core;
}
LoadConfig();
InitTray();
InitUI();
if (this.autoLogin)
{
StartCoreProcess();
Expand All @@ -204,7 +216,10 @@ private void Window_Loaded(object sender, RoutedEventArgs e)

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
this.notifyIcon.Visible = false;
if (this.notifyIcon != null)
{
this.notifyIcon.Visible = false;
}
try
{
if (process != null) process.Kill();
Expand Down Expand Up @@ -317,9 +332,18 @@ private void StartCoreProcess()
string s = match.Groups[1].Value;
if (this.success)
{
if (s.Contains("ignore"))
{
return;
}
string text = "出现错误,但是保持核心程序运行。";
if (s.Contains("Will try reconnect at the next"))
{
text = s;
}
this.Dispatcher.BeginInvoke(new NoArgDelegate(() =>
{
label.Content = "出现错误,但是保持连接。";
label.Content = text;
this.notifyIcon.ShowBalloonTip(5000, "错误", s, ToolTipIcon.Error);
}));
return;
Expand Down
4 changes: 2 additions & 2 deletions drcom4scutGUI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
22 changes: 22 additions & 0 deletions drcom4scutGUI/drcom4scutGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@
<WarningLevel>4</WarningLevel>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -122,5 +137,12 @@
<ItemGroup>
<Resource Include="DrClient.ico" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

0 comments on commit 1024178

Please sign in to comment.