General fixes

This commit is contained in:
Lohikar 2017-11-23 17:44:05 -06:00
parent 32454bd123
commit 0ceb5c4ae3
4 changed files with 34 additions and 9 deletions

View file

@ -13,6 +13,7 @@
<!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedTabControl.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

View file

@ -6,9 +6,10 @@
xmlns:local="clr-namespace:AuroraRecordGenerator"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
GlowBrush="{DynamicResource AccentColorBrush}"
Title="Generated Records" Height="500" Width="850" TitleCaps="False">
<Grid>
<TabControl Margin="10">
<controls:MetroAnimatedTabControl Margin="10">
<TabItem Header="Employment">
<TextBox x:Name="EmploymentBox" IsReadOnly="True" IsUndoEnabled="False" AutoWordSelection="True" FontFamily="Consolas"/>
</TabItem>
@ -18,6 +19,6 @@
<TabItem Header="Security">
<TextBox x:Name="SecurityBox" IsReadOnly="True" IsUndoEnabled="False" AutoWordSelection="True" FontFamily="Consolas"/>
</TabItem>
</TabControl>
</controls:MetroAnimatedTabControl>
</Grid>
</controls:MetroWindow>

View file

@ -8,6 +8,7 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
Title="Aurora Character Records Generator" Height="563" Width="719.583"
GlowBrush="{DynamicResource AccentColorBrush}"
TitleCharacterCasing="Normal" Loaded="WindowLoaded">
<controls:MetroWindow.Resources>
<!-- Species Combobox Data Source -->
@ -18,7 +19,7 @@
</ObjectDataProvider>
</controls:MetroWindow.Resources>
<Grid>
<TabControl Margin="0,10,0,44.96" controls:TabControlHelper.IsUnderlined="True">
<controls:MetroAnimatedTabControl Margin="0,10,0,44.96" controls:TabControlHelper.IsUnderlined="True">
<!-- General Character Information -->
<TabItem Header="General">
<ScrollViewer>
@ -367,7 +368,7 @@
</Grid>
</ScrollViewer>
</TabItem>
</TabControl>
</controls:MetroAnimatedTabControl>
<!-- Footer -->
<Grid Height="45" VerticalAlignment="Bottom">
<Button Content="Open" HorizontalAlignment="Left" Margin="10,9.66,0,10" Width="75"

View file

@ -91,6 +91,20 @@ namespace AuroraRecordGenerator
// Figure out their species too.
Data.Species = (SpeciesType)SpeciesCombo.SelectedValue;
// Finally, gender.
switch ((string)GenderCombo.SelectionBoxItem)
{
case "Male":
Data.Gender = GenderType.Male;
break;
case "Female":
Data.Gender = GenderType.Female;
break;
default:
Data.Gender = GenderType.NotApplicable;
break;
}
var wnd = new GeneratedResultWindow(Data);
wnd.Show();
}
@ -128,7 +142,7 @@ namespace AuroraRecordGenerator
}
}
private void OpenContent(object sender, RoutedEventArgs e)
private async void OpenContent(object sender, RoutedEventArgs e)
{
var dialog = new Microsoft.Win32.OpenFileDialog
{
@ -141,10 +155,18 @@ namespace AuroraRecordGenerator
if (!(dialog.ShowDialog() ?? false)) return;
var fs = File.Open(dialog.FileName, FileMode.Open);
Data = ProtoBuf.Serializer.Deserialize<Record>(fs);
_currentFilePath = dialog.FileName;
// So WPF updates bindings
DataContext = Data;
try
{
Data = ProtoBuf.Serializer.Deserialize<Record>(fs);
_currentFilePath = dialog.FileName;
// So WPF updates bindings
DataContext = Data;
}
catch (ProtoBuf.ProtoException)
{
await this.ShowMessageAsync("Profile Error", "An error occurred during loading of your profile. You may have selected a file that is not a profile file, or the profile is corrupted.");
}
}
private void SaveContentAs(object sender, RoutedEventArgs e)