asm & csm: add message to mainwindow for missing Steam WebApiKey

This commit is contained in:
Lacoi 2023-08-02 16:32:23 +02:00
parent 0c18b60501
commit 37add08f64
9 changed files with 68 additions and 0 deletions

View file

@ -915,6 +915,7 @@
<sys:String x:Key="MainWindow_SteamCmd_Label">If you proceed the entire SteamCMD folder will be removed including all mod cache downloads.\r\nAre you sure you want to reinstall SteamCMD?</sys:String>
<sys:String x:Key="MainWindow_SteamCmd_FailedTitle">Reinstall SteamCMD Error</sys:String>
<sys:String x:Key="MainWindow_SteamCmd_FailedLabel">An error occured while trying to reinstall SteamCMD. This has left SteamCmd in an unstable state, try reinstalling again or please report this.\r\nException: {0}</sys:String>
<sys:String x:Key="MainWindow_SteamWebApiKeyMissingLabel">Steam WebAPI Key missing! Updates, downloads and installation of profiles could fail. Enter your Steam WebApiKey in the global settings</sys:String>
<sys:String x:Key="MainWindow_DiscordBot_RunningCommandsTitle">Discord Bot Running Commands</sys:String>
<sys:String x:Key="MainWindow_DiscordBot_RunningCommandsLabel">The discord bot has one or more running commands, do you want to continue shutting down the server manager?</sys:String>

View file

@ -25,6 +25,8 @@
<cc:SecondsToHoursConverter x:Key="SecondsToHoursConverter"/>
<cc:SecondsToMinutesConverter x:Key="SecondsToMinutesConverter"/>
<cc:SecondsToTimeValueConverter x:Key="SecondsToTimeValueConverter"/>
<cc:StringNullOrEmptyToVisibilityConverter x:Key="StringNullOrEmptyToVisibilityConverter"/>
<cc:InvertStringNullOrEmptyToVisibilityConverter x:Key="InvertStringNullOrEmptyToVisibilityConverter"/>
<SolidColorBrush x:Key="BeigeBorder" Color="#FFD8CCBC"/>
<SolidColorBrush x:Key="BeigeLabel" Color="#FFE6DFD8"/>

View file

@ -43,6 +43,10 @@
</Style>
</DockPanel.Style>
<Grid DockPanel.Dock="Top" Background="Red" Visibility="{Binding CommonConfig.SteamAPIKey, Converter={StaticResource InvertStringNullOrEmptyToVisibilityConverter}}">
<TextBlock Text="{DynamicResource MainWindow_SteamWebApiKeyMissingLabel}" Margin="0,5,0,5" HorizontalAlignment="Center" Foreground="White"/>
</Grid>
<Grid DockPanel.Dock="Left">
<Grid.RowDefinitions>
<RowDefinition/>

View file

@ -1,5 +1,6 @@
using EO.Wpf;
using NLog;
using ServerManagerTool.Common;
using ServerManagerTool.Common.Enums;
using ServerManagerTool.Common.Lib;
using ServerManagerTool.Common.Utils;
@ -35,6 +36,7 @@ namespace ServerManagerTool
public static readonly DependencyProperty AppInstanceProperty = DependencyProperty.Register(nameof(AppInstance), typeof(App), typeof(MainWindow), new PropertyMetadata(null));
public static readonly DependencyProperty ConfigProperty = DependencyProperty.Register(nameof(Config), typeof(Config), typeof(MainWindow), new PropertyMetadata(null));
public static readonly DependencyProperty CommonConfigProperty = DependencyProperty.Register(nameof(CommonConfig), typeof(CommonConfig), typeof(MainWindow), new PropertyMetadata(null));
public static readonly DependencyProperty ServerManagerProperty = DependencyProperty.Register(nameof(ServerManager), typeof(ServerManager), typeof(MainWindow), new PropertyMetadata(null));
public static readonly DependencyProperty AutoBackupStateProperty = DependencyProperty.Register(nameof(AutoBackupState), typeof(Microsoft.Win32.TaskScheduler.TaskState), typeof(MainWindow), new PropertyMetadata(Microsoft.Win32.TaskScheduler.TaskState.Unknown));
public static readonly DependencyProperty AutoBackupStateStringProperty = DependencyProperty.Register(nameof(AutoBackupStateString), typeof(string), typeof(MainWindow), new PropertyMetadata(string.Empty));
@ -52,6 +54,7 @@ namespace ServerManagerTool
{
this.AppInstance = App.Instance;
this.Config = Config.Default;
this.CommonConfig = CommonConfig.Default;
InitializeComponent();
WindowUtils.RemoveDefaultResourceDictionary(this, Config.Default.DefaultGlobalizationFile);
@ -102,6 +105,12 @@ namespace ServerManagerTool
set { SetValue(ConfigProperty, value); }
}
public CommonConfig CommonConfig
{
get { return GetValue(CommonConfigProperty) as CommonConfig; }
set { SetValue(CommonConfigProperty, value); }
}
public ServerManager ServerManager
{
get { return (ServerManager)GetValue(ServerManagerProperty); }

View file

@ -696,6 +696,7 @@
<sys:String x:Key="MainWindow_SteamCmd_Label">If you proceed the entire SteamCMD folder will be removed including all mod cache downloads.\r\nAre you sure you want to reinstall SteamCMD?</sys:String>
<sys:String x:Key="MainWindow_SteamCmd_FailedTitle">Reinstall SteamCMD Error</sys:String>
<sys:String x:Key="MainWindow_SteamCmd_FailedLabel">An error occured while trying to reinstall SteamCMD. This has left SteamCmd in an unstable state, try reinstalling again or please report this.\r\nException: {0}</sys:String>
<sys:String x:Key="MainWindow_SteamWebApiKeyMissingLabel">Steam WebAPI Key missing! Updates, downloads and installation of profiles could fail. Enter your Steam WebApiKey in the global settings</sys:String>
<sys:String x:Key="MainWindow_DiscordBot_RunningCommandsTitle">Discord Bot Running Commands</sys:String>
<sys:String x:Key="MainWindow_DiscordBot_RunningCommandsLabel">The discord bot has one or more running commands, do you want to continue shutting down the server manager?</sys:String>

View file

@ -24,6 +24,8 @@
<cc:SecondsToMinutesConverter x:Key="SecondsToMinutesConverter"/>
<cc:SecondsToTimeValueConverter x:Key="SecondsToTimeValueConverter"/>
<cc:UnixTimeToDateTimeConverter x:Key="UnixTimeToDateTimeConverter"/>
<cc:StringNullOrEmptyToVisibilityConverter x:Key="StringNullOrEmptyToVisibilityConverter"/>
<cc:InvertStringNullOrEmptyToVisibilityConverter x:Key="InvertStringNullOrEmptyToVisibilityConverter"/>
<SolidColorBrush x:Key="BeigeBorder" Color="#FFD8CCBC"/>
<SolidColorBrush x:Key="BeigeLabel" Color="#FFE6DFD8"/>

View file

@ -1,5 +1,6 @@
using EO.Wpf;
using NLog;
using ServerManagerTool.Common;
using ServerManagerTool.Common.Enums;
using ServerManagerTool.Common.Lib;
using ServerManagerTool.Common.Utils;
@ -35,6 +36,7 @@ namespace ServerManagerTool
public static readonly DependencyProperty AppInstanceProperty = DependencyProperty.Register(nameof(AppInstance), typeof(App), typeof(MainWindow), new PropertyMetadata(null));
public static readonly DependencyProperty ConfigProperty = DependencyProperty.Register(nameof(Config), typeof(Config), typeof(MainWindow), new PropertyMetadata(null));
public static readonly DependencyProperty CommonConfigProperty = DependencyProperty.Register(nameof(CommonConfig), typeof(CommonConfig), typeof(MainWindow), new PropertyMetadata(null));
public static readonly DependencyProperty ServerManagerProperty = DependencyProperty.Register(nameof(ServerManager), typeof(ServerManager), typeof(MainWindow), new PropertyMetadata(null));
public static readonly DependencyProperty AutoBackupStateProperty = DependencyProperty.Register(nameof(AutoBackupState), typeof(Microsoft.Win32.TaskScheduler.TaskState), typeof(MainWindow), new PropertyMetadata(Microsoft.Win32.TaskScheduler.TaskState.Unknown));
public static readonly DependencyProperty AutoBackupStateStringProperty = DependencyProperty.Register(nameof(AutoBackupStateString), typeof(string), typeof(MainWindow), new PropertyMetadata(string.Empty));
@ -52,6 +54,7 @@ namespace ServerManagerTool
{
this.AppInstance = App.Instance;
this.Config = Config.Default;
this.CommonConfig = CommonConfig.Default;
InitializeComponent();
WindowUtils.RemoveDefaultResourceDictionary(this, Config.Default.DefaultGlobalizationFile);
@ -102,6 +105,12 @@ namespace ServerManagerTool
set { SetValue(ConfigProperty, value); }
}
public CommonConfig CommonConfig
{
get { return GetValue(CommonConfigProperty) as CommonConfig; }
set { SetValue(CommonConfigProperty, value); }
}
public ServerManager ServerManager
{
get { return (ServerManager)GetValue(ServerManagerProperty); }

View file

@ -0,0 +1,20 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace ServerManagerTool.Common.Converters
{
public class InvertStringNullOrEmptyToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return string.IsNullOrEmpty(value as string) ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException("InvertStringNullOrEmptyToVisibilityConverter is a OneWay converter.");
}
}
}

View file

@ -0,0 +1,20 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace ServerManagerTool.Common.Converters
{
public class StringNullOrEmptyToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return string.IsNullOrEmpty(value as string) ? Visibility.Collapsed : Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException("StringNullOrEmptyToVisibilityConverter is a OneWay converter.");
}
}
}