From 5ff5cd77dc33463718ee275ef3fb15dea214015c Mon Sep 17 00:00:00 2001 From: Ionite Date: Tue, 13 Jun 2023 16:14:18 -0400 Subject: [PATCH] Add mock launchviewmodel --- .../DesignData/MockLaunchViewModel.cs | 33 +++++++++++++++++++ StabilityMatrix/LaunchPage.xaml | 11 ++++--- 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 StabilityMatrix/DesignData/MockLaunchViewModel.cs diff --git a/StabilityMatrix/DesignData/MockLaunchViewModel.cs b/StabilityMatrix/DesignData/MockLaunchViewModel.cs new file mode 100644 index 00000000..2f3e6b71 --- /dev/null +++ b/StabilityMatrix/DesignData/MockLaunchViewModel.cs @@ -0,0 +1,33 @@ +using System.ComponentModel; +using Microsoft.Extensions.Logging; +using StabilityMatrix.Helper; +using StabilityMatrix.Python; +using StabilityMatrix.ViewModels; +using Wpf.Ui.Contracts; +using ISnackbarService = StabilityMatrix.Helper.ISnackbarService; + +namespace StabilityMatrix.DesignData; + +[DesignOnly(true)] +public class MockLaunchViewModel : LaunchViewModel +{ + public MockLaunchViewModel() : base( + null!, null!, null!, + null!, null!, null!, + null!, null!) + { + InstalledPackages = new() + { + new() + { + DisplayName = "Mock Package", + PackageName = "mock-package", + PackageVersion = "1.0.0", + DisplayVersion = "1.0.0", + InstalledBranch = "main", + Path = @"C:\Users\AppData\StabilityMatrix\mock-package", + } + }; + SelectedPackage = InstalledPackages[0]; + } +} diff --git a/StabilityMatrix/LaunchPage.xaml b/StabilityMatrix/LaunchPage.xaml index f8809086..01823040 100644 --- a/StabilityMatrix/LaunchPage.xaml +++ b/StabilityMatrix/LaunchPage.xaml @@ -2,16 +2,17 @@ Foreground="{DynamicResource TextFillColorPrimaryBrush}" Loaded="LaunchPage_OnLoaded" Title="LaunchPage" - d:DataContext="{d:DesignInstance Type=viewModels:LaunchViewModel, + d:DataContext="{d:DesignInstance Type=designViewModels:MockLaunchViewModel, IsDesignTimeCreatable=True}" d:DesignHeight="450" d:DesignWidth="700" + mc:Ignorable="d" ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}" ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}" - mc:Ignorable="d" x:Class="StabilityMatrix.LaunchPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:designViewModels="clr-namespace:StabilityMatrix.DesignData" xmlns:local="clr-namespace:StabilityMatrix" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:models="clr-namespace:StabilityMatrix.Models" @@ -54,7 +55,9 @@ + VerticalAlignment="Top" + d:DataContext="{d:DesignInstance Type=models:InstalledPackage, + IsDesignTimeCreatable=True}"> @@ -105,8 +108,8 @@ FontSize="18" Grid.Column="0" Grid.Row="0" - Margin="24,8,0,0" IsOpen="{Binding IsLaunchTeachingTipsOpen, Mode=TwoWay}" + Margin="24,8,0,0" Placement="Bottom">