更换字体,登录页面开发完结

This commit is contained in:
MoYue 2024-01-31 14:26:57 +08:00
parent c6e5207d9e
commit b630c11e0e
21 changed files with 321 additions and 83 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -9,6 +9,8 @@
<ItemGroup> <ItemGroup>
<None Remove="Fonts\iconfont.ttf" /> <None Remove="Fonts\iconfont.ttf" />
<None Remove="Fonts\方正楷体简体.ttf" />
<None Remove="Images\bitbug_favicon.ico" />
<None Remove="Images\Login\bird.png" /> <None Remove="Images\Login\bird.png" />
<None Remove="Images\Login\logo.png" /> <None Remove="Images\Login\logo.png" />
<None Remove="Images\Login\ship.png" /> <None Remove="Images\Login\ship.png" />
@ -21,6 +23,12 @@
<Resource Include="Fonts\iconfont.ttf"> <Resource Include="Fonts\iconfont.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource> </Resource>
<Resource Include="Fonts\方正楷体简体.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\bitbug_favicon.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Images\Login\bird.png"> <Resource Include="Images\Login\bird.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource> </Resource>

View File

@ -1,8 +0,0 @@
namespace StandardDesign.DataAccess
{
public class Class1
{
}
}

View File

@ -0,0 +1,10 @@
using StandardDesign.IDataAccess;
namespace StandardDesign.DataAccess
{
public class LoacalDataAccess : ILoacalDataAccess
{
}
}

View File

@ -7,4 +7,8 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\StandardDesign.IDataAccess\StandardDesign.IDataAccess.csproj" />
</ItemGroup>
</Project> </Project>

View File

@ -1,8 +0,0 @@
namespace StandardDesign.IDataAccess
{
public class Class1
{
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StandardDesign.IDataAccess
{
public interface ILoacalDataAccess
{
}
}

View File

@ -1,8 +0,0 @@
namespace StandardDesign.Models
{
public class Class1
{
}
}

View File

@ -0,0 +1,12 @@
namespace StandardDesign.Models
{
public class SocketModel
{
public string IP { get; set; }
public string Port { get; set; }
public string AuthorizeCode { get; set; }
}
}

View File

@ -7,11 +7,4 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\StandardDesign.Common\StandardDesign.Common.csproj" />
<ProjectReference Include="..\StandardDesign.DataAccess\StandardDesign.DataAccess.csproj" />
<ProjectReference Include="..\StandardDesign.IDataAccess\StandardDesign.IDataAccess.csproj" />
<ProjectReference Include="..\StandardDesign.ViewModels\StandardDesign.ViewModels.csproj" />
</ItemGroup>
</Project> </Project>

View File

@ -1,10 +1,159 @@
using GalaSoft.MvvmLight; using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using StandardDesign.IDataAccess;
using StandardDesign.Models;
using System.CodeDom;
using System.IO;
using System.Net.Sockets;
using System.Text.RegularExpressions;
using System.Windows;
namespace StandardDesign.ViewModels namespace StandardDesign.ViewModels
{ {
public class LoginViewModel : ViewModelBase public class LoginViewModel : ViewModelBase
{ {
ILoacalDataAccess _localDataAccess;
//ip
public string ip;
public string IP
{
get { return ip; }
set { Set(ref ip, value); }
}
//Port
public string port;
public string Port
{
get { return port; }
set { Set(ref port, value); }
}
//授权码
public string _authorizeCode;
public string AuthorizeCode
{
get { return _authorizeCode; }
set { Set(ref _authorizeCode, value); }
}
//异常信息
public string _failedMsg;
public string FailedMsg
{
get { return _failedMsg; }
set { Set(ref _failedMsg, value); }
}
//是否保存记录
private bool _isRecord;
public bool IsRecord
{
get { return _isRecord; }
set { Set<bool>(ref _isRecord, value); }
}
//登录按钮
public RelayCommand<object> LoginCommand { get; set; }
public RelayCommand<object> SkipCommand { get; set; }
public LoginViewModel(ILoacalDataAccess localDataAccess)
{
_localDataAccess = localDataAccess;
if (File.Exists("temp.txt"))
{
string info = File.ReadAllText("temp.txt");
this.IP = info.Split("|")[0];
this.Port = info.Split("|")[1];
}
if (!IsInDesignMode)
{
LoginCommand = new RelayCommand<object>(DoLogin);
SkipCommand = new RelayCommand<object>(SkipLogin);
}
}
private void DoLogin(object obj)
{
try
{
// 根据选项进行信息记录
if (IsRecord)
{
string info = $"{this.IP}|{this.Port}";
File.WriteAllText("temp.txt", info);
}
else
{
if (File.Exists("temp.txt"))
File.Delete("temp.text");
}
if (string.IsNullOrEmpty(IP))
{
throw new Exception("IP地址为空!");
}
else if (!ValidateIPAddress(IP))
{
throw new Exception("IP输入有误!");
}
else if (string.IsNullOrEmpty(Port))
{
throw new Exception("端口号为空!");
}
else if (!ValidatePortAddress(Port))
{
throw new Exception("端口号输入有误!");
}
else
{
(obj as Window).DialogResult = true;
}
}
catch (Exception ex)
{
FailedMsg = ex.Message;
}
}
/// <summary>
/// 跳过连接
/// </summary>
/// <param name="obj"></param>
private void SkipLogin(object obj)
{
(obj as Window).DialogResult = true;
}
/// <summary>
/// 校验Ip
/// </summary>
/// <param name="ipAddress"></param>
/// <returns></returns>
public static bool ValidateIPAddress(string ipAddress)
{
Regex validipregex = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$");
return (ipAddress != "" && validipregex.IsMatch(ipAddress.Trim())) ? true : false;
}
/// <summary>
/// 校验端口号
/// </summary>
/// <param name="prtAddress"></param>
/// <returns></returns>
public static bool ValidatePortAddress(string prtAddress)
{
Regex validipregex = new Regex(@"^(\d|[1-9]\d{1,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$");
return (prtAddress != "" && validipregex.IsMatch(prtAddress.Trim())) ? true : false;
}
} }
} }

View File

@ -11,4 +11,11 @@
<PackageReference Include="MvvmLightLibs" Version="5.4.1.1" /> <PackageReference Include="MvvmLightLibs" Version="5.4.1.1" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\StandardDesign.Common\StandardDesign.Common.csproj" />
<ProjectReference Include="..\StandardDesign.DataAccess\StandardDesign.DataAccess.csproj" />
<ProjectReference Include="..\StandardDesign.IDataAccess\StandardDesign.IDataAccess.csproj" />
<ProjectReference Include="..\StandardDesign.Models\StandardDesign.Models.csproj" />
</ItemGroup>
</Project> </Project>

View File

@ -1,6 +1,8 @@
using CommonServiceLocator; using CommonServiceLocator;
using GalaSoft.MvvmLight; using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Ioc; using GalaSoft.MvvmLight.Ioc;
using StandardDesign.DataAccess;
using StandardDesign.IDataAccess;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -20,7 +22,7 @@ namespace StandardDesign.ViewModels
SimpleIoc.Default.Register<LoginViewModel>(); SimpleIoc.Default.Register<LoginViewModel>();
SimpleIoc.Default.Register<MainViewModel>(); SimpleIoc.Default.Register<MainViewModel>();
// SimpleIoc.Default.Register<ILoacalDataAccess, LoacalDataAccess>(); SimpleIoc.Default.Register<ILoacalDataAccess, LoacalDataAccess>();
} }
// 这种属性定义方式会有歧义,感觉好像定义的字段 // 这种属性定义方式会有歧义,感觉好像定义的字段
public LoginViewModel LoginViewModel => ServiceLocator.Current.GetInstance<LoginViewModel>(); public LoginViewModel LoginViewModel => ServiceLocator.Current.GetInstance<LoginViewModel>();

View File

@ -6,7 +6,7 @@
xmlns:local="clr-namespace:StandardDesign.Views" xmlns:local="clr-namespace:StandardDesign.Views"
xmlns:c="clr-namespace:StandardDesign.Common;assembly=StandardDesign.Common" xmlns:c="clr-namespace:StandardDesign.Common;assembly=StandardDesign.Common"
DataContext="{Binding Source={StaticResource locator},Path=LoginViewModel}" DataContext="{Binding Source={StaticResource locator},Path=LoginViewModel}"
mc:Ignorable="d" Name="win" FontFamily="Microsoft YaHei" mc:Ignorable="d" Name="win" FontFamily="{StaticResource DigitalDisplay}"
ResizeMode="NoResize" Background="#f1f5fd" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" Background="#f1f5fd" WindowStartupLocation="CenterScreen"
Title="系统登录" Height="540" Width="900"> Title="系统登录" Height="540" Width="900">
@ -21,24 +21,20 @@
<ResourceDictionary Source="pack://application:,,,/StandardDesign.Assets;component/Styles/ButtonStyles.xaml"/> <ResourceDictionary Source="pack://application:,,,/StandardDesign.Assets;component/Styles/ButtonStyles.xaml"/>
<ResourceDictionary> <ResourceDictionary>
<Style TargetType="TextBox" x:Key="UserNameTextBoxStyle"> <!--IP地址样式-->
<Setter Property="FontSize" Value="13"/> <Style x:Key="IPTextBoxStyle" TargetType="TextBox" >
<Setter Property="FontSize" Value="20"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="TextBox"> <ControlTemplate TargetType="TextBox">
<Border BorderBrush="#DDD" <Border BorderBrush="#DDD" BorderThickness="0,0,0,1" Height="40" SnapsToDevicePixels="True" Name="border">
BorderThickness="0,0,0,1" Height="40"
SnapsToDevicePixels="True" Name="border">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/> <ColumnDefinition Width="50"/>
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Text="&#xe610;" <TextBlock Text="&#xe645;" FontFamily="{DynamicResource Iconfont}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="40">
FontFamily="{DynamicResource Iconfont}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="15">
<TextBlock.Foreground> <TextBlock.Foreground>
<LinearGradientBrush StartPoint="0,1" EndPoint="1,0"> <LinearGradientBrush StartPoint="0,1" EndPoint="1,0">
<GradientStop Color="#16a1ff" Offset="0"/> <GradientStop Color="#16a1ff" Offset="0"/>
@ -47,8 +43,7 @@
</LinearGradientBrush> </LinearGradientBrush>
</TextBlock.Foreground> </TextBlock.Foreground>
</TextBlock> </TextBlock>
<TextBlock Text="请输入工号/手机号/用户名" Grid.Column="1" VerticalAlignment="Center" <TextBlock Text="请输入IP" Grid.Column="1" VerticalAlignment="Center" Foreground="#DDD" Name="markText" Visibility="Collapsed"/>
Foreground="#DDD" Name="markText" Visibility="Collapsed"/>
<ScrollViewer Name="PART_ContentHost" Grid.Column="1"/> <ScrollViewer Name="PART_ContentHost" Grid.Column="1"/>
</Grid> </Grid>
</Border> </Border>
@ -69,18 +64,20 @@
</Setter> </Setter>
</Style> </Style>
<Style TargetType="PasswordBox" x:Key="PasswordBoxStyle"> <!--Port样式-->
<Setter Property="FontSize" Value="13"/> <Style x:Key="PortTextBoxStyle" TargetType="TextBox">
<Setter Property="FontSize" Value="20"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="PasswordBox"> <ControlTemplate TargetType="TextBox">
<Border BorderBrush="#DDD" BorderThickness="0,0,0,1" Height="40" SnapsToDevicePixels="True" Name="border"> <Border BorderBrush="#DDD" BorderThickness="0,0,0,1" Height="40" SnapsToDevicePixels="True" Name="border">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/> <ColumnDefinition Width="50"/>
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Text="&#xe602;" FontFamily="{DynamicResource Iconfont}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="15"> <TextBlock Text="&#xe727;" FontFamily="{DynamicResource Iconfont}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="40">
<TextBlock.Foreground> <TextBlock.Foreground>
<LinearGradientBrush StartPoint="0,1" EndPoint="1,0"> <LinearGradientBrush StartPoint="0,1" EndPoint="1,0">
<GradientStop Color="#16a1ff" Offset="0"/> <GradientStop Color="#16a1ff" Offset="0"/>
@ -89,11 +86,11 @@
</LinearGradientBrush> </LinearGradientBrush>
</TextBlock.Foreground> </TextBlock.Foreground>
</TextBlock> </TextBlock>
<TextBlock Text="请输入登录密码" Grid.Column="1" VerticalAlignment="Center" Foreground="#DDD" Name="markText" <TextBlock Text="请输入端口号" Grid.Column="1" VerticalAlignment="Center" Foreground="#DDD" Name="markText" Visibility="Collapsed"/>
Visibility="Collapsed"/>
<ScrollViewer Name="PART_ContentHost" Grid.Column="1"/> <ScrollViewer Name="PART_ContentHost" Grid.Column="1"/>
</Grid> </Grid>
</Border> </Border>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true"> <Trigger Property="IsMouseOver" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/> <Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/>
@ -101,7 +98,50 @@
<Trigger Property="IsKeyboardFocused" Value="true"> <Trigger Property="IsKeyboardFocused" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="#FF569DE5"/> <Setter Property="BorderBrush" TargetName="border" Value="#FF569DE5"/>
</Trigger> </Trigger>
<DataTrigger Binding="{Binding Path=User.Password}" Value=""> <DataTrigger Binding="{Binding Path=Text,RelativeSource={RelativeSource Mode=Self}}" Value="">
<Setter Property="Visibility" TargetName="markText" Value="Visible"/>
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--验证码样式-->
<Style x:Key="AuthorizeTextBoxStyle" TargetType="TextBox">
<Setter Property="FontSize" Value="20"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Border BorderBrush="#DDD" BorderThickness="0,0,0,1" Height="40" SnapsToDevicePixels="True" Name="border">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="&#xe60e;" FontFamily="{DynamicResource Iconfont}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="40">
<TextBlock.Foreground>
<LinearGradientBrush StartPoint="0,1" EndPoint="1,0">
<GradientStop Color="#16a1ff" Offset="0"/>
<GradientStop Color="#b4fee7" Offset="0.65"/>
<GradientStop Color="#16a1ff" Offset="1"/>
</LinearGradientBrush>
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="请输入授权码" Grid.Column="1" VerticalAlignment="Center" Foreground="#DDD" Name="markText" Visibility="Collapsed"/>
<ScrollViewer Name="PART_ContentHost" Grid.Column="1"/>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="#FF7EB4EA"/>
</Trigger>
<Trigger Property="IsKeyboardFocused" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="#FF569DE5"/>
</Trigger>
<DataTrigger Binding="{Binding Path=Text,RelativeSource={RelativeSource Mode=Self}}" Value="">
<Setter Property="Visibility" TargetName="markText" Value="Visible"/> <Setter Property="Visibility" TargetName="markText" Value="Visible"/>
</DataTrigger> </DataTrigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
@ -111,6 +151,8 @@
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Window.Resources> </Window.Resources>
@ -182,26 +224,48 @@
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="40"/> <RowDefinition Height="40"/>
<RowDefinition Height="30"/> <RowDefinition Height="100"/>
<RowDefinition/> <RowDefinition Height="70"/>
<RowDefinition/> <RowDefinition Height="70"/>
<RowDefinition/> <RowDefinition Height="70"/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition /> <RowDefinition />
<RowDefinition Height="80"/>
<RowDefinition/> <RowDefinition/>
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!--窗口控制按钮--> <!--窗口控制按钮-->
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="20,10"> <StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="20,10">
<Button Content="&#xEA6A;" FontFamily="{DynamicResource Iconfont}" FontSize="14" Click="Button_MinClick" Style="{StaticResource WindowControlButtonStyle}" WindowChrome.IsHitTestVisibleInChrome="True"/> <Button Content="&#xEA6A;" FontFamily="{DynamicResource Iconfont}" FontSize="14" Click="Button_MinClick" Style="{StaticResource WindowControlButtonStyle}" WindowChrome.IsHitTestVisibleInChrome="True" Margin="10,0"/>
<Button Content="&#xE653;" FontFamily="{DynamicResource Iconfont}" FontSize="14" Click="Button_MaxClick" Style="{StaticResource WindowControlButtonStyle}" WindowChrome.IsHitTestVisibleInChrome="True" Margin="10,0"/> <!--<Button Content="&#xE653;" FontFamily="{DynamicResource Iconfont}" FontSize="14" Click="Button_MaxClick" Style="{StaticResource WindowControlButtonStyle}" WindowChrome.IsHitTestVisibleInChrome="True" Margin="10,0"/>-->
<Button Content="&#xe635;" FontFamily="{DynamicResource Iconfont}" FontSize="14" Click="Button_CloseClick" Style="{StaticResource WindowControlButtonStyle}" WindowChrome.IsHitTestVisibleInChrome="True" /> <Button Content="&#xe635;" FontFamily="{DynamicResource Iconfont}" FontSize="14" Click="Button_CloseClick" Style="{StaticResource WindowControlButtonStyle}" WindowChrome.IsHitTestVisibleInChrome="True" />
</StackPanel> </StackPanel>
<TextBlock Text="Socket连接" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="30"/> <TextBlock Text="Socket连接" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="30"/>
<!--Ip-->
<TextBox Grid.Row="2" VerticalContentAlignment="Center" Style="{StaticResource IPTextBoxStyle}"
Text="{Binding IP,UpdateSourceTrigger=PropertyChanged}" Width="287"/>
<!--端口号-->
<TextBox Grid.Row="3" VerticalContentAlignment="Center" Style="{StaticResource PortTextBoxStyle}"
Text="{Binding Port,UpdateSourceTrigger=PropertyChanged}" Width="287"/>
<!--授权码-->
<TextBox Grid.Row="4" VerticalContentAlignment="Center" Style="{StaticResource AuthorizeTextBoxStyle}"
Text="{Binding AuthorizeCode,UpdateSourceTrigger=PropertyChanged}" Width="287"/>
<!--错误提示信息-->
<TextBlock Text="{Binding FailedMsg}" Grid.Row="5" Foreground="Red" VerticalAlignment="Center"
HorizontalAlignment="Center" TextWrapping="Wrap"/>
<!--登录-->
<Button Content="登录" Grid.Row="6" Height="35" Style="{StaticResource NormalButtonStyle}"
Command="{Binding LoginCommand}" CommandParameter="{Binding ElementName=win}" Margin="82,22,83,23"/>
<!--记住当前设置-->
<CheckBox Content="记住当前设置" Foreground="#BBB" VerticalAlignment="Center" HorizontalAlignment="Left" VerticalContentAlignment="Center"
FontSize="15" Grid.Row="7" IsChecked="{Binding IsRecord}" Margin="51,0,0,0"/>
<!--跳过连接-->
<Button Content="跳过连接" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Foreground="#1E90FF" Command="{Binding SkipCommand}"
CommandParameter="{Binding ElementName=win}" Grid.Row="7" FontSize="15" HorizontalAlignment="Left" Margin="354,0,0,0"/>
</Grid> </Grid>

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -33,17 +34,11 @@ namespace StandardDesign.Views
/// <param name="e"></param> /// <param name="e"></param>
private void Button_CloseClick(object sender, RoutedEventArgs e) private void Button_CloseClick(object sender, RoutedEventArgs e)
{ {
//if (systemOperationView.buttonConnect.Content.ToString() == "断开连接") if (MessageBox.Show("是否确认关闭该软件", "退出软件", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
//{ {
// systemOperationView.AddLog("蓝牙连接未断开!请先断开后,再关闭主窗口!");
// MessageBox.Show("蓝牙连接未断开!请先断开后,再关闭主窗口!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
//}
//else
//{
// this.Close();
//}
this.Close(); this.Close();
} }
}
/// <summary> /// <summary>
/// 主窗口最小化事件 /// 主窗口最小化事件
/// </summary> /// </summary>

View File

@ -6,11 +6,11 @@
xmlns:local="clr-namespace:StandardDesign.Views" xmlns:local="clr-namespace:StandardDesign.Views"
xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:sys="clr-namespace:System;assembly=mscorlib"
DataContext="{Binding Source={StaticResource locator},Path=MainViewModel}" DataContext="{Binding Source={StaticResource locator},Path=MainViewModel}"
mc:Ignorable="d" mc:Ignorable="d" FontFamily="{StaticResource DigitalDisplay}"
d:DesignHeight="450" d:DesignWidth="800" d:DesignHeight="450" d:DesignWidth="800"
Title="MainView"> Title="主页">
<Grid> <Grid>
<TextBlock Text="aaaaa"/> <TextBlock Text="欢迎登录" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#B0C4DE" FontSize="52"/>
</Grid> </Grid>
</Window> </Window>

View File

@ -7,6 +7,6 @@
<Application.Resources> <Application.Resources>
<v:ViewModelLocator x:Key="locator"/> <v:ViewModelLocator x:Key="locator"/>
<FontFamily x:Key="Iconfont">pack://application:,,,/StandardDesign.Assets;component/Fonts/#iconfont</FontFamily> <FontFamily x:Key="Iconfont">pack://application:,,,/StandardDesign.Assets;component/Fonts/#iconfont</FontFamily>
<FontFamily x:Key="DigitalDisplay">pack://application:,,,/StandardDesign.Assets;component/Fonts/#Digital Display</FontFamily> <FontFamily x:Key="DigitalDisplay">pack://application:,,,/StandardDesign.Assets;component/Fonts/#方正楷体简体</FontFamily>
</Application.Resources> </Application.Resources>
</Application> </Application>

View File

@ -6,8 +6,13 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<ApplicationIcon>bitbug_favicon.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Content Include="bitbug_favicon.ico" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\StandardDesign.Assets\StandardDesign.Assets.csproj" /> <ProjectReference Include="..\StandardDesign.Assets\StandardDesign.Assets.csproj" />
<ProjectReference Include="..\StandardDesign.ViewModels\StandardDesign.ViewModels.csproj" /> <ProjectReference Include="..\StandardDesign.ViewModels\StandardDesign.ViewModels.csproj" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB