Skip to content

Commit

Permalink
Bugfixing. Ready for v0.20
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamcooled committed Dec 22, 2014
1 parent c09f63b commit 15fb364
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 132 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ Any contribution would be highly appreciated.


#### Download
Binaries of current version v0.16 (needs .NET 4.5):
Binaries of current version v0.20 (needs .NET 4.5):
#####https://github.com/Dreamcooled/sjupdater/releases/



#### Screenshots

![Main Screen](http://s1.directupload.net/images/140810/q8j684y5.png)
![Show Screen](http://s7.directupload.net/images/140115/xas33ut6.png)
![Episode Screen](http://s7.directupload.net/images/140115/cpffb9uf.png)
![Settings Screen](http://s1.directupload.net/images/140810/vcntsad3.png)
![Main Screen](http://fs2.directupload.net/images/141222/aistkio4.png)
![Show Screen](http://fs2.directupload.net/images/141222/oq7pq2mv.png)
![Show Screen 2](http://fs2.directupload.net/images/141222/yhzxtrjk.png)
![Settings Screen](http://fs1.directupload.net/images/141222/plp3of5m.png)
![Notification](http://s7.directupload.net/images/140810/wf7jemqk.png)


87 changes: 46 additions & 41 deletions SjUpdater/MainWindow.xaml

Large diffs are not rendered by default.

31 changes: 19 additions & 12 deletions SjUpdater/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ public MainWindow()

//Settings & Theme
_setti = Settings.Instance;

_currentAccent = ThemeManager.GetAccent(_setti.ThemeAccent);
_currentTheme = ThemeManager.GetAppTheme(_setti.ThemeBase);
CurrentAccent = _setti.ThemeAccent;

updateTimer = new Timer();
//Updater
_updater = new UpdateWindow("http://dreamcooled.github.io/sjupdater/latest", true, "SjUpdater.exe", "");
_updater = new UpdateWindow("http://dreamcooled.github.io/sjupdater/latest", true, "SjUpdater.exe", "-uf " + Stats.GetVersionString());
_updater.updateStartedEvent += (a, dsa) =>
{
Terminate(null);
Expand Down Expand Up @@ -316,14 +317,18 @@ private async void ShowDelete(object sender, RoutedEventArgs e)

void _selectedEpisodeTreeItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (_selectedEpisodeTreeItems.Count == 1 && _selectedEpisodeTreeItems.First() is SeasonViewModel)
var first = _selectedEpisodeTreeItems.FirstOrDefault();
if (_selectedEpisodeTreeItems.Count == 1 && first is SeasonViewModel)
{
EpisodeTabControl_Season.DataContext = _selectedEpisodeTreeItems.First();
EpisodeTabControl_Season.DataContext = first;
EpisodeTabControl.SelectedIndex = 1;
}
else if (_selectedEpisodeTreeItems.Count == 1 && _selectedEpisodeTreeItems.First() is EpisodeViewModel)
else if (_selectedEpisodeTreeItems.Count == 1 && first is EpisodeViewModel)
{
EpisodeTabControl_Episode.DataContext = _selectedEpisodeTreeItems.First();
var vm = (first as EpisodeViewModel);
vm.Episode.NewEpisode = false;
vm.Episode.NewUpdate = false;
EpisodeTabControl_Episode.DataContext = first;
EpisodeTabControl.SelectedIndex = 2;
}
else if (!_selectedEpisodeTreeItems.Any())
Expand All @@ -344,10 +349,7 @@ private void CleanShow(object sender, RoutedEventArgs e)
}


private void EpisodeDataBack(object sender, RoutedEventArgs e)
{
SwitchPage(1);
}


private void EpisodesBack(object sender, RoutedEventArgs e)
{
Expand All @@ -363,9 +365,6 @@ private void NavBack(object sender, ExecutedRoutedEventArgs e)
EpisodesBack(this, new RoutedEventArgs());
break;
case 2:
EpisodeDataBack(this, new RoutedEventArgs());
break;
case 3:
SwitchPage(_lastpage);
break;

Expand Down Expand Up @@ -540,6 +539,13 @@ private void EpisodeCloseAllDownloads(object sender, RoutedEventArgs e)
EpisodePopup.IsOpen = false;
}

private void EpisodePopup_Closed(object sender, EventArgs e)
{
EpisodeFavorizedUploadsListView.GetBindingExpression(ItemsControl.ItemsSourceProperty).UpdateTarget();
EpisodeFavorizedWarning1.GetBindingExpression(VisibilityProperty).UpdateTarget();
EpisodeFavorizedWarning2.GetBindingExpression(VisibilityProperty).UpdateTarget();
}


private void SeasonShowAllDownloads(object sender, RoutedEventArgs e)
{
Expand All @@ -562,6 +568,7 @@ private void NoneCloseAllDownloads(object sender, RoutedEventArgs e)
}




}
}
38 changes: 0 additions & 38 deletions SjUpdater/Properties/Settings.Designer.cs

This file was deleted.

9 changes: 0 additions & 9 deletions SjUpdater/Properties/Settings.settings

This file was deleted.

2 changes: 1 addition & 1 deletion SjUpdater/Provider/TMDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public EpisodeInformation GetEpisodeInformation(object show, int season, int epi
return new EpisodeInformation
{
AirDate = episodeinfo.AirDate,
Image = String.IsNullOrWhiteSpace(episodeinfo.StillPath)?null : client.GetImageUrl("original", episodeinfo.StillPath).AbsoluteUri,
Image = String.IsNullOrWhiteSpace(episodeinfo.StillPath)?null : client.GetImageUrl("w600", episodeinfo.StillPath).AbsoluteUri,
Images = null, /*client.GetTvEpisodeImages((int)show,season,episode).Stills,*/
ProviderHomepage = "https://www.themoviedb.org/tv/" + ((int)show) + "/season/" + season + "/episode/"+episode,
PublisherHomepage = null,
Expand Down
9 changes: 0 additions & 9 deletions SjUpdater/SjUpdater.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@
<Compile Include="NotificationBalloon.xaml.cs">
<DependentUpon>NotificationBalloon.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Provider\IProvider.cs" />
<Compile Include="Provider\ProviderManager.cs" />
<Compile Include="Provider\TMDb.cs" />
Expand Down Expand Up @@ -211,10 +206,6 @@
<None Include="Model\ClassDiagram1.cd" />
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
Expand Down
3 changes: 1 addition & 2 deletions SjUpdater/Utils/FavIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ private static BitmapImage Get(String value)
{
return GetFromCache(value) ?? GetFromUrl(value);
}
catch (Exception ex)
catch (Exception )
{

return null;
}
}
Expand Down
66 changes: 52 additions & 14 deletions SjUpdater/Utils/TreeViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ static void EnableMultiSelectChanged(DependencyObject s, DependencyPropertyChang
if(wasEnable)
{
tree.RemoveHandler(TreeViewItem.MouseDownEvent, new MouseButtonEventHandler(ItemClicked));
tree.RemoveHandler(TreeView.KeyDownEvent, new KeyEventHandler(KeyDown));
tree.RemoveHandler(TreeView.PreviewKeyDownEvent, new KeyEventHandler(KeyDown));
}
if(isEnabled)
{
tree.AddHandler(TreeViewItem.MouseDownEvent, new MouseButtonEventHandler(ItemClicked), true);
tree.AddHandler(TreeView.KeyDownEvent, new KeyEventHandler(KeyDown));
tree.AddHandler(TreeView.PreviewKeyDownEvent, new KeyEventHandler(KeyDown));
}
}

Expand Down Expand Up @@ -168,15 +168,54 @@ static void RealSelectedChanged(DependencyObject sender, DependencyPropertyChang

static void KeyDown(object sender, KeyEventArgs e)
{
TreeView tree = (TreeView)sender;
if(e.Key == Key.A && e.KeyboardDevice.Modifiers == ModifierKeys.Control) //Ctrl + A
{
foreach(var item in GetTreeViewItems(tree))
{
SetIsSelected(item, true);
}
e.Handled = true;
}
var tree = (TreeView)sender;
var selectedItems = GetSelectedTreeViewItems(tree);

if (e.Key == Key.A && e.KeyboardDevice.Modifiers == ModifierKeys.Control) //Ctrl + A
{
foreach (var item in GetTreeViewItems(tree).ToList())
{
SetIsSelected(item, true);
}
e.Handled = true;
}
else if (e.KeyboardDevice.Modifiers == ModifierKeys.None && selectedItems.Count>0)
{
var items = GetTreeViewItems(tree, true).ToList(); //get expanded items
switch (e.Key)
{
case Key.Space:
if (selectedItems.Count == 1)
{
selectedItems.First().IsExpanded ^= true;
}
break;
case Key.Up:
int ind = items.IndexOf(selectedItems.First());
if (ind > 0)
{
MakeSingleSelection(tree, items[ind - 1]);
}
else
{
MakeSingleSelection(tree, items.First());
}

break;
case Key.Down:
int ind2 = items.IndexOf(selectedItems.Last());
if (ind2 < items.Count - 1)
{
MakeSingleSelection(tree, items[ind2 + 1]);
}
else
{
MakeSingleSelection(tree, items.Last());
}

break;
}
}
}

static void ItemClicked(object sender, MouseButtonEventArgs e)
Expand Down Expand Up @@ -257,15 +296,15 @@ private static IEnumerable<TreeViewItem> GetChildren(TreeViewItem treeViewItem)
}
}

private static IEnumerable<TreeViewItem> GetTreeViewItems(ItemsControl tree)
private static IEnumerable<TreeViewItem> GetTreeViewItems(ItemsControl tree, bool only_expanded=false)
{
for(int i = 0; i < tree.Items.Count; i++)
{
var item = (TreeViewItem)tree.ItemContainerGenerator.ContainerFromIndex(i);
if(item == null)
continue;
yield return item;
//if(item.IsExpanded)
if(item.IsExpanded || !only_expanded)
foreach(var subItem in GetTreeViewItems(item))
yield return subItem;
}
Expand Down Expand Up @@ -294,7 +333,6 @@ private static void MakeAnchorSelection(TreeView tree, TreeViewItem actionItem,

var items = GetTreeViewItems(tree);
bool betweenBoundary = false;
bool end = false;
foreach(var item in items)
{
bool isBoundary = item == anchor || item == actionItem;
Expand Down
5 changes: 5 additions & 0 deletions SjUpdater/ViewModel/EpisodeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public EpisodeViewModel(FavEpisodeData favEpisodeData)

DownloadCommand = new SimpleCommand<object, String>(s =>
{
_favEpisodeData.Downloaded = true;
for (int i = 0; i < 10; i++)
{
try
Expand Down Expand Up @@ -261,6 +262,10 @@ public List<DownloadData> FavorizedUploads
{
get { return _favEpisodeData.Downloads.Where(d => d.Upload.Favorized).OrderByDescending(d => d.Upload.Size).ToList(); }
}
public Visibility ShowNoFavUploadsWarning
{
get { return (_favEpisodeData.Downloads.Any(d => d.Upload.Favorized)) ?Visibility.Collapsed: Visibility.Visible; }
}

public ObservableCollection<DownloadData> Downloads
{
Expand Down
7 changes: 6 additions & 1 deletion SjUpdater/ViewModel/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ private void update_source(object sender, NotifyCollectionChangedEventArgs e)
public ObservableCollection<ShowTileViewModel> TvShows
{
get { return _tvShows; }
}
}

public Settings Settings
{
get { return Settings.Instance; }
}


}
Expand Down

0 comments on commit 15fb364

Please sign in to comment.