mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add Page Navigation
This commit is contained in:
parent
37a8f26a74
commit
65fe8917f1
7 changed files with 164 additions and 20 deletions
|
|
@ -8,6 +8,7 @@
|
|||
Title="WelcomePage1"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
Background="#cecece"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<ScrollViewer>
|
||||
|
|
|
|||
14
Flow.Launcher/Resources/Pages/WelcomePage4.xaml
Normal file
14
Flow.Launcher/Resources/Pages/WelcomePage4.xaml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<Page x:Class="Flow.Launcher.Resources.Pages.WelcomePage4"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Flow.Launcher.Resources.Pages"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
Title="WelcomePage4">
|
||||
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Page>
|
||||
28
Flow.Launcher/Resources/Pages/WelcomePage4.xaml.cs
Normal file
28
Flow.Launcher/Resources/Pages/WelcomePage4.xaml.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Flow.Launcher.Resources.Pages
|
||||
{
|
||||
/// <summary>
|
||||
/// WelcomePage4.xaml에 대한 상호 작용 논리
|
||||
/// </summary>
|
||||
public partial class WelcomePage4 : Page
|
||||
{
|
||||
public WelcomePage4()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Flow.Launcher/Resources/Pages/WelcomePage5.xaml
Normal file
14
Flow.Launcher/Resources/Pages/WelcomePage5.xaml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<Page x:Class="Flow.Launcher.Resources.Pages.WelcomePage5"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Flow.Launcher.Resources.Pages"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
Title="WelcomePage5">
|
||||
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Page>
|
||||
28
Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs
Normal file
28
Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Flow.Launcher.Resources.Pages
|
||||
{
|
||||
/// <summary>
|
||||
/// WelcomePage5.xaml에 대한 상호 작용 논리
|
||||
/// </summary>
|
||||
public partial class WelcomePage5 : Page
|
||||
{
|
||||
public WelcomePage5()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
</Grid>
|
||||
</StackPanel>
|
||||
<!--#endregion-->
|
||||
<StackPanel Margin="26,12,26,0">
|
||||
<StackPanel Margin="0">
|
||||
<ui:Frame
|
||||
x:Name="ContentFrame"
|
||||
MinHeight="600"
|
||||
|
|
@ -93,18 +93,20 @@
|
|||
BorderThickness="0,1,0,0">
|
||||
<DockPanel>
|
||||
<Button
|
||||
x:Name="NextButton"
|
||||
Width="50"
|
||||
Height="50"
|
||||
Margin="10,5,28,5"
|
||||
Click="BackwardButton_Click"
|
||||
Click="ForwardButton_Click"
|
||||
Content=""
|
||||
DockPanel.Dock="Right"
|
||||
FontFamily="/Resources/#Segoe Fluent Icons"
|
||||
FontSize="22" />
|
||||
<Button
|
||||
x:Name="BackButton"
|
||||
Width="50"
|
||||
Height="50"
|
||||
Click="ForwardButton_Click"
|
||||
Click="BackwardButton_Click"
|
||||
Content=""
|
||||
DockPanel.Dock="Right"
|
||||
FontFamily="/Resources/#Segoe Fluent Icons"
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ using System.Windows.Media.Imaging;
|
|||
using System.Windows.Shapes;
|
||||
using ModernWpf.Media.Animation;
|
||||
using Page = ModernWpf.Controls.Page;
|
||||
using WelcomePages = Flow.Launcher.Resources.Pages;
|
||||
|
||||
namespace Flow.Launcher
|
||||
{
|
||||
|
|
@ -24,34 +25,89 @@ namespace Flow.Launcher
|
|||
public WelcomeWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
ContentFrame.Navigate(typeof(SamplePages.SamplePage1));
|
||||
//ContentFrame.Navigate(typeof(SamplePages.SamplePage1));
|
||||
ContentFrame.Navigate(typeof(WelcomePages.WelcomePage1));
|
||||
BackButton.IsEnabled = false;
|
||||
}
|
||||
private int page;
|
||||
private int MaxPage = 5;
|
||||
|
||||
/*public int Page
|
||||
{
|
||||
get { return this.page; }
|
||||
set
|
||||
{
|
||||
this.page = value;
|
||||
if (this.page == 1)
|
||||
{
|
||||
this.BackButton.IsEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.BackButton.IsEnabled = true;
|
||||
};
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
private void ButtonDisabler()
|
||||
{
|
||||
if (page == 0)
|
||||
{
|
||||
BackButton.IsEnabled = false;
|
||||
NextButton.IsEnabled = true;
|
||||
}
|
||||
else if (page == MaxPage - 1)
|
||||
{
|
||||
BackButton.IsEnabled = true;
|
||||
NextButton.IsEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
BackButton.IsEnabled = true;
|
||||
NextButton.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
private NavigationTransitionInfo _transitionInfo = new SlideNavigationTransitionInfo() { Effect = SlideNavigationTransitionEffect.FromRight };
|
||||
|
||||
private static Type PageSelector(int a)
|
||||
{
|
||||
switch (a)
|
||||
{
|
||||
case 0:
|
||||
return typeof(WelcomePages.WelcomePage1);
|
||||
case 1:
|
||||
return typeof(WelcomePages.WelcomePage2);
|
||||
case 2:
|
||||
return typeof(WelcomePages.WelcomePage3);
|
||||
case 3:
|
||||
return typeof(WelcomePages.WelcomePage4);
|
||||
case 4:
|
||||
return typeof(WelcomePages.WelcomePage5);
|
||||
default:
|
||||
return typeof(WelcomePages.WelcomePage1);
|
||||
}
|
||||
}
|
||||
private void ForwardButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
/*
|
||||
var pageToNavigateTo = ContentFrame.BackStackDepth % 2 == 1 ? typeof(SamplePages.SamplePage1) : typeof(SamplePages.SamplePage2);
|
||||
|
||||
if (_transitionInfo == null)
|
||||
{
|
||||
// Default behavior, no transition set or used.
|
||||
ContentFrame.Navigate(pageToNavigateTo, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Explicit transition info used.
|
||||
page = page + 1;
|
||||
ButtonDisabler();
|
||||
var pageToNavigateTo = PageSelector(page);
|
||||
ContentFrame.Navigate(pageToNavigateTo, null, _transitionInfo);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private void BackwardButton_Click(object sender, RoutedEventArgs e)
|
||||
{/*
|
||||
if (ContentFrame.BackStackDepth > 0)
|
||||
{
|
||||
if (page > 0)
|
||||
{
|
||||
page = page - 1;
|
||||
ButtonDisabler();
|
||||
ContentFrame.GoBack();
|
||||
}
|
||||
*/
|
||||
else
|
||||
{
|
||||
BackButton.IsEnabled = false;
|
||||
}
|
||||
}
|
||||
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
|
@ -59,3 +115,4 @@ namespace Flow.Launcher
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue