Skip to content

Commit

Permalink
feat: scenario page structure
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraZiling committed Jun 5, 2024
1 parent e1273ab commit d5d2040
Show file tree
Hide file tree
Showing 12 changed files with 178 additions and 135 deletions.
6 changes: 6 additions & 0 deletions src/PipManager/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
using System.Windows.Threading;
using PipManager.Services.Overlay;
using PipManager.ViewModels.Pages.Overlay;
using PipManager.ViewModels.Pages.Scenario;
using PipManager.Views.Pages.Overlay;
using PipManager.Views.Pages.Scenario;
using Wpf.Ui;
using AboutViewModel = PipManager.ViewModels.Pages.About.AboutViewModel;
using ActionViewModel = PipManager.ViewModels.Pages.Action.ActionViewModel;
Expand Down Expand Up @@ -109,8 +111,12 @@ public partial class App

services.AddSingleton<ToolsPage>();
services.AddSingleton<ToolsViewModel>();

services.AddSingleton<LabPage>();
services.AddSingleton<LabViewModel>();

services.AddSingleton<ScenarioPage>();
services.AddSingleton<ScenarioViewModel>();

services.AddSingleton<EnvironmentPage>();
services.AddSingleton<EnvironmentViewModel>();
Expand Down
9 changes: 9 additions & 0 deletions src/PipManager/Languages/Lang.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/PipManager/Languages/Lang.resx
Original file line number Diff line number Diff line change
Expand Up @@ -768,4 +768,7 @@
<data name="Library_Data_RefreshTimeUsage" xml:space="preserve">
<value>{0}s used</value>
</data>
<data name="MainWindow_NavigationContent_Scenario" xml:space="preserve">
<value>Scenario</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/PipManager/Languages/Lang.zh-cn.resx
Original file line number Diff line number Diff line change
Expand Up @@ -768,4 +768,7 @@
<data name="Library_Data_RefreshTimeUsage" xml:space="preserve">
<value>用时 {0} 秒</value>
</data>
<data name="MainWindow_NavigationContent_Scenario" xml:space="preserve">
<value>场景推荐</value>
</data>
</root>
3 changes: 1 addition & 2 deletions src/PipManager/ViewModels/Pages/Lab/LabViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using PipManager.Models.Action;
using PipManager.Services.Action;
using PipManager.Services.Environment;
using Serilog;
using Wpf.Ui.Controls;

namespace PipManager.ViewModels.Pages.Lab;

public partial class LabViewModel(IActionService actionService, IEnvironmentService environmentService)
public partial class LabViewModel(IActionService actionService)
: ObservableObject, INavigationAware
{
private bool _isInitialized;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using PipManager.Models.Package;
using PipManager.Models.Pages;
using System.Collections.ObjectModel;
using PipManager.Services.Environment.Response;
using PipManager.Services.Toast;
using PipManager.Views.Pages.Library;
using Wpf.Ui;
Expand Down
6 changes: 6 additions & 0 deletions src/PipManager/ViewModels/Pages/Scenario/ScenarioViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace PipManager.ViewModels.Pages.Scenario;

public class ScenarioViewModel : ObservableObject
{

}
3 changes: 1 addition & 2 deletions src/PipManager/ViewModels/Windows/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using PipManager.Services.Configuration;
using PipManager.Services.Environment;
using Serilog;

namespace PipManager.ViewModels.Windows;
Expand All @@ -8,7 +7,7 @@ public partial class MainWindowViewModel : ObservableObject
{
[ObservableProperty] private bool _experimentMode;

public MainWindowViewModel(IConfigurationService configurationService, IEnvironmentService environmentService)
public MainWindowViewModel(IConfigurationService configurationService)
{

if (configurationService.AppConfig.CurrentEnvironment != null)
Expand Down
40 changes: 17 additions & 23 deletions src/PipManager/Views/Pages/Lab/LabPage.xaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
<Page
x:Class="PipManager.Views.Pages.Lab.LabPage"
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:lab="clr-namespace:PipManager.Views.Pages.Lab"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="LabPage"
d:DataContext="{d:DesignInstance lab:LabPage,
IsDesignTimeCreatable=False}"
d:DesignHeight="700"
d:DesignWidth="1200"
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
FontFamily="/PipManager;component/Resources/Fonts/MiSans-Regular.ttf#MiSans"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
mc:Ignorable="d">

<Grid>
<Button Content="Test" Command="{Binding ViewModel.ParseTestCommand}"></Button>
</Grid>
</Page>
<Page x:Class="PipManager.Views.Pages.Lab.LabPage"
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:lab="clr-namespace:PipManager.Views.Pages.Lab"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="LabPage"
d:DataContext="{d:DesignInstance lab:LabPage,
IsDesignTimeCreatable=False}"
d:DesignHeight="700"
d:DesignWidth="1200"
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
FontFamily="/PipManager;component/Resources/Fonts/MiSans-Regular.ttf#MiSans"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
mc:Ignorable="d" />
19 changes: 19 additions & 0 deletions src/PipManager/Views/Pages/Scenario/ScenarioPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Page x:Class="PipManager.Views.Pages.Scenario.ScenarioPage"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:scenario="clr-namespace:PipManager.Views.Pages.Scenario"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="Scenario Recommendations"
d:DataContext="{d:DesignInstance scenario:ScenarioPage,
IsDesignTimeCreatable=False}"
d:DesignHeight="700"
d:DesignWidth="1200"
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
FontFamily="/PipManager;component/Resources/Fonts/MiSans-Regular.ttf#MiSans"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
mc:Ignorable="d">
<Grid />
</Page>
17 changes: 17 additions & 0 deletions src/PipManager/Views/Pages/Scenario/ScenarioPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using PipManager.ViewModels.Pages.Scenario;
using Wpf.Ui.Controls;

namespace PipManager.Views.Pages.Scenario;

public partial class ScenarioPage : INavigableView<ScenarioViewModel>
{
public ScenarioViewModel ViewModel { get; }

public ScenarioPage(ScenarioViewModel viewModel)
{
ViewModel = viewModel;
DataContext = this;

InitializeComponent();
}
}
Loading

0 comments on commit d5d2040

Please sign in to comment.