Skip to content

Commit

Permalink
[UX] Configuration check-up list added in about page for newcomers
Browse files Browse the repository at this point in the history
  • Loading branch information
BAndysc committed Apr 18, 2021
1 parent 7f4cdd4 commit 4989c24
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 54 deletions.
1 change: 1 addition & 0 deletions WoWDatabaseEditor.Common/WDE.Common/DBC/IDbcStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace WDE.Common.DBC
[UniqueProvider]
public interface IDbcStore
{
bool IsConfigured { get; }
Dictionary<long, string> AreaTriggerStore { get; }
Dictionary<long, string> SkillStore { get; }
Dictionary<long, string> LanguageStore { get; }
Expand Down
2 changes: 2 additions & 0 deletions WoWDatabaseEditor.Common/WDE.DbcStore/DbcStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public DbcStore(IParameterFactory parameterFactory, ITaskRunner taskRunner, IDbc
Load();
}

public bool IsConfigured { get; private set; }
public Dictionary<long, string> AreaTriggerStore { get; internal set; } = new();
public Dictionary<long, string> FactionStore { get; internal set; } = new();
public Dictionary<long, string> SpellStore { get; internal set; } = new();
Expand Down Expand Up @@ -82,6 +83,7 @@ internal void Load()
if (!Directory.Exists(dbcSettingsProvider.GetSettings().Path))
return;

IsConfigured = true;
taskRunner.ScheduleTask(new DbcLoadTask(parameterFactory, dbcSettingsProvider, this));
}

Expand Down
51 changes: 50 additions & 1 deletion WoWDatabaseEditor/ViewModels/AboutViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Windows.Input;
using Prism.Commands;
using WDE.Common.CoreVersion;
using WDE.Common.Database;
using WDE.Common.DBC;
using WDE.Common.History;
using WDE.Common.Managers;
using WDE.Common.Services;
using WDE.Module.Attributes;
using WoWDatabaseEditorCore.CoreVersion;

namespace WoWDatabaseEditorCore.ViewModels
{
Expand All @@ -13,11 +20,39 @@ public class AboutViewModel : IDocument
{
private readonly IApplicationVersion applicationVersion;

public AboutViewModel(IApplicationVersion applicationVersion)
public AboutViewModel(IApplicationVersion applicationVersion,
IDatabaseProvider databaseProvider,
IDbcStore dbcStore,
IConfigureService settings,
ICurrentCoreVersion coreVersion,
IRemoteConnectorService remoteConnectorService)
{
this.applicationVersion = applicationVersion;

ConfigurationChecks.Add(new ConfigurationCheckup(true,
"Core version compatibility mode",
"WoW Database Editor supports multiple world of warcraft server cores. In order to achieve maximum compatibility, choose version that matches best.\nYou are using: " + coreVersion.Current.FriendlyName + " compatibility mode now."));

ConfigurationChecks.Add(new ConfigurationCheckup(dbcStore.IsConfigured,
"DBC settings",
"DBC is DataBaseClient files provided with WoW client. Those contain a lot of useful stuff for scripting like spells data. For maximum features you have to provide DBC files path. All WoW servers require those files to work so if you have working core, you must have DBC files already."));

ConfigurationChecks.Add(new ConfigurationCheckup(databaseProvider.IsConnected,
"Database connection",
"WoW Database Editor is database editor by design. It stores all data and loads things from wow database. Therefore to activate all features you have to provide wow compatible database connection settings."));

ConfigurationChecks.Add(new ConfigurationCheckup(remoteConnectorService.IsConnected,
"Remote SOAP connection",
"WDE can invoke reload commands for you for faster work. To enable that, you have to enable SOAP connection in your worldserver configuration and provide details in the settings."));

AllConfigured = ConfigurationChecks.All(s => s.Fulfilled);

OpenSettingsCommand = new DelegateCommand(settings.ShowSettings);
}

public ICommand OpenSettingsCommand { get; }
public bool AllConfigured { get; }
public ObservableCollection<ConfigurationCheckup> ConfigurationChecks { get; } = new();
public int BuildVersion => applicationVersion.BuildVersion;
public string Branch => applicationVersion.Branch;
public string CommitHash => applicationVersion.CommitHash;
Expand All @@ -40,6 +75,20 @@ public AboutViewModel(IApplicationVersion applicationVersion)
public void Dispose()
{
}

public class ConfigurationCheckup
{
public bool Fulfilled { get; }
public string Title { get; }
public string Description { get; }

public ConfigurationCheckup(bool fulfilled, string title, string description)
{
Fulfilled = fulfilled;
Title = title;
Description = description;
}
}
}

public class DisabledCommand : ICommand
Expand Down
74 changes: 50 additions & 24 deletions WoWDatabaseEditorCore.Avalonia/Views/AboutView.axaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,54 @@
<UserControl x:Class="WoWDatabaseEditorCore.Avalonia.Views.AboutView"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<DockPanel Margin="20" LastChildFill="True">
<TextBlock DockPanel.Dock="Bottom" IsVisible="{Binding VersionKnown}" Text="{Binding ReleaseData}" TextWrapping="WrapWithOverflow" />
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:WDE.Common.Avalonia.Converters;assembly=WDE.Common.Avalonia">
<UserControl.Resources>
<converters:InverseBoolConverter x:Key="InversedBoolConverter" />
</UserControl.Resources>
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
<DockPanel Margin="20" LastChildFill="True">
<TextBlock DockPanel.Dock="Bottom" IsVisible="{Binding VersionKnown}" Text="{Binding ReleaseData}" TextWrapping="WrapWithOverflow" />
<StackPanel>
<Border BorderThickness="0,0,0,2" BorderBrush="#FF5FA2DA">
<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom">
<Image Source="../Icon.png" Width="56" Height="56" />
<TextBlock VerticalAlignment="Bottom" FontSize="34" FontFamily="Segoe UI Light" TextWrapping="WrapWithOverflow">World of Warcraft Database Editor</TextBlock>
</StackPanel>
</Border>
<WrapPanel Orientation="Horizontal" Margin="0, 10, 0, 0">
<TextBlock FontWeight="Bold" Text="WoW Database Editor" />
<TextBlock TextWrapping="WrapWithOverflow" Text=" is an application used to create scripts (behaviours) in TrinityCore based servers." />
</WrapPanel>
<WrapPanel Orientation="Horizontal" Margin="0, 10, 0, 0">
<TextBlock TextWrapping="WrapWithOverflow" Text="To start work, add new &quot;file&quot; to the solution - File -&gt; Load. To edit script, double click on selected item in Solution Explorer." />
</WrapPanel>
<WrapPanel Orientation="Horizontal" Margin="0, 10, 0, 0">
<TextBlock TextWrapping="WrapWithOverflow" Text="Items in Solution Explorer are saved automatically, but scripts themselves are not. Remember to save them (export to database)" />
</WrapPanel>
<WrapPanel Orientation="Horizontal" Margin="0, 10, 0, 0">
<TextBlock TextWrapping="WrapWithOverflow" Text="Database is not required, but in that case features are limited. It is database editor by design." />
</WrapPanel>
</StackPanel>
</DockPanel>
<Border BorderThickness="0,0,0,2" BorderBrush="#FF5FA2DA">
<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom">
<Image Source="../Icon.png" Width="56" Height="56" />
<TextBlock VerticalAlignment="Bottom" FontSize="34" FontFamily="Segoe UI Light" TextWrapping="WrapWithOverflow">World of Warcraft Database Editor</TextBlock>
</StackPanel>
</Border>
<WrapPanel Orientation="Horizontal" Margin="0, 10, 0, 0">
<TextBlock FontWeight="Bold" Text="WoW Database Editor" />
<TextBlock TextWrapping="WrapWithOverflow" Text=" is an application used to create scripts (behaviours) in TrinityCore based servers." />
</WrapPanel>
<WrapPanel Orientation="Horizontal" Margin="0, 10, 0, 0">
<TextBlock TextWrapping="WrapWithOverflow" Text="To start work, add new &quot;file&quot; to the solution - File -&gt; Add. To edit script, double click on selected item in Solution Explorer." />
</WrapPanel>
<WrapPanel Orientation="Horizontal" Margin="0, 10, 0, 0">
<TextBlock TextWrapping="WrapWithOverflow" Text="Items in Solution Explorer are saved automatically, but scripts themselves are not. Remember to save them (export to database)" />
</WrapPanel>
<WrapPanel Orientation="Horizontal" Margin="0, 10, 0, 0">
<TextBlock TextWrapping="WrapWithOverflow" Text="Database is not required, but in that case features are limited. It is database editor by design." />
</WrapPanel>

<Border Margin="0,35,0,0" BorderThickness="0,0,0,2" BorderBrush="#FF5FA2DA">
<TextBlock FontSize="26">Configuration check-up list</TextBlock>
</Border>
<TextBlock Margin="0,10,0,0" TextWrapping="WrapWithOverflow">In order to enable all features, you have to configure the editor first.</TextBlock>
<TextBlock Margin="0,10,0,0" TextWrapping="WrapWithOverflow" IsVisible="{Binding AllConfigured}">Congratulations! You have everything configured properly!</TextBlock>
<ItemsControl Items="{Binding ConfigurationChecks}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<DockPanel LastChildFill="True" Margin="0,10,0,0">
<CheckBox MinWidth="0" VerticalAlignment="Center" IsChecked="{Binding Fulfilled, Mode=OneWay}" IsHitTestVisible="False" />
<StackPanel Orientation="Vertical">
<TextBlock FontWeight="Bold" Text="{Binding Title}"/>
<TextBlock TextWrapping="WrapWithOverflow" Text="{Binding Description}" />
</StackPanel>
</DockPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Margin="0,10,0,0" IsVisible="{Binding AllConfigured, Converter={StaticResource InversedBoolConverter}}" Command="{Binding OpenSettingsCommand}">Open settings to configure</Button>
</StackPanel>
</DockPanel>
</ScrollViewer>
</UserControl>
86 changes: 57 additions & 29 deletions WoWDatabaseEditorCore.WPF/Views/AboutView.xaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,62 @@
<UserControl x:Class="WoWDatabaseEditorCore.WPF.Views.AboutView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:viewHelpers="clr-namespace:WDE.Common.WPF.ViewHelpers;assembly=WDE.Common.WPF"
Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}">
<Grid Margin="20">
<StackPanel>
<Border BorderThickness="0,0,0,2" BorderBrush="#FF5FA2DA">
<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom">
<Image Source="/Icon.ico" Width="56" Height="56" />
<TextBlock VerticalAlignment="Bottom" FontSize="34" FontFamily="Segoe UI Light" TextWrapping="WrapWithOverflow">World of Warcraft Database Editor</TextBlock>
</StackPanel>
</Border>
<TextBlock Margin="0,10,0,0" TextWrapping="WrapWithOverflow">
<Run FontWeight="Bold" Text="WoW Database Editor" /><Run Text=" " />
<Run Text="is an application used to create scripts (behaviours) in TrinityCore based servers." />
</TextBlock>
<TextBlock Margin="0,10,0,0" TextWrapping="WrapWithOverflow">
<Run Text="To start work, add new &quot;file&quot; to the solution " />
<Run Text="- File -&gt; Load. " />
<Run Text="To edit script, double click on selected item in Solution Explorer." />
</TextBlock>
<TextBlock Margin="0,10,0,0" TextWrapping="WrapWithOverflow">
<Run
Text="Items in Solution Explorer are saved automatically, but scripts themselves are not. Remember to save them " />
<Run Text="(" /><Run Text="export to database" /><Run Text=")." />
</TextBlock>
<TextBlock Margin="0,10,0,0" TextWrapping="WrapWithOverflow">
<Run Text="Database is not required" /><Run Text=", " /><Run Text="but in that" />
<Run Text=" case features are limited." /><Run Text=" " />
<Run Text="It is database editor by design" /><Run Text="." />
</TextBlock>
</StackPanel>
</Grid>
<UserControl.Resources>
<viewHelpers:BooleanToVisibilityConverter WhenTrue="Visible" WhenFalse="Collapsed" x:Key="BooleanToVisibilityConverter"/>
<viewHelpers:BooleanToVisibilityConverter WhenTrue="Collapsed" WhenFalse="Visible" x:Key="InverseBooleanToVisibilityConverter"/>
</UserControl.Resources>
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
<DockPanel Margin="20" LastChildFill="True">
<TextBlock DockPanel.Dock="Bottom" Visibility="{Binding VersionKnown, Converter={StaticResource BooleanToVisibilityConverter}}" Text="{Binding ReleaseData}" TextWrapping="WrapWithOverflow" />
<StackPanel>
<Border BorderThickness="0,0,0,2" BorderBrush="#FF5FA2DA">
<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom">
<Image Source="/Icon.ico" Width="56" Height="56" />
<TextBlock VerticalAlignment="Bottom" FontSize="34" FontFamily="Segoe UI Light" TextWrapping="WrapWithOverflow">World of Warcraft Database Editor</TextBlock>
</StackPanel>
</Border>
<TextBlock Margin="0,10,0,0" TextWrapping="WrapWithOverflow">
<Run FontWeight="Bold" Text="WoW Database Editor" /><Run Text=" " />
<Run Text="is an application used to create scripts (behaviours) in TrinityCore based servers." />
</TextBlock>
<TextBlock Margin="0,10,0,0" TextWrapping="WrapWithOverflow">
<Run Text="To start work, add new &quot;file&quot; to the solution " />
<Run Text="- File -&gt; Load. " />
<Run Text="To edit script, double click on selected item in Solution Explorer." />
</TextBlock>
<TextBlock Margin="0,10,0,0" TextWrapping="WrapWithOverflow">
<Run
Text="Items in Solution Explorer are saved automatically, but scripts themselves are not. Remember to save them " />
<Run Text="(" /><Run Text="export to database" /><Run Text=")." />
</TextBlock>
<TextBlock Margin="0,10,0,0" TextWrapping="WrapWithOverflow">
<Run Text="Database is not required" /><Run Text=", " /><Run Text="but in that" />
<Run Text=" case features are limited." /><Run Text=" " />
<Run Text="It is database editor by design" /><Run Text="." />
</TextBlock>

<Border Margin="0,35,0,0" BorderThickness="0,0,0,2" BorderBrush="#FF5FA2DA">
<TextBlock FontSize="26">Configuration check-up list</TextBlock>
</Border>
<TextBlock Margin="0,10,0,0" TextWrapping="WrapWithOverflow">In order to enable all features, you have to configure the editor first.</TextBlock>
<TextBlock Margin="0,10,0,0" TextWrapping="WrapWithOverflow" Visibility="{Binding AllConfigured, Converter={StaticResource BooleanToVisibilityConverter}}">Congratulations! You have everything configured properly!</TextBlock>
<ItemsControl ItemsSource="{Binding ConfigurationChecks}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<DockPanel LastChildFill="True" Margin="0,10,0,0">
<CheckBox MinWidth="0" VerticalAlignment="Center" IsChecked="{Binding Fulfilled, Mode=OneWay}" IsHitTestVisible="False" />
<StackPanel Orientation="Vertical" Margin="5,0,0,0">
<TextBlock FontWeight="Bold" Text="{Binding Title}"/>
<TextBlock TextWrapping="WrapWithOverflow" Text="{Binding Description}" />
</StackPanel>
</DockPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Margin="0,10,0,0" Visibility="{Binding AllConfigured, Converter={StaticResource InverseBooleanToVisibilityConverter}}" Command="{Binding OpenSettingsCommand}">Open settings to configure</Button>
</StackPanel>
</DockPanel>
</ScrollViewer>
</UserControl>

0 comments on commit 4989c24

Please sign in to comment.