| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using System;
- using System.Net.Http;
- using System.Threading.Tasks;
- using InABox.Mobile;
- using Xamarin.Forms;
- using Xamarin.Forms.Xaml;
- namespace PRS.Mobile
- {
- [XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class UpdatePage
- {
-
-
-
- public UpdatePage()
- {
-
- InitializeComponent();
- ProgressVisible = true;
-
- Task.Run(async () =>
- {
- bool blatest = await MobileUtils.AppVersion.IsUsingLatestVersion();
- if (!blatest)
- {
- var info = await MobileUtils.AppVersion.GetLatestVersion(false);
- Dispatcher.BeginInvokeOnMainThread(() =>
- {
- _update.Text = $"Update from {MobileUtils.AppVersion.InstalledVersionNumber} to {info.Version}";
- _update.IsEnabled = true;
- });
- }
- else
- {
- _update.Text = $"Up to date ({MobileUtils.AppVersion.InstalledVersionNumber})";
- _update.IsEnabled = false;
- }
- });
-
- Task.Run(async () =>
- {
-
- String response = "";
- try
- {
- using (HttpClient client = new HttpClient())
- {
- response = await client.GetStringAsync("https://prsdigital.com.au/updates/prsmobile/Release%20Notes.txt");
- }
- }
- catch (Exception eLatest)
- {
- response = "Error retrieving release notes!";
- }
-
- Device.BeginInvokeOnMainThread(() =>
- {
- _releaseNotes.Text = response;
- ProgressVisible = false;
- });
-
- });
- }
-
- private void _update_OnClicked(object sender, MobileButtonClickEventArgs args)
- {
- MobileUtils.AppVersion.OpenAppInStore();
- }
- }
- }
|