Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -37,8 +37,20 @@ private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
//For reassigning all of the indexes whenever the window is changed
var datacontext = DataContext as LibraryMenuViewModel;
int columncount = (int)DisplayArea.ActualWidth / 180;
datacontext.LibraryViewAreaResized(columncount);
datacontext.SeasonSortListAreaResized(columncount);
if(datacontext.CurrentView == "All")
{
datacontext.LibraryViewAreaResized(columncount);
}
else if (datacontext.CurrentView == "Season")
{
datacontext.SeasonSortListAreaResized(columncount);
}
else if (datacontext.CurrentView == "Search")
{
datacontext.SearchResultListAreaResized(columncount);
}


}

private void OnWindowLoaded(object sender, RoutedEventArgs e)
@@ -75,6 +87,12 @@ private void Button_Click(object sender, RoutedEventArgs e)
var datacontext = DataContext as LibraryMenuViewModel;
datacontext.AnimeInfoToggle = false;
}

private void SearchBox_GotFocus(object sender, RoutedEventArgs e)
{
var textbox = sender as TextBox;
textbox.Text = string.Empty;
}
}

public class UnsetConverter : IValueConverter
@@ -27,28 +27,32 @@ public LibraryMenuViewModel(OptionsObject optionsobject, IEventAggregator eventA
this.optionsobject = optionsobject;
datasource = new LibraryMenuModel(optionsobject);

//Subscribe to events
//Subscribe to message events first thing (so messages can be picked up immediately);
datasource.SendMessagetoGUI += new EventHandler(onSendMessagetoGUI);
this.animeLibraryList.CollectionChanged += OnAnimeLibraryListCollectionChanged;
this.SeasonSortList.CollectionChanged += OnSeasonSortListCollectionChanged;

//Read the cache file
datasource.ReadCacheFile();

//Subscribe to collection changed events. Subscribing to collection changed events has to happen after the cache file is read because ReadCacheFile (deserialize JSON)
//will replace the instance of the collection and make the events stop working
datasource.AnimeLibraryList.CollectionChanged += OnAnimeLibraryListCollectionChanged;
this.SeasonSortList.CollectionChanged += OnSeasonSortListCollectionChanged;

//Initialize animeLibraryList (for view all)
this.animeLibraryList = datasource.AnimeLibraryList;
this.AnimeLibraryList = datasource.AnimeLibraryList;

//Season sort
this.InitializeSeasonLists();
this.RefreshSeasonLists();
}


#region Fields

//Commands
private ICommand _refreshCommand;
private ICommand _selectAnime;
private ICommand _switchSort;
private ICommand _searchAnime;

//Private fields to keep track of the current grid column and row count
private int gridcolumncount;
@@ -60,6 +64,9 @@ public LibraryMenuViewModel(OptionsObject optionsobject, IEventAggregator eventA
//Private field for the current sort view
private string currentView = "All";

//Private field for the search term on the top rigiht
private string searchTerm = "Search";

//GUI Toggles
private bool messageLogToggle;
private bool animeInfoToggle;
@@ -74,8 +81,9 @@ public LibraryMenuViewModel(OptionsObject optionsobject, IEventAggregator eventA
private ObservableCollection<string> libraryMessageLog = new ObservableCollection<string>();
private ObservableCollection<AnimeEntryObject> animeLibraryList = new ObservableCollection<AnimeEntryObject>();
private ObservableCollection<SortedDisplayInfoHolder> seasonSortList = new ObservableCollection<SortedDisplayInfoHolder>();
private ObservableCollection<AnimeEntryObject> searchResultList = new ObservableCollection<AnimeEntryObject>();

public IEventAggregator EventAggregator { get; set; }
public IEventAggregator EventAggregator { get; set; }

#endregion

@@ -123,12 +131,50 @@ public ICommand SwitchSort
}
}

public ICommand SearchAnime
{
get
{
if (_searchAnime == null)
{
_searchAnime = new RelayCommand(
p => SearchAnimeLibraryList((string)p),
p => AnimeLibraryList.Count > 0);
}
return _searchAnime;
}
}

public ObservableCollection<AnimeEntryObject> AnimeLibraryList
{
get
{
return animeLibraryList;
}
set
{
if (animeLibraryList != value)
{
animeLibraryList = value;
OnPropertyChanged("AnimeLibraryList");
}
}
}

public ObservableCollection<AnimeEntryObject> SearchResultList
{
get
{
return searchResultList;
}
set
{
if (searchResultList != value)
{
searchResultList = value;
OnPropertyChanged("SearchResultList");
}
}
}

public ObservableCollection<SortedDisplayInfoHolder> SeasonSortList
@@ -137,8 +183,16 @@ public ObservableCollection<SortedDisplayInfoHolder> SeasonSortList
{
return seasonSortList;
}
set
{
if (seasonSortList != value)
{
seasonSortList = value;
OnPropertyChanged("SeasonSortList");
}
}
}

public ObservableCollection<string> LibraryMessageLog
{
get
@@ -236,7 +290,7 @@ public string CurrentView
}
}
}


public AnimeEntryObject SelectedAnime
{
@@ -254,6 +308,22 @@ public AnimeEntryObject SelectedAnime
}
}

public string SearchTerm
{
get
{
return searchTerm;
}
set
{
if (searchTerm != value)
{
searchTerm = value;
OnPropertyChanged("SearchTerm");
}
}
}

#endregion

#region Methods
@@ -299,13 +369,14 @@ private void Switch(string targetView)
return;
}

private void InitializeSeasonLists()
//Fills the Season lists for the season view
private void RefreshSeasonLists()
{
List<SortedDisplayInfoHolder> temporarylist = new List<SortedDisplayInfoHolder>();
//Go through all of the anime to dig out which dates are present and add them to their respective collections
foreach (AnimeEntryObject anime in this.AnimeLibraryList)
{

int SeasonSortCollectionIndex = temporarylist.FindIndex(season => season.SortCriteria == SeasonConverter(anime.start_date));

//If the index is found it won't be -1
@@ -317,22 +388,53 @@ private void InitializeSeasonLists()
{
//Make a new one if the season isn't found
SortedDisplayInfoHolder buffer = new SortedDisplayInfoHolder();
buffer.SortCriteria = SeasonConverter(anime.start_date);
buffer.SortCriteria = SeasonConverter(anime.start_date);
buffer.AnimeEntries.Add(anime.Clone());

temporarylist.Add(buffer);
}
}

//Sort the List
temporarylist.Sort(CompareAnimeSeasons);
//Sort the list into seasons
temporarylist.Sort(CompareAnimeSeasons);

//Turn the list into the observable collection for binding
seasonSortList = new ObservableCollection<SortedDisplayInfoHolder>(temporarylist);
//Turn the list into the observable collection for binding
SeasonSortList.Clear();
temporarylist.ForEach(x => SeasonSortList.Add(x));

return;
}

//Searches the AnimeLibraryList and fills the searchResults list with results
private void SearchAnimeLibraryList(string SearchTerm)
{
if (SearchTerm == null)
{
Switch("Search");
return;
}

//Search anime list for results based on the search term (linq?) and return a cloned collection
var search = (from anime in AnimeLibraryList

where anime.english.ToLower().Contains(SearchTerm.ToLower()) ||
anime.title.ToLower().Contains(SearchTerm.ToLower())

orderby anime.title ascending

select anime.Clone());

//Populate search results list
SearchResultList = new ObservableCollection<AnimeEntryObject>(search.ToList());

//Update the grid indexes for the cloned collection
UpdateGridIndexes(this.GridColumnCount, SearchResultList);

//Switch view to Search Results
Switch("Search");
}

//Turns a date string into a season i.e. (Summer 2014)
private string SeasonConverter(string startDate)
{
string ret;
@@ -366,7 +468,7 @@ private string SeasonConverter(string startDate)

//Delegate for comparing shit.
private static int CompareAnimeSeasons(SortedDisplayInfoHolder x, SortedDisplayInfoHolder y)
{
{
int xYear = Convert.ToInt16(x.SortCriteria.Substring(x.SortCriteria.IndexOf(" ") + 1));
int yYear = Convert.ToInt16(y.SortCriteria.Substring(y.SortCriteria.IndexOf(" ") + 1));
string xMonth = x.SortCriteria.Substring(0, x.SortCriteria.IndexOf(" "));
@@ -427,7 +529,7 @@ private static int CompareAnimeSeasons(SortedDisplayInfoHolder x, SortedDisplayI
return 0;
}
}
return 0;
return 0;
}

#endregion
@@ -468,6 +570,26 @@ public void LibraryViewAreaResized(int columncount)
}
}

//Function to be called for search view resizing
public void SearchResultListAreaResized(int columncount)
{
if (columncount != 0)
{
UpdateGridIndexes(columncount, this.SearchResultList);
GridColumnCount = columncount;
if (AnimeLibraryList.Count % columncount == 0)
{
GridRowCount = AnimeLibraryList.Count / columncount;
}

else
{
GridRowCount = (AnimeLibraryList.Count / columncount) + 1;
}
}
}

//Function to be called for SeasonSortResizing
public void SeasonSortListAreaResized(int columncount)
{
if (columncount != 0)
@@ -485,22 +607,23 @@ public void SeasonSortListAreaResized(int columncount)
{
SeasonSortList[i].GridRowCount = (SeasonSortList[i].AnimeEntries.Count / columncount) + 1;
}
}
}
}
}

private void OnAnimeLibraryListCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
LibraryViewAreaResized(this.GridColumnCount);

//When the AnimeLibraryList is changed, all of the season lists need to be updated again
RefreshSeasonLists();
}

private void OnSeasonSortListCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
SeasonSortListAreaResized(this.GridColumnCount);
}
}

#endregion


}
}
@@ -31,14 +31,20 @@
</TextBlock>
</DockPanel>
<Grid>
<DockPanel>
<DockPanel>
<TextBlock Text="Color Theme" Style="{StaticResource BodyHeaderText}" DockPanel.Dock="Top"></TextBlock>
<ComboBox x:Name="ThemeSelector" DockPanel.Dock="Top" Width="200" FontFamily="Segoe UI" HorizontalAlignment="Left" Margin="10,10,0,0" ItemsSource="{Binding AvailableThemes}"
SelectedItem="{Binding DataContext.SelectedTheme, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, diag:PresentationTraceSources.TraceLevel=High}" IsSynchronizedWithCurrentItem="True">
</ComboBox>

<TextBlock Text="Folder Options" Style="{StaticResource BodyHeaderText}" DockPanel.Dock="Top" Margin="10,20,0,0"></TextBlock>
<TextBlock Text="Cache Folder Path" Style="{StaticResource BodyHeaderText}" DockPanel.Dock="Top" FontSize="18"></TextBlock>
<TextBox Text="{Binding CacheFolderPath, Mode=TwoWay, UpdateSourceTrigger=Default}" DockPanel.Dock="Top" Margin="10,0,0,0"/>
<TextBlock Text="Cache Folder Path" Style="{StaticResource BodyHeaderText}" DockPanel.Dock="Top" FontSize="14"></TextBlock>
<TextBox Text="{Binding CacheFolderPath, Mode=TwoWay, UpdateSourceTrigger=Default}" DockPanel.Dock="Top" Margin="10,0,0,0"/>

<TextBlock Text="Data Source Options" Style="{StaticResource BodyHeaderText}" DockPanel.Dock="Top" Margin="10,20,0,0"></TextBlock>
<CheckBox Margin="10,0,0,0" IsChecked="{Binding UseMALDataSource, Mode=TwoWay, UpdateSourceTrigger=Default}" Style="{StaticResource BodyHeaderText}" FontSize="14" DockPanel.Dock="Top">My Anime List</CheckBox>
<CheckBox Margin="10,0,0,0" IsChecked="{Binding UseAniDBDataSource, Mode=TwoWay, UpdateSourceTrigger=Default}" Style="{StaticResource BodyHeaderText}" FontSize="14" DockPanel.Dock="Top">AniDB</CheckBox>

<DockPanel />
</DockPanel>
</Grid>
@@ -24,8 +24,10 @@ public string BaseName
public OptionMenuViewModel(OptionsObject optionsobject, IEventAggregator eventAggregator)
{
this.optionsobject = optionsobject;
this.SelectedTheme = this.optionsobject.Themesetting;
this.SelectedTheme = optionsobject.Themesetting;
this.CacheFolderPath = optionsobject.CacheFolderpath;
this.UseMALDataSource = optionsobject.UseMALDataSource;
this.UseAniDBDataSource = optionsobject.UseAniDBDataSource;
this.EventAggregator = eventAggregator;
}

@@ -40,6 +42,8 @@ public OptionMenuViewModel(OptionsObject optionsobject, IEventAggregator eventAg

private string selectedtheme;
private string cachefolderpath;
private bool useMALDataSource;
private bool useAniDBDataSource;
#endregion

#region Properties
@@ -90,6 +94,44 @@ public string CacheFolderPath
}
}

public bool UseMALDataSource
{
get
{
return useMALDataSource;
}
set
{
if (useMALDataSource != value)
{
useMALDataSource = value;
optionsobject.UseMALDataSource = value;

optionsobject.Save();
OnPropertyChanged("UseMALDataSource");
}
}
}

public bool UseAniDBDataSource
{
get
{
return useAniDBDataSource;
}
set
{
if (useAniDBDataSource != value)
{
useAniDBDataSource = value;
optionsobject.UseAniDBDataSource = value;

optionsobject.Save();
OnPropertyChanged("UseAniDBDataSource");
}
}
}

#endregion

#region Methods
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

@@ -5,7 +5,7 @@
<english/>
<synonyms>Amaburi</synonyms>
<episodes>13</episodes>
<score>7.77</score>
<score>7.76</score>
<type>TV</type>
<status>Finished Airing</status>
<start_date>2014-10-07</start_date>
@@ -47,7 +47,7 @@ http://cdn.myanimelist.net/images/anime/4/72011.jpg
Amagi Brilliant Park Episode 14; Amagi Brilliant Park Tokubetsu-hen
</synonyms>
<episodes>1</episodes>
<score>7.44</score>
<score>7.42</score>
<type>Special</type>
<status>Finished Airing</status>
<start_date>2015-06-26</start_date>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -5,7 +5,7 @@
<english/>
<synonyms/>
<episodes>12</episodes>
<score>8.16</score>
<score>8.17</score>
<type>TV</type>
<status>Finished Airing</status>
<start_date>2014-01-05</start_date>
@@ -14,7 +14,7 @@
The world consists of two parts: the near shore and far shore. The near shore is the place where people reside, while the far shore is the place for deities and ayakashi, which are emotional fragments that can posses humans and cause trouble. So it is a deity's responsibility to remove those ayakashi from the near shore with the help of weapons called Shinki, made from the spirits of dead people.<br /> <br /> Yato is a minor deity of war without shrine. Together with his Shinki, Tomone, he runs a Delivery Wish Granting Service, granting wishes for only 5 yen. After his Shinki leaves him on less than agreeable terms, he decides to run simple errands that do not involve ayakashi-related matters. While on a mission to find a lost kitten, he is nearly hit by a bus, but saved by a girl named Iki Hiyori. Hiyori dies for a moment, but then comes back to life. This, however, causes Hiyori's soul to become unstable, leaving her body frequently. So by offering 5 yen, she asks Yato to fix her body... but Yato cannot help without a Shinki, so Hiyori accompanies him on his journey to find one, in the hopes of becoming normal again. But behind Yato's kind-hearted face lies a twisted past...<br /> <br /> (Source: AniDB)
</synopsis>
<image>
http://cdn.myanimelist.net/images/anime/5/58139.jpg
http://cdn.myanimelist.net/images/anime/9/77809.jpg
</image>
</entry>
<entry>
@@ -23,7 +23,7 @@ http://cdn.myanimelist.net/images/anime/5/58139.jpg
<english/>
<synonyms/>
<episodes>2</episodes>
<score>7.87</score>
<score>7.88</score>
<type>OVA</type>
<status>Finished Airing</status>
<start_date>2014-02-17</start_date>
@@ -41,9 +41,9 @@ http://cdn.myanimelist.net/images/anime/10/54931.jpg
<english/>
<synonyms/>
<episodes>13</episodes>
<score>8.49</score>
<score>8.57</score>
<type>TV</type>
<status>Currently Airing</status>
<status>Finished Airing</status>
<start_date>2015-10-03</start_date>
<end_date>2015-12-26</end_date>
<synopsis>
@@ -59,9 +59,9 @@ http://cdn.myanimelist.net/images/anime/4/75627.jpg
<english/>
<synonyms/>
<episodes>2</episodes>
<score>0.00</score>
<score>8.18</score>
<type>OVA</type>
<status>Not yet aired</status>
<status>Currently Airing</status>
<start_date>2015-11-17</start_date>
<end_date>2016-03-17</end_date>
<synopsis>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,4 +1,4 @@
#pragma checksum "..\..\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "E7D5E41D6D4137C6B42B4FE1A56A1CBC"
#pragma checksum "..\..\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "EF47EF323FACB6237D6CADB81D2F79E4"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.