Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
Smart Enable Button
Browse files Browse the repository at this point in the history
  • Loading branch information
Dyvinia committed Jul 13, 2021
1 parent 2ee3285 commit ffb51b1
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 7 deletions.
16 changes: 12 additions & 4 deletions AboutWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,38 +70,46 @@
<Grid Height="155" Margin="10,0,10,117" VerticalAlignment="Bottom" Background="#FF141414">
<TextBlock Margin="10,6" TextWrapping="Wrap" Foreground="#FFF1F1F1" TextAlignment="Center" FontSize="16"><Run Text="Extra Options"/></TextBlock>
</Grid>
<TextBlock Margin="40,357,40,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FFF1F1F1" Height="20" TextAlignment="Center" FontSize="13">
<TextBlock Margin="40,351,40,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FFF1F1F1" Height="20" TextAlignment="Center" FontSize="13">
GitHub:
<Hyperlink
NavigateUri="https://github.com/Dulana57/FrostyFix"
RequestNavigate="Hyperlink_RequestNavigate" Foreground="White">
https://github.com/Dulana57/FrostyFix
</Hyperlink>
</TextBlock>
<TextBlock Margin="25,377,25,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FFF1F1F1" Height="20" TextAlignment="Center" FontSize="13">
<TextBlock Margin="25,371,25,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FFF1F1F1" Height="20" TextAlignment="Center" FontSize="13">
FAQ:
<Hyperlink
NavigateUri="https://github.com/Dulana57/FrostyFix#faq"
RequestNavigate="Hyperlink_RequestNavigate" Foreground="White">
https://github.com/Dulana57/FrostyFix#FAQ
</Hyperlink>
</TextBlock>
<TextBlock Margin="40,398,40,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FFF1F1F1" Height="20" TextAlignment="Center" FontSize="13">
<TextBlock Margin="40,392,40,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FFF1F1F1" Height="20" TextAlignment="Center" FontSize="13">
Support:
<Hyperlink
NavigateUri="https://Dulana57.com/Discord"
RequestNavigate="Hyperlink_RequestNavigate" Foreground="White">
https://Dulana57.com/Discord
</Hyperlink>
</TextBlock>
<TextBlock Margin="10,418,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FFF1F1F1" Height="20" TextAlignment="Center" FontSize="13">
<TextBlock Margin="10,412,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FFF1F1F1" Height="20" TextAlignment="Center" FontSize="13">
BattlefrontModding:
<Hyperlink
NavigateUri="https://discord.gg/advqsyv"
RequestNavigate="Hyperlink_RequestNavigate" Foreground="White">
https://discord.gg/advqsyv
</Hyperlink>
</TextBlock>
<TextBlock Margin="10,432,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FFF1F1F1" Height="20" TextAlignment="Center" FontSize="13">
Donate:
<Hyperlink
NavigateUri="https://www.dulana57.com/donate"
RequestNavigate="Hyperlink_RequestNavigate" Foreground="White">
https://Dulana57.com/Donate
</Hyperlink>
</TextBlock>
<Button Content="Refresh Status on Main Window" HorizontalAlignment="Center" Margin="75,310,75,0" VerticalAlignment="Top" Width="210" Height="25" Click="ButtonEnvVar" BorderBrush="#FFB90000" FontSize="14">
<Button.Style>
<Style TargetType="{x:Type Button}">
Expand Down
3 changes: 2 additions & 1 deletion MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@
</ControlTemplate>
</Button.Template>
</Button>
<Button x:Name="btn_enable" Content="Launch with Mods enabled" Width="210" Height="60" IsEnabled="False" Canvas.Left="322" Canvas.Top="253" Margin="286,0,286,28" VerticalAlignment="Bottom" Click="btn_enable_Click">
<Button x:Name="btn_enable" Width="242" Height="64" IsEnabled="False" Canvas.Left="322" Canvas.Top="253" Margin="270,0,270,26" VerticalAlignment="Bottom" Click="btn_enable_Click">
<TextBlock x:Name="btn_enable_text" Text="Launch with Mods enabled" TextWrapping="Wrap" TextAlignment="Center" Margin="2,0"/>
<Button.ToolTip>
<ToolTip Background="Black" Foreground="White" Content="Click to launch the select platform with the fix applied"/>
</Button.ToolTip>
Expand Down
32 changes: 32 additions & 0 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,28 @@ public void checkEnabled() {
}
}

public void enableButtonText() {
string platform = null;
if (rbtn_origin.IsChecked == true) platform = "Origin ";
if (rbtn_eadesk.IsChecked == true) platform = "EA Desktop ";
if (rbtn_epicgames.IsChecked == true) platform = "Epic Games Store ";
if (rbtn_steam.IsChecked == true) platform = "Steam ";

string game = null;
if (rbtn_bf2015.IsChecked == true) game = "Star Wars Battlefront (2015)";
if (rbtn_bf2017.IsChecked == true) game = "Star Wars Battlefront II (2017)";
if (rbtn_bf1.IsChecked == true) game = "Battlefield One";
if (rbtn_mea.IsChecked == true) game = "Mass Effect: Andromeda";
if (rbtn_nfs.IsChecked == true) game = "Need for Speed";
if (rbtn_nfspayback.IsChecked == true) game = "Need for Speed: Payback";
if (rbtn_gw2.IsChecked == true) game = "PvZ: Garden Warfare 2";
if (rbtn_dai.IsChecked == true) game = "Dragon Age: Inquisition";
if (rbtn_custom.IsChecked == true) game = "Custom Game";

btn_enable_text.Text = "Launch " + platform + "with Mods enabled";
if (game != null) btn_enable_text.Text = btn_enable_text.Text + " for " + game;
}

public void openGameDir() {
if (datadir != null) {
Process.Start("explorer.exe", datadir);
Expand Down Expand Up @@ -456,6 +478,7 @@ private void ButtonGithub(object sender, RoutedEventArgs e) {

private void rbtn_custom_Checked(object sender, RoutedEventArgs e) {
btn_customchoose.IsEnabled = true;
enableButtonText();
}

private void rbtn_custom_Unchecked(object sender, RoutedEventArgs e) {
Expand All @@ -482,45 +505,54 @@ private void btn_customchoose_Click(object sender, RoutedEventArgs e) {
private void rbtn_bf2015_Checked(object sender, RoutedEventArgs e) {
datadir = bf2015;
checkEnabled();
enableButtonText();
}

private void rbtn_bf2017_Checked(object sender, RoutedEventArgs e) {
datadir = bf2017;
checkEnabled();
enableButtonText();
}

private void rbtn_bf1_Checked(object sender, RoutedEventArgs e) {
datadir = bf1;
checkEnabled();
enableButtonText();
}

private void rbtn_mea_Checked(object sender, RoutedEventArgs e) {
datadir = mea;
checkEnabled();
enableButtonText();
}

private void rbtn_nfs_Checked(object sender, RoutedEventArgs e) {
datadir = nfs;
checkEnabled();
enableButtonText();
}

private void rbtn_nfspayback_Checked(object sender, RoutedEventArgs e) {
datadir = nfspayback;
checkEnabled();
enableButtonText();
}

private void rbtn_gw2_Checked(object sender, RoutedEventArgs e) {
datadir = gw2;
checkEnabled();
enableButtonText();
}

private void rbtn_dai_Checked(object sender, RoutedEventArgs e) {
datadir = dai;
checkEnabled();
enableButtonText();
}

private void rbtn_platform_Checked(object sender, RoutedEventArgs e) {
checkEnabled();
enableButtonText();
}

private void btn_refresh_Click(object sender, RoutedEventArgs e) {
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.1.2")]
[assembly: AssemblyFileVersion("3.1.2")]
[assembly: AssemblyVersion("3.2.0")]
[assembly: AssemblyFileVersion("3.2.0")]

0 comments on commit ffb51b1

Please sign in to comment.