protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            var item = await ControlInfoDataSource.Instance.GetItemAsync((string)e.Parameter);

            if (item != null)
            {
                Item = item;

                // Load control page into frame.
                var loader = ResourceLoader.GetForCurrentView();

                string pageRoot = loader.GetString("PageStringRoot");

                string pageString = pageRoot + item.UniqueId + "Page";
                Type   pageType   = Type.GetType(pageString);

                if (pageType != null)
                {
                    // Pagetype is not null!
                    // So lets generate the github links and set them!
                    var gitHubBaseURI = "https://github.com/microsoft/Xaml-Controls-Gallery/tree/master/XamlControlsGallery/ControlPages/";
                    var pageName      = pageType.Name + ".xaml";
                    PageCodeGitHubLink.NavigateUri   = new Uri(gitHubBaseURI + pageName + ".cs");
                    PageMarkupGitHubLink.NavigateUri = new Uri(gitHubBaseURI + pageName);

                    this.contentFrame.Navigate(pageType);
                }

                NavigationRootPage.Current.NavigationView.Header = item?.Title;
            }

            base.OnNavigatedTo(e);
        }
Exemplo n.º 2
0
        void AboutFlyout_Loaded(object sender, RoutedEventArgs e)
        {
            ContentWebView.Height = this.ActualHeight - 180;

            var loader = new Windows.ApplicationModel.Resources.ResourceLoader();

            string HTMLOpenTags  = loader.GetString("HTMLOpenTags");
            string HTMLCloseTags = loader.GetString("HTMLCloseTags");

            string contentString = string.Empty;

            if (this.DataContext != null)
            {
                ControlInfoDataItem item = this.DataContext as ControlInfoDataItem;
                if (item != null)
                {
                    contentString   = item.Content.ToString();
                    this.IconSource = new BitmapImage(new Uri(item.ImagePath));
                }
            }
            else
            {
                contentString = loader.GetString("helpFlyoutContent");
            }

            ContentWebView.NavigateToString(HTMLOpenTags + contentString + HTMLCloseTags);
        }
Exemplo n.º 3
0
 private void SelectControl(ControlInfoDataItem control)
 {
     if (control != null)
     {
         region.RequestNavigate("ContentRegion", control.PageType.Name);
     }
 }
Exemplo n.º 4
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            //Connected Animation

            PopOutStoryboard.Begin();
            PopOutStoryboard.Completed += (sender1_, e1_) =>
            {
                PopInStoryboard.Begin();
            };

            if (NavigationRootPage.Current.PageHeader != null)
            {
                var connectedAnimation = ConnectedAnimationService.GetForCurrentView().GetAnimation("controlAnimation");

                if (connectedAnimation != null)
                {
                    var target = NavigationRootPage.Current.PageHeader.TitlePanel;
                    connectedAnimation.TryStart(target, new UIElement[] { subTitleText });
                }
            }

            var item = await ControlInfoDataSource.Instance.GetItemAsync((String)e.Parameter);

            if (item != null)
            {
                Item = item;

                // Load control page into frame.
                var loader = ResourceLoader.GetForCurrentView();

                string pageRoot = loader.GetString("PageStringRoot");

                string pageString = pageRoot + item.UniqueId + "Page";
                Type   pageType   = Type.GetType(pageString);

                if (pageType != null)
                {
                    this.contentFrame.Navigate(pageType);
                }

                NavigationRootPage.Current.NavigationView.Header = item?.Title;
                if (item.IsNew && NavigationRootPage.Current.CheckNewControlSelected())
                {
                    return;
                }

                ControlInfoDataGroup group = await ControlInfoDataSource.Instance.GetGroupFromItemAsync((String)e.Parameter);

                var menuItem = NavigationRootPage.Current.NavigationView.MenuItems.Cast <NavigationViewItem>().FirstOrDefault(m => m.Tag?.ToString() == group.UniqueId);
                if (menuItem != null)
                {
                    menuItem.IsSelected = true;
                }
            }

            base.OnNavigatedTo(e);
        }
Exemplo n.º 5
0
        /// <summary>
        /// This
        /// </summary>
        /// <param name="contact"></param>
        private void SelectControl(ControlInfoDataItem control)
        {
            if (control != null)
            {
                ControlDetails.Visibility = Visibility.Visible;

                ControlTitle.Text   = control.Title;
                ControlLink.Content = "Go to " + control.Title;
                ControlLink.Tag     = control.PageType;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// This
        /// </summary>
        /// <param name="contact"></param>
        private void SelectControl(ControlInfoDataItem control)
        {
            if (control != null)
            {
                ControlDetails.Visibility = Visibility.Visible;

                BitmapImage image = new BitmapImage(new Uri(control.ImagePath));
                ControlImage.Source = image;

                ControlTitle.Text    = control.Title;
                ControlSubtitle.Text = control.Subtitle;
            }
        }
Exemplo n.º 7
0
 protected override void OnKeyDown(KeyRoutedEventArgs e)
 {
     if (e.Key == Windows.System.VirtualKey.Escape)
     {
         this.Item = null;
         if (this.contentFrame.CanGoBack)
         {
             this.contentFrame.GoBack();
         }
         else
         {
             this.Frame.Navigate(typeof(AllControlsPage));
         }
     }
 }
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            var item = await ControlInfoDataSource.Instance.GetItemAsync((string)e.Parameter);

            if (item != null)
            {
                Item = item;

                // Load control page into frame.
                var loader = ResourceLoader.GetForCurrentView();

                string pageRoot = loader.GetString("PageStringRoot");

                string pageString = pageRoot + item.UniqueId + "Page";
                Type   pageType   = Type.GetType(pageString);

                if (pageType != null)
                {
                    // Pagetype is not null!
                    // So lets generate the github links and set them!
                    var gitHubBaseURI = "https://github.com/microsoft/Xaml-Controls-Gallery/tree/master/XamlControlsGallery/ControlPages/";
                    var pageName      = pageType.Name + ".xaml";
                    PageCodeGitHubLink.NavigateUri   = new Uri(gitHubBaseURI + pageName + ".cs");
                    PageMarkupGitHubLink.NavigateUri = new Uri(gitHubBaseURI + pageName);

                    this.contentFrame.Navigate(pageType);
                }

                NavigationRootPage.Current.NavigationView.Header = item?.Title;
                if (item.IsNew && NavigationRootPage.Current.CheckNewControlSelected())
                {
                    PlayConnectedAnimation();
                    return;
                }

                ControlInfoDataGroup group = await ControlInfoDataSource.Instance.GetGroupFromItemAsync((string)e.Parameter);

                var menuItem = NavigationRootPage.Current.NavigationView.MenuItems.Cast <Microsoft.UI.Xaml.Controls.NavigationViewItemBase>().FirstOrDefault(m => m.Tag?.ToString() == group.UniqueId);
                if (menuItem != null)
                {
                    menuItem.IsSelected = true;
                }

                PlayConnectedAnimation();
            }

            base.OnNavigatedTo(e);
        }
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            var item = await ControlInfoDataSource.Instance.GetItemAsync((String)e.Parameter);

            if (item != null)
            {
                Item = item;

                // Load control page into frame.
                var loader = ResourceLoader.GetForCurrentView();

                string pageRoot = loader.GetString("PageStringRoot");

                string pageString = pageRoot + item.UniqueId + "Page";
                Type   pageType   = Type.GetType(pageString);

                if (pageType != null)
                {
                    this.contentFrame.Navigate(pageType);
                }

                NavigationRootPage.Current.NavigationView.Header = item?.Title;
                if (item.IsNew && NavigationRootPage.Current.CheckNewControlSelected())
                {
                    PlayConnectedAnimation();
                    return;
                }

                ControlInfoDataGroup group = await ControlInfoDataSource.Instance.GetGroupFromItemAsync((String)e.Parameter);

                var menuItem = NavigationRootPage.Current.NavigationView.MenuItems.Cast <Microsoft.UI.Xaml.Controls.NavigationViewItemBase>().FirstOrDefault(m => m.Tag?.ToString() == group.UniqueId);
                if (menuItem != null)
                {
                    menuItem.IsSelected = true;
                }

                PlayConnectedAnimation();
            }

            base.OnNavigatedTo(e);
        }
        protected virtual List <PageInfo> ConvertDataContextToList(object context)
        {
            List <PageInfo> infoList = new List <PageInfo>();

            if (context.GetType() == typeof(ObservableCollection <ControlInfoDataGroup>))
            {
                var data = context as ObservableCollection <ControlInfoDataGroup>;
                for (int i = 0; i < data.Count; i++)
                {
                    ControlInfoDataGroup group = data.ElementAt(i);

                    infoList.Add(new PageInfo(group.Title, typeof(SectionPage), group.UniqueId, group.Items));
                }
            }
            else if (context.GetType() == typeof(ControlInfoDataGroup))
            {
                var data = context as ControlInfoDataGroup;
                for (int i = 0; i < data.Items.Count; i++)
                {
                    ControlInfoDataItem item = data.Items[i];

                    infoList.Add(new PageInfo(item.Title, typeof(ItemPage), item.UniqueId));
                }
            }
            else if (context.GetType() == typeof(ObservableCollection <ControlInfoDataItem>))
            {
                var data = context as ObservableCollection <ControlInfoDataItem>;
                for (int i = 0; i < data.Count; i++)
                {
                    ControlInfoDataItem item = data.ElementAt(i);

                    infoList.Add(new PageInfo(item.Title, typeof(ItemPage), item.UniqueId));
                }
            }

            return(infoList);
        }