Exemplo n.º 1
0
        public DonationPage()
        {
            license = new License.License();
            license.GetPrice();
            var p = SettingsModel.Current.Preferences;

            Theme = p.GetTheme();
            license.LicenseChanged += License_LicenseChanged;
            this.InitializeComponent();
            Task.Run(async() =>
            {
                while (license.Price.IsNullorEmpty())
                {
                    await Task.Delay(100);
                }
                await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, new Windows.UI.Core.DispatchedHandler(() =>
                {
                    PurchaseSlider_ValueChanged(null, null);
                    TextBlock_Loaded(null, null);
                    Button_Loaded(null, null);
                    PurchaseSlider.ValueChanged += PurchaseSlider_ValueChanged;
                    LoadingPanel.Visibility      = Visibility.Collapsed;
                    LoadingRing.IsActive         = false;
                }));
            });
        }
Exemplo n.º 2
0
        public MainPage()
        {
            InitializeComponent();
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                TitleBlock.Visibility = Visibility.Collapsed;
            }
            Current = this;
            Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += MainPage_BackRequested;
            MainFrame.Navigate(typeof(NowWeatherPage), this);
            license = new License.License();
            var t = ThreadPool.RunAsync(async(w) =>
            {
                var c = Convert.ToUInt64(RoamingSettingsHelper.ReadSettingsValue("MeetDataSourceOnce"));
#if BETA
                if (true)
                {
                    RoamingSettingsHelper.WriteSettingsValue("MeetDataSourceOnce", SystemInfoHelper.GetPackageVersionNum());
                    await Task.Delay(1000);
                    await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, new Windows.UI.Core.DispatchedHandler(() =>
                    {
                        VersionText.Text           = SystemInfoHelper.GetPackageVer();
                        UpdateTitle.Text           = "BETA Version Note";
                        UpdateDetailText.Text      = "You are in BETA version NOW, all the features are unlocked and you should be clear what you are doing. You can contact with developers to quit BETA version. This BETA version is unstable and you MUST be aware of all the consequence that may arise.";
                        UpdateDetailText.FontSize  = 18;
                        UpdateLogButton.Visibility = Visibility.Collapsed;
                        ShowUpdateDetail();
                    }));
                }
#else
                if (c < SystemInfoHelper.GetPackageVersionNum())

                //if (true)
                {
                    RoamingSettingsHelper.WriteSettingsValue("MeetDataSourceOnce", SystemInfoHelper.GetPackageVersionNum());
                    await Task.Delay(1000);
                    await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, new Windows.UI.Core.DispatchedHandler(() =>
                    {
                        VersionText.Text = SystemInfoHelper.GetPackageVer();
                        ShowUpdateDetail();
                    }));
                }
#endif
                else
                {
                    HideUpdateButton_Click(null, null);
                }
            });
        }
Exemplo n.º 3
0
        private async void DismissedEventHandler(SplashScreen sender, object args)
        {
            dismissed = true;
            await SQLAction.CheckDB();

            SetLongTimeTimer();
            var settings = SettingsModel.Current;
            var license  = new License.License();

            if (!license.IsPurchased)
            {
                settings.Preferences.EnableAlarm   = false;
                settings.Preferences.EnableEvening = false;
                settings.Preferences.EnableMorning = false;
                settings.Preferences.Set(240);
            }

            if (settings.Preferences.MainColor.A > 0)
            {
                App.MainColor = settings.Preferences.MainColor;
                await Dispatcher.RunAsync(CoreDispatcherPriority.High, new DispatchedHandler(() =>
                {
                    App.ChangeThemeColor(settings.Preferences.MainColor);
                    ChangeThemeColor(settings.Preferences.MainColor);
                }));
            }
            if (!settings.Inited)
            {
                NavigatetoStart();
                return;
            }
            if (!this.args.IsNullorEmpty())
            {
                settings.Cities.ChangeCurrent(this.args);
            }
            try
            {
                if (settings.Cities.GetCurrentCity() == null)
                {
                    NavigatetoStart();
                    return;
                }
            }
            catch (Exception)
            {
            }

            if (settings.Cities.CurrentIndex == -1 && settings.Cities.EnableLocate)
            {
                try
                {
                    var accessStatus = await Geolocator.RequestAccessAsync();

                    if (accessStatus == GeolocationAccessStatus.Allowed)
                    {
                        await Dispatcher.RunAsync(CoreDispatcherPriority.High, new DispatchedHandler(async() =>
                        {
                            var l = new ResourceLoader();
                            SplashWelcome.Text = l.GetString("Locating");
                            try
                            {
                                var _geolocator = new Geolocator();
                                var pos = await _geolocator.GetGeopositionAsync();
                                if ((_geolocator.LocationStatus != PositionStatus.NoData) && (_geolocator.LocationStatus != PositionStatus.NotAvailable) && (_geolocator.LocationStatus != PositionStatus.Disabled))
                                {
                                    var t = ThreadPool.RunAsync(async(w) =>
                                    {
                                        await CalcPosition(pos, settings);
                                        GetCityListandCompelte(settings);
                                    });
                                }
                                else
                                {
                                    GetCityListandCompelte(settings);
                                }
                            }
                            catch (Exception)
                            {
                                GetCityListandCompelte(settings);
                            }
                        }));
                    }
                    else
                    {
                        if (!settings.Cities.SavedCities.IsNullorEmpty())
                        {
                            settings.Cities.CurrentIndex = 0;
                        }
                        else
                        {
                            GetCityListandCompelte(settings);
                        }
                    }
                }
                catch (Exception)
                {
                    NavigatetoStart();
                }
            }
            else if (settings.Cities.CurrentIndex >= 0 && !settings.Cities.SavedCities.IsNullorEmpty())
            {
                foreach (var citty in settings.Cities.SavedCities)
                {
                    if (citty.Latitude == 0 && citty.Longitude == 0)
                    {
                        var tar = SQLAction.Find(citty.Id);
                        citty.Latitude  = tar.Latitude;
                        citty.Longitude = tar.Longitude;
                    }
                }
                settings.Cities.Save();
                GetCityListandCompelte(settings);
            }
            else
            {
                NavigatetoStart();
                return;
            }
        }
Exemplo n.º 4
0
 public CitiesPage()
 {
     this.InitializeComponent();
     license = new License.License();
 }