Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ------------------------------------------------------------------------
- // ========================================================================
- // THIS CODE AND INFORMATION ARE GENERATED BY AUTOMATIC CODE GENERATOR
- // ========================================================================
- // Template: PageCS.tt
- using System;
- using System.CodeDom.Compiler;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Net;
- using System.Runtime.CompilerServices;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Navigation;
- using Entities=WPAppStudio.Entities;
- using Ioc=WPAppStudio.Ioc;
- using IServices=WPAppStudio.Services.Interfaces;
- using IViewModels=WPAppStudio.ViewModel.Interfaces;
- using Localization=WPAppStudio.Localization;
- using Microsoft.Phone.Controls;
- using Microsoft.Phone.Shell;
- using MyToolkit.Paging;
- using Repositories=WPAppStudio.Repositories;
- using WPAppStudio;
- using System.Resources;
- using System.Windows.Media.Animation;
- using System.Windows.Input;
- namespace WPAppStudio.View
- {
- /// <summary>
- /// Phone application page for MainNews_News.
- /// </summary>
- [CompilerGenerated]
- [GeneratedCode("Radarc", "4.0")]
- public partial class MainNews_News : PhoneApplicationPage
- {
- /// <summary>
- /// Initializes the phone application page for MainNews_News and all its components.
- /// </summary>
- public MainNews_News()
- {
- InitializeComponent();
- VisualStateManager.GoToState(this, "Normal", false);
- if (Resources.Contains("PanoramaMainNews_News0AppBar"))
- PhonePage.SetApplicationBar(this, Resources["PanoramaMainNews_News0AppBar"] as BindableApplicationBar);
- }
- private void panoramaMainNews_News_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- InitializeAppBarpanoramaMainNews_News(PanoramaMainNews_News.SelectedItem as PivotItem);
- }
- private void InitializeAppBarpanoramaMainNews_News(PivotItem panoramaItem)
- {
- if (Resources.Contains(panoramaItem.Name + "AppBar"))
- {
- PhonePage.SetApplicationBar(this, Resources[panoramaItem.Name + "AppBar"] as BindableApplicationBar);
- ApplicationBar.IsVisible = true;
- }
- else if(ApplicationBar != null)
- ApplicationBar.IsVisible = false;
- }
- private void OpenClose_Left(object sender, RoutedEventArgs e)
- {
- var left = Canvas.GetLeft(LayoutRoot);
- if (left > -100)
- {
- ApplicationBar.IsVisible = true;
- MoveViewWindow(-420);
- }
- else
- {
- ApplicationBar.IsVisible = false;
- MoveViewWindow(0);
- }
- }
- private void OpenClose_Right(object sender, RoutedEventArgs e)
- {
- var left = Canvas.GetLeft(LayoutRoot);
- if (left > -520)
- {
- ApplicationBar.IsVisible = false;
- MoveViewWindow(-840);
- }
- else
- {
- ApplicationBar.IsVisible = true;
- MoveViewWindow(-420);
- }
- }
- void MoveViewWindow(double left)
- {
- _viewMoved = true;
- if (left == -420)
- ApplicationBar.IsVisible = true;
- else
- ApplicationBar.IsVisible = false;
- ((Storyboard)canvas.Resources["moveAnimation"]).SkipToFill();
- ((DoubleAnimation)((Storyboard)canvas.Resources["moveAnimation"]).Children[0]).To = left;
- ((Storyboard)canvas.Resources["moveAnimation"]).Begin();
- }
- private void canvas_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
- {
- if (e.DeltaManipulation.Translation.X != 0)
- Canvas.SetLeft(LayoutRoot, Math.Min(Math.Max(-840, Canvas.GetLeft(LayoutRoot) + e.DeltaManipulation.Translation.X), 0));
- }
- double initialPosition;
- bool _viewMoved = false;
- private void canvas_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
- {
- _viewMoved = false;
- initialPosition = Canvas.GetLeft(LayoutRoot);
- }
- private void canvas_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
- {
- var left = Canvas.GetLeft(LayoutRoot);
- if (_viewMoved)
- return;
- if (Math.Abs(initialPosition - left) < 100)
- {
- //bouncing back
- MoveViewWindow(initialPosition);
- return;
- }
- //change of state
- if (initialPosition - left > 0)
- {
- //slide to the left
- if (initialPosition > -420)
- MoveViewWindow(-420);
- else
- MoveViewWindow(-840);
- }
- else
- {
- //slide to the right
- if (initialPosition < -420)
- MoveViewWindow(-420);
- else
- MoveViewWindow(0);
- }
- }
- /// <summary>
- /// Called when the page becomes the active page.
- /// </summary>
- /// <param name="e">Contains information about the navigation done.</param>
- protected override void OnNavigatedTo(NavigationEventArgs e)
- {
- base.OnNavigatedTo(e);
- MainNews_NewsListControl.SelectedItem = null;
- // GamesNews_GamesNewsfeedListControl.SelectedItem = null;
- // SoftwareNews_SoftwareNewsfeedListControl.SelectedItem = null;
- // MenuSection_MenuMenuControl.SelectedItem = null;
- }
- private void PanoramaMainNews_News_Loaded(object sender, RoutedEventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment