Beispiel #1
0
        private static void OnListSelectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            int      a    = (int)e.NewValue;
            MainPage main = d as MainPage;

            main.SpiltViewPaneListBox.SelectedIndex = a;
            if (a == 0)
            {
                FrameNavigationService.Header.Text = "Controls";
            }
            else if (a == 1)
            {
                FrameNavigationService.Header.Text = "Whats New";
            }
            else if (a == 2)
            {
                if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
                {
                    FrameNavigationService.Header.Text = "Essential Studio for UWP - 2022 Volume 4 ";
                }
                else
                {
                    FrameNavigationService.Header.Text = "Essential Studio for UWP";
                }
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            FrameNavigationService.Main.EnableFullScreenButton(true);

            if (e.Parameter != null)
            {
                this.DataContext = e.Parameter;
                FrameNavigationService.SampleDataContext = this.DataContext;
                if (e.Parameter is FeatureSampleCategory)
                {
                    FrameNavigationService.Header.Text = ((e.Parameter as FeatureSampleCategory).Name);
                }
            }
            else
            {
                if (FrameNavigationService.SampleDataContext != null)
                {
                    this.DataContext = FrameNavigationService.SampleDataContext;
                    FrameNavigationService.Header.Text = ((FrameNavigationService.SampleDataContext as FeatureSampleCategory).Name);
                }
            }
            if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
            {
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                FrameNavigationService.Main.AllControlButtonvisibility(true);
            }
            this.DataContext = e.Parameter;
            FrameNavigationService.Main.ListSelection = -1;

            base.OnNavigatedTo(e);
        }
Beispiel #3
0
 public void CheckFullPage(bool isFullScreen)
 {
     if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
     {
         if (isFullScreen)
         {
             this.titlebar.Visibility           = Visibility.Collapsed;
             this.MyFrame.Margin                = new Thickness(0, -42, 0, 0);
             this.MySplitView.CompactPaneLength = 0;
             if (FrameNavigationService.SampleLayout != null && FrameNavigationService.SampleLayout as SampleLayout != null)
             {
                 (FrameNavigationService.SampleLayout as SampleLayout).FontIcons = null;
             }
         }
         else
         {
             if (FrameNavigationService.SampleLayout != null && FrameNavigationService.SampleLayout as SampleLayout != null)
             {
                 (FrameNavigationService.SampleLayout as SampleLayout).FontIcons = temp;
             }
             this.titlebar.Visibility = Visibility.Visible;
             this.MyFrame.Margin      = new Thickness(0, 0, 0, 0);
             if (SampleHelper.DataViewModel.SidePanelVisibility != Visibility.Collapsed)
             {
                 this.MySplitView.CompactPaneLength = 48;
             }
             temp = null;
         }
     }
 }
 protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
 {
     FrameNavigationService.Main.EnableFullScreenButton(false);
     base.OnNavigatingFrom(e);
     if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
     {
         FrameNavigationService.Header.Text             = "Controls";
         FrameNavigationService.SampleHeader.Visibility = Visibility.Collapsed;
         FrameNavigationService.Arrow.Visibility        = Visibility.Collapsed;
     }
     foreach (Products p in SampleHelper.DataViewModel.AllProductsCategories.Values)
     {
         foreach (FeatureSampleCategory category in p.AllProducts.Values)
         {
             foreach (FeatureSampleCollection samples in category.AllSampleCategory.Values)
             {
                 foreach (SampleInfo sample in samples.AllSamples)
                 {
                     if (sample.IsSelected)
                     {
                         sample.IsSelected = false;
                         break;
                     }
                 }
             }
         }
     }
     Dispose();
     if (lastselecteditem is CustomListBox)
     {
         (lastselecteditem as CustomListBox).ItemsSource = null;
         (lastselecteditem as CustomListBox).DataContext = null;
     }
 }
Beispiel #5
0
 private void searchtextbox_KeyDown(object sender, KeyRoutedEventArgs e)
 {
     if (e.Key == Windows.System.VirtualKey.Enter)
     {
         isEnterPressed = true;
         if (this.searchtextbox.Text == string.Empty)
         {
             this.searchtextbox.Focus(FocusState.Keyboard);
         }
         else
         {
             if (DeviceFamily.GetDeviceFamily() == Devices.Desktop && this.layoutheader.Text != "Results for \"" + this.searchtextbox.Text + "\"")
             {
                 this.layoutheader.Text = "Results for \"" + this.searchtextbox.Text + "\"";
                 FrameNavigationService.CurrentFrame.Navigate(typeof(SearchView), this.searchtextbox.Text);
             }
             if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
             {
                 FrameNavigationService.IsInFeatureSample  = false;
                 FrameNavigationService.IsInWhatsNewSample = false;
                 FrameNavigationService.GoToFrame();
                 FrameNavigationService.CurrentFrame.Navigate(typeof(SearchView), this.searchtextbox.Text);
                 this.searchtextbox.Text  = string.Empty;
                 searchtextbox.Visibility = Visibility.Collapsed;
                 search.Visibility        = Visibility.Visible;
                 title.Visibility         = Visibility.Visible;
                 button.Visibility        = Visibility.Visible;
             }
         }
     }
 }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            IsNavigatedFrom = false;
            Main            = e.Parameter as MainPage;
            if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
            {
                Main.ListSelection = 0;
            }
            else
            {
                Main.ListSelection = 0;
                FrameNavigationService.Header.Text = "Controls";
            }

            FrameNavigationService.Main.ListSelection = 0;
            //   MySpiltView = (e.Parameter as MainPage).MainSpiltView;

            // if (FrameNavigationService.CurrentFrame.CanGoBack)
            // {
            //     SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
            //AppViewBackButtonVisibility.Visible;
            // }
            // else
            // {
            //     SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
            //AppViewBackButtonVisibility.Collapsed;
            // }
            base.OnNavigatedTo(e);
            this.scroll.ScrollToVerticalOffset(FrameNavigationService.ControlScrollOffset);
        }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
     {
         FrameHeader = FrameNavigationService.Header.Text.ToString();
         FrameNavigationService.Header.Text = (e.Parameter as SampleInfo).Header;
         ShowcaseContent.Content            = (Activator.CreateInstance(Type.GetType((e.Parameter as SampleInfo).SampleView.ToString()))) as UIElement;
         ShowcaseContent.Margin             = new Thickness(5, 0, 5, 0);
         ShowCaseGrid.Visibility            = Visibility.Visible;
     }
     else
     {
         FrameNavigationService.Main.CheckFullPage(true);
         // if (FrameNavigationService.CurrentFrame.CanGoBack)
         // {
         //     SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
         //AppViewBackButtonVisibility.Visible;
         // }
         // else
         // {
         //     SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
         //AppViewBackButtonVisibility.Collapsed;
         // }
         FrameHeader = FrameNavigationService.Header.Text.ToString();
         FrameNavigationService.Header.Text = (e.Parameter as SampleInfo).Header;
         showcasePage.Content = (Activator.CreateInstance(Type.GetType((e.Parameter as SampleInfo).SampleView.ToString()))) as UIElement;
     }
     base.OnNavigatedTo(e);
 }
Beispiel #8
0
        private void MainPage_BackRequested(object sender, BackRequestedEventArgs e)
        {
            if (FrameNavigationService.CurrentFrame.CanGoBack)
            {
                e.Handled = true;
            }

            if (FrameNavigationService.IsSettingOpen)
            {
                FrameNavigationService.Main.Margin = new Thickness(0, 0, 0, 0);
                if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
                {
                    FrameNavigationService.IsSettingOpen        = false;
                    FrameNavigationService.SelectedSampleLayout = null;
                    if (FrameNavigationService.CurrentFrame != null)
                    {
                        if (FrameNavigationService.IsInWhatsNewSample)
                        {
                            FrameNavigationService.currentFrame.Margin = new Thickness(0, 39, -5, 0);
                            ((FrameNavigationService.SampleLayout) as SampleLayout).SetOptionGridMargin();
                        }
                        else
                        {
                            FrameNavigationService.CurrentFrame.Margin = new Thickness(0, 39, 0, 0);
                        }
                    }
                }
                ((FrameNavigationService.SampleLayout) as SampleLayout).FontIcons = "\uE713";
                FrameNavigationService.Headergrid.Visibility = Visibility.Visible;
                ((FrameNavigationService.SampleLayout) as SampleLayout).Pathstring       = "M16.153984,12.087952C13.92602,12.087952 12.113032,13.844971 12.113032,16.003967 12.113032,18.164001 13.92602,19.921997 16.153984,19.921997 18.382011,19.921997 20.195,18.164001 20.195,16.003967 20.195,13.844971 18.382011,12.087952 16.153984,12.087952z M16.153984,10.087952C19.484978,10.087952 22.194998,12.741943 22.194998,16.003967 22.194998,19.267944 19.484978,21.921997 16.153984,21.921997 12.822992,21.921997 10.113033,19.267944 10.113033,16.003967 10.113033,12.741943 12.822992,10.087952 16.153984,10.087952z M14.195978,1.9999999L14.195978,5.4509887 13.437006,5.638977C11.470027,6.1249999,9.6860313,7.1269531,8.2780113,8.5379638L7.7300382,9.086975 4.6240215,7.2529907 2.7770376,10.232971 5.8810401,12.066956 5.6390357,12.824951C5.3129859,13.852966 5.1470313,14.921997 5.1470313,16.003967 5.1470313,17.093994 5.3190284,18.180969 5.6580176,19.234985L5.9009986,19.991943 2.8120105,21.836975 4.6780376,24.80896 7.7570157,22.964966 8.3080406,23.511963C9.7089806,24.899963,11.48199,25.888,13.437006,26.370972L14.195978,26.55896 14.195978,30 17.804008,30 17.804008,26.613953 18.590019,26.441956C20.624014,25.995972,22.473989,25.004944,23.939993,23.574951L24.48699,23.040955 27.374989,24.743957 29.223988,21.764954 26.364979,20.08197 26.619007,19.315979C26.978992,18.231995 27.160999,17.116943 27.160999,16.003967 27.160999,14.869995 26.97002,13.736999 26.593983,12.636963L26.332996,11.869995 29.191029,10.161987 27.324024,7.1919555 24.433035,8.9179687 23.882986,8.3880004C22.424978,6.9839477,20.595022,6.0099487,18.590996,5.5699462L17.804008,5.3989868 17.804008,1.9999999z M12.195979,0L19.804008,0 19.804008,3.8149413C21.613028,4.3279418,23.282034,5.2199706,24.699026,6.4299926L27.976978,4.4729614 31.971972,10.829956 28.726002,12.770996C29.015003,13.832947 29.160999,14.916992 29.160999,16.003967 29.160999,17.065979 29.022999,18.125 28.749012,19.164978L32.001999,21.078979 28.043995,27.460998 24.767996,25.527954C23.337027,26.765991,21.64501,27.675964,19.804008,28.197998L19.804008,32 12.195979,32 12.195979,28.100952C10.445003,27.555969,8.8350182,26.656982,7.4730191,25.465942L4.0259991,27.528992 0.030029264,21.168945 3.5320418,19.076965C3.2770371,18.066956 3.1470323,17.036987 3.1470323,16.003967 3.1470323,14.983948 3.2709947,13.974976 3.5150135,12.991943L0,10.915955 3.9550152,4.5359496 7.4320035,6.5879516C8.8030357,5.3729858,10.428035,4.4599609,12.195979,3.9089965z";
                ((FrameNavigationService.SampleLayout) as SampleLayout).OptionVisibility = Visibility.Collapsed;
                FrameNavigationService.IsSettingOpen = false;
                return;
            }
            FrameNavigationService.GoBack();

            if (this.searchtextbox.Text != String.Empty)
            {
                this.searchtextbox.Text = string.Empty;
                if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
                {
                    FrameNavigationService.GoToFrame();
                }
            }

            if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
            {
                if (searchtextbox.FocusState == FocusState.Pointer)
                {
                    searchtextbox.Padding = new Thickness(8, 0, 0, 0);
                }
                else if (searchtextbox.FocusState == FocusState.Unfocused)
                {
                    searchtextbox.Padding = new Thickness(8, 8, 0, 0);
                }
            }
            isEnterPressed = false;
            GC.Collect();
        }
Beispiel #9
0
 private void GridView_ItemClick(object sender, ItemClickEventArgs e)
 {
     FrameNavigationService.CurrentFrame.Navigate(typeof(ShowcasePage), e.ClickedItem);
     if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
     {
         (FrameNavigationService.Main as MainPage).backvisibility();
     }
 }
 private void SampleContent_BackRequested(object sender, BackRequestedEventArgs e)
 {
     if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
     {
         FrameNavigationService.GoBack();
     }
     e.Handled = true;
 }
 public WhatsNewContentPage()
 {
     this.InitializeComponent();
     if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
     {
         viewContent.Margin = new Thickness(0, 0, 5, -22);
     }
     // SystemNavigationManager.GetForCurrentView().BackRequested += WhatsNewContentPage_BackRequested;
 }
Beispiel #12
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     FrameNavigationService.Header.Text = "Controls";
     Main = e.Parameter as MainPage;
     if (Main != null && DeviceFamily.GetDeviceFamily() == Devices.Desktop)
     {
         Main.ListSelection = 0;
         FrameNavigationService.Main.AllControlButtonvisibility(false);
     }
 }
Beispiel #13
0
 public object Convert(object value, Type targetType, object parameter, string language)
 {
     if ((value as Dictionary <string, FeatureSampleCollection>).Count == 1)
     {
         return(new Thickness(0, (DeviceFamily.GetDeviceFamily() == Devices.Desktop)?-48:-40, 0, 0));
     }
     else
     {
         return(new Thickness(0));
     }
 }
Beispiel #14
0
 private void samplelist_Loaded(object sender, RoutedEventArgs e)
 {
     if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
     {
         if (!customlistboxload)
         {
             (sender as CustomListBox).SelectedIndex = 0;
         }
         customlistboxload = true;
     }
 }
Beispiel #15
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            MainPage Main = e.Parameter as MainPage;

            Main.ListSelection = 1;
            FrameNavigationService.Header.Text = "Whats New";
            if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
            {
                FrameNavigationService.Main.AllControlButtonvisibility(true);
            }
            base.OnNavigatedTo(e);
        }
Beispiel #16
0
 public SearchView()
 {
     this.InitializeComponent();
     // SystemNavigationManager.GetForCurrentView().BackRequested += SearchViewPage_BackRequested;
     if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
     {
         FrameNavigationService.FullScreenButton.Click += FullScreenButton_Click;
     }
     if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
     {
         FrameNavigationService.Main.ListSelection = 2;
         FrameNavigationService.Header.Text        = "Controls";
     }
 }
Beispiel #17
0
 public void EnableFullScreenButton(bool isEnabled)
 {
     if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
     {
         if (isEnabled)
         {
             this.fullscreenbutton.Visibility = Visibility.Visible;
             this.searchcontent.Margin        = new Thickness(0, 0, 46, 0);
         }
         else
         {
             CheckFullPage(false);
             this.fullscreenbutton.Visibility = Visibility.Collapsed;
             this.searchcontent.Margin        = new Thickness(0);
         }
     }
 }
Beispiel #18
0
        public MainPage()
        {
            this.InitializeComponent();
            SampleHelper.DataViewModel          = new ViewModel();
            FrameNavigationService.CurrentFrame = this.MyFrame;
            FrameNavigationService.BackButton   = this.backbutton;
            FrameNavigationService.Main         = this;
            FrameNavigationService.Listbox      = this.SpiltViewPaneListBox;
            if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
            {
                FrameNavigationService.Header       = this.layoutheader;
                FrameNavigationService.Arrow        = this.arrow;
                FrameNavigationService.SampleHeader = this.sampleheader;
            }
            else
            {
                FrameNavigationService.Header     = this.title;
                FrameNavigationService.Headergrid = this.grid;
                FrameNavigationService.SplitView  = this.MySplitView;
            }
            SystemNavigationManager.GetForCurrentView().BackRequested += MainPage_BackRequested;

            FrameNavigationService.FullScreenButton = this.fullscreenbutton;
            if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
            {
                ApplicationView.GetForCurrentView().TitleBar.ButtonBackgroundColor = Colors.White;
                //ApplicationView.GetForCurrentView().TitleBar.ButtonHoverBackgroundColor = Colors.FromArgb(255, 58, 159, 221);
                //ApplicationView.GetForCurrentView().TitleBar.ButtonHoverForegroundColor = Colors.White;
                ApplicationView.GetForCurrentView().TitleBar.ButtonForegroundColor = Colors.Black;
                ApplicationView.GetForCurrentView().TitleBar.BackgroundColor = Colors.White;
                ApplicationView.GetForCurrentView().TitleBar.ForegroundColor = Colors.Black;
                ApplicationView.GetForCurrentView().TitleBar.ForegroundColor = Colors.Black;
            }
            else
            {
                ApplicationView view = ApplicationView.GetForCurrentView();
                view.TryEnterFullScreenMode();
            }
            this.DataContext = SampleHelper.DataViewModel;

            if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
            {
                DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait;
            }
        }
Beispiel #19
0
 private void OnDataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
 {
     if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
     {
         if (categoryselector.Items.Count > 0)
         {
             categoryselector.SelectedIndex = 0;
         }
         if (categoryselector.Items.Count <= 1)
         {
             headergrid.Visibility = Visibility.Collapsed;
         }
         else
         {
             headergrid.Visibility = Visibility.Visible;
         }
     }
 }
Beispiel #20
0
 private void SearchTextBox_LostFocus(object sender, RoutedEventArgs e)
 {
     if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
     {
         searchtextbox.Text       = string.Empty;
         searchtextbox.Visibility = Visibility.Collapsed;
         search.Visibility        = Visibility.Visible;
         title.Visibility         = Visibility.Visible;
         button.Visibility        = Visibility.Visible;
     }
     else
     {
         if (string.IsNullOrEmpty(searchtextbox.Text))
         {
             searchtextbox.Padding = new Thickness(8, 8, 0, 0);
         }
     }
 }
        private void SampleContent_Loaded(object sender, RoutedEventArgs e)
        {
            if (FrameNavigationService.IsDirectNavigation && DeviceFamily.GetDeviceFamily() == Devices.Mobile)
            {
                FrameNavigationService.IsDirectNavigation = false;
                FrameNavigationService.GoBack();
                return;
            }

            if (CategoryAccordion.Margin.Top != 0)
            {
                foreach (AccordionButton button in VisualTreeHelperExtension.FindVisualChildrenOfType <AccordionButton>(CategoryAccordion))
                {
                    if (button.Name == "ExpanderButton")
                    {
                        button.Height            = 0.0;
                        CategoryAccordion.Margin = new Thickness(0.0);
                        break;
                    }
                }
                if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
                {
                    var allSample = new List <SampleInfo>();
                    FrameNavigationService.SampleDataContext = this.DataContext;
                    foreach (var item in (this.DataContext as FeatureSampleCategory).AllSampleCategory)
                    {
                        var samples = item.Value;
                        foreach (var sam in (samples as FeatureSampleCollection).AllSamples)
                        {
                            allSample.Add(sam);
                        }
                    }

                    if (allSample.Count > 1)
                    {
                        return;
                    }
                    FrameNavigationService.SelectedIndex = 0;


                    FrameNavigationService.CurrentFrame.Navigate(typeof(MobileSamplePage), allSample);
                }
            }
        }
Beispiel #22
0
        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count > 0)
            {
                if (lastselecteditem != null && sender != lastselecteditem)
                {
                    if (lastselecteditem is CustomListBox)
                    {
                        (lastselecteditem as CustomListBox).SelectedIndex = -1;
                    }
                }

                else if (lastselecteditem == null && DeviceFamily.GetDeviceFamily() == Devices.Desktop)
                {
                    (sender as ListBox).SelectedIndex = 0;
                }
                lastselecteditem = sender;

                if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
                {
                    this.viewContent.Children.Clear();
                    if ((sender as ListBox).SelectedItem != null)
                    {
                        Type type = Type.GetType(((sender as ListBox).SelectedItem as SampleInfo).SampleView.ToString());
                        if (type != null)
                        {
                            this.viewContent.Children.Add(Activator.CreateInstance(type) as FrameworkElement);
                        }
                    }
                }
                if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
                {
                    FrameNavigationService.SampleDataContext = this.DataContext;
                    if (e.AddedItems.Count > 0)
                    {
                        FrameNavigationService.CurrentFrame.Navigate(typeof(MobileSearchResultView), e.AddedItems[0]);
                    }
                }
            }
        }
Beispiel #23
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            MainPage Main = e.Parameter as MainPage;

            if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
            {
                Main.ListSelection = 2;
            }
            else
            {
                Main.ListSelection = 2;
                // FrameNavigationService.Header.Text = "Showcase";
            }
            //     SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
            //AppViewBackButtonVisibility.Collapsed;

            if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
            {
                FrameNavigationService.Main.AllControlButtonvisibility(true);
            }

            base.OnNavigatedTo(e);
        }
 public SampleContent()
 {
     this.InitializeComponent();
     if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
     {
         FrameNavigationService.FullScreenButton.Click += FullScreenButton_Click;
     }
     // SystemNavigationManager.GetForCurrentView().BackRequested += SampleContent_BackRequested;
     this.Loaded   += SampleContent_Loaded;
     this.Unloaded += (sender, e) =>
     {
         this.Loaded -= SampleContent_Loaded;
         DataContext  = null;
         try
         {
             Dispose();
         }
         catch
         {
             GC.Collect();
         }
     };
 }
 private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count > 0)
     {
         SelectedItem = e.AddedItems[0] as FeatureSampleCategory;
         foreach (Products p in SampleHelper.DataViewModel.AllProductsCategories.Values)
         {
             foreach (FeatureSampleCategory category in p.AllProducts.Values)
             {
                 if (category.IsSelected && category != e.AddedItems[0] as FeatureSampleCategory)
                 {
                     category.IsSelected = false;
                     break;
                 }
             }
         }
     }
     if (e.RemovedItems.Count > 0 && (!IsNavigatedFrom))
     {
         if (SelectedItem != null)
         {
             SelectedItem.IsSelected = true;
         }
     }
     if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
     {
         if (SelectedItem != null)
         {
             this.SampleContent.DataContext = SelectedItem;
         }
     }
     else
     {
         FrameNavigationService.Header.Text = (e.AddedItems[0] as FeatureSampleCategory).Name;
         FrameNavigationService.CurrentFrame.Navigate(typeof(SampleContent), e.AddedItems[0]);
     }
 }
Beispiel #26
0
        private void SpiltViewPaneListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ClearSearchText();
            var listBox = sender as ListBox;

            //FrameNavigationService.IsDirectNavigation = false;
            if (ListSelection != SpiltViewPaneListBox.SelectedIndex)
            {
                if (FrameNavigationService.CurrentFrame == null && DeviceFamily.GetDeviceFamily() == Devices.Mobile)
                {
                    if (listBox.SelectedIndex == 0)
                    {
                        FrameNavigationService.IsInFeatureSample = true;
                    }
                }
                if (FrameNavigationService.CurrentFrame == null)
                {
                    return;
                }

                if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
                {
                    MySplitView.Content = FrameNavigationService.CurrentFrame;
                    MainSpiltView       = MySplitView;

                    if (listBox.SelectedIndex == 0)
                    {
                        this.layoutheader.Text = "Controls";
                        //FrameNavigationService.GoToFrame();
                        this.allcontrolbutton.Visibility = Visibility.Collapsed;
                        FrameNavigationService.CurrentFrame.Navigate(typeof(SamplePage), this);
                        if (MySplitView.IsPaneOpen)
                        {
                            MySplitView.IsPaneOpen = false;
                        }

                        // this.backbutton.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    }
                    else if (listBox.SelectedIndex == 1)
                    {
                        this.allcontrolbutton.Visibility = Visibility.Visible;
                        this.layoutheader.Text           = "Whats New";
                        //FrameNavigationService.GoToFrame();
                        FrameNavigationService.CurrentFrame.Navigate(typeof(WhatsNewPage), this);
                        if (MySplitView.IsPaneOpen)
                        {
                            MySplitView.IsPaneOpen = false;
                        }
                        SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                        //this.backbutton.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    }


                    else if (listBox.SelectedIndex == 2)
                    {
                        this.layoutheader.Text           = "Essential Studio UWP - 2022 Volume 4 ";
                        this.allcontrolbutton.Visibility = Visibility.Visible;
                        //FrameNavigationService.GoToFrame();
                        FrameNavigationService.CurrentFrame.Navigate(typeof(ShowcaseHome), this);
                        SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                        if (MySplitView.IsPaneOpen)
                        {
                            MySplitView.IsPaneOpen = false;
                        }
                    }
                }
                else
                {
                    if (listBox.SelectedIndex == 0)
                    {
                        FrameNavigationService.Header.Text        = "CONTROLS";
                        FrameNavigationService.IsInFeatureSample  = true;
                        FrameNavigationService.IsInWhatsNewSample = false;

                        FrameNavigationService.CurrentFrame.Navigate(typeof(ControlsHome), this);
                        if (MySplitView.IsPaneOpen)
                        {
                            MySplitView.IsPaneOpen = false;
                        }
                    }

                    else if (listBox.SelectedIndex == 1)
                    {
                        FrameNavigationService.IsInFeatureSample  = false;
                        FrameNavigationService.Header.Text        = "WHATS NEW";
                        FrameNavigationService.IsInWhatsNewSample = true;

                        FrameNavigationService.CurrentFrame.Navigate(typeof(WhatsNewPage), this);
                        if (MySplitView.IsPaneOpen)
                        {
                            MySplitView.IsPaneOpen = false;
                        }
                    }
                    else if (listBox.SelectedIndex == 2)
                    {
                        FrameNavigationService.IsInFeatureSample = false;
                        FrameNavigationService.CurrentFrame.Navigate(typeof(ShowcaseHome), this);
                        FrameNavigationService.IsInWhatsNewSample = false;
                        if (MySplitView.IsPaneOpen)
                        {
                            MySplitView.IsPaneOpen = false;
                        }
                    }
                    if (!MySplitView.IsPaneOpen)
                    {
                        //SpiltViewPaneListBox.SelectedIndex = -1;
                        //ListSelection = -1;
                    }
                }
            }
        }
        private async void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (sender != lastselecteditem)
            {
                if (lastselecteditem is CustomListBox)
                {
                    (lastselecteditem as CustomListBox).SelectedIndex = -1;
                }
            }
            lastselecteditem = sender;

            for (int i = 0; i < contentgrid.Children.Count; i++)
            {
                object content = contentgrid.Children[i];
                //if (content is IDisposable)
                //    (content as IDisposable).Dispose();
                content = null;
            }
            contentgrid.Children.Clear();
            GC.Collect();
            if ((sender as ListBox).SelectedItem != null)
            {
                if (DeviceFamily.GetDeviceFamily() != Devices.Mobile && busyIndicator != null)
                {
                    busyIndicator.IsBusy = true;
                }
                await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, (() =>
                {
                    Type type = Type.GetType(((sender as ListBox).SelectedItem as SampleInfo).SampleView.ToString());
                    if (type != null && DeviceFamily.GetDeviceFamily() == Devices.Desktop)
                    {
                        contentgrid.Children.Add(Activator.CreateInstance(type) as FrameworkElement);
                    }
                    if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
                    {
                        FrameNavigationService.SampleHeader.Text = ((sender as ListBox).SelectedItem as SampleInfo).Header;
                        FrameNavigationService.SampleHeader.Visibility = Visibility.Visible;
                        FrameNavigationService.Arrow.Visibility = Visibility.Visible;
                    }
                }));

                if (DeviceFamily.GetDeviceFamily() != Devices.Mobile && busyIndicator != null)
                {
                    busyIndicator.IsBusy = false;
                }
            }


            var allSample     = new List <SampleInfo>();
            var selectedindex = 0;

            if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
            {
                FrameNavigationService.SampleDataContext = this.DataContext;
                if (e.AddedItems.Count > 0)
                {
                    foreach (var item in (this.DataContext as FeatureSampleCategory).AllSampleCategory)
                    {
                        var samples = item.Value;

                        foreach (var sam in (samples as FeatureSampleCollection).AllSamples)
                        {
                            allSample.Add(sam);
                            if (sam.Header == ((sender as ListBox).SelectedItem as SampleInfo).Header && sam.SampleCategory == ((sender as ListBox).SelectedItem as SampleInfo).SampleCategory)
                            {
                                selectedindex = allSample.Count - 1;
                            }
                        }
                    }
                }
                FrameNavigationService.SelectedIndex = selectedindex;

                FrameNavigationService.CurrentFrame.Navigate(typeof(MobileSamplePage), allSample);
            }
        }
Beispiel #28
0
        public SampleLayout()
        {
            this.Name = "Root";
            this.InitializeComponent();
            _canExecute = true;
            FrameNavigationService.SampleLayout = this;
            this.Unloaded += SampleLayout_Unloaded;
            if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
            {
                if (!FrameNavigationService.IsInFeatureSample)
                {
                    if (!FrameNavigationService.IsInWhatsNewSample)
                    {
                        foreach (ContentControl content in FindVisualChildren <ContentControl>(this))
                        {
                            if (content.Tag != null && content.Tag.ToString() == "Sample")
                            {
                                content.Margin = new Thickness(10, 0, 10, 0);
                                break;
                            }
                        }
                        foreach (Grid grid in FindVisualChildren <Grid>(this))
                        {
                            if (grid.Tag != null && grid.Tag.ToString() == "OptionGrid")
                            {
                                grid.Margin = new Thickness(0, 0, 5, 0);
                                break;
                            }
                        }
                        if (FrameNavigationService.CurrentFrame != null)
                        {
                            FrameNavigationService.CurrentFrame.Margin = new Thickness(0, 39, 0, 0);
                        }
                    }
                    else
                    {
                        if (FrameNavigationService.CurrentFrame != null)
                        {
                            FrameNavigationService.CurrentFrame.Margin = new Thickness(0, 39, -5, 0);
                        }

                        SetOptionGridMargin();
                    }
                }
                else
                {
                    if (FrameNavigationService.CurrentFrame != null)
                    {
                        FrameNavigationService.CurrentFrame.Margin = new Thickness(0, 39, 0, 0);
                    }

                    foreach (ContentControl content in FindVisualChildren <ContentControl>(this))
                    {
                        if (content.Tag != null && content.Tag.ToString() == "Sample")
                        {
                            content.Margin = new Thickness(0);
                            break;
                        }
                    }

                    foreach (Grid grid in FindVisualChildren <Grid>(this))
                    {
                        if (grid.Tag != null && grid.Tag.ToString() == "OptionGrid")
                        {
                            grid.Margin = new Thickness(0, 0, -2, 20);
                            break;
                        }
                    }
                }
            }
        }
Beispiel #29
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            FrameNavigationService.Main.EnableFullScreenButton(true);
            FrameNavigationService.Main.ListSelection = -1;
            Results = new Dictionary <string, ResultByProduct>();

            searchResult = e.Parameter.ToString().ToLower();

            if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
            {
                FrameNavigationService.Header.Text = "Search Result";
            }
            foreach (var item in SampleHelper.DataViewModel.FeaturedSamples)
            {
                if (item.SearchKeys == null)
                {
                    continue;
                }

                foreach (var key in item.SearchKeys)
                {
                    if (key.ToLower().Contains(searchResult) || searchResult.Contains(key.ToLower()))
                    {
                        if (Results.ContainsKey(item.Product))
                        {
                            var currentProduct = Results[item.Product];
                            if (!currentProduct.SearchResults.Contains(item))
                            {
                                currentProduct.SearchResults.Add(item);
                            }
                        }
                        else
                        {
                            ResultByProduct newProduct = new ResultByProduct();
                            newProduct.Name          = item.Product;
                            newProduct.SearchResults = new List <SampleInfo>();
                            newProduct.SearchResults.Add(item);
                            Results.Add(item.Product, newProduct);
                        }
                    }
                }
            }
            this.CategoryAccordion.ItemsSource = Results;
            if (DeviceFamily.GetDeviceFamily() == Devices.Desktop)
            {
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                //  FrameNavigationService.BackButton.Visibility = Visibility.Visible;
            }

            // if (FrameNavigationService.CurrentFrame.CanGoBack)
            // {
            //     SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
            //AppViewBackButtonVisibility.Visible;
            // }
            // else
            // {
            //     SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
            //AppViewBackButtonVisibility.Collapsed;
            // }
            base.OnNavigatedTo(e);
        }
Beispiel #30
0
        public void MyAction()
        {
            if (OptionVisibility == Visibility.Collapsed)
            {
                if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
                {
                    if (FrameNavigationService.IsInFeatureSample)
                    {
                        FrameNavigationService.Main.Margin = new Thickness(0, -16, 0, 0);

                        foreach (TextBlock txtblock in FindVisualChildren <TextBlock>(this))
                        {
                            if (txtblock.Text == "Options")
                            {
                                txtblock.Margin = new Thickness(5);
                                break;
                            }
                        }
                        if (FrameNavigationService.CurrentFrame != null)
                        {
                            FrameNavigationService.CurrentFrame.Margin = new Thickness(0, 10, 0, 0);
                        }
                    }
                    else
                    {
                        if (FrameNavigationService.CurrentFrame != null)
                        {
                            if (FrameNavigationService.IsInWhatsNewSample)
                            {
                                FrameNavigationService.CurrentFrame.Margin = new Thickness(0, 25, -5, 0);
                            }
                            else
                            {
                                FrameNavigationService.CurrentFrame.Margin = new Thickness(0, 25, 0, 0);
                            }
                            SetOptionGridMargin();
                        }

                        foreach (TextBlock txtblock in FindVisualChildren <TextBlock>(this))
                        {
                            if (txtblock.Text == "Options")
                            {
                                txtblock.Margin = new Thickness(15, 25, 5, 5);
                                break;
                            }
                        }
                        foreach (ContentControl control in FindVisualChildren <ContentControl>(this))
                        {
                            if (control.Tag != null && control.Tag.ToString() == "Setting")
                            {
                                control.Margin = new Thickness(10, 65, 0, 5);
                            }
                        }
                    }
                    FrameNavigationService.SelectedSampleLayout  = this;
                    FrameNavigationService.Headergrid.Visibility = Visibility.Collapsed;
                    FrameNavigationService.IsSettingOpen         = true;
                }
                this.OptionVisibility = Visibility.Visible;
                this.Pathstring       = "M22.014996,10.204013L23.449993,11.597013 13.512005,21.845022 8.4560118,17.863018 9.6940098,16.292017 13.332006,19.157019z M15.937988,2C8.2529907,2,2,8.2520142,2,15.937988L2,16.062988C2,23.747986,8.2529907,30,15.937988,30L16.062988,30C23.747986,30,30.000977,23.747986,30.000977,16.062988L30.000977,15.937988C30.000977,8.2520142,23.747986,2,16.062988,2z M15.937988,0L16.062988,0C24.851013,0,32,7.1489868,32,15.937988L32,16.062988C32,24.851013,24.851013,32,16.062988,32L15.937988,32C7.1499634,32,0,24.851013,0,16.062988L0,15.937988C0,7.1489868,7.1499634,0,15.937988,0z";
                this.FontIcons        = "\uE0AB";
            }
            else
            {
                if (DeviceFamily.GetDeviceFamily() == Devices.Mobile)
                {
                    FrameNavigationService.Main.Margin           = new Thickness(0, 0, 0, 0);
                    FrameNavigationService.Headergrid.Visibility = Visibility.Visible;
                    FrameNavigationService.IsSettingOpen         = false;
                    FrameNavigationService.SelectedSampleLayout  = null;
                    if (FrameNavigationService.CurrentFrame != null)
                    {
                        if (FrameNavigationService.IsInWhatsNewSample)
                        {
                            FrameNavigationService.currentFrame.Margin = new Thickness(0, 39, -5, 0);
                            SetOptionGridMargin();
                        }
                        else
                        {
                            FrameNavigationService.CurrentFrame.Margin = new Thickness(0, 39, 0, 0);
                        }
                    }
                }
                this.OptionVisibility = Visibility.Collapsed;
                this.Pathstring       = "M16.153984,12.087952C13.92602,12.087952 12.113032,13.844971 12.113032,16.003967 12.113032,18.164001 13.92602,19.921997 16.153984,19.921997 18.382011,19.921997 20.195,18.164001 20.195,16.003967 20.195,13.844971 18.382011,12.087952 16.153984,12.087952z M16.153984,10.087952C19.484978,10.087952 22.194998,12.741943 22.194998,16.003967 22.194998,19.267944 19.484978,21.921997 16.153984,21.921997 12.822992,21.921997 10.113033,19.267944 10.113033,16.003967 10.113033,12.741943 12.822992,10.087952 16.153984,10.087952z M14.195978,1.9999999L14.195978,5.4509887 13.437006,5.638977C11.470027,6.1249999,9.6860313,7.1269531,8.2780113,8.5379638L7.7300382,9.086975 4.6240215,7.2529907 2.7770376,10.232971 5.8810401,12.066956 5.6390357,12.824951C5.3129859,13.852966 5.1470313,14.921997 5.1470313,16.003967 5.1470313,17.093994 5.3190284,18.180969 5.6580176,19.234985L5.9009986,19.991943 2.8120105,21.836975 4.6780376,24.80896 7.7570157,22.964966 8.3080406,23.511963C9.7089806,24.899963,11.48199,25.888,13.437006,26.370972L14.195978,26.55896 14.195978,30 17.804008,30 17.804008,26.613953 18.590019,26.441956C20.624014,25.995972,22.473989,25.004944,23.939993,23.574951L24.48699,23.040955 27.374989,24.743957 29.223988,21.764954 26.364979,20.08197 26.619007,19.315979C26.978992,18.231995 27.160999,17.116943 27.160999,16.003967 27.160999,14.869995 26.97002,13.736999 26.593983,12.636963L26.332996,11.869995 29.191029,10.161987 27.324024,7.1919555 24.433035,8.9179687 23.882986,8.3880004C22.424978,6.9839477,20.595022,6.0099487,18.590996,5.5699462L17.804008,5.3989868 17.804008,1.9999999z M12.195979,0L19.804008,0 19.804008,3.8149413C21.613028,4.3279418,23.282034,5.2199706,24.699026,6.4299926L27.976978,4.4729614 31.971972,10.829956 28.726002,12.770996C29.015003,13.832947 29.160999,14.916992 29.160999,16.003967 29.160999,17.065979 29.022999,18.125 28.749012,19.164978L32.001999,21.078979 28.043995,27.460998 24.767996,25.527954C23.337027,26.765991,21.64501,27.675964,19.804008,28.197998L19.804008,32 12.195979,32 12.195979,28.100952C10.445003,27.555969,8.8350182,26.656982,7.4730191,25.465942L4.0259991,27.528992 0.030029264,21.168945 3.5320418,19.076965C3.2770371,18.066956 3.1470323,17.036987 3.1470323,16.003967 3.1470323,14.983948 3.2709947,13.974976 3.5150135,12.991943L0,10.915955 3.9550152,4.5359496 7.4320035,6.5879516C8.8030357,5.3729858,10.428035,4.4599609,12.195979,3.9089965z";
                this.FontIcons        = "\uE713";
            }
        }