Add project files.
This commit is contained in:
65
Views/Windows/MainWindow.xaml
Normal file
65
Views/Windows/MainWindow.xaml
Normal file
@@ -0,0 +1,65 @@
|
||||
<ui:FluentWindow
|
||||
x:Class="DownloadManager.Views.Windows.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:DownloadManager.Views.Windows"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="{Binding ViewModel.ApplicationTitle, Mode=OneWay}"
|
||||
Width="1100"
|
||||
Height="650"
|
||||
d:DataContext="{d:DesignInstance local:MainWindow,
|
||||
IsDesignTimeCreatable=True}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
|
||||
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||
ExtendsContentIntoTitleBar="True"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||
WindowBackdropType="Mica"
|
||||
WindowCornerPreference="Round"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<ui:NavigationView
|
||||
x:Name="RootNavigation"
|
||||
Grid.Row="1"
|
||||
Padding="42,0,42,0"
|
||||
BreadcrumbBar="{Binding ElementName=BreadcrumbBar}"
|
||||
FooterMenuItemsSource="{Binding ViewModel.FooterMenuItems, Mode=OneWay}"
|
||||
FrameMargin="0"
|
||||
IsBackButtonVisible="Visible"
|
||||
IsPaneToggleVisible="True"
|
||||
MenuItemsSource="{Binding ViewModel.MenuItems, Mode=OneWay}"
|
||||
PaneDisplayMode="LeftFluent">
|
||||
<ui:NavigationView.Header>
|
||||
<ui:BreadcrumbBar x:Name="BreadcrumbBar" Margin="42,32,42,20" />
|
||||
</ui:NavigationView.Header>
|
||||
<ui:NavigationView.ContentOverlay>
|
||||
<Grid>
|
||||
<ui:SnackbarPresenter x:Name="SnackbarPresenter" />
|
||||
</Grid>
|
||||
</ui:NavigationView.ContentOverlay>
|
||||
</ui:NavigationView>
|
||||
|
||||
<ContentPresenter
|
||||
x:Name="RootContentDialog"
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="2" />
|
||||
|
||||
<ui:TitleBar
|
||||
x:Name="TitleBar"
|
||||
Title="{Binding ViewModel.ApplicationTitle}"
|
||||
Grid.Row="0"
|
||||
CloseWindowByDoubleClickOnIcon="True">
|
||||
<ui:TitleBar.Icon>
|
||||
<ui:ImageIcon Source="pack://application:,,,/Assets/wpfui-icon-256.png" />
|
||||
</ui:TitleBar.Icon>
|
||||
</ui:TitleBar>
|
||||
</Grid>
|
||||
</ui:FluentWindow>
|
||||
70
Views/Windows/MainWindow.xaml.cs
Normal file
70
Views/Windows/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
// This Source Code Form is subject to the terms of the MIT License.
|
||||
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
|
||||
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
|
||||
// All Rights Reserved.
|
||||
|
||||
using DownloadManager.ViewModels.Windows;
|
||||
using Wpf.Ui;
|
||||
using Wpf.Ui.Appearance;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace DownloadManager.Views.Windows;
|
||||
public partial class MainWindow : INavigationWindow
|
||||
{
|
||||
public MainWindowViewModel ViewModel
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public MainWindow(
|
||||
MainWindowViewModel viewModel,
|
||||
IPageService pageService,
|
||||
INavigationService navigationService
|
||||
)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
DataContext = this;
|
||||
|
||||
SystemThemeWatcher.Watch(this);
|
||||
|
||||
InitializeComponent();
|
||||
SetPageService(pageService);
|
||||
|
||||
navigationService.SetNavigationControl(RootNavigation);
|
||||
}
|
||||
|
||||
#region INavigationWindow methods
|
||||
|
||||
public INavigationView GetNavigation() => RootNavigation;
|
||||
|
||||
public bool Navigate(Type pageType) => RootNavigation.Navigate(pageType);
|
||||
|
||||
public void SetPageService(IPageService pageService) => RootNavigation.SetPageService(pageService);
|
||||
|
||||
public void ShowWindow() => Show();
|
||||
|
||||
public void CloseWindow() => Close();
|
||||
|
||||
#endregion INavigationWindow methods
|
||||
|
||||
/// <summary>
|
||||
/// Raises the closed event.
|
||||
/// </summary>
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
base.OnClosed(e);
|
||||
|
||||
// Make sure that closing this window will begin the process of closing the application.
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
|
||||
INavigationView INavigationWindow.GetNavigation()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetServiceProvider(IServiceProvider serviceProvider)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user