Guest User

bhast2 app

a guest
Oct 20th, 2013
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.01 KB | None | 0 0
  1. // ------------------------------------------------------------------------
  2. // ========================================================================
  3. // THIS CODE AND INFORMATION ARE GENERATED BY AUTOMATIC CODE GENERATOR
  4. // ========================================================================
  5. // Template:   PageCS.tt
  6. using System;
  7. using System.CodeDom.Compiler;
  8. using System.Collections.Generic;
  9. using System.ComponentModel;
  10. using System.Linq;
  11. using System.Net;
  12. using System.Runtime.CompilerServices;
  13. using System.Windows;
  14. using System.Windows.Controls;
  15. using System.Windows.Navigation;
  16. using Entities=WPAppStudio.Entities;
  17. using Ioc=WPAppStudio.Ioc;
  18. using IServices=WPAppStudio.Services.Interfaces;
  19. using IViewModels=WPAppStudio.ViewModel.Interfaces;
  20. using Localization=WPAppStudio.Localization;
  21. using Microsoft.Phone.Controls;
  22. using Microsoft.Phone.Shell;
  23. using MyToolkit.Paging;
  24. using Repositories=WPAppStudio.Repositories;
  25. using WPAppStudio;
  26. using System.Resources;
  27. using System.Windows.Media.Animation;
  28. using System.Windows.Input;
  29.  
  30.  
  31. namespace WPAppStudio.View
  32. {
  33.     /// <summary>
  34.     /// Phone application page for MainNews_News.
  35.     /// </summary>
  36.     [CompilerGenerated]
  37.     [GeneratedCode("Radarc", "4.0")]
  38.     public partial class MainNews_News : PhoneApplicationPage
  39.     {      
  40.         /// <summary>
  41.         /// Initializes the phone application page for MainNews_News and all its components.
  42.         /// </summary>
  43.         public MainNews_News()
  44.         {
  45.             InitializeComponent();
  46.             VisualStateManager.GoToState(this, "Normal", false);
  47.             if (Resources.Contains("PanoramaMainNews_News0AppBar"))
  48.                 PhonePage.SetApplicationBar(this, Resources["PanoramaMainNews_News0AppBar"] as BindableApplicationBar);
  49.                            
  50.         }
  51.        
  52.         private void panoramaMainNews_News_SelectionChanged(object sender, SelectionChangedEventArgs e)
  53.         {
  54.             InitializeAppBarpanoramaMainNews_News(PanoramaMainNews_News.SelectedItem as PivotItem);
  55.         }
  56.  
  57.         private void InitializeAppBarpanoramaMainNews_News(PivotItem panoramaItem)        
  58.         {
  59.             if (Resources.Contains(panoramaItem.Name + "AppBar"))
  60.             {
  61.                 PhonePage.SetApplicationBar(this, Resources[panoramaItem.Name + "AppBar"] as BindableApplicationBar);            
  62.                 ApplicationBar.IsVisible = true;
  63.             }
  64.             else if(ApplicationBar != null)
  65.                 ApplicationBar.IsVisible = false;
  66.         }
  67.         private void OpenClose_Left(object sender, RoutedEventArgs e)
  68.         {
  69.             var left = Canvas.GetLeft(LayoutRoot);
  70.             if (left > -100)
  71.             {
  72.                 ApplicationBar.IsVisible = true;
  73.                 MoveViewWindow(-420);
  74.             }
  75.             else
  76.             {
  77.                 ApplicationBar.IsVisible = false;
  78.                 MoveViewWindow(0);
  79.             }
  80.         }
  81.         private void OpenClose_Right(object sender, RoutedEventArgs e)
  82.         {
  83.             var left = Canvas.GetLeft(LayoutRoot);
  84.             if (left > -520)
  85.             {
  86.                 ApplicationBar.IsVisible = false;
  87.                 MoveViewWindow(-840);
  88.             }
  89.             else
  90.             {
  91.                 ApplicationBar.IsVisible = true;
  92.                 MoveViewWindow(-420);
  93.  
  94.             }
  95.         }
  96.  
  97.         void MoveViewWindow(double left)
  98.         {
  99.             _viewMoved = true;
  100.             if (left == -420)
  101.                 ApplicationBar.IsVisible = true;
  102.             else
  103.                 ApplicationBar.IsVisible = false;
  104.             ((Storyboard)canvas.Resources["moveAnimation"]).SkipToFill();
  105.             ((DoubleAnimation)((Storyboard)canvas.Resources["moveAnimation"]).Children[0]).To = left;
  106.             ((Storyboard)canvas.Resources["moveAnimation"]).Begin();
  107.         }
  108.  
  109.         private void canvas_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
  110.         {
  111.             if (e.DeltaManipulation.Translation.X != 0)
  112.                 Canvas.SetLeft(LayoutRoot, Math.Min(Math.Max(-840, Canvas.GetLeft(LayoutRoot) + e.DeltaManipulation.Translation.X), 0));
  113.         }
  114.  
  115.         double initialPosition;
  116.         bool _viewMoved = false;
  117.         private void canvas_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
  118.         {
  119.             _viewMoved = false;
  120.             initialPosition = Canvas.GetLeft(LayoutRoot);
  121.         }
  122.  
  123.         private void canvas_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
  124.         {
  125.             var left = Canvas.GetLeft(LayoutRoot);
  126.             if (_viewMoved)
  127.                 return;
  128.             if (Math.Abs(initialPosition - left) < 100)
  129.             {
  130.                 //bouncing back
  131.                 MoveViewWindow(initialPosition);
  132.                 return;
  133.             }
  134.             //change of state
  135.             if (initialPosition - left > 0)
  136.             {
  137.                 //slide to the left
  138.                 if (initialPosition > -420)
  139.                     MoveViewWindow(-420);
  140.                 else
  141.                     MoveViewWindow(-840);
  142.             }
  143.             else
  144.             {
  145.                 //slide to the right
  146.                 if (initialPosition < -420)
  147.                     MoveViewWindow(-420);
  148.                 else
  149.                     MoveViewWindow(0);
  150.             }
  151.  
  152.         }
  153.         /// <summary>
  154.         /// Called when the page becomes the active page.
  155.         /// </summary>
  156.         /// <param name="e">Contains information about the navigation done.</param>
  157.         protected override  void OnNavigatedTo(NavigationEventArgs e)
  158.         {
  159.             base.OnNavigatedTo(e);
  160.        
  161.             MainNews_NewsListControl.SelectedItem = null;
  162.        
  163.         //    GamesNews_GamesNewsfeedListControl.SelectedItem = null;
  164.        
  165.         //    SoftwareNews_SoftwareNewsfeedListControl.SelectedItem = null;
  166.        
  167.         //    MenuSection_MenuMenuControl.SelectedItem = null;
  168.         }
  169.  
  170.         private void PanoramaMainNews_News_Loaded(object sender, RoutedEventArgs e)
  171.         {
  172.            
  173.         }
  174.        
  175.     }
  176. }
Advertisement
Add Comment
Please, Sign In to add comment