/// <summary>
 /// Initializes a new instance of the <see cref="GalleryPreviewControl" /> class.
 /// </summary>
 public GalleryPreviewControl()
 {
     HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch;
     VerticalAlignment   = Windows.UI.Xaml.VerticalAlignment.Stretch;
     Transitions         = new Windows.UI.Xaml.Media.Animation.TransitionCollection();
     Transitions.Add(new Windows.UI.Xaml.Media.Animation.RepositionThemeTransition());
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GalleryPreviewControl" /> class.
 /// </summary>
 public GalleryPreviewControl()
 {
     HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch;
     VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch;
     Transitions = new Windows.UI.Xaml.Media.Animation.TransitionCollection();
     Transitions.Add(new Windows.UI.Xaml.Media.Animation.RepositionThemeTransition());
 }
        public ResultPage()
        {
            this.InitializeComponent();

            // GUI Stuff
            var currentView = SystemNavigationManager.GetForCurrentView();

            currentView.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            currentView.BackRequested += (ev, x) => { if (Frame.CanGoBack)
                                                      {
                                                          Frame.GoBack();
                                                      }
            };
            SizeChanged += (s, e) => ValuesStackPanel.Orientation = e.NewSize.Height >= e.NewSize.Width ? Orientation.Vertical : Orientation.Horizontal;
            Transitions  = new Windows.UI.Xaml.Media.Animation.TransitionCollection()
            {
                new Windows.UI.Xaml.Media.Animation.NavigationThemeTransition()
            };

            // Calculate rough number of years
            int years = (int)Math.Floor(Info.DateDifference.TotalDays / 365.2425);
            // Calculate rough number of residual months
            int months = (int)Math.Floor((Info.DateDifference.TotalDays % 365.25) / 30.4375);
            // Calculate rough number of residual days
            int days = (int)Math.Floor((Info.DateDifference.TotalDays % 365.25) % 30.4375);

            // Display Information Appropriately
            YearsTextBlock.Text  = years == 1 ? $"{years.ToString()} Year," : $"{years.ToString()} Years,";
            MonthsTextBlock.Text = months == 1 ? $"{months.ToString()} Month," : $"{months.ToString()} Months,";
            DaysTextBlock.Text   = days == 1 ? $"{days.ToString()} Day" : $"{days.ToString()} Days";
        }
Beispiel #4
0
        private void ExibirPopupEpisodio()
        {
            if (p_objPopup != null)
            {
                p_objPopup.IsOpen = false;
                p_objPopup        = null;
            }
            p_objPopup = new Popup();
            PopupEpisodio objControl = new PopupEpisodio();

            //Height="450" Width="900" (tamanhos do popup)
            p_objPopup.HorizontalOffset = (Window.Current.Bounds.Width / 2) - (450);
            p_objPopup.VerticalOffset   = (Window.Current.Bounds.Height / 2) - (225);

            p_objPopup.Child = objControl;

            objControl.NomePodcast     = p_objPodcastSelecionadoLista.Nome;
            objControl.TituloEpisodio  = p_objEpisodioSelecionadoLista.Titulo;
            objControl.URLEpisodio     = p_objEpisodioSelecionadoLista.URLSite;
            objControl.URLMp3          = p_objEpisodioSelecionadoLista.URLMp3;
            objControl.URLImagem       = p_objEpisodioSelecionadoLista.URLImagem;
            objControl.DuracaoEpisodio = p_objEpisodioSelecionadoLista.Duracao;
            objControl.DataPublicacao  = p_objEpisodioSelecionadoLista.DataPublicacao;
            objControl.CarregarInformacoesCampos();

            var transitions = new Windows.UI.Xaml.Media.Animation.TransitionCollection();

            transitions.Add(new Windows.UI.Xaml.Media.Animation.PopupThemeTransition()
            {
                FromHorizontalOffset = 0, FromVerticalOffset = 100
            });
            p_objPopup.ChildTransitions = transitions;
            p_objPopup.IsOpen           = true;

            objControl.imgVoltar.Tapped += (s, args) =>
            {
                p_objPopup.IsOpen = false;
            };

            ExecutarTarefasDeAberturaDeEpisodio();
        }
Beispiel #5
0
        /// <summary>
        ///     Invoked when the application is launched normally by the end user.  Other entry points
        ///     will be used when the application is launched to open a specific file, to display
        ///     search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            var rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                //Associate the frame with a SuspensionManager key
                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

                // TODO: change this value to a cache size that is appropriate for your application
                rootFrame.CacheSize = 1;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropriate
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        // Something went wrong restoring state.
                        // Assume there is no state and continue
                    }
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
#if WINDOWS_PHONE_APP
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    this.transitions = new Windows.UI.Xaml.Media.Animation.TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        this.transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated         += this.RootFrame_FirstNavigated;
#endif

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(HubPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
 /// <summary>
 /// Creates a <see cref="TransitionCollection"/> from <see cref="Windows.UI.Xaml.Media.Animation.TransitionCollection"/>.
 /// </summary>
 /// <param name="args">The <see cref="Windows.UI.Xaml.Media.Animation.TransitionCollection"/> instance containing the event data.</param>
 /// <returns><see cref="TransitionCollection"/></returns>
 public static TransitionCollection FromTransitionCollection(Windows.UI.Xaml.Media.Animation.TransitionCollection args)
 {
     return(new TransitionCollection(args));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TransitionCollection"/> class, a
 /// Wpf-enabled wrapper for <see cref="Windows.UI.Xaml.Media.Animation.TransitionCollection"/>
 /// </summary>
 public TransitionCollection(Windows.UI.Xaml.Media.Animation.TransitionCollection instance)
 {
     this.UwpInstance = instance;
 }
Beispiel #8
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            /*if (System.Diagnostics.Debugger.IsAttached)
             * {
             *  this.DebugSettings.EnableFrameRateCounter = true;
             * }*/
            Frame rootFrame = Window.Current.Content as Frame;

#if WINDOWS_UWP
            if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.AcrylicBrush"))
            {
                aBrush = new AcrylicBrush()
                {
                    BackgroundSource = AcrylicBackgroundSource.HostBackdrop,
                    TintOpacity      = 0.6
                };

                if (Application.Current.RequestedTheme == ApplicationTheme.Dark)
                {
                    ((AcrylicBrush)aBrush).TintColor     = (Color)Resources["SystemAccentColorDark2"];
                    ((AcrylicBrush)aBrush).FallbackColor = (Color)Resources["SystemAccentColorDark2"];
                }
                else
                {
                    ((AcrylicBrush)aBrush).TintColor     = (Color)Resources["SystemAccentColor"];
                    ((AcrylicBrush)aBrush).FallbackColor = (Color)Resources["SystemAccentColor"];
                }
            }
            else
            {
                aBrush = Resources["SystemControlBackgroundAccentBrush"] as SolidColorBrush;
            }

            // title bar customization
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) // mobile
#endif
            {
                var statusBar = StatusBar.GetForCurrentView();
                statusBar.ForegroundColor   = Colors.White;
                statusBar.BackgroundOpacity = 0;
            }
#if WINDOWS_UWP
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView")) // PC
            {
                CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
                var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                titleBar.ButtonBackgroundColor         = Colors.Transparent;
                titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
                titleBar.ButtonForegroundColor         = Colors.White;
                titleBar.ButtonInactiveForegroundColor = Colors.Gray;
            }

            if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Xbox")
            {
                ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
            }
            else
            {
                ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseVisible);
            }
#endif

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

#if WINDOWS_UWP
                rootFrame.NavigationFailed += OnNavigationFailed;
#elif WINDOWS_PHONE_APP
                // TODO: change this value to a cache size that is appropriate for your application
                rootFrame.CacheSize = 1;

                // Set the default language
                rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
#endif

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;

                rootFrame.SizeChanged += RootFrame_SizeChanged;
            }

            var lineSerializer = new Utilities.LineSerializer(Windows.ApplicationModel.Resources.ResourceLoader.GetForViewIndependentUse());
#if WINDOWS_UWP
            if (e.PrelaunchActivated == false)
#endif
            {
                if (e.Arguments == "opensearch")
                {
                    rootFrame.Navigate(typeof(Search));
                    rootFrame.BackStack.Clear();
                    rootFrame.BackStack.Add(new PageStackEntry(typeof(MainPage), null, null));
#if WINDOWS_UWP
                    SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
#endif
                }
                else
                {
                    string[] tileData  = e.TileId.Split('-'); // handle secondary tile
                    string[] tileData2 = e.Arguments.Split('|');
                    if (tileData[0] == "MenetrendApp")
                    {
                        Line line = await lineSerializer.openLine(tileData[1], tileData[2], tileData[3], tileData[4], tileData2[0], tileData2[1]);

                        if (!line.Error)
                        {
                            rootFrame.Navigate(typeof(Results), line);
                            rootFrame.BackStack.Clear();
                            rootFrame.BackStack.Add(new PageStackEntry(typeof(MainPage), null, null));
#if WINDOWS_UWP
                            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
#endif
                        }
                        else
                        {
                            rootFrame.Navigate(typeof(MainPage));
                        }
                    }
                    else
                    {
                        string[] lineData = e.Arguments.Split('-'); //uwp jumplist, wp8 notification
                        if (lineData.Length == 4)
                        {
                            Line line = await lineSerializer.openLine(lineData[0], lineData[1], lineData[2], lineData[3]);

                            if (!line.Error)
                            {
                                rootFrame.Navigate(typeof(Results), line);
                                rootFrame.BackStack.Clear();
                                rootFrame.BackStack.Add(new PageStackEntry(typeof(MainPage), null, null));
#if WINDOWS_UWP
                                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
#endif
                            }
                            else
                            {
                                rootFrame.Navigate(typeof(MainPage));
                            }
                        }
                    }
                }

                if (rootFrame.Content == null)
                {
#if WINDOWS_PHONE_APP
                    // Removes the turnstile navigation for startup.
                    if (rootFrame.ContentTransitions != null)
                    {
                        transitions = new Windows.UI.Xaml.Media.Animation.TransitionCollection();
                        foreach (var c in rootFrame.ContentTransitions)
                        {
                            transitions.Add(c);
                        }
                    }

                    rootFrame.ContentTransitions = null;
                    rootFrame.Navigated         += this.RootFrame_FirstNavigated;
#endif
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }

#if WINDOWS_UWP
            SystemNavigationManager snm = SystemNavigationManager.GetForCurrentView();
            snm.BackRequested += (sender, backReqEvArgs) =>
            {
                if (rootFrame.CanGoBack)
                {
                    backReqEvArgs.Handled = true;
                    rootFrame.GoBack();
                }
                snm.AppViewBackButtonVisibility = rootFrame.CanGoBack ?
                                                  AppViewBackButtonVisibility.Visible :
                                                  AppViewBackButtonVisibility.Collapsed;
            };
#endif
        }