Exemple #1
0
        public static void Init(PhoneApplicationPage page)
        {
            AddMenuItem(page, "Settings", () => page.NavigationService.Navigate(new Uri("/SettingsPage.xaml", UriKind.Relative)));

            AddMenuItem(page, "Rate and Review", () =>
            {
                new MarketplaceReviewTask().Show();
                Settings.Set(Setting.RatingDone, true);
            });

            AddMenuItem(page, "Give Feedback", () =>
            {
                new EmailComposeTask
                {
                    To      = "*****@*****.**",
                    Subject = "Feedback for Learn On The Go",
                    Body    = LittleWatson.GetMailBody("")
                }.Show();
            });

            var installationDate = Settings.GetDateTime(Setting.InstallationDate);

            if (!installationDate.HasValue)
            {
                Settings.Set(Setting.InstallationDate, DateTime.UtcNow);
            }
            else if (!Settings.GetBool(Setting.RatingDone))
            {
                if ((DateTime.UtcNow - installationDate.Value).TotalDays >= 1)
                {
                    var result = MessageBox.Show("Would you mind reviewing the Learn On The Go app?", "Rate and Review", MessageBoxButton.OKCancel);
                    if (result == MessageBoxResult.OK)
                    {
                        new MarketplaceReviewTask().Show();
                    }
                    Settings.Set(Setting.RatingDone, true);
                }
            }
        }
Exemple #2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            LittleWatson.CheckForPreviousException(true);

            if (App.Crawler != null)
            {
                return;
            }

            var email    = Settings.GetString(Setting.Email);
            var password = Settings.GetString(Setting.Password);

            if (e.NavigationMode != NavigationMode.Back && (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password)))
            {
                OnSettingsClick(null, null);
            }
            else
            {
                LoadCourses(email, password, false);
            }
        }
Exemple #3
0
        private void OnLectureVideoClick(object sender, RoutedEventArgs e)
        {
            if (videoLazyBlock != null)
            {
                return;
            }

            var lecture = (Coursera.Lecture)((Button)sender).DataContext;

            videoLazyBlock = new LazyBlock <string>(
                "video",
                null,
                lecture.VideoUrl,
                _ => false,
                new LazyBlockUI <string>(
                    this,
                    videoUrl =>
            {
                try
                {
                    var launcher   = new MediaPlayerLauncher();
                    launcher.Media = new Uri(videoUrl, UriKind.Absolute);
                    launcher.Show();
                }
                catch (Exception ex)
                {
                    LittleWatson.ReportException(ex, string.Format("Opening video for lecture '{0}' of course '{1}' ({2})", lecture.Title, pivot.Title, videoUrl));
                    LittleWatson.CheckForPreviousException(false);
                }
            },
                    () => false,
                    null),
                false,
                null,
                _ => videoLazyBlock = null,
                null);
        }
Exemple #4
0
 private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
 {
     LittleWatson.ReportException(e.Exception, "NavigationFailed: " + e.Uri);
 }
Exemple #5
0
 public void OnException(string message, Exception e)
 {
     LittleWatson.ReportException(e, message);
     LittleWatson.CheckForPreviousException(false);
 }