Skip to content

Commit

Permalink
Merge pull request #835 from storybuilder-org/MoreHelp
Browse files Browse the repository at this point in the history
More help
  • Loading branch information
terrycox authored Nov 21, 2024
2 parents 17f4454 + f8ec3fa commit 4eae75d
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 11 deletions.
11 changes: 11 additions & 0 deletions StoryCAD/Views/Shell.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ private async void Shell_Loaded(object sender, RoutedEventArgs e)
await new Services.Dialogs.Changelog().ShowChangeLog();
}

if (Preferences.ShowStartupDialog)
{
ContentDialog CD = new()
{
Title = "Need help getting started?",
Content = new HelpPage(),
PrimaryButtonText = "Close",
};
await Ioc.Default.GetRequiredService<Windowing>().ShowContentDialog(CD);
}

//If StoryCAD was loaded from a .STBX File then instead of showing the Unified menu
//We will instead load the file instead.
Logger.Log(LogLevel.Info, $"Filepath to launch {ShellVm.FilePathToLaunch}");
Expand Down
5 changes: 4 additions & 1 deletion StoryCADLib/DAL/PreferencesIO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ public async Task ReadPreferences()
case "AdvancedLogging":
_model.AdvancedLogging = _tokens[1] == "True";
break;

case "StartupPage":
_model.ShowStartupDialog = _tokens[1] == "True";
break;
}
}

Expand Down Expand Up @@ -279,6 +281,7 @@ public async Task WritePreferences()
CummulativeTimeUsed={_model.CumulativeTimeUsed}
LastReviewDate={_model.LastReviewDate}
AdvancedLogging={_model.AdvancedLogging}
StartupPage={_model.ShowStartupDialog}
""";

_newPreferences += (_model.WrapNodeNames == TextWrapping.WrapWholeWords
Expand Down
9 changes: 7 additions & 2 deletions StoryCADLib/Models/Tools/PreferencesModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ public class PreferencesModel : ObservableObject
/// DateTime of last review
/// </summary>
public DateTime LastReviewDate;


/// <summary>
/// Should the startup dialog (HelpPage) be shown
/// </summary>
public bool ShowStartupDialog;

/// <summary>
/// Do we want to log more in depth
Expand Down Expand Up @@ -130,8 +134,9 @@ public PreferencesModel()
ThemePreference = ElementTheme.Default; // Use system theme
HideRatingPrompt = false;
CumulativeTimeUsed = 0;
AdvancedLogging = false;
AdvancedLogging = false;
LastReviewDate = DateTime.MinValue;
ShowStartupDialog = true;
}
#endregion
}
27 changes: 27 additions & 0 deletions StoryCADLib/Services/Dialogs/HelpPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Page
x:Class="StoryCAD.Services.Dialogs.HelpPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<StackPanel>
<InfoBar Severity="Informational" IsOpen="True" IsClosable="False">
<TextBlock Text="The videos below refer to StoryCAD as StoryBuilder,
however are still a good place to get started" TextWrapping="Wrap" Margin="10,10"/>
</InfoBar>
<TextBlock Text="StoryCAD can be daunting, so here are some resources to help you get started:" Margin="0,10"/>

<HyperlinkButton Content="StoryCAD Concepts (Video)" NavigateUri="https://www.youtube.com/watch?v=Oi7G9TEKsro"/>
<HyperlinkButton Content="A 5-minute Introduction to StoryCAD (Video)" NavigateUri="https://www.youtube.com/watch?v=qFpTI15-q7A"/>
<HyperlinkButton Content="Frequently Asked Questions" NavigateUri="https://www.storybuilder.org/faq"/>
<HyperlinkButton Content="Tutorial" NavigateUri="https://storybuilder-org.github.io/StoryCAD/Tutorial_Creating_a_Story.html"/>
<HyperlinkButton Content="User manual" NavigateUri="https://storybuilder-org.github.io/StoryCAD/"/>
<HyperlinkButton Content="Events" NavigateUri="https://storybuilder.org/events/"/>

<CheckBox Content="Don't show this again" Click="Clicked"
HorizontalAlignment="Center" VerticalAlignment="Bottom"/>
</StackPanel>
</Page>
17 changes: 17 additions & 0 deletions StoryCADLib/Services/Dialogs/HelpPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.UI.Xaml;

namespace StoryCAD.Services.Dialogs;

public sealed partial class HelpPage : Page
{
public HelpPage() { InitializeComponent(); }

/// <summary>
/// Update preferences to hide/show menu
/// </summary>
private void Clicked(object sender, RoutedEventArgs e)
{
Ioc.Default.GetRequiredService<PreferenceService>().Model.ShowStartupDialog =
(bool)(sender as CheckBox).IsChecked;
}
}
33 changes: 25 additions & 8 deletions StoryCADLib/Services/Dialogs/Tools/PreferencesDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,41 @@
</StackPanel>
</PivotItem>
<PivotItem Header="Other" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch">
<StackPanel HorizontalAlignment="Center">
<CheckBox Content="Send error logs to Team StoryCAD" Margin="8" HorizontalAlignment="Left" IsChecked="{x:Bind PreferencesVm.ErrorCollectionConsent, Mode=TwoWay}"/>
<CheckBox Content="Send me newsletters about StoryCAD" Margin="8" HorizontalAlignment="Left" IsChecked="{x:Bind PreferencesVm.Newsletter, Mode=TwoWay}"/>
<CheckBox Content="Wrap node names" Margin="8" HorizontalAlignment="Left" Click="ToggleWrapping" Name="TextWrap"/>
<CheckBox Content="Advanced logging" Margin="8" HorizontalAlignment="Left" IsChecked="{x:Bind PreferencesVm.AdvancedLogging, Mode=TwoWay}"/>
<Grid HorizontalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<CheckBox Grid.Row="0" Grid.Column="0" Content="Send error logs" Margin="8" HorizontalAlignment="Left" IsChecked="{x:Bind PreferencesVm.ErrorCollectionConsent, Mode=TwoWay}"/>
<CheckBox Grid.Row="0" Grid.Column="1" Content="Send me StoryCAD newsletters" Margin="8" HorizontalAlignment="Left" IsChecked="{x:Bind PreferencesVm.Newsletter, Mode=TwoWay}"/>
<CheckBox Grid.Row="1" Grid.Column="0" Content="Wrap node names" Margin="8" HorizontalAlignment="Left" Click="ToggleWrapping" Name="TextWrap"/>
<CheckBox Grid.Row="1" Grid.Column="1" Content="Advanced logging" Margin="8" HorizontalAlignment="Left" IsChecked="{x:Bind PreferencesVm.AdvancedLogging, Mode=TwoWay}"/>
<CheckBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center"
Content="Show startup page" Margin="8" IsChecked="{x:Bind PreferencesVm.ShowStartupPage, Mode=TwoWay}" />

<ComboBox Header="Preferred Theme" HorizontalAlignment="Stretch" SelectedIndex="{x:Bind PreferencesVm.PreferredThemeIndex, Mode=TwoWay}" Margin="8">
<ComboBox Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="3" Width="300"
Header="Preferred Theme" HorizontalAlignment="Stretch"
SelectedIndex="{x:Bind PreferencesVm.PreferredThemeIndex, Mode=TwoWay}" Margin="8">
<ComboBoxItem Content="Use system theme"/>
<ComboBoxItem Content="Light Theme"/>
<ComboBoxItem Content="Dark Theme"/>
</ComboBox>
<ComboBox Header="Preferred Search Engine" HorizontalAlignment="Stretch" Name="SearchEngine" SelectedIndex="{x:Bind PreferencesVm.SearchEngineIndex, Mode=TwoWay}" Margin="0,4,0,0">
<ComboBox Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="4" Width="300"
Header="Preferred Search Engine" HorizontalAlignment="Stretch"
Name="SearchEngine" SelectedIndex="{x:Bind PreferencesVm.SearchEngineIndex, Mode=TwoWay}" Margin="0,4,0,0">
<ComboBoxItem Content="DuckDuckGo"/>
<ComboBoxItem Content="Google"/>
<ComboBoxItem Content="Bing"/>
<ComboBoxItem Content="Yahoo"/>
</ComboBox>
</StackPanel>
</Grid>
</PivotItem>
<PivotItem Header="About" VerticalContentAlignment="Center" VerticalAlignment="Stretch">
<StackPanel>
Expand Down
4 changes: 4 additions & 0 deletions StoryCADLib/StoryCADLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<None Remove="Controls\Traits.xaml" />
<None Remove="Services\Dialogs\ElementPicker.xaml" />
<None Remove="Services\Dialogs\FeedbackDialog.xaml" />
<None Remove="Services\Dialogs\HelpPage.xaml" />
<None Remove="Services\Dialogs\NewProjectPage.xaml" />
<None Remove="Services\Dialogs\NewRelationshipPage.xaml" />
<None Remove="Services\Dialogs\RecentFiles.xaml" />
Expand Down Expand Up @@ -169,6 +170,9 @@
<None Update="NLog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Page Update="Services\Dialogs\HelpPage.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="Services\Dialogs\ElementPicker.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
Expand Down
10 changes: 10 additions & 0 deletions StoryCADLib/ViewModels/Tools/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@ public bool AdvancedLogging
set => SetProperty(ref _advancedLogging, value);
}

// Show startup page.
private bool _ShowStartupPage;
public bool ShowStartupPage
{
get => _ShowStartupPage;
set => SetProperty(ref _ShowStartupPage, value);
}

#endregion

#region Methods
Expand Down Expand Up @@ -221,6 +229,7 @@ internal void LoadModel()
PreferredSearchEngine = CurrentModel.PreferredSearchEngine;
PreferedTheme = CurrentModel.ThemePreference;
AdvancedLogging = CurrentModel.AdvancedLogging;
ShowStartupPage = CurrentModel.ShowStartupDialog;
}

internal void SaveModel()
Expand Down Expand Up @@ -259,6 +268,7 @@ internal void SaveModel()
Ioc.Default.GetService<Windowing>().UpdateUIToTheme();
}
CurrentModel.ThemePreference = PreferedTheme;
CurrentModel.ShowStartupDialog = ShowStartupPage;
}

/// <summary>
Expand Down

0 comments on commit 4eae75d

Please sign in to comment.