Created
November 24, 2015 13:15
-
-
Save dkudelko/9a4fe9d0424e3eb7f411 to your computer and use it in GitHub Desktop.
XamarinForms.BaseUrl
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
using System; | |
using Xamarin.Forms; | |
using App.Android; | |
[assembly: Dependency (typeof (BaseUrl_Android))] | |
namespace App.Android | |
{ | |
public class BaseUrl_Android : IBaseUrl | |
{ | |
public string Get () | |
{ | |
return "file:///android_asset/"; | |
} | |
} | |
} |
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
using Xamarin.Forms; | |
using App.iOS; | |
using Foundation; | |
[assembly: Dependency (typeof (BaseUrl_iOS))] | |
namespace App.iOS | |
{ | |
public class BaseUrl_iOS : IBaseUrl | |
{ | |
public string Get () | |
{ | |
return NSBundle.MainBundle.BundlePath; | |
} | |
} | |
} |
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
using Xamarin.Forms; | |
using App.WinPhone; | |
using Windows.Storage; | |
using System.IO.IsolatedStorage; | |
[assembly: Dependency(typeof(BaseUrl_WinPhone))] | |
namespace App.WinPhone | |
{ | |
public class BaseUrl_WinPhone : IBaseUrl | |
{ | |
public string Get() | |
{ | |
//IsolatedStorageFile.GetUserStoreForApplication(). | |
return ""; | |
} | |
} | |
} |
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
using Xamarin.Forms; | |
namespace App.WinPhone | |
{ | |
public interface IBaseUrl { string Get(); } | |
} | |
// how to use | |
// var url = DependencyService.Get<IBaseUrl>().Get(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment