Skip to content

Commit

Permalink
add statusbar messagetypes & colors, show error message if new projec…
Browse files Browse the repository at this point in the history
…t root folder is missing (on new project creation) #175
  • Loading branch information
unitycoder committed Nov 15, 2024
1 parent 572ca0e commit 05a0dc3
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
9 changes: 9 additions & 0 deletions UnityLauncherPro/Data/MessageType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace UnityLauncherPro.Data
{
public enum MessageType
{
Info,
Warning,
Error
}
}
18 changes: 17 additions & 1 deletion UnityLauncherPro/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shell;
using UnityLauncherPro.Data;
using UnityLauncherPro.Helpers;
using UnityLauncherPro.Properties;

Expand Down Expand Up @@ -1930,6 +1931,7 @@ void CreateNewEmptyProject(string targetFolder = null)
tabControl.SelectedIndex = 4;
this.UpdateLayout();
txtRootFolderForNewProjects.Focus();
SetStatus("Root folder for new projects is missing or doesn't exist: " + rootFolder, MessageType.Error);
return;
}
}
Expand Down Expand Up @@ -3353,8 +3355,22 @@ private void Window_MouseDown(object sender, MouseButtonEventArgs e)
gridSettingsBg.Focus();
}

public void SetStatus(string msg)
public void SetStatus(string msg, MessageType messageType = MessageType.Info)
{
Console.WriteLine(messageType);
switch (messageType)
{
case MessageType.Info:
txtStatus.Foreground = (SolidColorBrush)Application.Current.Resources["ThemeStatusText"];
break;
case MessageType.Warning:
txtStatus.Foreground = (SolidColorBrush)Application.Current.Resources["ThemeMessageWarning"];
break;
case MessageType.Error:
txtStatus.Foreground = (SolidColorBrush)Application.Current.Resources["ThemeMessageError"];
break;
}

txtStatus.Text = msg;
}

Expand Down
5 changes: 5 additions & 0 deletions UnityLauncherPro/Resources/Colors.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,10 @@
<SolidColorBrush x:Key="ThemeSystemHighlight" Color="#FF0078D7"/>
<!--<SolidColorBrush x:Key="ThemeButtonWhiteText" Color="#FFFFFFFF"/>-->
<SolidColorBrush x:Key="ThemeBrightText" Color="#FFFFFFFF"/>

<!--messages-->
<!--<SolidColorBrush x:Key="ThemeMessageInfo" Color="#FF1E1E1E"/>-->
<SolidColorBrush x:Key="ThemeMessageWarning" Color="#FFFF5200"/>
<SolidColorBrush x:Key="ThemeMessageError" Color="Red"/>

</ResourceDictionary>
1 change: 1 addition & 0 deletions UnityLauncherPro/UnityLauncherPro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
<Compile Include="Data\BuildReport.cs" />
<Compile Include="Data\BuildReportItem.cs" />
<Compile Include="Data\DownloadProgress.cs" />
<Compile Include="Data\MessageType.cs" />
<Compile Include="Data\Platform.cs" />
<Compile Include="Data\Tabs.cs" />
<Compile Include="Data\ThemeColor.cs" />
Expand Down

0 comments on commit 05a0dc3

Please sign in to comment.