fix new install handling

This commit is contained in:
fyr77 2020-07-31 15:50:35 +02:00
parent 6bec92eebc
commit 0bcafdf4a0
2 changed files with 35 additions and 25 deletions

View file

@ -6,7 +6,7 @@
xmlns:local="clr-namespace:EnvyUpdate"
xmlns:tb="http://www.hardcodet.net/taskbar"
mc:Ignorable="d"
Title="EnvyUpdate" Height="132.5" Width="463" Icon="icon.ico" ResizeMode="CanMinimize" StateChanged="Window_StateChanged" Closing="Window_Closing">
Title="EnvyUpdate" Height="140" Width="463" Icon="icon.ico" ResizeMode="CanMinimize" StateChanged="Window_StateChanged" Closing="Window_Closing">
<Grid Margin="0,0,0,6">
<tb:TaskbarIcon IconSource="/icon.ico" ToolTipText="EnvyUpdate" TrayLeftMouseDown="TaskbarIcon_TrayLeftMouseDown" />
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" FontWeight="Bold" Width="151"><Run Text="Local d"/><Run Text="river "/><Run Text="v"/><Run Text="ersion:"/></TextBlock>
@ -14,7 +14,7 @@
<Button x:Name="buttonHelp" Content="?" HorizontalAlignment="Left" Margin="425,11,0,0" VerticalAlignment="Top" Width="20" Click="buttonHelp_Click"/>
<TextBlock HorizontalAlignment="Left" Margin="10,31,0,0" TextWrapping="Wrap" VerticalAlignment="Top" FontWeight="Bold" Width="151"><Run Text="Online "/><Run Text="d"/><Run Text="river "/><Run Text="v"/><Run Text="ersion:"/></TextBlock>
<TextBlock x:Name="textblockOnline" HorizontalAlignment="Left" Margin="166,31,0,0" TextWrapping="Wrap" Text="&lt;none&gt;" VerticalAlignment="Top" RenderTransformOrigin="-0.346,0.564"/>
<CheckBox x:Name="chkInstall" Content="Install?" HorizontalAlignment="Left" Margin="10,78,0,0" VerticalAlignment="Top" IsChecked="False" Unchecked="chkInstall_Unchecked" Checked="chkInstall_Checked"/>
<CheckBox x:Name="chkInstall" Content="Install" HorizontalAlignment="Left" Margin="10,78,0,0" VerticalAlignment="Top" IsChecked="False" Unchecked="chkInstall_Unchecked" Checked="chkInstall_Checked"/>
<Button x:Name="buttonDL" Content="⟱" HorizontalAlignment="Left" Margin="250,10,0,0" VerticalAlignment="Top" Width="37" FontSize="20" Height="37" Click="buttonDL_Click" Foreground="White" Background="#FF3CDA00" Visibility="Hidden"/>
<CheckBox x:Name="chkAutostart" Content="Autostart" HorizontalAlignment="Left" Margin="10,58,0,0" VerticalAlignment="Top" IsEnabled="False" Checked="chkAutostart_Checked" Unchecked="chkAutostart_Unchecked"/>
</Grid>

View file

@ -24,6 +24,7 @@ namespace EnvyUpdate
private readonly string startmenu = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
private readonly string version = "2.0";
private string argument = null;
private bool isDebug = false;
public MainWindow()
{
@ -48,6 +49,11 @@ namespace EnvyUpdate
MessageBox.Show("Application is already running.");
Environment.Exit(1);
}
// Set correct ticks
if (File.Exists(startup + "\\EnvyUpdate.lnk"))
chkAutostart.IsChecked = true;
if (File.Exists(appdata + "EnvyUpdate.exe"))
chkInstall.IsChecked = true;
// Check if application is installed and update
if (exepath == appdata)
{
@ -64,8 +70,6 @@ namespace EnvyUpdate
}
// Also set correct ticks.
chkInstall.IsChecked = true;
if (File.Exists(startup + "\\EnvyUpdate.lnk"))
chkAutostart.IsChecked = true;
}
if (Util.GetLocDriv() != null)
{
@ -78,6 +82,7 @@ namespace EnvyUpdate
{
case "/ignoregpu":
MessageBox.Show("Debug: GPU ignored.");
isDebug = true;
break;
default:
MessageBox.Show("No NVIDIA GPU found. Application will exit.");
@ -112,6 +117,9 @@ namespace EnvyUpdate
int osid;
//int langid;
// This little bool check is necessary for debug mode on systems without an Nvidia GPU.
if (!isDebug)
{
psid = Util.GetIDs("psid");
pfid = Util.GetIDs("pfid");
osid = Util.GetIDs("osid");
@ -135,6 +143,8 @@ namespace EnvyUpdate
}
else
textblockOnline.Foreground = Brushes.Green;
}
if (exepath == appdata)
{
WindowState = WindowState.Minimized;