刘彬 4 周之前
父節點
當前提交
fdf73e54fc

+ 0 - 9
BuildProcess.Core/BuildProcess.Core.csproj

@@ -1,9 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFramework>net6.0-windows</TargetFramework>
-    <UseWPF>true</UseWPF>
-  </PropertyGroup>
-  <ItemGroup>
-    <PackageReference Include="Prism.Wpf" Version="8.1.97" />
-  </ItemGroup>
-</Project>

+ 0 - 35
BuildProcess.Core/Mvvm/RegionViewModelBase.cs

@@ -1,35 +0,0 @@
-using Prism.Regions;
-using System;
-
-namespace BuildProcess.Core.Mvvm
-{
-    public class RegionViewModelBase : ViewModelBase, INavigationAware, IConfirmNavigationRequest
-    {
-        protected IRegionManager RegionManager { get; private set; }
-
-        public RegionViewModelBase(IRegionManager regionManager)
-        {
-            RegionManager = regionManager;
-        }
-
-        public virtual void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
-        {
-            continuationCallback(true);
-        }
-
-        public virtual bool IsNavigationTarget(NavigationContext navigationContext)
-        {
-            return true;
-        }
-
-        public virtual void OnNavigatedFrom(NavigationContext navigationContext)
-        {
-
-        }
-
-        public virtual void OnNavigatedTo(NavigationContext navigationContext)
-        {
-
-        }
-    }
-}

+ 0 - 18
BuildProcess.Core/Mvvm/ViewModelBase.cs

@@ -1,18 +0,0 @@
-using Prism.Mvvm;
-using Prism.Navigation;
-
-namespace BuildProcess.Core.Mvvm
-{
-    public abstract class ViewModelBase : BindableBase, IDestructible
-    {
-        protected ViewModelBase()
-        {
-
-        }
-
-        public virtual void Destroy()
-        {
-
-        }
-    }
-}

+ 0 - 7
BuildProcess.Core/RegionNames.cs

@@ -1,7 +0,0 @@
-namespace BuildProcess.Core
-{
-    public static class RegionNames
-    {
-        public const string ContentRegion = "ContentRegion";
-    }
-}

+ 0 - 13
Modules/BuildProcess.Modules.ModuleName/BuildProcess.Modules.ModuleName.csproj

@@ -1,13 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFramework>net6.0-windows</TargetFramework>
-    <UseWPF>true</UseWPF>
-  </PropertyGroup>
-  <ItemGroup>
-    <PackageReference Include="Prism.Wpf" Version="8.1.97" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\..\BuildProcess.Core\BuildProcess.Core.csproj" />
-    <ProjectReference Include="..\..\Services\BuildProcess.Services.Interfaces\BuildProcess.Services.Interfaces.csproj" />
-  </ItemGroup>
-</Project>

+ 0 - 28
Modules/BuildProcess.Modules.ModuleName/ModuleNameModule.cs

@@ -1,28 +0,0 @@
-using BuildProcess.Core;
-using BuildProcess.Modules.ModuleName.Views;
-using Prism.Ioc;
-using Prism.Modularity;
-using Prism.Regions;
-
-namespace BuildProcess.Modules.ModuleName
-{
-    public class ModuleNameModule : IModule
-    {
-        private readonly IRegionManager _regionManager;
-
-        public ModuleNameModule(IRegionManager regionManager)
-        {
-            _regionManager = regionManager;
-        }
-
-        public void OnInitialized(IContainerProvider containerProvider)
-        {
-            _regionManager.RequestNavigate(RegionNames.ContentRegion, "ViewA");
-        }
-
-        public void RegisterTypes(IContainerRegistry containerRegistry)
-        {
-            containerRegistry.RegisterForNavigation<ViewA>();
-        }
-    }
-}

+ 0 - 27
Modules/BuildProcess.Modules.ModuleName/ViewModels/ViewAViewModel.cs

@@ -1,27 +0,0 @@
-using BuildProcess.Core.Mvvm;
-using BuildProcess.Services.Interfaces;
-using Prism.Regions;
-
-namespace BuildProcess.Modules.ModuleName.ViewModels
-{
-    public class ViewAViewModel : RegionViewModelBase
-    {
-        private string _message;
-        public string Message
-        {
-            get { return _message; }
-            set { SetProperty(ref _message, value); }
-        }
-
-        public ViewAViewModel(IRegionManager regionManager, IMessageService messageService) :
-            base(regionManager)
-        {
-            Message = messageService.GetMessage();
-        }
-
-        public override void OnNavigatedTo(NavigationContext navigationContext)
-        {
-            //do something
-        }
-    }
-}

+ 0 - 13
Modules/BuildProcess.Modules.ModuleName/Views/ViewA.xaml

@@ -1,13 +0,0 @@
-<UserControl x:Class="BuildProcess.Modules.ModuleName.Views.ViewA"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:local="clr-namespace:BuildProcess.Modules.ModuleName.Views"
-             xmlns:prism="http://prismlibrary.com/"
-             prism:ViewModelLocator.AutoWireViewModel="True" >
-    <Grid>
-        <TextBlock Text="{Binding Message}"
-                   HorizontalAlignment="Center"
-                   VerticalAlignment="Center"
-                   FontSize="24"/>
-    </Grid>
-</UserControl>

+ 0 - 28
Modules/BuildProcess.Modules.ModuleName/Views/ViewA.xaml.cs

@@ -1,28 +0,0 @@
-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 BuildProcess.Modules.ModuleName.Views
-{
-    /// <summary>
-    /// Interaction logic for ViewA.xaml
-    /// </summary>
-    public partial class ViewA : UserControl
-    {
-        public ViewA()
-        {
-            InitializeComponent();
-        }
-    }
-}

+ 0 - 7
Services/BuildProcess.Services.Interfaces/BuildProcess.Services.Interfaces.csproj

@@ -1,7 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>netstandard2.1</TargetFramework>
-  </PropertyGroup>
-
-</Project>

+ 0 - 7
Services/BuildProcess.Services.Interfaces/IMessageService.cs

@@ -1,7 +0,0 @@
-namespace BuildProcess.Services.Interfaces
-{
-    public interface IMessageService
-    {
-        string GetMessage();
-    }
-}

+ 0 - 11
Services/BuildProcess.Services/BuildProcess.Services.csproj

@@ -1,11 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>netstandard2.1</TargetFramework>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <ProjectReference Include="..\BuildProcess.Services.Interfaces\BuildProcess.Services.Interfaces.csproj" />
-  </ItemGroup>
-
-</Project>

+ 0 - 12
Services/BuildProcess.Services/MessageService.cs

@@ -1,12 +0,0 @@
-using BuildProcess.Services.Interfaces;
-
-namespace BuildProcess.Services
-{
-    public class MessageService : IMessageService
-    {
-        public string GetMessage()
-        {
-            return "Hello from the Message Service";
-        }
-    }
-}

+ 0 - 27
Tests/BuildProcess.Modules.ModuleName.Tests/BuildProcess.Modules.ModuleName.Tests.csproj

@@ -1,27 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>net6.0-windows</TargetFramework>
-
-    <IsPackable>false</IsPackable>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
-    <PackageReference Include="Moq" Version="4.17.2" />
-    <PackageReference Include="xunit" Version="2.4.1" />
-    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
-      <PrivateAssets>all</PrivateAssets>
-      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
-    </PackageReference>
-    <PackageReference Include="coverlet.collector" Version="3.1.2">
-      <PrivateAssets>all</PrivateAssets>
-      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
-    </PackageReference>
-  </ItemGroup>
-
-  <ItemGroup>
-    <ProjectReference Include="..\..\Modules\BuildProcess.Modules.ModuleName\BuildProcess.Modules.ModuleName.csproj" />
-  </ItemGroup>
-
-</Project>

+ 0 - 41
Tests/BuildProcess.Modules.ModuleName.Tests/ViewModels/ViewAViewModelFixture.cs

@@ -1,41 +0,0 @@
-using BuildProcess.Modules.ModuleName.ViewModels;
-using BuildProcess.Services.Interfaces;
-using Moq;
-using Prism.Regions;
-using Xunit;
-
-namespace BuildProcess.Modules.ModuleName.Tests.ViewModels
-{
-    public class ViewAViewModelFixture
-    {
-        Mock<IMessageService> _messageServiceMock;
-        Mock<IRegionManager> _regionManagerMock;
-        const string MessageServiceDefaultMessage = "Some Value";
-
-        public ViewAViewModelFixture()
-        {
-            var messageService = new Mock<IMessageService>();
-            messageService.Setup(x => x.GetMessage()).Returns(MessageServiceDefaultMessage);
-            _messageServiceMock = messageService;
-
-            _regionManagerMock = new Mock<IRegionManager>();
-        }
-
-        [Fact]
-        public void MessagePropertyValueUpdated()
-        {
-            var vm = new ViewAViewModel(_regionManagerMock.Object, _messageServiceMock.Object);
-
-            _messageServiceMock.Verify(x => x.GetMessage(), Times.Once);
-
-            Assert.Equal(MessageServiceDefaultMessage, vm.Message);
-        }
-
-        [Fact]
-        public void MessageINotifyPropertyChangedCalled()
-        {
-            var vm = new ViewAViewModel(_regionManagerMock.Object, _messageServiceMock.Object);
-            Assert.PropertyChanged(vm, nameof(vm.Message), () => vm.Message = "Changed");
-        }
-    }
-}