コード例 #1
0
        private void ClearCacheButton_Click(object sender, RoutedEventArgs e)
        {
            AppUser.ClearCache();

            App.SettingsViewModel.Usage = "Cleared";
            App.SettingsViewModel.NotifyPropertyChanged("Usage");
        }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: taurgis/WPTrakt
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            LayoutRoot.Opacity = 1;
            if (App.ViewModel.Profile != null)
            {
                lastModel = null;
                StorageController.IsNetworkStateCached = false;
                return;
            }

            try
            {
                if (!NetworkInterface.GetIsNetworkAvailable())
                {
                    App.TrackEvent("MainPage", "No internet connection");
                    ToastNotification.ShowToast("Connection", "No connection available!");
                    return;
                }

                var assembly          = Assembly.GetExecutingAssembly().FullName;
                var fullVersionNumber = assembly.Split('=')[1].Split(',')[0];

                if ((String.IsNullOrEmpty(AppUser.Instance.UserName) || String.IsNullOrEmpty(AppUser.Instance.Password)))
                {
                    App.TrackEvent("MainPage", "New user");
                    AppUser.Instance.AppVersion = fullVersionNumber;

                    NavigationService.Navigate(new Uri("/Login.xaml", UriKind.Relative));
                }
                else
                {
                    if (AppUser.Instance.AppVersion != fullVersionNumber)
                    {
                        MessageBox.Show("Application update. Clearing cache, the application will hang for a few seconds.");
                        App.TrackEvent("MainPage", "Updating application");

                        AppUser.ClearCache();
                        AppUser.Instance.AppVersion = fullVersionNumber;
                    }

                    if (!AppUser.Instance.SmallScreenshotsEnabled && !(AppUser.Instance.ImagesWithWIFI && StorageController.IsConnectedToWifi()))
                    {
                        this.TrendingPanoramaItem.Visibility = System.Windows.Visibility.Collapsed;
                    }

                    LoadProfile();

                    TileHelper.StartReloadLiveTile();
                }
            }
            catch (InvalidOperationException error) {
                GoogleAnalytics.EasyTracker.GetTracker().SendException(error.Message, false);
            }
        }