This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class App : PrismApplication | |
{ | |
public App(IPlatformInitializer initializer = null) : base(initializer) { } | |
protected override void OnInitialized() | |
{ | |
InitializeComponent(); | |
NavigationService.NavigateAsync("MainPage?title=Hello%20from%20Xamarin.Forms"); | |
} | |
protected override void RegisterTypes() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class App : Application | |
{ | |
public App() | |
{ | |
MainPage = new ContentPage | |
{ | |
Content = new StackLayout | |
{ | |
VerticalOptions = LayoutOptions.Center, | |
Children = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms" | |
prism:ViewModelLocator.AutowireViewModel="True" | |
x:Class="HelloPrism.Views.MainPage" | |
Title="MainPage"> | |
<StackLayout HorizontalOptions="Center" VerticalOptions="Center"> | |
<Label Text="{Binding Title}" /> | |
</StackLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HatPepper | |
{ | |
public IList<Shop> SearchShops() | |
{ | |
GeolocationService geolocationService = new GeolocationService(); | |
var location = geolocationService.GetCurrentLocation(); | |
// 以降、取得した位置情報から周辺の店舗を取得して返却する | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HatPepper | |
{ | |
public IList<Shop> SearchShops() | |
{ | |
IGeolocationService geolocationService = new GeolocationService(); | |
var location = geolocationService.GetCurrentLocation(); | |
// 以降、取得した位置情報から周辺の店舗を取得して返却する | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HatPepper | |
{ | |
private readonly IGeolocationService _geolocationService; | |
public HatPepper(IGeolocationService geolocationService) | |
{ | |
_geolocationService = geolocationService; | |
} | |
public IList<Shop> SearchShops() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void ConfigureViewModelLocator() | |
{ | |
base.ConfigureViewModelLocator(); // <- 必須!DIされなくなります。 | |
ViewModelLocationProvider.SetDefaultViewTypeToViewModelTypeResolver( | |
viewType => | |
{ | |
var viewName = viewType.FullName; | |
viewName = viewName.Replace(".Views.", ".ViewModels."); | |
string viewModelName; | |
if (viewName.EndsWith("Page")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void ConfigureViewModelLocator() | |
{ | |
base.ConfigureViewModelLocator(); | |
ViewModelLocationProvider.Register<MainPage, HogeViewModel>(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void ConfigureViewModelLocator() | |
{ | |
base.ConfigureViewModelLocator(); | |
ViewModelLocationProvider.Register<MainPage>(() => new MainPageViewModel()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms" | |
prism:ViewModelLocator.AutowireViewModel="True" | |
x:Class="NavigationService.Views.SecondPage" | |
Title="SecondPage"> | |
<StackLayout Orientation="Vertical" HorizontalOptions="Center" VerticalOptions="Center"> | |
<Label Text="Second Page."/> | |
</StackLayout> |