Example #1
0
        static void OnHubTileSizeChanged(object sender, SizeChangedEventArgs e)
        {
            HubTile hubTile = (HubTile)sender;

            hubTile.SizeChanged -= OnHubTileSizeChanged;

            // In order to avoid getting into a bad state, we'll shift the HubTile
            // back to the Expanded state.  If we were already in the Expanded state,
            // then we'll manually shift the title panel to the right location,
            // since the visual state manager won't do it for us in that case.
            if (hubTile.State != ImageState.Expanded)
            {
                hubTile.State = ImageState.Expanded;
                VisualStateManager.GoToState(hubTile, Expanded, false);
            }
            else if (hubTile._titlePanel != null)
            {
                CompositeTransform titlePanelTransform = hubTile._titlePanel.RenderTransform as CompositeTransform;

                if (titlePanelTransform != null)
                {
                    titlePanelTransform.TranslateY = -hubTile.Height;
                }
            }

            HubTileService.InitializeReference(hubTile);
        }
Example #2
0
        /// <summary>
        /// Triggers the transition between visual states.
        /// </summary>
        /// <param name="obj">The dependency object.</param>
        /// <param name="e">The event information.</param>
        private static void OnSizeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            HubTile hubTile = (HubTile)obj;

            // And now we'll update the width and height to match the new size.
            switch (hubTile.Size)
            {
            case TileSize.Default:
                hubTile.Width  = 173;
                hubTile.Height = 173;
                break;

            case TileSize.Small:
                hubTile.Width  = 99;
                hubTile.Height = 99;
                break;

            case TileSize.Medium:
                hubTile.Width  = 210;
                hubTile.Height = 210;
                break;

            case TileSize.Large:
                hubTile.Width  = 432;
                hubTile.Height = 210;
                break;
            }

            hubTile.SizeChanged += OnHubTileSizeChanged;
            HubTileService.FinalizeReference(hubTile);
        }
Example #3
0
        /// <summary>
        /// Remove all references of a hub tile before finalizing it.
        /// </summary>
        /// <param name="tile">The hub tile that is to be finalized.</param>
        internal static void FinalizeReference(HubTile tile)
        {
            WeakReference wref = new WeakReference(tile, TrackResurrection);

            HubTileService.RemoveReferenceFromEnabledPool(wref);
            HubTileService.RemoveReferenceFromFrozenPool(wref);
            HubTileService.RemoveReferenceFromStalledPipeline(wref);
        }
Example #4
0
        /// <summary>
        /// Freeze a hub tile.
        /// </summary>
        /// <param name="tile">The hub tile to be frozen.</param>
        public static void FreezeHubTile(HubTile tile)
        {
            WeakReference wref = new WeakReference(tile, TrackResurrection);

            AddReferenceToFrozenPool(wref);
            RemoveReferenceFromEnabledPool(wref);
            RemoveReferenceFromStalledPipeline(wref);
        }
 public Friend_Photo(PublisherServiceClient _client)
 {
     InitializeComponent();
     hubTile= new HubTile();
     this.grid_Content.Children.Add(hubTile);
     hubTile.DisplayNotification = true;
     
    // hubTile.Background = new SolidColorBrush(new Color() {A=255, });
    // client = _client;
   //  client.GetImageByItemIdCompleted+=new EventHandler<GetImageByItemIdCompletedEventArgs>(client_GetImageByItemIdCompleted);
 }
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/wpTiles;component/PageContextMenu.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.hubMedium = ((Microsoft.Phone.Controls.HubTile)(this.FindName("hubMedium")));
     this.menuFixar = ((Microsoft.Phone.Controls.MenuItem)(this.FindName("menuFixar")));
     this.menuRemover = ((Microsoft.Phone.Controls.MenuItem)(this.FindName("menuRemover")));
     this.menuAtualizar = ((Microsoft.Phone.Controls.MenuItem)(this.FindName("menuAtualizar")));
 }
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Ejemplo_HubTile;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel")));
     this.ApplicationTitle = ((System.Windows.Controls.TextBlock)(this.FindName("ApplicationTitle")));
     this.PageTitle = ((System.Windows.Controls.TextBlock)(this.FindName("PageTitle")));
     this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.pastasTile = ((Microsoft.Phone.Controls.HubTile)(this.FindName("pastasTile")));
 }
Example #8
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/wpTiles;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel")));
     this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.hubLarge = ((Microsoft.Phone.Controls.HubTile)(this.FindName("hubLarge")));
     this.hubMedium = ((Microsoft.Phone.Controls.HubTile)(this.FindName("hubMedium")));
     this.hubSmall = ((Microsoft.Phone.Controls.HubTile)(this.FindName("hubSmall")));
 }
Example #9
0
        /// <summary>
        /// Removes the frozen image from the enabled image pool or the stalled image pipeline.
        /// Adds the non-frozen image to the enabled image pool.
        /// </summary>
        /// <param name="obj">The dependency object.</param>
        /// <param name="e">The event information.</param>
        private static void OnIsFrozenChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            HubTile tile = (HubTile)obj;

            if ((bool)e.NewValue)
            {
                HubTileService.FreezeHubTile(tile);
            }
            else
            {
                HubTileService.UnfreezeHubTile(tile);
            }
        }
Example #10
0
        /// <summary>
        /// Prevents the hub tile from transitioning into a Semiexpanded or Collapsed visual state if the title is not set.
        /// </summary>
        /// <param name="obj">The dependency object.</param>
        /// <param name="e">The event information.</param>
        private static void OnTitleChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            HubTile tile = (HubTile)obj;

            if (string.IsNullOrEmpty((string)e.NewValue))
            {
                tile._canDrop = false;
                tile.State    = ImageState.Expanded;
            }
            else
            {
                tile._canDrop = true;
            }
        }
Example #11
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/php-pb;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.blogphp = ((Microsoft.Phone.Controls.Pivot)(this.FindName("blogphp")));
     this.ListBox = ((System.Windows.Controls.ListBox)(this.FindName("ListBox")));
     this.Progress = ((System.Windows.Controls.StackPanel)(this.FindName("Progress")));
     this.tFace = ((Microsoft.Phone.Controls.HubTile)(this.FindName("tFace")));
     this.tTwit = ((Microsoft.Phone.Controls.HubTile)(this.FindName("tTwit")));
     this.tGit = ((Microsoft.Phone.Controls.HubTile)(this.FindName("tGit")));
     this.tFeed = ((Microsoft.Phone.Controls.HubTile)(this.FindName("tFeed")));
 }
Example #12
0
        /// <summary>
        /// Add a reference to a newly instantiated hub tile.
        /// </summary>
        /// <param name="tile">The newly instantiated hub tile.</param>
        internal static void InitializeReference(HubTile tile)
        {
            WeakReference wref = new WeakReference(tile, TrackResurrection);

            if (tile.IsFrozen)
            {
                AddReferenceToFrozenPool(wref);
            }
            else
            {
                AddReferenceToEnabledPool(wref);
            }

            RestartTimer();
        }
Example #13
0
        /// <summary>
        /// Prevents the hub tile from transitioning into a Flipped visual state if neither the notification alert nor the message are set.
        /// </summary>
        /// <param name="obj">The dependency object.</param>
        /// <param name="e">The event information.</param>
        private static void OnBackContentChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            HubTile tile = (HubTile)obj;

            // If there is a new notification or a message, the hub tile can flip.
            if ((!(string.IsNullOrEmpty(tile.Notification)) && tile.DisplayNotification) ||
                (!(string.IsNullOrEmpty(tile.Message)) && !tile.DisplayNotification))
            {
                tile._canFlip = true;
            }
            else
            {
                tile._canFlip = false;
                tile.State    = ImageState.Expanded;
            }
        }
Example #14
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/RallyLK;component/Controllers/Home.xaml", System.UriKind.Relative));
     this.LayoutRoot   = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.TitlePanel   = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel")));
     this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.View         = ((Microsoft.Phone.Controls.HubTile)(this.FindName("View")));
     this.Add          = ((Microsoft.Phone.Controls.HubTile)(this.FindName("Add")));
     this.Comments     = ((Microsoft.Phone.Controls.HubTile)(this.FindName("Comments")));
     this.Contact      = ((Microsoft.Phone.Controls.HubTile)(this.FindName("Contact")));
     this.PageTitle    = ((System.Windows.Controls.TextBlock)(this.FindName("PageTitle")));
 }
Example #15
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/TextEditor;component/Help.xaml", System.UriKind.Relative));
     this.LayoutRoot       = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.TitlePanel       = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel")));
     this.ApplicationTitle = ((System.Windows.Controls.TextBlock)(this.FindName("ApplicationTitle")));
     this.PageTitle        = ((System.Windows.Controls.TextBlock)(this.FindName("PageTitle")));
     this.ContentPanel     = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.ContentMain      = ((System.Windows.Controls.Grid)(this.FindName("ContentMain")));
     this.hubTile          = ((Microsoft.Phone.Controls.HubTile)(this.FindName("hubTile")));
     this.textBox1         = ((System.Windows.Controls.TextBox)(this.FindName("textBox1")));
 }
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/MultiTenant;component/Pages/LandlordMainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot       = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.landlordTitle    = ((System.Windows.Controls.TextBlock)(this.FindName("landlordTitle")));
     this.ContentPanel     = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.propertiesHubTle = ((Microsoft.Phone.Controls.HubTile)(this.FindName("propertiesHubTle")));
     this.tenantsHubTle    = ((Microsoft.Phone.Controls.HubTile)(this.FindName("tenantsHubTle")));
     this.maintanceHubTle  = ((Microsoft.Phone.Controls.HubTile)(this.FindName("maintanceHubTle")));
     this.complaintsHubTle = ((Microsoft.Phone.Controls.HubTile)(this.FindName("complaintsHubTle")));
     this.messagesHubTle   = ((Microsoft.Phone.Controls.HubTile)(this.FindName("messagesHubTle")));
     this.socialHubTle     = ((Microsoft.Phone.Controls.HubTile)(this.FindName("socialHubTle")));
 }
Example #17
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/PicAid%201.0;component/P1WithOutLogIn.xaml", System.UriKind.Relative));
     this.LayoutRoot      = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.btnLogInPivot   = ((System.Windows.Controls.Button)(this.FindName("btnLogInPivot")));
     this.btnSignUpPivot  = ((System.Windows.Controls.Button)(this.FindName("btnSignUpPivot")));
     this.e_service       = ((Microsoft.Phone.Controls.HubTile)(this.FindName("e_service")));
     this.awrnes          = ((Microsoft.Phone.Controls.HubTile)(this.FindName("awrnes")));
     this.btnfndhoscat    = ((System.Windows.Controls.Button)(this.FindName("btnfndhoscat")));
     this.hos_name_search = ((System.Windows.Controls.Image)(this.FindName("hos_name_search")));
     this.btnfndDocCat    = ((System.Windows.Controls.Button)(this.FindName("btnfndDocCat")));
     this.doc_name_search = ((System.Windows.Controls.Image)(this.FindName("doc_name_search")));
 }
Example #18
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/PhoneApp1;component/Assuntos.xaml", System.UriKind.Relative));
     this.LayoutRoot         = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.ContentPanel       = ((System.Windows.Controls.StackPanel)(this.FindName("ContentPanel")));
     this.hubOrientacao      = ((Microsoft.Phone.Controls.HubTile)(this.FindName("hubOrientacao")));
     this.hubTeclados        = ((Microsoft.Phone.Controls.HubTile)(this.FindName("hubTeclados")));
     this.hubNavegacao       = ((Microsoft.Phone.Controls.HubTile)(this.FindName("hubNavegacao")));
     this.hubDateTimePicker  = ((Microsoft.Phone.Controls.HubTile)(this.FindName("hubDateTimePicker")));
     this.hubListas          = ((Microsoft.Phone.Controls.HubTile)(this.FindName("hubListas")));
     this.hubIsolatedStorage = ((Microsoft.Phone.Controls.HubTile)(this.FindName("hubIsolatedStorage")));
     this.hubDatabase        = ((Microsoft.Phone.Controls.HubTile)(this.FindName("hubDatabase")));
     this.hubGeo             = ((Microsoft.Phone.Controls.HubTile)(this.FindName("hubGeo")));
 }
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/cnblogs;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.btnPost1 = ((Microsoft.Phone.Controls.HubTile)(this.FindName("btnPost1")));
     this.btnPost2 = ((Microsoft.Phone.Controls.HubTile)(this.FindName("btnPost2")));
     this.btnPost5 = ((Microsoft.Phone.Controls.HubTile)(this.FindName("btnPost5")));
     this.btnPost4 = ((Microsoft.Phone.Controls.HubTile)(this.FindName("btnPost4")));
     this.btnPost3 = ((Microsoft.Phone.Controls.HubTile)(this.FindName("btnPost3")));
     this.btnPost6 = ((Microsoft.Phone.Controls.HubTile)(this.FindName("btnPost6")));
     this.listBox1 = ((System.Windows.Controls.ListBox)(this.FindName("listBox1")));
     this.listBox2 = ((System.Windows.Controls.ListBox)(this.FindName("listBox2")));
     this.listBox3 = ((System.Windows.Controls.ListBox)(this.FindName("listBox3")));
     this.searchValue = ((System.Windows.Controls.TextBox)(this.FindName("searchValue")));
     this.btnSearch = ((System.Windows.Controls.Button)(this.FindName("btnSearch")));
 }
Example #20
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/CarDashboardNew;component/Views/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel")));
     this.Artist = ((System.Windows.Controls.TextBlock)(this.FindName("Artist")));
     this.Title = ((System.Windows.Controls.TextBlock)(this.FindName("Title")));
     this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.PauseResume = ((Microsoft.Phone.Controls.HubTile)(this.FindName("PauseResume")));
     this.PreviousSong = ((Microsoft.Phone.Controls.HubTile)(this.FindName("PreviousSong")));
     this.NextSong = ((Microsoft.Phone.Controls.HubTile)(this.FindName("NextSong")));
     this.Shuffle = ((Microsoft.Phone.Controls.HubTile)(this.FindName("Shuffle")));
     this.Repeat = ((Microsoft.Phone.Controls.HubTile)(this.FindName("Repeat")));
     this.AppBar = ((Caliburn.Micro.BindableAppBar.BindableAppBar)(this.FindName("AppBar")));
     this.BuyTheApp = ((Caliburn.Micro.BindableAppBar.BindableAppBarMenuItem)(this.FindName("BuyTheApp")));
     this.ShowSettings = ((Caliburn.Micro.BindableAppBar.BindableAppBarMenuItem)(this.FindName("ShowSettings")));
 }
Example #21
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/MultiTenant;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot       = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.ContentPanel     = ((Microsoft.Phone.Controls.Panorama)(this.FindName("ContentPanel")));
     this.socialContent    = ((System.Windows.Controls.Grid)(this.FindName("socialContent")));
     this.maintanceHubTle  = ((Microsoft.Phone.Controls.HubTile)(this.FindName("maintanceHubTle")));
     this.inventoryHubTle  = ((Microsoft.Phone.Controls.HubTile)(this.FindName("inventoryHubTle")));
     this.profileHubTle    = ((Microsoft.Phone.Controls.HubTile)(this.FindName("profileHubTle")));
     this.complaintsHubTle = ((Microsoft.Phone.Controls.HubTile)(this.FindName("complaintsHubTle")));
     this.messagesHubTle   = ((Microsoft.Phone.Controls.HubTile)(this.FindName("messagesHubTle")));
     this.documentsHubTle  = ((Microsoft.Phone.Controls.HubTile)(this.FindName("documentsHubTle")));
     this.emercancyContact = ((System.Windows.Controls.StackPanel)(this.FindName("emercancyContact")));
     this.contactDetails   = ((System.Windows.Controls.StackPanel)(this.FindName("contactDetails")));
 }
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/AroundMe;component/FrontPage.xaml", System.UriKind.Relative));
     this.LayoutRoot        = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.nature            = ((Microsoft.Phone.Controls.HubTile)(this.FindName("nature")));
     this.art               = ((Microsoft.Phone.Controls.HubTile)(this.FindName("art")));
     this.beach             = ((Microsoft.Phone.Controls.HubTile)(this.FindName("beach")));
     this.graffiti          = ((Microsoft.Phone.Controls.HubTile)(this.FindName("graffiti")));
     this.fashion           = ((Microsoft.Phone.Controls.HubTile)(this.FindName("fashion")));
     this.flowers           = ((Microsoft.Phone.Controls.HubTile)(this.FindName("flowers")));
     this.party             = ((Microsoft.Phone.Controls.HubTile)(this.FindName("party")));
     this.music             = ((Microsoft.Phone.Controls.HubTile)(this.FindName("music")));
     this.SearchTopic       = ((System.Windows.Controls.TextBox)(this.FindName("SearchTopic")));
     this.InneractiveXamlAd = ((Inneractive.Ad.InneractiveAd)(this.FindName("InneractiveXamlAd")));
     this.locSearch         = ((Microsoft.Phone.Controls.ToggleSwitch)(this.FindName("locSearch")));
     this.AroundMeMap       = ((Microsoft.Phone.Maps.Controls.Map)(this.FindName("AroundMeMap")));
 }
Example #23
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/WP7Filmographie;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot         = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.TitlePanel         = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel")));
     this.ApplicationTitle   = ((System.Windows.Controls.TextBlock)(this.FindName("ApplicationTitle")));
     this.PageTitle          = ((System.Windows.Controls.TextBlock)(this.FindName("PageTitle")));
     this.ContentPanel       = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.mWrapPanelHubTiles = ((Microsoft.Phone.Controls.WrapPanel)(this.FindName("mWrapPanelHubTiles")));
     this.ListeFilms         = ((Microsoft.Phone.Controls.HubTile)(this.FindName("ListeFilms")));
     this.ListeActeur        = ((Microsoft.Phone.Controls.HubTile)(this.FindName("ListeActeur")));
     this.ListeRealisateur   = ((Microsoft.Phone.Controls.HubTile)(this.FindName("ListeRealisateur")));
     this.Genres             = ((Microsoft.Phone.Controls.HubTile)(this.FindName("Genres")));
     this.Favoris            = ((Microsoft.Phone.Controls.HubTile)(this.FindName("Favoris")));
     this.Ajout     = ((Microsoft.Phone.Controls.HubTile)(this.FindName("Ajout")));
     this.Connexion = ((Microsoft.Phone.Controls.HubTile)(this.FindName("Connexion")));
     this.Parameter = ((Microsoft.Phone.Controls.HubTile)(this.FindName("Parameter")));
 }
Example #24
0
 /// <summary>
 /// Remove all references of a hub tile before finalizing it.
 /// </summary>
 /// <param name="tile">The hub tile that is to be finalized.</param>
 internal static void FinalizeReference(HubTile tile)
 {
     WeakReference wref = new WeakReference(tile, TrackResurrection);
     HubTileService.RemoveReferenceFromEnabledPool(wref);
     HubTileService.RemoveReferenceFromFrozenPool(wref);
     HubTileService.RemoveReferenceFromStalledPipeline(wref);
 }
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            /*Button morebtn = (Button)this.FindName("moreButton");
            stackPanel1.Children.Remove(morebtn);*/
            if (app_count == 0)
            {
                Button more_btn = new Button();
                more_btn.Content = "More...";
                more_btn.Name = "MoreButton";
                more_btn.Click += PhoneApplicationPage_Loaded;
                stackPanel1.Children.Add(more_btn);
                app_count++;
            }
            Button morebtn = (Button)this.FindName("MoreButton");
            stackPanel1.Children.Remove(morebtn);
            if (FlickrManager.OAuthToken == null || FlickrManager.OAuthTokenSecret == null)
                return;
            else
            {
                int count=0;
                Grid grid = new Grid();
                grid.Name = "Grid" + panel_count;
                grid.ColumnDefinitions.Add(new ColumnDefinition());
                grid.ColumnDefinitions.Add(new ColumnDefinition());
                grid.RowDefinitions.Add(new RowDefinition {Height = new GridLength(200)});
                grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(200) });
                grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(200) });
                grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(200) });
                stackPanel1.Children.Add(grid);
                //scrollViewer1.Content = grid;
                Button btn = (Button)this.FindName("flickrAuthenticate");
                btn.Content = "Not your Account?";
                Flickr f = FlickrManager.GetAuthInstance();

                f.PeopleGetPhotosAsync(FlickrManager.OAuthUserID, page, perPage, r => 
                {
                    if (r.Error != null)
                    {
                        Dispatcher.BeginInvoke(() =>
                        {
                            MessageBox.Show("An error occurred talking to Flickr: " + r.Error.Message);
                        });
                        return;
                    }

                    PhotoCollection photos = r.Result;

                    Dispatcher.BeginInvoke(() =>
                    {
                        //ResultsListBox.ItemsSource = photos;
                        while (count != photos.Count)
                        {
                            int comments_count=0;
                            String full_comment = "";

                            HubTile hubTile = new HubTile();
                            hubTile.Title = photos[count].Title;
                            hubTile.Source = new BitmapImage(new Uri(photos[count].SquareThumbnailUrl));
                            hubTile.Name = photos[count].WebUrl;
                            hubTile.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(hubTile_Tap);
                            Flickr flickr = FlickrManager.GetAuthInstance();
                            flickr.PhotosCommentsGetListAsync(photos[count].PhotoId, res => 
                            {
                                if (res.Error != null)
                                {
                                    Dispatcher.BeginInvoke(() =>
                                    {
                                        MessageBox.Show("An error occurred talking to Flickr: " + res.Error.Message);
                                    });
                                    return;
                                }
                                PhotoCommentCollection comments = res.Result;
                                if (comments.Count == 0)
                                    full_comment = "No comments";
                                else
                                {
                                    while (comments_count != comments.Count)
                                    {
                                        full_comment = full_comment + comments[comments_count].AuthorUserName + ":" + comments[comments_count].CommentHtml + " ";
                                        comments_count++;
                                    }
                                }
                                hubTile.Message = full_comment;
                            });
                            //stackPanel1.Children.Add(comment);
                            //stackPanel1.Children.Add(hubTile);
                            hubTile.SetValue(Grid.RowProperty, count / 2);
                            hubTile.SetValue(Grid.ColumnProperty, count % 2);
                            grid.Children.Add(hubTile);
                            count++;
                            if (count == photos.Count)
                            {
                                int newCount = 0;
                                String imageURL = photos[count-1].SquareThumbnailUrl;
                                // Application Tile is always the first Tile, even if it is not pinned to Start.
                                ShellTile TileToFind = ShellTile.ActiveTiles.First();
                                // Application should always be found
                                if (TileToFind != null)
                                {
                                    // Set the properties to update for the Application Tile.
                                    // Empty strings for the text values and URIs will result in the property being cleared.
                                    StandardTileData NewTileData = new StandardTileData
                                    {
                                        Title = "Flickr-On-Tiles",
                                        BackgroundImage = new Uri(imageURL),
                                        Count = newCount,
                                        BackTitle = "What is This?",
                                        BackContent = "Flickr-on-Tiles. An app for photofreaks"
                                    };

                                    // Update the Application Tile
                                    TileToFind.Update(NewTileData);
                                }
                            }
                        }
                        if (photos.Pages != page)
                        {
                            page++;
                            stackPanel1.Children.Add(morebtn);
                        }
                    });
                    return;
                });
            }
        }
        public void ImagesDownloaded(object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                if (e.Result == null || e.Error != null)
                {
                    MessageBox.Show("Cannot get albums data from Picasa server!");
                    return;
                }
                else
                {
                    panel_count++;
                    Grid grid = new Grid();
                    grid.Name = "Grid" + panel_count;
                    grid.ColumnDefinitions.Add(new ColumnDefinition());
                    grid.ColumnDefinitions.Add(new ColumnDefinition());
                    grid.RowDefinitions.Add(new RowDefinition {Height = new GridLength(200)});
                    grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(200) });
                    grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(200) });
                    grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(200) });
                    stackPanel1.Children.Add(grid);
                    // Deserialize JSON string to dynamic object
                    IDictionary<string, object> json = (IDictionary<string, object>)SimpleJson.DeserializeObject(e.Result);
                    // Feed object
                    IDictionary<string, object> feed = (IDictionary<string, object>)json["feed"];
                    // Image entries
                    IList entries = (IList)feed["entry"];
                    // Delete previous albums from albums list
                    //albumImages.Clear();
                    // Find album details
                    for (int i = 0; i < entries.Count; i++)
                    {
                        // Create a new Album
                        AlbumImage albumImage = new AlbumImage();
                        // Album entry object
                        IDictionary<string, object> entry = (IDictionary<string, object>)entries[i];
                        // Published object
                        IDictionary<string, object> summary = (IDictionary<string, object>)entry["summary"];
                        // Image Caption
                        if ((string)summary["$t"] == "")
                        {
                            albumImage.title = "No caption";
                        }
                        else
                        {
                            albumImage.title = (string)summary["$t"];
                        }
                        // Link List
                        IList link = (IList)entry["link"];
                        // First link is Image URL in Picasa
                        IDictionary<string, object> href = (IDictionary<string, object>)link[0];
                        // Get image webURL
                        albumImage.webUrl = (string)href["href"];
                        // Media group object
                        IDictionary<string, object> mediagroup = (IDictionary<string, object>)entry["media$group"];
                        // Media thumbnail object list
                        IList mediathumbnailList = (IList)mediagroup["media$thumbnail"];
                        // First thumbnail object (smallest)
                        IDictionary<string, object> mediathumbnail = (IDictionary<string, object>)mediathumbnailList[0];
                        // Get thumbnail url
                        albumImage.thumbnail = (string)mediathumbnail["url"];
                        IDictionary<string, object> photoid = (IDictionary<string, object>)entry["gphoto$id"];
                        IDictionary<string, object> photoalbumid = (IDictionary<string, object>)entry["gphoto$albumid"];
                        albumImage.content = GetComments((string)photoid["$t"], (string)photoalbumid["$t"]);
                        HubTile hubtile = new HubTile();
                        hubtile.Title = albumImage.title;
                        hubtile.Source = new BitmapImage(new Uri(albumImage.thumbnail));
                        hubtile.Name = albumImage.webUrl;// +":" + (string)photoid["$t"];
                        hubtile.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(hubtile_Tap);
                        hubtile.Message = albumImage.content;
                        hubtile.SetValue(Grid.RowProperty, i / 2);
                        hubtile.SetValue(Grid.ColumnProperty, i % 2);
                        grid.Children.Add(hubtile);
                        /*if (i == entries.Count - 1)
                        {
                            int newCount = 0;
                            String imageURL = albumImage.thumbnail;
                            // Application Tile is always the first Tile, even if it is not pinned to Start.
                            ShellTile TileToFind = ShellTile.ActiveTiles.First();
                            // Application should always be found
                            if (TileToFind != null)
                            {
                                // Set the properties to update for the Application Tile.
                                // Empty strings for the text values and URIs will result in the property being cleared.
                                StandardTileData NewTileData = new StandardTileData
                                {
                                    Title = "Picasa-On-Tiles",
                                    BackgroundImage = new Uri(imageURL,UriKind.Absolute),
                                    //BackgroundImage = new Uri((string)mediathumbnail["url"]),
                                    //BackgroundImage = ((System.Windows.Media.Imaging.BitmapImage)hubtile.Source).UriSource,
                                    Count = newCount,
                                    BackTitle = "What is This?",
                                    BackContent = "Picasa-on-Tiles. An app for photofreaks"
                                };

                                // Update the Application Tile
                                TileToFind.Update(NewTileData);
                            }
                        }*/
                    }
                    /*if (entries.Count != 8)
                    {
 
                    }*/
                    // Add albums to AlbumListBox
                    //AlbumsListBox.ItemsSource = app.albums;
                }
            }
            catch (WebException)
            {
                MessageBox.Show("Cannot get albums data from Picasa server!");
            }
            catch (KeyNotFoundException)
            {
                //MessageBox.Show("Cannot load images from Picasa Server - JSON parsing error happened!");
            }
        }
Example #27
0
        /// <summary>
        /// Unfreezes a hub tile and restarts the timer if needed.
        /// </summary>
        /// <param name="tile">The hub tile to be unfrozen.</param>
        public static void UnfreezeHubTile(HubTile tile)
        {
            WeakReference wref = new WeakReference(tile, TrackResurrection);
            AddReferenceToEnabledPool(wref);
            RemoveReferenceFromFrozenPool(wref);
            RemoveReferenceFromStalledPipeline(wref);

            RestartTimer();
        }
        // called when albums are responded.
        void albums_response(IDictionary<String, object> res)
        {
             object response;
             albumIdList = new List<string>();
            // getting all photos 
             if (res != null && res.TryGetValue("data", out response))
             {

                 foreach (JsonObject _post in (JsonArray)response)
                 {
                     model = new FacebookItemViewModel(_post);
                     if (model.id != null)
                     {
                         photoManager.getPhotos(model.id, photo_response);
                         // add hubtile to panorama view when there is an album in facebook
                         album = new HubTile();
                         album.Title = model.name;
                         album.Margin = new Thickness(2, 2, 2, 2);
                         album.GroupTag = model.id;
                         album.Background = new SolidColorBrush(Colors.Green);
                         albumIdList.Add(model.id);
                         // add albums to album specific collection
                         this.AlbumsList.Items.Add(album);
                         // tapping support
                         album.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(album_Tap);
                     }
                 }
             }
             else
             {
                 MessageBoxResult m = MessageBox.Show("Facebook null album response", "Response", MessageBoxButton.OK);
             }
                      
        }
Example #29
0
 private void CreateLiveTile(HubTile hubtile)
 {
     StandardTileData LiveTile = new StandardTileData
         {
             BackgroundImage = ((System.Windows.Media.Imaging.BitmapImage)hubtile.Source).UriSource,
             Title = hubtile.Title,
             BackTitle = hubtile.Title,
             BackContent = hubtile.Message
         };
     ShellTile Tile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("DefaultTitle=" + LiveTile.Title));
     if (Tile == null)
     {
         try
         {
             ShellTile.Create(new Uri("/AddPage.xaml?category=" + hubtile.Title, UriKind.Relative), LiveTile);
         }
         catch (Exception)
         {
             MessageBox.Show("I prefer not to be pinned");
         }
     }
     else MessageBox.Show("The tile is already pinned");
 }
Example #30
0
        /// <summary>
        /// Add a reference to a newly instantiated hub tile.
        /// </summary>
        /// <param name="tile">The newly instantiated hub tile.</param>
        internal static void InitializeReference(HubTile tile)
        {
            WeakReference wref = new WeakReference(tile, TrackResurrection);
            if (tile.IsFrozen)
            {
                AddReferenceToFrozenPool(wref);
            }
            else
            {
                AddReferenceToEnabledPool(wref);
            }

            RestartTimer();
        }
        private void GraphApiPhotos()
        {
            var fb = new FacebookClient(_accessToken);

            fb.GetCompleted += (o, e) =>
            {
                if (e.Error != null)
                {
                    Dispatcher.BeginInvoke(() => MessageBox.Show(e.Error.Message));
                    return;
                }
                count =count+ 8;
                var result = (IDictionary<string, object>)e.GetResultData();

                Dispatcher.BeginInvoke(() =>
                {
                    int i;
                    panel_count++;
                    Grid grid = new Grid();
                    grid.Name = "Grid" + panel_count;
                    grid.ColumnDefinitions.Add(new ColumnDefinition());
                    grid.ColumnDefinitions.Add(new ColumnDefinition());
                    grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(200) });
                    grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(200) });
                    grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(200) });
                    grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(200) });
                    stackPanel1.Children.Add(grid);
                    IList data = (IList)result["data"];
                    for (i = 0; i < data.Count; i++)
                    {
                        IDictionary<string, object> entry = (IDictionary<string, object>)data[i];
                        HubTile hubTile = new HubTile();
                        try
                        {
                            hubTile.Title = (string)entry["name"];
                        }
                        catch
                        {
                            hubTile.Title = "No caption";
                        }
                        //hubTile.Title = "Title";
                        hubTile.Source = new BitmapImage(new Uri((string)entry["picture"]));
                        hubTile.Name = (string)entry["link"];
                        GetComments((string)entry["id"], (string)entry["link"]);
                        hubTile.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(hubTile_Tap);
                        hubTile.SetValue(Grid.RowProperty, i / 2);
                        hubTile.SetValue(Grid.ColumnProperty, i % 2);
                        grid.Children.Add(hubTile);
                        if (i == data.Count - 1)
                        {
                            int newCount = 0;
                            String imageURL = (string)entry["picture"];
                            String imageURI = imageURL.Replace("https://", "http://");
                            // Application Tile is always the first Tile, even if it is not pinned to Start.
                            ShellTile TileToFind = ShellTile.ActiveTiles.First();
                            // Application should always be found
                            if (TileToFind != null)
                            {
                                // Set the properties to update for the Application Tile.
                                // Empty strings for the text values and URIs will result in the property being cleared.
                                StandardTileData NewTileData = new StandardTileData
                                {
                                    Title = "Fhotos-On-Tiles",
                                    //BackgroundImage = new Uri(imageURL, UriKind.Absolute),
                                    BackgroundImage = new Uri(imageURI),
                                    Count = newCount,
                                    BackTitle = "What is This?",
                                    BackContent = "View your Facebook photos on tiles."
                                };

                                // Update the Application Tile
                                TileToFind.Update(NewTileData);
                            }
                        }
                    }
                    if (i == 8)
                    {
                        Button more_btn = new Button();
                        more_btn.Content = "More...";
                        more_btn.Name = "MoreButton";
                        more_btn.Click += PhoneApplicationPage_Loaded;
                        stackPanel1.Children.Add(more_btn);
                    }

                });
            };

            fb.GetAsync("me/photos?limit=8&offset=" + count + "&fields=name,picture,link");
        }
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Calendario%20Estudiantil;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot2 = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot2")));
     this.listaMenu = ((System.Windows.Controls.ListBox)(this.FindName("listaMenu")));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.colLun = ((System.Windows.Controls.ColumnDefinition)(this.FindName("colLun")));
     this.colMar = ((System.Windows.Controls.ColumnDefinition)(this.FindName("colMar")));
     this.colMer = ((System.Windows.Controls.ColumnDefinition)(this.FindName("colMer")));
     this.colGio = ((System.Windows.Controls.ColumnDefinition)(this.FindName("colGio")));
     this.colVen = ((System.Windows.Controls.ColumnDefinition)(this.FindName("colVen")));
     this.colSab = ((System.Windows.Controls.ColumnDefinition)(this.FindName("colSab")));
     this.colDom = ((System.Windows.Controls.ColumnDefinition)(this.FindName("colDom")));
     this.t0CTRL = ((System.Windows.Controls.RowDefinition)(this.FindName("t0CTRL")));
     this.t0Head = ((System.Windows.Controls.RowDefinition)(this.FindName("t0Head")));
     this.t1Sett = ((System.Windows.Controls.RowDefinition)(this.FindName("t1Sett")));
     this.t2Sett = ((System.Windows.Controls.RowDefinition)(this.FindName("t2Sett")));
     this.t3Sett = ((System.Windows.Controls.RowDefinition)(this.FindName("t3Sett")));
     this.t4Sett = ((System.Windows.Controls.RowDefinition)(this.FindName("t4Sett")));
     this.t5Sett = ((System.Windows.Controls.RowDefinition)(this.FindName("t5Sett")));
     this.t6Sett = ((System.Windows.Controls.RowDefinition)(this.FindName("t6Sett")));
     this.LUN = ((System.Windows.Controls.TextBlock)(this.FindName("LUN")));
     this.MAR = ((System.Windows.Controls.TextBlock)(this.FindName("MAR")));
     this.MER = ((System.Windows.Controls.TextBlock)(this.FindName("MER")));
     this.JUE = ((System.Windows.Controls.TextBlock)(this.FindName("JUE")));
     this.ViN = ((System.Windows.Controls.TextBlock)(this.FindName("ViN")));
     this.SAB = ((System.Windows.Controls.TextBlock)(this.FindName("SAB")));
     this.DOM = ((System.Windows.Controls.TextBlock)(this.FindName("DOM")));
     this.BackBtn = ((System.Windows.Controls.Button)(this.FindName("BackBtn")));
     this.imgPrevMonth = ((System.Windows.Controls.Image)(this.FindName("imgPrevMonth")));
     this.NextBtn = ((System.Windows.Controls.Button)(this.FindName("NextBtn")));
     this.imgNextMonth = ((System.Windows.Controls.Image)(this.FindName("imgNextMonth")));
     this.mes = ((System.Windows.Controls.TextBlock)(this.FindName("mes")));
     this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.TrabajosTap = ((Microsoft.Phone.Controls.HubTile)(this.FindName("TrabajosTap")));
     this.CertamenTap = ((Microsoft.Phone.Controls.HubTile)(this.FindName("CertamenTap")));
     this.DisertacionesTap = ((Microsoft.Phone.Controls.HubTile)(this.FindName("DisertacionesTap")));
     this.ControlTap = ((Microsoft.Phone.Controls.HubTile)(this.FindName("ControlTap")));
 }
Example #33
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/311NYC;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.MainListBox = ((System.Windows.Controls.ListBox)(this.FindName("MainListBox")));
     this.DisplayLoginInfo = ((System.Windows.Controls.TextBlock)(this.FindName("DisplayLoginInfo")));
     this.textToday = ((System.Windows.Controls.TextBlock)(this.FindName("textToday")));
     this.textTemp = ((System.Windows.Controls.TextBlock)(this.FindName("textTemp")));
     this.textBlock2_Copy = ((System.Windows.Controls.TextBlock)(this.FindName("textBlock2_Copy")));
     this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.StreetClosuresTile = ((Microsoft.Phone.Controls.HubTile)(this.FindName("StreetClosuresTile")));
     this.OEMTile = ((Microsoft.Phone.Controls.HubTile)(this.FindName("OEMTile")));
     this.OSFNSTile = ((Microsoft.Phone.Controls.HubTile)(this.FindName("OSFNSTile")));
     this.CareersTile = ((Microsoft.Phone.Controls.HubTile)(this.FindName("CareersTile")));
     this.DOTTile = ((Microsoft.Phone.Controls.HubTile)(this.FindName("DOTTile")));
     this.HopeTile = ((Microsoft.Phone.Controls.HubTile)(this.FindName("HopeTile")));
     this.TeenTile = ((Microsoft.Phone.Controls.HubTile)(this.FindName("TeenTile")));
     this.FreeTile = ((Microsoft.Phone.Controls.HubTile)(this.FindName("FreeTile")));
     this.TwitterFeedList = ((System.Windows.Controls.ListBox)(this.FindName("TwitterFeedList")));
 }