Browse Source

初始化项目

Lishi
xxe 2 years ago
parent
commit
26c3d16780
6 changed files with 185 additions and 26 deletions
  1. +67
    -1
      HKCardIN/Bootstrapper.cs
  2. +8
    -1
      HKCardIN/HKCardIN.csproj
  3. BIN
     
  4. +1
    -8
      HKCardIN/ViewModels/RootViewModel.cs
  5. +107
    -15
      HKCardIN/Views/RootView.xaml
  6. +2
    -1
      HKCardOUT/HKCardOUT.csproj

+ 67
- 1
HKCardIN/Bootstrapper.cs View File

@@ -1,11 +1,77 @@
using HKCardIN.ViewModels;
using HandyControl.Controls;
using HKCardIN.ViewModels;
using Stylet;
using StyletIoC;
using System;
using System.Configuration;
using System.Windows.Controls;
using System.Windows.Threading;
using System.Windows;

namespace HKCardIN
{
public class Bootstrapper : Bootstrapper<RootViewModel>
{
/// <summary>
/// 程序启动
/// </summary>
protected override void OnStart()
{
}

protected override void ConfigureIoC(IStyletIoCBuilder builder)
{
}

/// <summary>
/// 初始化系统相关参数配置
/// </summary>
protected override void Configure()
{
base.Configure();
}

/// <summary>
/// 初始化VM
/// </summary>
protected override void Launch()
{
base.Launch();
}

/// <summary>
/// 加载首页VM
/// </summary>
/// <param name="rootViewModel"></param>
protected override void DisplayRootView(object rootViewModel)
{
base.DisplayRootView(rootViewModel);
}

/// <summary>
///VM加载完毕
/// </summary>
protected override void OnLaunch()
{
base.OnLaunch();
}

/// <summary>
/// 退出
/// </summary>
/// <param name="e"></param>
protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
}

/// <summary>
/// 全局异常捕获
/// </summary>
/// <param name="e"></param>
protected override void OnUnhandledException(DispatcherUnhandledExceptionEventArgs e)
{
GC.Collect();
}
}
}

+ 8
- 1
HKCardIN/HKCardIN.csproj View File

@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net6.0-windows</TargetFramework>
<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
<UseWPF>true</UseWPF>
<AssemblyName>HKCardIN</AssemblyName>
<RootNamespace>HKCardIN</RootNamespace>
@@ -17,8 +18,14 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE;Core</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Remove="HKResouces\头像.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="HandyControls" Version="3.4.1" />
<PackageReference Include="Stylet" Version="1.3.6" />
</ItemGroup>
<ItemGroup>
<Resource Include="HKResouces\头像.png" />
</ItemGroup>
</Project>

BIN
View File


+ 1
- 8
HKCardIN/ViewModels/RootViewModel.cs View File

@@ -2,15 +2,8 @@

namespace HKCardIN.ViewModels
{
public class RootViewModel : PropertyChangedBase
public class RootViewModel : Conductor<IScreen>
{
private string _title = "HandyControl Application";
public string Title
{
get { return _title; }
set { SetAndNotify(ref _title, value); }
}

public RootViewModel()
{



+ 107
- 15
HKCardIN/Views/RootView.xaml View File

@@ -1,16 +1,108 @@
<hc:Window x:Class="HKCardIN.Views.RootView"
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:viewModels="clr-namespace:HKCardIN.ViewModels"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=viewModels:RootViewModel}"
Title="{Binding Title}"
WindowStartupLocation="CenterScreen"
ShowTitle="True"
Height="450"
Width="800">
<TextBlock Text="Hello World" HorizontalAlignment="Center" VerticalAlignment="Center" />
<hc:Window
x:Class="HKCardIN.Views.RootView"
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:hc="https://handyorg.github.io/handycontrol"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="clr-namespace:HKCardIN.ViewModels"
Title="海科智慧一卡通平台"
Width="800"
Height="500"
d:DataContext="{d:DesignInstance Type=viewModels:RootViewModel}"
ShowMaxButton="False"
ShowTitle="True"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Margin="0,12,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border
Width="100"
Height="120"
BorderBrush="BlanchedAlmond"
BorderThickness="1">
<Border.Effect>
<DropShadowEffect ShadowDepth="1" Color="Black" />
</Border.Effect>
<Image
Width="100"
Height="120"
Source="/HKResouces/头像.png"
Stretch="UniformToFill" />
</Border>
<StackPanel Grid.Column="1">
<WrapPanel>
<TextBlock
FontSize="18"
Style="{StaticResource TextBlockDefaultBold}"
Text="姓名:" />
<TextBlock
FontSize="18"
Foreground="Red"
Style="{StaticResource TextBlockDefaultBold}"
Text="李四" />
</WrapPanel>
<WrapPanel Margin="0,20,0,0">
<TextBlock
FontSize="18"
Style="{StaticResource TextBlockDefaultBold}"
Text="手机:" />
<TextBlock
FontSize="18"
Foreground="Red"
Style="{StaticResource TextBlockDefaultBold}"
Text="13812345678" />
</WrapPanel>
<WrapPanel Margin="0,20,0,0">
<TextBlock
FontSize="18"
Style="{StaticResource TextBlockDefaultBold}"
Text="员工号:" />
<TextBlock
FontSize="18"
Foreground="Red"
Style="{StaticResource TextBlockDefaultBold}"
Text="001" />
</WrapPanel>
</StackPanel>
</Grid>
<hc:Divider
Content="卡信息"
FontSize="16"
FontWeight="Bold" />
<StackPanel Margin="20,0,0,0">
<WrapPanel>
<TextBlock
FontSize="18"
Style="{StaticResource TextBlockDefaultBold}"
Text="卡号:" />
<TextBlock
FontSize="18"
Foreground="Red"
Style="{StaticResource TextBlockDefaultBold}"
Text="123456" />
</WrapPanel>
<WrapPanel Margin="0,20,0,0">
<TextBlock
FontSize="18"
Style="{StaticResource TextBlockDefaultBold}"
Text="卡上余额:" />
<TextBlock
FontSize="18"
Foreground="Red"
Style="{StaticResource TextBlockDefaultBold}"
Text="123456" />
</WrapPanel>
</StackPanel>
</StackPanel>
</Grid>
</hc:Window>

+ 2
- 1
HKCardOUT/HKCardOUT.csproj View File

@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net6.0-windows</TargetFramework>
<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
<UseWPF>true</UseWPF>
<AssemblyName>HKCardOUT</AssemblyName>
<RootNamespace>HKCardOUT</RootNamespace>


Loading…
Cancel
Save