Matt Hamilton avatar Matt Hamilton committed 29bddd8

Sorting characters and creators before showing the appearance/credit dialogs

Comments (0)

Files changed (4)

Comicster/Comicster.csproj

     <PublisherName>Comicster</PublisherName>
     <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
     <WebPage>publish.htm</WebPage>
-    <ApplicationRevision>44</ApplicationRevision>
+    <ApplicationRevision>45</ApplicationRevision>
     <ApplicationVersion>4.0.0.%2a</ApplicationVersion>
     <UseApplicationTrust>false</UseApplicationTrust>
     <PublishWizardCompleted>true</PublishWizardCompleted>

Comicster/ViewModels/Editors/AppearanceEditorViewModel.cs

 using System;
 using System.ComponentModel;
 using GalaSoft.MvvmLight;
+using System.Collections.Generic;
+using System.Linq;
 
 namespace Comicster.ViewModels
 {
         {
             Image = "/Images/character_16.png";
             Title = "Appearance Properties";
+
+            SortedCharacters = host.Collection.Characters.OrderBy(c => c.Name).ThenBy(c => c.Universe).ToList();
         }
 
+        public IList<Character> SortedCharacters { get; private set; }
+
         protected override void OnSubmitting(SubmittingEventArgs e)
         {
             base.OnSubmitting(e);

Comicster/ViewModels/Editors/CreditEditorViewModel.cs

 using System;
+using System.Linq;
 using System.Collections.Generic;
 using System.ComponentModel;
 using GalaSoft.MvvmLight;
         {
             Image = "/Images/creator_16.png";
             Title = "Credit Properties";
+
+            SortedCreators = host.Collection.Creators.OrderBy(c => c.Name).ToList();
         }
 
+        public IList<Creator> SortedCreators { get; private set; }
+
         protected override void OnSubmitting(SubmittingEventArgs e)
         {
             base.OnSubmitting(e);

Comicster/Views/EditorTemplates.xaml

                 </Grid.RowDefinitions>
 
                 <Label Grid.Column="0" Grid.Row="0" Target="{x:Reference focus}" Content="_Creator:" Margin="0 0 10 20" Padding="0" />
-                <ComboBox Grid.Column="1" Grid.Row="0" x:Name="focus" Margin="0 0 0 20" IsEditable="True" ItemsSource="{Binding Collection.Creators,Converter={StaticResource Sorter}}" DisplayMemberPath="Name" SelectedItem="{Binding Item.Creator,ValidatesOnDataErrors=True,UpdateSourceTrigger=PropertyChanged}" Text="{Binding Item.CreatorName}">
+                <ComboBox Grid.Column="1" Grid.Row="0" x:Name="focus" Margin="0 0 0 20" IsEditable="True" ItemsSource="{Binding SortedCreators}" DisplayMemberPath="Name" SelectedItem="{Binding Item.Creator,ValidatesOnDataErrors=True,UpdateSourceTrigger=PropertyChanged}" Text="{Binding Item.CreatorName}">
                     <ComboBox.Style>
                         <Style TargetType="ComboBox">
                             <Setter Property="IsEnabled" Value="False" />
                 </Grid.RowDefinitions>
 
                 <Label Grid.Column="0" Grid.Row="0" Target="{x:Reference focus}" Content="_Character:" Margin="0 0 10 20" Padding="0" />
-                <ComboBox Grid.Column="1" Grid.Row="0" x:Name="focus" Margin="0 0 0 20" IsEditable="True" ItemsSource="{Binding Collection.Characters,Converter={StaticResource Sorter}}" DisplayMemberPath="Name" SelectedItem="{Binding Item.Character,ValidatesOnDataErrors=True,UpdateSourceTrigger=PropertyChanged}" Text="{Binding Item.CharacterName}">
+                <ComboBox Grid.Column="1" Grid.Row="0" x:Name="focus" Margin="0 0 0 20" IsEditable="True" ItemsSource="{Binding SortedCharacters}" DisplayMemberPath="Name" SelectedItem="{Binding Item.Character,ValidatesOnDataErrors=True,UpdateSourceTrigger=PropertyChanged}" Text="{Binding Item.CharacterName}">
                     <ComboBox.Style>
                         <Style TargetType="ComboBox">
                             <Setter Property="IsEnabled" Value="False" />
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.