Exemplo n.º 1
0
        public void NavigateTo(IViewModelBase viewmodel)
        {
            var view = GetView(viewmodel);

            if (view != null)
            {
                NavigationFrame?.Navigate(view);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Navigates to a Sample
 /// </summary>
 /// <param name="sample">Sample to navigate to</param>
 public void NavigateToSample(Sample sample)
 {
     if (sample == null)
     {
         NavigationFrame.Navigate(typeof(About), null, new SuppressNavigationTransitionInfo());
     }
     else
     {
         NavigationFrame.Navigate(typeof(SampleController), sample);
         TrackingManager.TrackEvent("sample", "navigation", sample.Name);
     }
 }
Exemplo n.º 3
0
        public MainWindow()
        {
            InitializeComponent();
            MinHeight = 500;
            MinWidth  = 580;
            NavigationFrame.Navigate(new Presets());

            notificationDisplay.MouseClickSubscriber(notifyIcon_Click);
            StateChanged += WindowStateChanged;
            Closing      += WindowClosing;
            Closed       += notifyIcon_OnClosing;
        }
 public void Navigate(Uri targetUri, Uri currentUri)
 {
     try
     {
         NavigationFrame.Navigate(targetUri);
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine("** " + e.ToString());
         System.Diagnostics.Debug.WriteLine("** '" + targetUri.OriginalString + "'");
         ShowNavigationError(targetUri);
     }
 }
Exemplo n.º 5
0
        private void SearchBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            if (args.ChosenSuggestion is Sample sample)
            {
                NavigateToSample(sample);
            }
            else
            {
                NavigationFrame.Navigate(typeof(SamplePicker), _searchBox.Text);
            }

            HamburgerMenu.IsPaneOpen = false;
        }
Exemplo n.º 6
0
        public void Navigate(View view)
        {
            switch (view)
            {
            case View.PrivateChatsList:
                NavigationFrame.Navigate(typeof(PrivateChatsList));
                break;

            case View.PrivateChat:
                NavigationFrame.Navigate(typeof(PrivateChat));
                break;
            }
        }
Exemplo n.º 7
0
        public void Navigate(View view)
        {
            switch (view)
            {
            case View.CategoriesList:
                NavigationFrame.Navigate(typeof(CategoriesList));
                break;

            case View.CategoryTopicsList:
                NavigationFrame.Navigate(typeof(CategoryTopicsList));
                break;
            }
        }
Exemplo n.º 8
0
 public void NavigateToViewV2(string Name)
 {
     if (Name != null)
     {
         if (Name == "page 1")
         {
             NavigationFrame.Navigate(typeof(Page1));
         }
         if (Name == "page 2")
         {
             NavigationFrame.Navigate(typeof(Page2));
         }
     }
 }
Exemplo n.º 9
0
        private void ExternalUriToPageSimpleVM_OnClick(object sender, RoutedEventArgs e)
        {
            // this all doesnt work

            // var loadComponent = (Page)Application.LoadComponent(new Uri(
            //     @"D:\vcs\github\andez2000\wpf-navigation\external\Pages\ExternalPageSimpleVM.xaml",
            //     UriKind.RelativeOrAbsolute));

            // cannot create the vm in

            NavigationFrame.Navigate(
                new Uri(
                    @"D:\vcs\github\andez2000\wpf-navigation\external\Pages\ExternalPageSimpleVM.xaml", UriKind.RelativeOrAbsolute));
        }
Exemplo n.º 10
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            NavigationFrame.Navigate(typeof(About));

            // Get list of samples
            var sampleCategories = (await Samples.GetCategoriesAsync()).ToList();

            HamburgerMenu.ItemsSource = sampleCategories;

            // Options
            HamburgerMenu.OptionsItemsSource = new[]
            {
                new Option {
                    Glyph = "\xE10F", Name = "About", PageType = typeof(About)
                }
            };

            HideInfoArea();

            NavigationFrame.Navigating += NavigationFrame_Navigating;
            NavigationFrame.Navigated  += NavigationFrameOnNavigated;
            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;

            if (!string.IsNullOrWhiteSpace(e?.Parameter?.ToString()))
            {
                var parser       = DeepLinkParser.Create(e.Parameter.ToString());
                var targetSample = await Sample.FindAsync(parser.Root, parser["sample"]);

                if (targetSample != null)
                {
                    NavigateToSample(targetSample);
                }
            }

            _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;

            if (AnimationHelper.IsImplicitHideShowSupported)
            {
                AnimationHelper.SetTopLevelShowHideAnimation(SamplePickerGrid);

                AnimationHelper.SetTopLevelShowHideAnimation(SamplePickerDetailsGrid);
                AnimationHelper.SetSecondLevelShowHideAnimation(SamplePickerDetailsGridContent);
                AnimationHelper.SetSecondLevelShowHideAnimation(InfoAreaGrid);
                AnimationHelper.SetSecondLevelShowHideAnimation(Splitter);

                ////ElementCompositionPreview.SetImplicitHideAnimation(ContentShadow, GetOpacityAnimation(0, 1, _defaultHideAnimationDiration));
                ElementCompositionPreview.SetImplicitShowAnimation(ContentShadow, AnimationHelper.GetOpacityAnimation(_compositor, (float)ContentShadow.Opacity, 0, _defaultShowAnimationDuration));
            }
        }
Exemplo n.º 11
0
 public void Navigate(Uri targetUri)
 {
     try
     {
         NavigationFrame.Navigate(targetUri);
         HomeButton.Visibility = Visibility.Visible;
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine("** " + e.ToString());
         System.Diagnostics.Debug.WriteLine("** '" + targetUri.OriginalString + "'");
         ShowNavigationError(targetUri);
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// Navigates to a Sample
 /// </summary>
 /// <param name="sample">Sample to navigate to</param>
 public void NavigateToSample(Sample sample)
 {
     if (sample == null)
     {
         System.Console.WriteLine($"Navigating to about");
         NavigationFrame.Navigate(typeof(About), null, new SuppressNavigationTransitionInfo());
         System.Console.WriteLine($"Navigated to about");
     }
     else
     {
         NavigationFrame.Navigate(typeof(SampleController), sample);
         TrackingManager.TrackEvent("sample", "navigation", sample.Name);
     }
 }
Exemplo n.º 13
0
        public async Task NavigateToSampleAsync(Sample sample)
        {
            var pageType = Type.GetType("Microsoft.Toolkit.Uwp.SampleApp.SamplePages." + sample.Type);

            if (pageType != null)
            {
                InfoAreaPivot.Items.Clear();
                ShowInfoArea();

                var propertyDesc = await sample.GetPropertyDescriptorAsync();

                DataContext = sample;
                Title.Text  = sample.Name;

                NavigationFrame.Navigate(pageType, propertyDesc);

                _currentSample = sample;

                if (propertyDesc != null && propertyDesc.Options.Count > 0)
                {
                    InfoAreaPivot.Items.Add(PropertiesPivotItem);
                }

                if (sample.HasXAMLCode)
                {
                    XamlCodeRenderer.XamlSource = _currentSample.UpdatedXamlCode;

                    InfoAreaPivot.Items.Add(XamlPivotItem);

                    InfoAreaPivot.SelectedIndex = 0;
                }

                if (sample.HasCSharpCode)
                {
                    CSharpCodeRenderer.CSharpSource = await _currentSample.GetCSharpSourceAsync();

                    InfoAreaPivot.Items.Add(CSharpPivotItem);
                }

                if (sample.HasJavaScriptCode)
                {
                    JavaScriptCodeRenderer.CSharpSource = await _currentSample.GetJavaScriptSourceAsync();

                    InfoAreaPivot.Items.Add(JavaScriptPivotItem);
                }

                UpdateRootGridMinWidth();
            }
        }
Exemplo n.º 14
0
        private void ConnectToSearch()
        {
            var searchButton = HamburgerMenu.FindDescendantByName("SearchButton") as Button;

            _searchBox = HamburgerMenu.FindDescendantByName("SearchBox") as AutoSuggestBox;

            if (_searchBox == null || searchButton == null)
            {
                return;
            }

            searchButton.Click += async(sender, args) =>
            {
                HamburgerMenu.IsPaneOpen = true;
                _searchBox.Text          = string.Empty;

                // We need to wait for the textbox to be created to focus it (only first time).
                TextBox innerTextbox = null;

                do
                {
                    innerTextbox = _searchBox.FindDescendant <TextBox>();
                    innerTextbox?.Focus(FocusState.Programmatic);

                    if (innerTextbox == null)
                    {
                        await Task.Delay(150);
                    }
                }while (innerTextbox == null);
            };

            _searchBox.DisplayMemberPath = "Name";
            _searchBox.TextMemberPath    = "Name";

            _searchBox.QuerySubmitted += (sender, args) =>
            {
                NavigationFrame.Navigate(typeof(SamplePicker), _searchBox.Text);
            };

            _searchBox.TextChanged += (sender, args) =>
            {
                if (args.Reason != AutoSuggestionBoxTextChangeReason.UserInput)
                {
                    return;
                }

                UpdateSearchSuggestions();
            };
        }
        public override void NavigateView(NavigationFrame frameView)
        {
            var vouchersSelected = ((IEnumerable <VoucherExtendedClient>)dgVouchersGrid.ItemsSource).Where(p => p.IsAdded == true).ToList();

            if (vouchersSelected.Count > 0)
            {
                WizardData = vouchersSelected;
                frameView.Navigate(new VoucherSaveFolderWizardView(WizardData));
            }
            else
            {
                UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("NoSettlementSelected"), Uniconta.ClientTools.Localization.lookup("Warning"),
                                        MessageBoxButton.OK);
            }
        }
        public override void NavigateView(NavigationFrame frameView)
        {
            var selectedServer = cmbSMTPServer.SelectedItem as ServerInformation;

            if (selectedServer != null)
            {
                WizardData = selectedServer;
                frameView.Navigate(new EmailUserPasswordWizard(WizardData));
            }
            else
            {
                UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("NoServerSelected"), Uniconta.ClientTools.Localization.lookup("Warning"),
                                        MessageBoxButton.OK);
            }
        }
Exemplo n.º 17
0
        private void Navigate(NavigationViewItem item)
        {
            switch (item.Tag)
            {
            case "pomodoro":
                NavigationFrame.Navigate(typeof(Pomodoro));
                break;

            case "history":
                NavigationFrame.Navigate(typeof(History));
                break;

            default:
                break;
            }
        }
Exemplo n.º 18
0
        private void HamburgerMenu_OnItemClick(object sender, ItemClickEventArgs e)
        {
            var category = e.ClickedItem as SampleCategory;

            if (category != null)
            {
                while (NavigationFrame.BackStack.Count > 0)
                {
                    if (NavigationFrame.CanGoBack)
                    {
                        NavigationFrame.GoBack();
                    }
                }
                NavigationFrame.Navigate(typeof(SamplePicker), category);
            }
        }
Exemplo n.º 19
0
 public MainWindow()
 {
     InitializeComponent();
     AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
     {
         var resourceName = "AssemblyLoadingAndReflection." + new AssemblyName(args.Name).Name + ".dll";
         using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
         {
             var assemblyData = new byte[stream.Length];
             stream.Read(assemblyData, 0, assemblyData.Length);
             return(Assembly.Load(assemblyData));
         }
     };
     InstallerFrame.Navigate(new InstallerFrame());
     NavigationFrame.Navigate(new MainPage());
 }
Exemplo n.º 20
0
        private void NavView_SelectionChanged(muxs.NavigationView sender, muxs.NavigationViewSelectionChangedEventArgs args)
        {
            var navItemTag = args.SelectedItemContainer.Content.ToString();

            if (navItemTag == "Home")
            {
                NavigationFrame.Navigate(typeof(Homepage));
            }
            if (navItemTag == "Files")
            {
                NavigationFrame.Navigate(typeof(File));
            }
            if (navItemTag == "Notes")
            {
                NavigationFrame.Navigate(typeof(Notes));
            }
        }
Exemplo n.º 21
0
        /// <summary>
        /// 系统空闲进入三维图片动画线
        /// </summary>
        private void RunSlideShowThread()
        {
            DispatcherTimer Timer_SlideShow = new DispatcherTimer();

            Timer_SlideShow.Tick += new EventHandler((s, e) =>
            {
                try
                {
                    if (SystemIdleHelper.GetIdleTime() >= 10)
                    {
                        NavigationFrame.Navigate(new Uri("/Views/ProductSlideGallery.xaml", UriKind.Relative));
                    }
                }
                catch { }
            });
            Timer_SlideShow.Interval = new TimeSpan(0, 0, 1);
            Timer_SlideShow.Start();
        }
Exemplo n.º 22
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     // Options
     HamburgerMenu.OptionsItemsSource = new[]
     {
         new Option {
             Glyph = "", Name = "Setting"
         },
         new Option {
             Glyph = "", Name = "About"
         }
     };
     NavigationFrame.Navigating += NavigationFrame_Navigating;
     NavigationFrame.Navigated  += NavigationFrameOnNavigated;
     SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
     NavigationFrame.Navigate(typeof(MainPage));
 }
Exemplo n.º 23
0
        private void NavigateToViewModel(object viewModel)
        {
            Type pageType = null;

            switch (viewModel)
            {
            case FluentEditor.ControlPalette.ControlPaletteViewModel controlPalette:
                pageType = typeof(FluentEditor.ControlPalette.ControlPaletteView);
                break;
            }

            if (pageType == null)
            {
                return;
            }

            NavigationFrame.Navigate(pageType, viewModel);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Navigate to a specific page, passing parameters
        /// </summary>
        /// <param name="pageType">Page Type</param>
        /// <param name="argument">Argument to pass (primitive type, may be null)</param>
        /// <param name="viewModel">ViewModel to assign (may be null)</param>
        public bool NavigateTo(Type pageType, object argument, object viewModel)
        {
            Initialize();

            if (pageType == null)
            {
                throw new ArgumentNullException("pageType");
            }

            try
            {
                _watchForViewModel = viewModel;
                return(NavigationFrame.Navigate(pageType, argument));
            }
            finally
            {
                _watchForViewModel = null;
            }
        }
Exemplo n.º 25
0
        private void NavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
        {
            NavigationViewItem selectedItem = args.SelectedItem as NavigationViewItem;

            switch ((string)selectedItem.Tag)
            {
            case "ColorPicker": NavigationFrame.Navigate(typeof(ModulePages.ColorPicker)); break;

            case "FancyZones": NavigationFrame.Navigate(typeof(ModulePages.FancyZones)); break;

            case "Run": NavigationFrame.Navigate(typeof(ModulePages.Run)); break;

            case "KBM": NavigationFrame.Navigate(typeof(ModulePages.ColorPicker)); break;

            case "ImageResizer": NavigationFrame.Navigate(typeof(ModulePages.FancyZones)); break;

            case "PowerRename": NavigationFrame.Navigate(typeof(ModulePages.Run)); break;
            }
        }
Exemplo n.º 26
0
        private void HamburgerMenu_OnOptionsItemClick(object sender, ItemClickEventArgs e)
        {
            var option = e.ClickedItem as Option;

            if (option == null)
            {
                return;
            }

            if (option.Tag != null)
            {
                NavigationFrame.Navigate(typeof(SamplePicker), option.Tag);
                return;
            }

            if (NavigationFrame.CurrentSourcePageType != option.PageType)
            {
                NavigationFrame.Navigate(option.PageType);
            }
        }
Exemplo n.º 27
0
        private void Animation_Completed(object sender, EventArgs e)
        {
            switch (navArgs.NavigationMode)
            {
            case NavigationMode.New:
                if (navArgs.Uri == null)
                {
                    NavigationFrame.Navigate(navArgs.Content);
                }
                else
                {
                    NavigationFrame.Navigate(navArgs.Uri);
                }
                break;

            case NavigationMode.Back:
                NavigationFrame.GoBack();
                break;

            case NavigationMode.Forward:
                NavigationFrame.GoBack();
                break;

            case NavigationMode.Refresh:
                NavigationFrame.GoBack();
                break;

            default:
                break;
            }

            inNavigation = false;

            DoubleAnimation animation = new DoubleAnimation();

            animation.From     = 0f;
            animation.To       = 1f;
            animation.Duration = new Duration(TimeSpan.FromMilliseconds(200));
            NavigationFrame.BeginAnimation(OpacityProperty, animation);
        }
        private void NavigationView_SelectionChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewSelectionChangedEventArgs args)
        {
            Microsoft.UI.Xaml.Controls.NavigationViewItem selectedItem = args.SelectedItem as Microsoft.UI.Xaml.Controls.NavigationViewItem;

            if (selectedItem != null)
            {
                switch (selectedItem.Tag)
                {
                case "Overview": NavigationFrame.Navigate(typeof(OobeOverview)); break;

                case "WhatsNew": NavigationFrame.Navigate(typeof(OobeWhatsNew)); break;

                case "AlwaysOnTop": NavigationFrame.Navigate(typeof(OobeAlwaysOnTop)); break;

                case "Awake": NavigationFrame.Navigate(typeof(OobeAwake)); break;

                case "ColorPicker": NavigationFrame.Navigate(typeof(OobeColorPicker)); break;

                case "FancyZones": NavigationFrame.Navigate(typeof(OobeFancyZones)); break;

                case "Run": NavigationFrame.Navigate(typeof(OobeRun)); break;

                case "ImageResizer": NavigationFrame.Navigate(typeof(OobeImageResizer)); break;

                case "KBM": NavigationFrame.Navigate(typeof(OobeKBM)); break;

                case "PowerRename": NavigationFrame.Navigate(typeof(OobePowerRename)); break;

                case "FileExplorer": NavigationFrame.Navigate(typeof(OobeFileExplorer)); break;

                case "ShortcutGuide": NavigationFrame.Navigate(typeof(OobeShortcutGuide)); break;

                case "VideoConference": NavigationFrame.Navigate(typeof(OobeVideoConference)); break;

                case "MouseUtils": NavigationFrame.Navigate(typeof(OobeMouseUtils)); break;
                }
            }
        }
Exemplo n.º 29
0
        private void NavigationButton_Click(object sender, RoutedEventArgs e)
        {
            var to = sender as Button;

            switch (to.Name)
            {
            case nameof(DonutButton):
                NavigationFrame.Navigate(typeof(DonutPage));
                break;

            case nameof(CoffeeButton):
                NavigationFrame.Navigate(typeof(CoffeePage));
                break;

            case nameof(ScheduleButton):
                NavigationFrame.Navigate(typeof(SchedulePage));
                break;

            case nameof(CompleteButton):
                NavigationFrame.Navigate(typeof(CompletePage));
                break;
            }
        }
Exemplo n.º 30
0
        private void HamburgerMenu_OnOptionsItemClick(object sender, ItemClickEventArgs e)
        {
            var option = e.ClickedItem as Option;

            if (option == null)
            {
                return;
            }

            if (NavigationFrame.CurrentSourcePageType != option.PageType)
            {
                NavigationFrame.Navigate(option.PageType);
            }

            HamburgerMenu.IsPaneOpen = false;

            var expanders = HamburgerMenu.FindDescendants <Expander>();

            foreach (var expander in expanders)
            {
                expander.IsExpanded = false;
            }
        }