Skip to content

Commit

Permalink
WindowsStore: Now using WindowsStoreNavigationManager. Added BasePage…
Browse files Browse the repository at this point in the history
…. Very minimal navigation for now.

Related to issue #423.
  • Loading branch information
ycastonguay committed Oct 1, 2013
1 parent 80c18ca commit f8be28a
Show file tree
Hide file tree
Showing 22 changed files with 5,353 additions and 587 deletions.
2 changes: 1 addition & 1 deletion MPfm/MPfm.Library/Services/WinRT/SyncDiscoveryService.cs
Expand Up @@ -188,7 +188,7 @@ private async Task<SyncDevice> ProcessDevice(string url, string ip)
/// </summary>
public void Cancel()
{
Console.WriteLine("SyncDiscoveryService - Cancelling process...");
Tracing.Log("SyncDiscoveryService - Cancelling process...");
if (IsRunning)
{
if (_cancellationTokenSource != null)
Expand Down
4 changes: 2 additions & 2 deletions MPfm/MPfm.MVP/Presenters/SyncPresenter.cs
Expand Up @@ -49,7 +49,7 @@ public SyncPresenter(ISyncDiscoveryService syncDiscoveryService, ISyncDeviceSpec
_syncDiscoveryService.OnDiscoveryProgress += HandleOnDiscoveryProgress;
_syncDiscoveryService.OnDiscoveryEnded += HandleOnDiscoveryEnded;

#if IOS || ANDROID || WINDOWS_PHONE
#if IOS || ANDROID || WINDOWS_PHONE || WINDOWSSTORE
_mobileNavigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
#else
_navigationManager = Bootstrapper.GetContainer().Resolve<NavigationManager>();
Expand Down Expand Up @@ -96,7 +96,7 @@ private void HandleOnDiscoveryEnded(IEnumerable<SyncDevice> devices)

private void ConnectDevice(SyncDevice device)
{
#if IOS || ANDROID || WINDOWS_PHONE
#if IOS || ANDROID || WINDOWS_PHONE || WINDOWSSTORE
_mobileNavigationManager.CreateSyncMenuView(device);
#else
_navigationManager.CreateSyncMenuView(device);
Expand Down
2 changes: 1 addition & 1 deletion MPfm/MPfm.Player/WinRT/Player.cs
Expand Up @@ -21,7 +21,7 @@
using MPfm.Sound.AudioFiles;
using MPfm.Sound.BassNetWrapper;
using MPfm.Sound.Playlists;
using Microsoft.Phone.BackgroundAudio;
//using Microsoft.Phone.BackgroundAudio;

namespace MPfm.Player
{
Expand Down
10 changes: 2 additions & 8 deletions MPfm/MPfm.WindowsStore/App.xaml
Expand Up @@ -4,22 +4,16 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MPfm.WindowsStore"
xmlns:localData="using:MPfm.WindowsStore.Data"
RequestedTheme="Light">
RequestedTheme="Dark">

<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>

<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>

<!-- Application-specific resources -->

<x:String x:Key="AppName">MPfm.WindowsStore</x:String>
<x:String x:Key="AppName">Sessions</x:String>
</ResourceDictionary>
</Application.Resources>
</Application>
17 changes: 9 additions & 8 deletions MPfm/MPfm.WindowsStore/App.xaml.cs
Expand Up @@ -21,6 +21,7 @@
using MPfm.MVP.Navigation;
using MPfm.MVP.Views;
using MPfm.WindowsStore.Classes;
using MPfm.WindowsStore.Classes.Navigation;
using MPfm.WindowsStore.Classes.Pages;
using MPfm.WindowsStore.Common;

Expand Down Expand Up @@ -107,10 +108,10 @@ protected override async void OnLaunched(LaunchActivatedEventArgs args)
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
Debug.WriteLine("RootFrame.Content == null; trying to navigate to ItemsPage");
//if (!rootFrame.Navigate(typeof(ItemsPage), "AllGroups"))
//if(!rootFrame.Navigate(typeof(TestPage), args.Arguments))
if(!rootFrame.Navigate(typeof(Main), "AllGroups"))
Debug.WriteLine("RootFrame.Content == null; trying to navigate to MainPage");
//if (!rootFrame.Navigate(typeof(ArtistBrowserPage), "AllGroups"))
//if(!rootFrame.Navigate(typeof(SyncPage), args.Arguments))
if(!rootFrame.Navigate(typeof(MainPage), "AllGroups"))
{
throw new Exception("Failed to create initial page");
}
Expand Down Expand Up @@ -138,9 +139,9 @@ private void BootstrapApp()
{
TinyIoCContainer container = Bootstrapper.GetContainer();
container.Register<ISyncDeviceSpecifications, WindowsStoreSyncDeviceSpecifications>().AsSingleton();
//container.Register<MobileNavigationManager, AndroidNavigationManager>().AsSingleton();
//container.Register<IMobileOptionsMenuView, MainActivity>().AsMultiInstance();
//container.Register<ISplashView, SplashFragment>().AsMultiInstance();
container.Register<MobileNavigationManager, WindowsStoreNavigationManager>().AsSingleton();
container.Register<IMobileOptionsMenuView, MainPage>().AsMultiInstance();
container.Register<ISplashView, SplashPage>().AsMultiInstance();
//container.Register<IPlayerView, PlayerActivity>().AsMultiInstance();
//container.Register<IPlayerMetadataView, PlayerMetadataFragment>().AsMultiInstance();
//container.Register<IMarkersView, MarkersFragment>().AsMultiInstance();
Expand All @@ -151,7 +152,7 @@ private void BootstrapApp()
//container.Register<IUpdateLibraryView, UpdateLibraryFragment>().AsMultiInstance();
//container.Register<IMobileLibraryBrowserView, MobileLibraryBrowserFragment>().AsMultiInstance();
//container.Register<IPlaylistView, PlaylistActivity>().AsMultiInstance();
//container.Register<ISyncView, SyncActivity>().AsMultiInstance();
container.Register<ISyncView, SyncPage>().AsMultiInstance();
//container.Register<ISyncDownloadView, SyncDownloadActivity>().AsMultiInstance();
//container.Register<ISyncMenuView, SyncMenuActivity>().AsMultiInstance();
//container.Register<ISyncWebBrowserView, SyncWebBrowserActivity>().AsMultiInstance();
Expand Down
@@ -0,0 +1,92 @@
// Copyright © 2011-2013 Yanick Castonguay
//
// This file is part of MPfm.
//
// MPfm is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// MPfm is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with MPfm. If not, see <http://www.gnu.org/licenses/>.

using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using MPfm.Library.Objects;
using MPfm.MVP.Navigation;
using MPfm.MVP.Views;
using MPfm.WindowsStore.Classes.Pages;
using MPfm.WindowsStore.Classes.Pages.Base;

namespace MPfm.WindowsStore.Classes.Navigation
{
public class WindowsStoreNavigationManager : MobileNavigationManager
{
private Action<IBaseView> _onSyncViewReady;

public override void ShowSplash(ISplashView view)
{
}

public override void HideSplash()
{
}

public override void AddTab(MobileNavigationTabType type, string title, IBaseView view)
{
}

public override void AddTab(MobileNavigationTabType type, string title, MobileLibraryBrowserType browserType, LibraryQuery query,
IBaseView view)
{
}

public override void PushTabView(MobileNavigationTabType type, IBaseView view)
{
}

public override void PushTabView(MobileNavigationTabType type, MobileLibraryBrowserType browserType, LibraryQuery query, IBaseView view)
{
}

public override void PushDialogView(string viewTitle, IBaseView sourceView, IBaseView view)
{
}

public override void PushDialogSubview(string parentViewTitle, IBaseView view)
{
}

public override void PushPlayerSubview(IPlayerView playerView, IBaseView view)
{
}

public override void PushPreferencesSubview(IPreferencesView preferencesView, IBaseView view)
{
}

public override void NotifyMobileLibraryBrowserQueryChange(MobileNavigationTabType type, MobileLibraryBrowserType browserType,
LibraryQuery query)
{
}

protected override void CreateSyncViewInternal(Action<IBaseView> onViewReady)
{
_onSyncViewReady = onViewReady;
var frame = Window.Current.Content as Frame;
frame.Navigate(typeof(SyncPage));
}

public void SetViewInstance(BasePage page)
{
if (page is SyncPage)
_onSyncViewReady(page);
}
}
}
@@ -1,6 +1,6 @@
<common:LayoutAwarePage
<base:BasePage
x:Name="pageRoot"
x:Class="MPfm.WindowsStore.ItemsPage"
x:Class="MPfm.WindowsStore.Classes.Pages.ArtistBrowserPage"
DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand All @@ -9,6 +9,7 @@
xmlns:common="using:MPfm.WindowsStore.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:base="using:MPfm.WindowsStore.Classes.Pages.Base"
mc:Ignorable="d">

<Page.Resources>
Expand Down Expand Up @@ -116,4 +117,4 @@
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</common:LayoutAwarePage>
</base:BasePage>
@@ -1,35 +1,23 @@
using System.Diagnostics;
using MPfm.WindowsStore.Data;

using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Graphics.Display;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using System.Diagnostics;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using MPfm.WindowsStore.Classes.Pages.Base;
using MPfm.WindowsStore.Data;

// The Items Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234233

namespace MPfm.WindowsStore
namespace MPfm.WindowsStore.Classes.Pages
{
/// <summary>
/// A page that displays a collection of item previews. In the Split Application this page
/// is used to display and select one of the available groups.
/// </summary>
public sealed partial class ItemsPage : MPfm.WindowsStore.Common.LayoutAwarePage
public sealed partial class ArtistBrowserPage : BasePage
{
public ItemsPage()
public ArtistBrowserPage()
{
Debug.WriteLine("ItemsPage - Ctor");
Debug.WriteLine("ArtistBrowserPage - Ctor");
this.InitializeComponent();
}

Expand All @@ -45,7 +33,7 @@ public ItemsPage()
protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
{
// TODO: Create an appropriate data model for your problem domain to replace the sample data
Debug.WriteLine("ItemsPage - LoadState");
Debug.WriteLine("ArtistBrowserPage - LoadState");
var sampleDataGroups = SampleDataSource.GetGroups((String)navigationParameter);
this.DefaultViewModel["Items"] = sampleDataGroups;
}
Expand All @@ -60,9 +48,9 @@ void ItemView_ItemClick(object sender, ItemClickEventArgs e)
{
// Navigate to the appropriate destination page, configuring the new page
// by passing required information as a navigation parameter
Debug.WriteLine("ItemsPage - ItemClick");
Debug.WriteLine("ArtistBrowserPage - ItemClick");
var groupId = ((SampleDataGroup)e.ClickedItem).UniqueId;
this.Frame.Navigate(typeof(SplitPage), groupId);
this.Frame.Navigate(typeof(SyncPage), groupId);
}
}
}
32 changes: 32 additions & 0 deletions MPfm/MPfm.WindowsStore/Classes/Pages/Base/BasePage.cs
@@ -0,0 +1,32 @@
// Copyright © 2011-2013 Yanick Castonguay
//
// This file is part of MPfm.
//
// MPfm is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// MPfm is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with MPfm. If not, see <http://www.gnu.org/licenses/>.

using System;
using MPfm.MVP.Views;
using MPfm.WindowsStore.Common;

namespace MPfm.WindowsStore.Classes.Pages.Base
{
public class BasePage : LayoutAwarePage, IBaseView
{
public Action<IBaseView> OnViewDestroy { get; set; }

public void ShowView(bool shown)
{
}
}
}
45 changes: 0 additions & 45 deletions MPfm/MPfm.WindowsStore/Classes/Pages/Main.xaml.cs

This file was deleted.

0 comments on commit f8be28a

Please sign in to comment.