Skip to content

Commit

Permalink
細かい修正
Browse files Browse the repository at this point in the history
  • Loading branch information
tor4kichi committed Aug 8, 2016
1 parent 3cb6200 commit b9c30b6
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 143 deletions.
2 changes: 1 addition & 1 deletion NicoPlayerHohoema/Models/Video/NicoVideoDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private async Task<bool> _StopDownload()
Debug.Write("ダウンロードキャンセルを待機中");


await _DownloadTask.WaitToCompelation();
await _DownloadTask.WaitToCompelation(count:5);


_DownloadTask = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,22 @@ protected override uint IncrementalLoadCount
{
get
{
return VideoSearchSource.OneTimeLoadSearchItemCount / 2;
return 15;
}
}

protected override bool CheckNeedUpdateOnNavigateTo(NavigationMode mode)
{
return true;
var source = IncrementalLoadingItems.Source as MylistSearchSource;

if (SearchOption != null)
{
return !SearchOption.Equals(source.SearchOption);
}
else
{
return true;
}
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ protected override Task ListPageNavigatedToAsync(CancellationToken cancelToken,

_NowProcessFavorite = false;

return Task.CompletedTask;
return base.ListPageNavigatedToAsync(cancelToken, e, viewModelState);
}

#region Implement HohoemaVideListViewModelBase
Expand Down
95 changes: 50 additions & 45 deletions NicoPlayerHohoema/ViewModels/SearchPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,61 +240,66 @@ public SearchPageViewModel(HohoemaApp hohoemaApp, PageManager pageManager, Views

public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
{
var prevSearchOption = RequireSearchOption;
if (e.Parameter is string)
{
RequireSearchOption = SearchOption.FromParameterString(e.Parameter as string);
}

HohoemaViewModelBase contentVM = null;
SearchTarget? searchTarget = RequireSearchOption?.SearchTarget;
switch (searchTarget)
{
case SearchTarget.Keyword:
contentVM = new KeywordSearchPageContentViewModel(
HohoemaApp
, PageManager
, _MylistDialogService
, RequireSearchOption
);
break;
case SearchTarget.Tag:
contentVM = new TagSearchPageContentViewModel(
HohoemaApp
, PageManager
, _MylistDialogService
, RequireSearchOption
);
break;
case SearchTarget.Mylist:
contentVM = new MylistSearchPageContentViewModel(
HohoemaApp
, PageManager
, RequireSearchOption
);
break;
case SearchTarget.Community:
break;
case SearchTarget.Niconama:
break;
default:
contentVM = new EmptySearchPageContentViewModel(
HohoemaApp
, PageManager
);
break;
}
// ContentVM側のページタイトルが後で呼び出されるように、SearchPage側を先に呼び出す
base.OnNavigatedTo(e, viewModelState);

if (contentVM == null)

if (!(prevSearchOption?.Equals(RequireSearchOption) ?? false))
{
throw new NotSupportedException($"not support SearchPageContent type : {RequireSearchOption.SearchTarget}");
}
HohoemaViewModelBase contentVM = null;
SearchTarget? searchTarget = RequireSearchOption?.SearchTarget;
switch (searchTarget)
{
case SearchTarget.Keyword:
contentVM = new KeywordSearchPageContentViewModel(
HohoemaApp
, PageManager
, _MylistDialogService
, RequireSearchOption
);
break;
case SearchTarget.Tag:
contentVM = new TagSearchPageContentViewModel(
HohoemaApp
, PageManager
, _MylistDialogService
, RequireSearchOption
);
break;
case SearchTarget.Mylist:
contentVM = new MylistSearchPageContentViewModel(
HohoemaApp
, PageManager
, RequireSearchOption
);
break;
case SearchTarget.Community:
break;
case SearchTarget.Niconama:
break;
default:
contentVM = new EmptySearchPageContentViewModel(
HohoemaApp
, PageManager
);
break;
}

// ContentVM側のページタイトルが後で呼び出されるように、SearchPage側を先に呼び出す
base.OnNavigatedTo(e, viewModelState);
if (contentVM == null)
{
throw new NotSupportedException($"not support SearchPageContent type : {RequireSearchOption.SearchTarget}");
}

contentVM.OnNavigatedTo(e, viewModelState);
ContentVM.Value = contentVM;
}

ContentVM.Value = contentVM;
ContentVM.Value?.OnNavigatedTo(e, viewModelState);
}

public override void OnNavigatingFrom(NavigatingFromEventArgs e, Dictionary<string, object> viewModelState, bool suspending)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
>

<i:Interaction.Behaviors>
<mybehavior:ListViewSelectedItemsGetter SelectedItems="{Binding SelectedVideoInfoItems, Mode=TwoWay}" />
<mybehavior:ListViewSelectedItemsGetter SelectedItems="{Binding SelectedItems, Mode=TwoWay}" />

<mybehavior:ListViewVerticalOffsetGetter
VerticalOffset="{Binding ListViewVerticalOffset.Value, Mode=TwoWay}"
Expand Down
70 changes: 38 additions & 32 deletions NicoPlayerHohoema/Views/MenuNavigatePageBase.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,53 +183,59 @@
OpenPaneLength="180"
>
<SplitView.Pane>
<StackPanel>
<ScrollViewer HorizontalScrollMode="Disabled"
VerticalScrollMode="Auto"
VerticalScrollBarVisibility="Hidden"
>
<StackPanel>

<ListBox ItemsSource="{Binding MenuItems}"
<ListBox ItemsSource="{Binding MenuItems}"
SelectionMode="Single"
SelectedValue="{Binding SelectedItem.Value, Mode=TwoWay}"
ItemTemplate="{StaticResource MenuItemTemplate}"
>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="6 8 10 8" />
<Setter Property="Margin" Value="0" />
</Style>
</ListBox.ItemContainerStyle>
<i:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="SelectionChanged">
<mybehavior:SplitViewClosePane SplitView="{Binding ElementName=SplitView}"
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="6 12 10 12" />
<Setter Property="Margin" Value="0" />
</Style>
</ListBox.ItemContainerStyle>

<i:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="SelectionChanged">
<mybehavior:SplitViewClosePane SplitView="{Binding ElementName=SplitView}"
/>
</core:EventTriggerBehavior>
</i:Interaction.Behaviors>
</ListBox>
</core:EventTriggerBehavior>
</i:Interaction.Behaviors>
</ListBox>

<Border BorderBrush="Gray"
<Border BorderBrush="Gray"
BorderThickness="0 1 0 0" />

<ListBox ItemsSource="{Binding PersonalMenuItems}"

<ListBox ItemsSource="{Binding PersonalMenuItems}"
SelectionMode="Single"
SelectedValue="{Binding SelectedItem.Value, Mode=TwoWay}"
ItemTemplate="{StaticResource MenuItemTemplate}"

>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="6 8 10 8" />
<Setter Property="Margin" Value="0" />
</Style>
</ListBox.ItemContainerStyle>

<i:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="SelectionChanged">
<mybehavior:SplitViewClosePane SplitView="{Binding ElementName=SplitView}"
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="6 12 10 12" />
<Setter Property="Margin" Value="0" />
</Style>
</ListBox.ItemContainerStyle>

<i:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="SelectionChanged">
<mybehavior:SplitViewClosePane SplitView="{Binding ElementName=SplitView}"
/>
</core:EventTriggerBehavior>
</i:Interaction.Behaviors>
</ListBox>
</core:EventTriggerBehavior>
</i:Interaction.Behaviors>
</ListBox>

</StackPanel>
</StackPanel>
</ScrollViewer>

</SplitView.Pane>
<SplitView.Content>

Expand Down
63 changes: 2 additions & 61 deletions NicoPlayerHohoema/Views/MylistPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
xmlns:mybehavior="using:NicoPlayerHohoema.Views.Behaviors"
xmlns:rlv="using:RefreshableListView"
xmlns:controls="using:NicoPlayerHohoema.Views.Controls"
mvvm:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d">

Expand Down Expand Up @@ -125,66 +125,7 @@



<rlv:RefreshableListView x:Name="VideoInfoItems"
ItemsSource="{Binding IncrementalLoadingItems}"
SelectionMode="Multiple"
IsMultiSelectCheckBoxEnabled="{Binding IsSelectionModeEnable.Value}"
IncrementalLoadingTrigger="Edge"
AutoRefresh="False"
RefreshCommand="{Binding RefreshCommand}"
>

<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment"
Value="Stretch"
/>
<Setter Property="Margin"
Value="0 0 0 8"
/>
</Style>
</ListView.ItemContainerStyle>


<i:Interaction.Behaviors>
<mybehavior:ListViewSelectedItemsGetter SelectedItems="{Binding SelectedVideoInfoItems, Mode=TwoWay}" />

<mybehavior:ListViewVerticalOffsetGetter
VerticalOffset="{Binding ListViewVerticalOffset.Value, Mode=TwoWay}"
/>

<mybehavior:KeyboardTrigger Key="F5">
<mybehavior:KeyboardTrigger.Actions>
<core:InvokeCommandAction Command="{Binding RefreshCommand}" />
</mybehavior:KeyboardTrigger.Actions>
</mybehavior:KeyboardTrigger>

</i:Interaction.Behaviors>

<ListView.ItemTemplate>
<DataTemplate>
<toolkit:DockPanel Margin="8"
Background="Transparent" IsHitTestVisible="True"
>
<i:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Tapped">
<core:InvokeCommandAction Command="{Binding ElementName=PageRoot, Path=DataContext.PlayCommand}"
CommandParameter="{Binding}"
/>
</core:EventTriggerBehavior>
</i:Interaction.Behaviors>



<Border >
<local:VideoInfoControl
/>
</Border>

</toolkit:DockPanel>
</DataTemplate>
</ListView.ItemTemplate>
</rlv:RefreshableListView>
<controls:HohoemaIncrementalLoadingList />



Expand Down

0 comments on commit b9c30b6

Please sign in to comment.