Exemple #1
0
        private void Login_Click(object sender, RoutedEventArgs e)
        {
            CloudHandler handler = Application.Current.Resources["CloudHandler"] as CloudHandler;

            handler.InvokeGetAccessToken();
            NavigationService.Navigate(new Uri("/FileListPage.xaml", UriKind.RelativeOrAbsolute));
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            CloudHandler ch = Application.Current.Resources["CloudHandler"] as CloudHandler;

            if (ch != null)
            {
                imageProgress.IsIndeterminate = true;
                ch.GetFileUri(UrlCallback, ch.CurrentItem.Entry);
            }
        }
        void UrlCallback(IAsyncResult result)
        {
            Uri fileUri = result as Uri;

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                CloudHandler ch      = Application.Current.Resources["CloudHandler"] as CloudHandler;
                fileUri              = ch.EndGetFileUri(result);
                BitmapImage bi       = new BitmapImage();
                bi.DownloadProgress += new EventHandler <DownloadProgressEventArgs>(bi_DownloadProgress);
                bi.UriSource         = fileUri;
                currentImage.Source  = bi;
            });
        }
Exemple #4
0
        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            CloudHandler ch = Application.Current.Resources["CloudHandler"] as CloudHandler;

            if (ch != null)
            {
                ListBox lb = sender as ListBox;
                if (lb != null)
                {
                    if (lb.SelectedIndex > -1)
                    {
                        CloudItem ci = lb.SelectedItem as CloudItem;
                        if (ci != null)
                        {
                            ch.CurrentItem   = ci;
                            lb.SelectedIndex = -1;
                            NavigationService.Navigate(new Uri("/ImagePage.xaml", UriKind.RelativeOrAbsolute));
                        }
                    }
                }
            }
        }