初始化提交
13
电子展板/App.xaml
Normal file
@@ -0,0 +1,13 @@
|
||||
<Application x:Class="电子展板.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:电子展板" >
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
28
电子展板/App.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using HandyControl.Collections;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
|
||||
namespace 电子展板
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
public App()
|
||||
{
|
||||
}
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
MainWindow mainWindow = new MainWindow();
|
||||
mainWindow.Show();
|
||||
|
||||
MainWindow2 mainWindow2 = new MainWindow2();
|
||||
mainWindow2.Show();
|
||||
base.OnStartup(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
BIN
电子展板/Assets/0.jpg
Normal file
|
After Width: | Height: | Size: 36 KiB |
373
电子展板/Assets/AmazeUI/css/admin.css
Normal file
@@ -0,0 +1,373 @@
|
||||
/**
|
||||
* admin.css
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
fixed-layout 固定头部和边栏布局
|
||||
*/
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.admin-icon-yellow {
|
||||
color: #ffbe40;
|
||||
}
|
||||
|
||||
.admin-header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 1500;
|
||||
font-size: 1.4rem;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.admin-header-list a:hover :after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
.admin-main {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
padding-top: 51px;
|
||||
background: #f3f3f3;
|
||||
}
|
||||
|
||||
.admin-menu {
|
||||
position: fixed;
|
||||
z-index: 10;
|
||||
bottom: 30px;
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
.admin-sidebar {
|
||||
width: 260px;
|
||||
min-height: 100%;
|
||||
float: left;
|
||||
border-right: 1px solid #cecece;
|
||||
}
|
||||
|
||||
.admin-sidebar.am-active {
|
||||
z-index: 1600;
|
||||
}
|
||||
|
||||
.admin-sidebar-list {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.admin-sidebar-list li a {
|
||||
color: #5c5c5c;
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
.admin-sidebar-list li:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.admin-sidebar-sub {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
box-shadow: 0 16px 8px -15px #e2e2e2 inset;
|
||||
background: #ececec;
|
||||
padding-left: 24px;
|
||||
}
|
||||
|
||||
.admin-sidebar-sub li:first-child {
|
||||
border-top: 1px solid #dedede;
|
||||
}
|
||||
|
||||
.admin-sidebar-panel {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.admin-content {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-webkit-flex-direction: column;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.admin-content,
|
||||
.admin-sidebar {
|
||||
height: 100%;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.admin-content-body {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex: 1 0 auto;
|
||||
-ms-flex: 1 0 auto;
|
||||
flex: 1 0 auto;
|
||||
}
|
||||
|
||||
.admin-content-footer {
|
||||
font-size: 85%;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.admin-content-list {
|
||||
border: 1px solid #e9ecf1;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.admin-content-list li {
|
||||
border: 1px solid #e9ecf1;
|
||||
border-width: 0 1px;
|
||||
margin-left: -1px;
|
||||
}
|
||||
|
||||
.admin-content-list li:first-child {
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
.admin-content-list li:last-child {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.admin-content-table a {
|
||||
color: #535353;
|
||||
}
|
||||
.admin-content-file {
|
||||
margin-bottom: 0;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.admin-content-file p {
|
||||
margin: 0 0 5px 0;
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
.admin-content-file li {
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.admin-content-file li:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.admin-content-file li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.admin-content-file li .am-progress {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.admin-content-file li .am-progress-bar {
|
||||
line-height: 14px;
|
||||
}
|
||||
|
||||
.admin-content-task {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.admin-content-task li {
|
||||
padding: 5px 0;
|
||||
border-color: #eee;
|
||||
}
|
||||
|
||||
.admin-content-task li:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.admin-content-task li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.admin-task-meta {
|
||||
font-size: 1.2rem;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.admin-task-bd {
|
||||
font-size: 1.4rem;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.admin-content-comment {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.admin-content-comment .am-comment-bd {
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
.admin-content-pagination {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.admin-content-pagination li a {
|
||||
padding: 4px 8px;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 641px) {
|
||||
.admin-sidebar {
|
||||
display: block;
|
||||
position: static;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.admin-offcanvas-bar {
|
||||
position: static;
|
||||
width: auto;
|
||||
background: none;
|
||||
-webkit-transform: translate3d(0, 0, 0);
|
||||
-ms-transform: translate3d(0, 0, 0);
|
||||
transform: translate3d(0, 0, 0);
|
||||
overflow-y: visible;
|
||||
min-height: 100%;
|
||||
}
|
||||
.admin-offcanvas-bar:after {
|
||||
content: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 640px) {
|
||||
.admin-sidebar {
|
||||
width: inherit;
|
||||
}
|
||||
|
||||
.admin-offcanvas-bar {
|
||||
background: #f3f3f3;
|
||||
}
|
||||
|
||||
.admin-offcanvas-bar:after {
|
||||
background: #BABABA;
|
||||
}
|
||||
|
||||
.admin-sidebar-list a:hover, .admin-sidebar-list a:active{
|
||||
-webkit-transition: background-color .3s ease;
|
||||
-moz-transition: background-color .3s ease;
|
||||
-ms-transition: background-color .3s ease;
|
||||
-o-transition: background-color .3s ease;
|
||||
transition: background-color .3s ease;
|
||||
background: #E4E4E4;
|
||||
}
|
||||
|
||||
.admin-content-list li {
|
||||
padding: 10px;
|
||||
border-width: 1px 0;
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
.admin-content-list li:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.admin-content-list li:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.admin-form-text {
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* user.html css
|
||||
*/
|
||||
.user-info {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.user-info .am-progress {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.user-info p {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.user-info-order {
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
/*
|
||||
* errorLog.html css
|
||||
*/
|
||||
|
||||
.error-log .am-pre-scrollable {
|
||||
max-height: 40rem;
|
||||
}
|
||||
|
||||
/*
|
||||
* table.html css
|
||||
*/
|
||||
|
||||
.table-main {
|
||||
font-size: 1.4rem;
|
||||
padding: .5rem;
|
||||
}
|
||||
|
||||
.table-main button {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.table-check {
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
.table-id {
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 640px) {
|
||||
.table-select {
|
||||
margin-top: 10px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
gallery.html css
|
||||
*/
|
||||
|
||||
.gallery-list li {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.gallery-list a {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.gallery-list a:hover {
|
||||
color: #3bb4f2;
|
||||
}
|
||||
|
||||
.gallery-title {
|
||||
margin-top: 6px;
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
.gallery-desc {
|
||||
font-size: 1.2rem;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
/*
|
||||
404.html css
|
||||
*/
|
||||
|
||||
.page-404 {
|
||||
background: #fff;
|
||||
border: none;
|
||||
width: 200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
14550
电子展板/Assets/AmazeUI/css/amazeui.css
Normal file
14572
电子展板/Assets/AmazeUI/css/amazeui.flat.css
Normal file
1
电子展板/Assets/AmazeUI/css/amazeui.flat.min.css
vendored
Normal file
1
电子展板/Assets/AmazeUI/css/amazeui.min.css
vendored
Normal file
1
电子展板/Assets/AmazeUI/css/app.css
Normal file
@@ -0,0 +1 @@
|
||||
/* Write your styles */
|
||||
BIN
电子展板/Assets/AmazeUI/fonts/FontAwesome.otf
Normal file
BIN
电子展板/Assets/AmazeUI/fonts/fontawesome-webfont.eot
Normal file
BIN
电子展板/Assets/AmazeUI/fonts/fontawesome-webfont.ttf
Normal file
BIN
电子展板/Assets/AmazeUI/fonts/fontawesome-webfont.woff
Normal file
BIN
电子展板/Assets/AmazeUI/fonts/fontawesome-webfont.woff2
Normal file
BIN
电子展板/Assets/AmazeUI/i/app-icon72x72@2x.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
电子展板/Assets/AmazeUI/i/examples/admin-chrome.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
电子展板/Assets/AmazeUI/i/examples/admin-firefox.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
电子展板/Assets/AmazeUI/i/examples/admin-ie.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
电子展板/Assets/AmazeUI/i/examples/admin-opera.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
电子展板/Assets/AmazeUI/i/examples/admin-safari.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
电子展板/Assets/AmazeUI/i/examples/adminPage.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
电子展板/Assets/AmazeUI/i/examples/blogPage.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
电子展板/Assets/AmazeUI/i/examples/landing.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
电子展板/Assets/AmazeUI/i/examples/landingPage.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
电子展板/Assets/AmazeUI/i/examples/loginPage.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
电子展板/Assets/AmazeUI/i/examples/sidebarPage.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
电子展板/Assets/AmazeUI/i/favicon.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
电子展板/Assets/AmazeUI/i/startup-640x1096.png
Normal file
|
After Width: | Height: | Size: 9.4 KiB |
2880
电子展板/Assets/AmazeUI/js/amazeui.ie8polyfill.js
Normal file
3
电子展板/Assets/AmazeUI/js/amazeui.ie8polyfill.min.js
vendored
Normal file
16780
电子展板/Assets/AmazeUI/js/amazeui.js
Normal file
8
电子展板/Assets/AmazeUI/js/amazeui.min.js
vendored
Normal file
92
电子展板/Assets/AmazeUI/js/amazeui.widgets.helper.js
Normal file
3
电子展板/Assets/AmazeUI/js/amazeui.widgets.helper.min.js
vendored
Normal file
14
电子展板/Assets/AmazeUI/js/app.js
Normal file
@@ -0,0 +1,14 @@
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
$(function() {
|
||||
var $fullText = $('.admin-fullText');
|
||||
$('#admin-fullscreen').on('click', function() {
|
||||
$.AMUI.fullscreen.toggle();
|
||||
});
|
||||
|
||||
$(document).on($.AMUI.fullscreen.raw.fullscreenchange, function() {
|
||||
$fullText.text($.AMUI.fullscreen.isFullscreen ? '退出全屏' : '开启全屏');
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
29
电子展板/Assets/AmazeUI/js/handlebars.min.js
vendored
Normal file
229
电子展板/Assets/Views/Login.html
Normal file
@@ -0,0 +1,229 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Quick Start - Layui</title>
|
||||
<link href="layui/css/layui.css" rel="stylesheet">
|
||||
<style>
|
||||
.container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 15vh;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h2>展板数据配置</h2>
|
||||
</div>
|
||||
<form class="layui-form" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">时间</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" class="layui-input" id="ID-laydate-type-time" placeholder="HH:mm:ss" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">字体大小</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="price_min" lay-verify="required" placeholder="字体大小" lay-verify="required" autocomplete="off" class="layui-input" min="15" max="60" step="1" lay-affix="number">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">负责人</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" class="layui-input" placeholder="负责人" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">字体大小</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="price_min" lay-verify="required" placeholder="字体大小" autocomplete="off" class="layui-input" min="15" max="60" step="1" lay-affix="number">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">风险等级</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" class="layui-input" placeholder="风险等级" lay-verify="required">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">字体大小</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="price_min" placeholder="字体大小" autocomplete="off" class="layui-input" min="15" max="60" step="1" lay-affix="number">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">工作内容</label>
|
||||
<div class="layui-input-inline">
|
||||
<textarea name="message" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">字体大小</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="price_min" placeholder="字体大小" autocomplete="off" class="layui-input" min="15" max="60" step="1" lay-affix="number">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">危险点</label>
|
||||
<div class="layui-input-inline">
|
||||
<textarea name="message" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">字体大小</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="price_min" placeholder="字体大小" autocomplete="off" class="layui-input" min="15" max="60" step="1" lay-affix="number">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">重点管控措施</label>
|
||||
<div class="layui-input-inline">
|
||||
<textarea name="message" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">字体大小</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="price_min" placeholder="字体大小" autocomplete="off" class="layui-input" min="15" max="60" step="1" lay-affix="number">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<div class="layui-upload">
|
||||
<button type="button" class="layui-btn" id="ID-upload-demo-btn-2" style="margin-left:30px">
|
||||
<i class="layui-icon layui-icon-upload"></i> 党员上传
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 11px;">
|
||||
预览图:
|
||||
<div class="layui-upload-list" id="upload-demo-preview"></div>
|
||||
</blockquote>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
|
||||
<script src="layui/layui.js"></script>
|
||||
<script>
|
||||
layui.use(['form', 'laydate', 'util'], function () {
|
||||
var form = layui.form;
|
||||
var layer = layui.layer;
|
||||
var laydate = layui.laydate;
|
||||
var upload = layui.upload;
|
||||
var util = layui.util;
|
||||
|
||||
|
||||
// 多图片上传
|
||||
upload.render({
|
||||
elem: '#ID-upload-demo-btn-2',
|
||||
url: '', // 实际使用时改成您自己的上传接口即可。
|
||||
multiple: true,
|
||||
before: function (obj) {
|
||||
// 预读本地文件示例,不支持ie8
|
||||
obj.preview(function (index, file, result) {
|
||||
$('#upload-demo-preview').append('<img src="' + result + '" alt="' + file.name + '" style="width: 90px; height: 90px;">')
|
||||
});
|
||||
},
|
||||
done: function (res) {
|
||||
// 上传完毕
|
||||
// …
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 时间选择器
|
||||
laydate.render({
|
||||
elem: '#ID-laydate-type-time',
|
||||
type: 'time'
|
||||
});
|
||||
// 自定义验证规则
|
||||
form.verify({
|
||||
pass: function (value) {
|
||||
if (!/(.+){6,12}$/.test(value)) {
|
||||
return '密码必须 6 到 12 位';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 指定开关事件
|
||||
form.on('switch(switchTest)', function (data) {
|
||||
layer.msg('开关 checked:' + (this.checked ? 'true' : 'false'), {
|
||||
offset: '6px'
|
||||
});
|
||||
layer.tips('温馨提示:请注意开关状态的文字可以随意定义,而不仅仅是 ON|OFF', data.othis)
|
||||
});
|
||||
|
||||
// 提交事件
|
||||
form.on('submit(demo1)', function (data) {
|
||||
var field = data.field; // 获取表单字段值
|
||||
// 显示填写结果,仅作演示用
|
||||
layer.alert(JSON.stringify(field), {
|
||||
title: '当前填写的字段值'
|
||||
});
|
||||
// 此处可执行 Ajax 等操作
|
||||
// …
|
||||
return false; // 阻止默认 form 跳转
|
||||
});
|
||||
|
||||
// 日期
|
||||
laydate.render({
|
||||
elem: '#date'
|
||||
});
|
||||
|
||||
// 普通事件
|
||||
util.on('lay-on', {
|
||||
// 获取验证码
|
||||
"get-vercode": function (othis) {
|
||||
var isvalid = form.validate('.demo-phone'); // 主动触发验证,v2.7.0 新增
|
||||
// 验证通过
|
||||
if (isvalid) {
|
||||
layer.msg('手机号规则验证通过');
|
||||
// 此处可继续书写「发送验证码」等后续逻辑
|
||||
// …
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
1
电子展板/Assets/layui/css/layui.css
Normal file
BIN
电子展板/Assets/layui/font/iconfont.eot
Normal file
409
电子展板/Assets/layui/font/iconfont.svg
Normal file
|
After Width: | Height: | Size: 326 KiB |
BIN
电子展板/Assets/layui/font/iconfont.ttf
Normal file
BIN
电子展板/Assets/layui/font/iconfont.woff
Normal file
BIN
电子展板/Assets/layui/font/iconfont.woff2
Normal file
1
电子展板/Assets/layui/layui.js
Normal file
95
电子展板/Configs/NLog.config
Normal file
@@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<targets>
|
||||
<!--此部分中的所有目标将自动异步-->
|
||||
<target name="asyncFile" xsi:type="AsyncWrapper">
|
||||
<!--项目日志保存文件路径说明fileName="${basedir}/保存目录,以年月日的格式创建/${shortdate}/${记录器名称}-${单级记录}-${shortdate}.txt"-->
|
||||
<target name="log_file" xsi:type="File"
|
||||
fileName="${basedir}/Log/${shortdate}.log"
|
||||
layout="${longdate} [${threadid}] ${level} - ${message} ${onexception:${exception:format=message} ${newline} ${stacktrace} ${newline}"
|
||||
archiveFileName="${basedir}/Log/${shortdate}-{#####}.log"
|
||||
archiveAboveSize="102400"
|
||||
archiveNumbering="Sequence"
|
||||
maxArchiveDays="30"
|
||||
concurrentWrites="true"
|
||||
keepFileOpen="false" />
|
||||
<!-- 2025-07-28 10:55:15.9719 [1] Info - Message -->
|
||||
</target>
|
||||
<!--使用可自定义的着色将日志消息写入控制台-->
|
||||
<target name="colorConsole" xsi:type="ColoredConsole" layout="[${date:format=HH\:mm\:ss}]:${message} ${exception:format=message}" />
|
||||
</targets>
|
||||
|
||||
<!--规则配置,final - 最终规则匹配后不处理任何规则-->
|
||||
<rules>
|
||||
<logger name="Microsoft.*" minlevel="Info" writeTo="" final="true" />
|
||||
<logger name="*" minlevel="Info" writeTo="asyncFile" />
|
||||
<logger name="*" minlevel="Info" writeTo="colorConsole" />
|
||||
</rules>
|
||||
<!--
|
||||
NLog允许的日志级别由高到低依次是:
|
||||
|
||||
Fatal
|
||||
Error
|
||||
Warn
|
||||
Info
|
||||
Debug
|
||||
Trace
|
||||
Off
|
||||
-->
|
||||
|
||||
<!--
|
||||
${all-event-properties} 事件日志上下文
|
||||
${appdomain} 当前应用程序域
|
||||
${assembly-version} 应用程序
|
||||
${basedir} 应用程序域的基本目录。
|
||||
${callsite} (类名称、方法名称和相关信息的源信息)。
|
||||
${callsite-linenumber} 调用类的
|
||||
${counter} 数值
|
||||
${date} 当前日期和时间。
|
||||
${document-uri} 用于Silverlight应用。
|
||||
${environment} 环境变量
|
||||
${event-properties}
|
||||
${exception} exception信息
|
||||
${file-contents} 显示指定文件的内容
|
||||
${gc} 垃圾收集器
|
||||
${gdc} 诊断上下文
|
||||
${guid} GUID
|
||||
${identity} 线程标识信息
|
||||
${install-context} 安装参数
|
||||
${level} 级别。
|
||||
${literal}
|
||||
${log4jxmlevent} XML事件描述
|
||||
${logger} 记录器的名字
|
||||
${longdate} 日期和时间的格式分类yyyy-MM-dd HH:mm:ss.ffff。
|
||||
${machinename} 名称
|
||||
${mdc} 映射诊断
|
||||
${mdlc} 异步映射诊断上下文
|
||||
${message} 消息
|
||||
${ndc} 线程结构
|
||||
${ndlc} 异步线程
|
||||
${newline} 文字换行
|
||||
${nlogdir} nlog.dll目录。
|
||||
${performancecounter} 述性能计数器。
|
||||
${processid} 当前进程标识符
|
||||
${processinfo} 运行信息
|
||||
${processname} 当前进程的名称。
|
||||
${processtime} 该时间过程中格式HH:MM:ss.mmm。
|
||||
${qpc} 高精度定时器,基于返回的值从queryperformancecounter(任选地)转换为秒。
|
||||
${registry} 从注册表中的值。
|
||||
${sequenceid} ID
|
||||
${shortdate} 短时间 格式YYYY-MM-DD。
|
||||
${sl-appinfo} Silverlight应用。
|
||||
${specialfolder} 文件夹路径
|
||||
${stacktrace} 堆栈跟踪渲染器。
|
||||
${tempdir} 临时目录中。
|
||||
${threadid} 当前线程的标识符。
|
||||
${threadname} 当前线程。
|
||||
${ticks} 当前日期和时间。
|
||||
${time} 24小时格式HH:MM:ss.mmm。
|
||||
${var} {$var}-提供新的变量(4.1)
|
||||
${windows-identity} windows线程标识信息(用户名)
|
||||
-->
|
||||
|
||||
</nlog>
|
||||
1
电子展板/Configs/config.json
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
155
电子展板/Controller/AmazeUIController.cs
Normal file
@@ -0,0 +1,155 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace 电子展板.Controller
|
||||
{
|
||||
public class AmazeUIController : BaseController
|
||||
{
|
||||
#region css
|
||||
[HttpGet, Route("AmazeUI/css/admin.css")]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return Resouce("/AmazeUI/css/admin.css", "text/css");
|
||||
}
|
||||
|
||||
[HttpGet, Route("AmazeUI/css/amazeui.css")]
|
||||
public ActionResult AmazeuiCSS()
|
||||
{
|
||||
return Resouce("/AmazeUI/css/amazeui.css", "text/css");
|
||||
}
|
||||
|
||||
[HttpGet, Route("AmazeUI/css/amazeui.flat.css")]
|
||||
public ActionResult AmazeuiFlatCss()
|
||||
{
|
||||
return Resouce("/AmazeUI/css/amazeui.flat.css", "text/css");
|
||||
}
|
||||
|
||||
[HttpGet, Route("AmazeUI/css/amazeui.flat.min.css")]
|
||||
public ActionResult AmazeuiFlatMinCSS()
|
||||
{
|
||||
return Resouce("/AmazeUI/css/amazeui.flat.min.css", "text/css");
|
||||
}
|
||||
|
||||
[HttpGet, Route("AmazeUI/css/amazeui.min.css")]
|
||||
public ActionResult AmazeuiMinCSS()
|
||||
{
|
||||
return Resouce("/AmazeUI/css/amazeui.min.css", "text/css");
|
||||
}
|
||||
|
||||
[HttpGet, Route("AmazeUI/css/app.css")]
|
||||
public ActionResult AppCSS()
|
||||
{
|
||||
return Resouce("/AmazeUI/css/app.css", "text/css");
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region fonts
|
||||
[HttpGet, Route("AmazeUI/fonts/FontAwesome.otf")]
|
||||
public ActionResult FontAwesomeotf()
|
||||
{
|
||||
return Resouce("/AmazeUI/fonts/FontAwesome.otf", "font/otf");
|
||||
}
|
||||
[HttpGet, Route("AmazeUI/fonts/fontawesome-webfont.eot")]
|
||||
public ActionResult fontawesome_webfont_eot()
|
||||
{
|
||||
return Resouce("/AmazeUI/fonts/fontawesome-webfont.eot", "font/eot");
|
||||
}
|
||||
[HttpGet, Route("AmazeUI/fonts/fontawesome-webfont.ttf")]
|
||||
public ActionResult fontawesome_webfont_ttf()
|
||||
{
|
||||
return Resouce("/AmazeUI/fonts/fontawesome-webfont.ttf", "font/ttf");
|
||||
}
|
||||
[HttpGet, Route("AmazeUI/fonts/fontawesome-webfont.woff")]
|
||||
public ActionResult fontawesome_webfont_woff()
|
||||
{
|
||||
return Resouce("/AmazeUI/fonts/fontawesome-webfont.woff", "font/woff");
|
||||
}
|
||||
[HttpGet, Route("AmazeUI/fonts/fontawesome-webfont.woff2")]
|
||||
public ActionResult fontawesome_webfont_woff2()
|
||||
{
|
||||
return Resouce("/AmazeUI/fonts/fontawesome-webfont.woff2", "font/woff2");
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region i
|
||||
[HttpGet, Route("AmazeUI/i/app-icon72x72@2x.png")]
|
||||
public ActionResult app_icon72x72_2x_png()
|
||||
{
|
||||
return Resouce("/AmazeUI/i/app-icon72x72@2x.png", "image/png");
|
||||
}
|
||||
|
||||
[HttpGet, Route("AmazeUI/i/favicon.png")]
|
||||
public ActionResult favicon_png()
|
||||
{
|
||||
return Resouce("/AmazeUI/i/favicon.png", "image/png");
|
||||
}
|
||||
|
||||
[HttpGet, Route("AmazeUI/i/startup-640x1096.png")]
|
||||
public ActionResult startup_640x1096_png()
|
||||
{
|
||||
return Resouce("/AmazeUI/i/startup-640x1096.png", "image/png");
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
#region JS
|
||||
[HttpGet, Route("AmazeUI/js/amazeui.ie8polyfill.js")]
|
||||
public ActionResult amazeui_ie8polyfill_js()
|
||||
{
|
||||
return Resouce("/AmazeUI/js/amazeui.ie8polyfill.js", "application/javascript");
|
||||
}
|
||||
[HttpGet, Route("AmazeUI/js/amazeui.ie8polyfill.min.js")]
|
||||
public ActionResult amazeui_ie8polyfill_min_js()
|
||||
{
|
||||
return Resouce("/AmazeUI/js/amazeui.ie8polyfill.min.js", "application/javascript");
|
||||
}
|
||||
|
||||
|
||||
[HttpGet, Route("AmazeUI/js/amazeui.js")]
|
||||
public ActionResult amazeui_js()
|
||||
{
|
||||
return Resouce("/AmazeUI/js/amazeui.js", "application/javascript");
|
||||
}
|
||||
|
||||
|
||||
[HttpGet, Route("AmazeUI/js/amazeui.min.js")]
|
||||
public ActionResult amazeui_min_js()
|
||||
{
|
||||
return Resouce("/AmazeUI/js/amazeui.min.js", "application/javascript");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[HttpGet, Route("AmazeUI/js/amazeui.widgets.helper.js")]
|
||||
public ActionResult amazeui_widgets_helper_js()
|
||||
{
|
||||
return Resouce("/AmazeUI/js/amazeui.widgets.helper.js", "application/javascript");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[HttpGet, Route("AmazeUI/js/amazeui.widgets.helper.min.js")]
|
||||
public ActionResult amazeui_widgets_helper_min_js()
|
||||
{
|
||||
return Resouce("/AmazeUI/js/amazeui.widgets.helper.min.js", "application/javascript");
|
||||
}
|
||||
|
||||
|
||||
[HttpGet, Route("AmazeUI/js/app_js")]
|
||||
public ActionResult app_js()
|
||||
{
|
||||
return Resouce("/AmazeUI/js/app_js", "application/javascript");
|
||||
}
|
||||
[HttpGet, Route("AmazeUI/js/handlebars.min.js")]
|
||||
public ActionResult handlebars_min_js()
|
||||
{
|
||||
return Resouce("/AmazeUI/js/handlebars.min.js", "application/javascript");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
206
电子展板/Controller/BaseController.cs
Normal file
@@ -0,0 +1,206 @@
|
||||
using JinianNet.JNTemplate;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Pipes;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Results;
|
||||
using System.Xml.Linq;
|
||||
using 电子展板.Utility.Core;
|
||||
using 电子展板.Utility.Extension;
|
||||
using 电子展板.Utility.ResponseModels;
|
||||
|
||||
|
||||
namespace 电子展板.Controller
|
||||
{
|
||||
|
||||
public class BaseController : ApiController
|
||||
{
|
||||
protected ActionResult Content(string content)
|
||||
{
|
||||
return new ActionResult { Content = new StringContent(content, Encoding.UTF8, "text/plain") };
|
||||
}
|
||||
|
||||
protected ActionResult ContentType(string content, string contentType)
|
||||
{
|
||||
return new ActionResult { Content = new StringContent(content, Encoding.UTF8, contentType) };
|
||||
}
|
||||
|
||||
public new ActionResult Redirect(string url)
|
||||
{
|
||||
ActionResult resp = new ActionResult(HttpStatusCode.Moved);
|
||||
string originalString = Request.RequestUri.OriginalString;
|
||||
string pathAndQuery = Request.RequestUri.PathAndQuery;
|
||||
string baseUrl = originalString.Substring(0, originalString.IndexOf(pathAndQuery));
|
||||
resp.Headers.Location = new Uri(baseUrl + url);
|
||||
return resp;
|
||||
}
|
||||
|
||||
protected ActionResult File(string virtualPath, string contentType)
|
||||
{
|
||||
return File(virtualPath, contentType, "HelloWorld");
|
||||
}
|
||||
|
||||
protected ActionResult File(string virtualPath, string contentType, string fileDownloadName)
|
||||
{
|
||||
string physicalPath = MyEnvironment.WebRootPath(virtualPath);
|
||||
return PhysicalFile(physicalPath, contentType, fileDownloadName);
|
||||
}
|
||||
|
||||
protected ActionResult PhysicalFile(string physicalPath, string contentType)
|
||||
{
|
||||
return PhysicalFile(physicalPath, contentType, "HelloWorld");
|
||||
}
|
||||
|
||||
protected ActionResult PhysicalFile(string physicalPath, string contentType, string fileDownloadName)
|
||||
{
|
||||
return File(System.IO.File.OpenRead(physicalPath), contentType, fileDownloadName);
|
||||
}
|
||||
|
||||
|
||||
protected ActionResult File(byte[] fileContents, string contentType)
|
||||
{
|
||||
return File(fileContents, contentType, "HelloWorld");
|
||||
}
|
||||
|
||||
|
||||
protected ActionResult File(byte[] fileContents, string contentType, string fileDownloadName)
|
||||
{
|
||||
ActionResult response = new ActionResult(HttpStatusCode.OK);
|
||||
response.Content = new ByteArrayContent(fileContents);
|
||||
response.Content.Headers.ContentType = new MediaTypeHeaderValue(contentType);
|
||||
response.Content.Headers.ContentLength = fileContents.Length;
|
||||
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
|
||||
{
|
||||
FileName = HttpUtility.UrlEncode(fileDownloadName)
|
||||
};
|
||||
response.Headers.Add("Access-Control-Expose-Headers", "FileName");
|
||||
response.Headers.Add("FileName", HttpUtility.UrlEncode(fileDownloadName));
|
||||
return response;
|
||||
}
|
||||
|
||||
protected ActionResult File(Stream fileStream, string contentType)
|
||||
{
|
||||
return File(fileStream, contentType, "HelloWorld");
|
||||
}
|
||||
|
||||
protected ActionResult File(Stream fileStream, string contentType, string fileDownloadName)
|
||||
{
|
||||
ActionResult response = new ActionResult(HttpStatusCode.OK);
|
||||
response.Content = new StreamContent(fileStream);
|
||||
response.Content.Headers.ContentType = new MediaTypeHeaderValue(contentType);
|
||||
response.Content.Headers.ContentLength = fileStream.Length;
|
||||
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
|
||||
{
|
||||
FileName = HttpUtility.UrlEncode(fileDownloadName)
|
||||
};
|
||||
response.Headers.Add("Access-Control-Expose-Headers", "FileName");
|
||||
response.Headers.Add("FileName", HttpUtility.UrlEncode(fileDownloadName));
|
||||
return response;
|
||||
}
|
||||
#region 快捷方法
|
||||
protected ActionResult Success(string message = "恭喜您,操作成功。", object data = null)
|
||||
{
|
||||
return Content(new AjaxResult(ResultType.Success, message, data).ToJson());
|
||||
}
|
||||
protected ActionResult Error(string message = "对不起,操作失败。", object data = null)
|
||||
{
|
||||
return Content(new AjaxResult(ResultType.Error, message, data).ToJson());
|
||||
}
|
||||
protected ActionResult Warning(string message, object data = null)
|
||||
{
|
||||
return Content(new AjaxResult(ResultType.Warning, message, data).ToJson());
|
||||
}
|
||||
protected ActionResult Info(string message, object data = null)
|
||||
{
|
||||
return Content(new AjaxResult(ResultType.Info, message, data).ToJson());
|
||||
}
|
||||
|
||||
|
||||
public ActionResult Json(object obj)
|
||||
{
|
||||
return new ActionResult { Content = new StringContent(obj.ToJson(), Encoding.UTF8, "application/json") };
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ActionResult Text(string str)
|
||||
{
|
||||
//return Content(str, "text/plain");
|
||||
return new ActionResult { Content = new System.Net.Http.StringContent(str, Encoding.UTF8, "text/plain") };
|
||||
|
||||
}
|
||||
|
||||
public ActionResult HtmlStr(string str)
|
||||
{
|
||||
return new ActionResult { Content = new System.Net.Http.StringContent(str, Encoding.UTF8, "text/html") };
|
||||
|
||||
}
|
||||
|
||||
public ActionResult Html(string view)
|
||||
{
|
||||
return Html(view, null);
|
||||
}
|
||||
public ActionResult Resouce(string viewName, string contentType)
|
||||
{
|
||||
string packUri = $"pack://application:,,,/Assets{viewName}";
|
||||
byte[] bytes = null;
|
||||
using (Stream stream = System.Windows.Application.GetResourceStream(new Uri(packUri, UriKind.RelativeOrAbsolute)).Stream)
|
||||
{
|
||||
bytes = new byte[stream.Length];
|
||||
stream.Read(bytes, 0, bytes.Length);
|
||||
}
|
||||
ActionResult response = new ActionResult(HttpStatusCode.OK);
|
||||
response.Content = new ByteArrayContent(bytes);
|
||||
response.Content.Headers.ContentType = new MediaTypeHeaderValue(contentType);
|
||||
response.Content.Headers.ContentLength = bytes.Length;
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
public ActionResult Html(string view, Dictionary<string, object> dict)
|
||||
{
|
||||
if (!view.StartsWith("/"))
|
||||
view = "/" + view;
|
||||
string path = AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/") + "Views";
|
||||
|
||||
|
||||
var template = Engine.LoadTemplate(path + view + ".html");
|
||||
|
||||
|
||||
if (dict != null)
|
||||
{
|
||||
foreach (KeyValuePair<string, object> keyValue in dict)
|
||||
{
|
||||
template.Set(keyValue.Key, keyValue.Value);
|
||||
}
|
||||
}
|
||||
var result = template.Render();
|
||||
// return Content(result, "text/html");
|
||||
return new ActionResult { Content = new System.Net.Http.StringContent(result, Encoding.UTF8, "text/html") };
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
namespace Microsoft.AspNetCore.Mvc
|
||||
{
|
||||
public class ActionResult : System.Net.Http.HttpResponseMessage
|
||||
{
|
||||
public ActionResult() : base(HttpStatusCode.OK)
|
||||
{
|
||||
|
||||
}
|
||||
public ActionResult(HttpStatusCode statusCode) : base(statusCode)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
25
电子展板/Controller/IndexController.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace 电子展板.Controller
|
||||
{
|
||||
public class IndexController : BaseController
|
||||
{
|
||||
//[HttpGet, Route("index/error")]
|
||||
//public ActionResult Error()
|
||||
//{
|
||||
// return Html("/Sys/Index/Error");
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 后台首页视图。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet, Route("")]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return Resouce("/Views/Login.html", "text/html");
|
||||
}
|
||||
}
|
||||
}
|
||||
54
电子展板/Controller/LayUIController.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace 电子展板.Controller
|
||||
{
|
||||
public class LayUIController : BaseController
|
||||
{
|
||||
#region css
|
||||
[HttpGet, Route("layui/css/layui.css")]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return Resouce("/layui/css/layui.css", "text/css");
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region fonts
|
||||
[HttpGet, Route("layui/font/iconfont.eot")]
|
||||
public ActionResult Iconfont_eot()
|
||||
{
|
||||
return Resouce("/layui/font/iconfont.eot", "font/eot");
|
||||
}
|
||||
[HttpGet, Route("layui/font/iconfont.svg")]
|
||||
public ActionResult iconfont_svg()
|
||||
{
|
||||
return Resouce("/layui/font/iconfont.svg", "text/xml");
|
||||
}
|
||||
[HttpGet, Route("layui/font/iconfont.ttf")]
|
||||
public ActionResult iconfont_ttf()
|
||||
{
|
||||
return Resouce("/layui/font/iconfont.ttf", "font/ttf");
|
||||
}
|
||||
[HttpGet, Route("layui/font/iconfont.woff")]
|
||||
public ActionResult iconfont_woff()
|
||||
{
|
||||
return Resouce("/layui/font/iconfont.woff", "font/woff");
|
||||
}
|
||||
[HttpGet, Route("layui/font/iconfont.woff2")]
|
||||
public ActionResult iconfont_woff2()
|
||||
{
|
||||
return Resouce("/layui/font/iconfont.woff2", "font/woff2");
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region JS
|
||||
[HttpGet, Route("layui/layui.js")]
|
||||
public ActionResult layui_js()
|
||||
{
|
||||
return Resouce("/layui/layui.js", "application/javascript");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
4
电子展板/FodyWeavers.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<PropertyChanged />
|
||||
<Costura />
|
||||
</Weavers>
|
||||
225
电子展板/FodyWeavers.xsd
Normal file
@@ -0,0 +1,225 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="TriggerDependentProperties" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if the Dependent properties feature is enabled.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="EnableIsChangedProperty" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if the IsChanged property feature is enabled.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="EventInvokerNames" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="CheckForEquality" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="SuppressWarnings" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to turn off build warnings from this weaver.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="SuppressOnPropertyNameChangedWarning" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to turn off build warnings about mismatched On_PropertyName_Changed methods.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeRuntimeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="IncludeRuntimeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Obsolete, use UnmanagedWinX86Assemblies instead</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="UnmanagedWinX86Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged X86 (32 bit) assembly names to include, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Obsolete, use UnmanagedWinX64Assemblies instead.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="UnmanagedWinX64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged X64 (64 bit) assembly names to include, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="UnmanagedWinArm64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged Arm64 (64 bit) assembly names to include, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeRuntimeReferences" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Controls if runtime assemblies are also embedded.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="UseRuntimeReferencePaths" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Controls whether the runtime assemblies are embedded with their full path or only with their assembly name.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="DisableCompression" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="DisableCleanup" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="DisableEventSubscription" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The attach method no longer subscribes to the `AppDomain.AssemblyResolve` (.NET 4.x) and `AssemblyLoadContext.Resolving` (.NET 6.0+) events.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="ExcludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="ExcludeRuntimeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeRuntimeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Obsolete, use UnmanagedWinX86Assemblies instead</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="UnmanagedWinX86Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged X86 (32 bit) assembly names to include, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Obsolete, use UnmanagedWinX64Assemblies instead</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="UnmanagedWinX64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged X64 (64 bit) assembly names to include, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="UnmanagedWinArm64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged Arm64 (64 bit) assembly names to include, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="PreloadOrder" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
83
电子展板/MainWindow.xaml
Normal file
@@ -0,0 +1,83 @@
|
||||
<Window xmlns:hc="https://handyorg.github.io/handycontrol" x:Class="电子展板.MainWindow"
|
||||
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:local="clr-namespace:电子展板"
|
||||
ResizeMode="NoResize"
|
||||
WindowStyle="None"
|
||||
mc:Ignorable="d"
|
||||
Closing="Window_Closing"
|
||||
Loaded="Window_Loaded"
|
||||
Title="MainWindow" Background="#E5E5E5">
|
||||
<Grid>
|
||||
<Viewbox Stretch="Uniform" >
|
||||
<Canvas Width="1920" Height="1080">
|
||||
<Grid Width="1920" Height="1080">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="80"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="140"/>
|
||||
<RowDefinition Height="80"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50"/>
|
||||
<ColumnDefinition Width="6*"/>
|
||||
<ColumnDefinition Width="8*"/>
|
||||
<ColumnDefinition Width="6*"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Row="0" Grid.Column="1">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="180"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="时间:" Grid.Column="0" FontSize="60" Foreground="#1F7572" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0"/>
|
||||
<Border Grid.Column="1" Background="#C0E3D9" CornerRadius="20" Height="140">
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="55" Foreground="Black" TextWrapping="Wrap" Text="10:00:00"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Grid.Row="0" Grid.Column="2" Margin="40,0,0,0">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="240"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="负责人:" Grid.Column="0" FontSize="60" Foreground="#1F7572" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0"/>
|
||||
<Border Grid.Column="1" Background="#C0E3D9" CornerRadius="20" Height="140">
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="55" Foreground="Black" TextWrapping="Wrap" Text="刘华强"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Grid.Row="0" Grid.Column="3" Margin="40,0,0,0">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="270"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="风险等级:" Grid.Column="0" FontSize="60" Foreground="#1F7572" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0"/>
|
||||
<Border Grid.Column="1" Background="#C0E3D9" CornerRadius="20" Height="140">
|
||||
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="55" Foreground="Black" TextWrapping="Wrap" Text="A"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="工作内容:" FontSize="60" Foreground="#1F7572" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0"/>
|
||||
<Border Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Background="#C0E3D9" CornerRadius="20" Margin="0,40,0,40">
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10" VerticalAlignment="Top" FontSize="55" Foreground="Black" TextWrapping="Wrap" Text="1、 负责组织项目开工前的准备工作,按照施工图总平面布置确定所建建筑物位置,复合定位、标高。安排临时道路铺设工作。参与工程技术管理,配合总工程师编制项目部施工生产计划。
2、认真会审施工图纸,掌握设计意图,严格按图施工。在实际施工中,发现设计图纸不能满足实用要求时,要及时向领导报告,按规定办理设计变更手续"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
</Window>
|
||||
47
电子展板/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Media;
|
||||
using System.Xml;
|
||||
|
||||
namespace 电子展板
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
int screenIndex = 0;
|
||||
this.Left = (int)(Screen.AllScreens[screenIndex].Bounds.Left / GetDpiScaleX());
|
||||
this.Top = (int)(Screen.AllScreens[screenIndex].Bounds.Top / GetDpiScaleX());
|
||||
this.Width = (int)(Screen.AllScreens[screenIndex].Bounds.Width / GetDpiScaleX());
|
||||
this.Height = (int)(Screen.AllScreens[screenIndex].Bounds.Height / GetDpiScaleX());
|
||||
WebServer.Start();
|
||||
}
|
||||
|
||||
public double GetDpiScaleX()
|
||||
{
|
||||
return VisualTreeHelper.GetDpi(this).DpiScaleX;
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
WebServer.Stop();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
98
电子展板/MainWindow2.xaml
Normal file
@@ -0,0 +1,98 @@
|
||||
<Window xmlns:hc="https://handyorg.github.io/handycontrol" x:Class="电子展板.MainWindow2"
|
||||
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:local="clr-namespace:电子展板"
|
||||
ResizeMode="NoResize"
|
||||
Closing="Window_Closing"
|
||||
WindowStyle="None"
|
||||
mc:Ignorable="d"
|
||||
Loaded="Window_Loaded"
|
||||
Title="MainWindow" Background="#E5E5E5">
|
||||
<Grid>
|
||||
<Viewbox Stretch="Uniform" >
|
||||
<Canvas Width="1920" Height="1080">
|
||||
<Grid Width="1920" Height="1080">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50"/>
|
||||
<RowDefinition Height="70"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="50"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="460"/>
|
||||
<ColumnDefinition Width="50"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="危险点" Grid.Row="1" Grid.Column="1" FontSize="60" Foreground="#1F7572" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0"/>
|
||||
<TextBlock Text="重点管控措施" Grid.Row="1" Grid.Column="2" FontSize="60" Foreground="#1F7572" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0"/>
|
||||
<TextBlock Text="党员亮身份" Grid.Row="1" Grid.Column="3" FontSize="60" Foreground="#1F7572" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,0"/>
|
||||
|
||||
<Border Grid.Row="2" Grid.Column="1" Background="#C0E3D9" CornerRadius="20" Margin="0,20,20,50">
|
||||
<TextBlock Margin="10" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="55" Foreground="Black" TextWrapping="Wrap" Text="1、 负责组织项目开工前的准备工作,按照施工图总平面布置确定所建建筑物位置,复合定位、标高。安排临时道路铺设工作。参与工程技术管理,配合总工程师编制项目部施工生产计划。"/>
|
||||
</Border>
|
||||
<Border Grid.Row="2" Grid.Column="2" Background="#C0E3D9" CornerRadius="20" Margin="25,20,20,50">
|
||||
<TextBlock Margin="10" HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="55" Foreground="Black" TextWrapping="Wrap" Text="1、 负责组织项目开工前的准备工作,按照施工图总平面布置确定所建建筑物位置,复合定位、标高。安排临时道路铺设工作。参与工程技术管理,配合总工程师编制项目部施工生产计划。"/>
|
||||
</Border>
|
||||
<Grid Grid.Row="2" Grid.Column="3" Margin="20,20,0,50">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Grid.Row="0" Grid.Column="0" Background="#C0E3D9" CornerRadius="20" Margin="10,0,5,5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="80"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Image Margin="10" Source="/Assets/0.jpg" Stretch="Uniform" />
|
||||
<TextBlock Text="陈龙" Grid.Row="1" FontSize="40" Foreground="Black" TextWrapping="Wrap" TextAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="0" Grid.Column="1" Background="#C0E3D9" CornerRadius="20" Margin="5,0,10,5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="80"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Image Margin="10" Source="/Assets/0.jpg" Stretch="Uniform" />
|
||||
<TextBlock Text="陶陶" Grid.Row="1" FontSize="40" Foreground="Black" TextWrapping="Wrap" TextAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Grid.Row="1" Grid.Column="0" Background="#C0E3D9" CornerRadius="20" Margin="10,5,5,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="80"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Image Margin="10" Source="/Assets/0.jpg" Stretch="Uniform" />
|
||||
<TextBlock Text="陈龙" Grid.Row="1" FontSize="40" Foreground="Black" TextWrapping="Wrap" TextAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Grid.Row="1" Grid.Column="1" Background="#C0E3D9" CornerRadius="20" Margin="5,5,10,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="80"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Image Margin="10" Source="/Assets/0.jpg" Stretch="Uniform" />
|
||||
<TextBlock Text="陶陶" Grid.Row="1" FontSize="40" Foreground="Black" TextWrapping="Wrap" TextAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
</Grid>
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
</Grid>
|
||||
</Window>
|
||||
59
电子展板/MainWindow2.xaml.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
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.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace 电子展板
|
||||
{
|
||||
/// <summary>
|
||||
/// MainWindow2.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MainWindow2 : Window
|
||||
{
|
||||
public MainWindow2()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Screen[] screens = Screen.AllScreens;
|
||||
if (screens.Length > 1)
|
||||
{
|
||||
int screenIndex = 1;
|
||||
this.Left = (int)(Screen.AllScreens[screenIndex].Bounds.Left / GetDpiScaleX());
|
||||
this.Top = (int)(Screen.AllScreens[screenIndex].Bounds.Top / GetDpiScaleX());
|
||||
this.Width = (int)(Screen.AllScreens[screenIndex].Bounds.Width / GetDpiScaleX());
|
||||
this.Height = (int)(Screen.AllScreens[screenIndex].Bounds.Height / GetDpiScaleX());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public double GetDpiScaleX()
|
||||
{
|
||||
return VisualTreeHelper.GetDpi(this).DpiScaleX;
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
WebServer.Stop();
|
||||
Screen[] screens = Screen.AllScreens;
|
||||
if (screens.Length > 1)
|
||||
{
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
394
电子展板/Utility/Core/Checker.cs
Normal file
@@ -0,0 +1,394 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace 电子展板.Utility.Core
|
||||
{
|
||||
public static class Checker
|
||||
{
|
||||
#region 验证IP
|
||||
/// <summary>
|
||||
/// 验证IP
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsIP(this string source)
|
||||
{
|
||||
return Regex.IsMatch(source, @"^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$", RegexOptions.IgnoreCase);
|
||||
}
|
||||
public static bool HasIP(this string source)
|
||||
{
|
||||
return Regex.IsMatch(source, @"(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])", RegexOptions.IgnoreCase);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 验证EMail是否合法
|
||||
/// <summary>
|
||||
/// 验证EMail是否合法
|
||||
/// </summary>
|
||||
/// <param name="email">要验证的Email</param>
|
||||
public static bool IsEmail(this string source)
|
||||
{
|
||||
return Regex.IsMatch(source, @"^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$", RegexOptions.IgnoreCase);
|
||||
}
|
||||
public static bool HasEmail(this string source)
|
||||
{
|
||||
return Regex.IsMatch(source, @"[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})", RegexOptions.IgnoreCase);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 验证网址
|
||||
/// <summary>
|
||||
/// 验证网址
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsUrl(this string source)
|
||||
{
|
||||
return Regex.IsMatch(source, @"^(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp)://)|(www\.))+(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(/[a-zA-Z0-9\&%_\./-~-]*)?$", RegexOptions.IgnoreCase);
|
||||
}
|
||||
public static bool HasUrl(this string source)
|
||||
{
|
||||
return Regex.IsMatch(source, @"(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp)://)|(www\.))+(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(/[a-zA-Z0-9\&%_\./-~-]*)?", RegexOptions.IgnoreCase);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 验证日期
|
||||
/// <summary>
|
||||
/// 验证日期
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsDateTime(this string source)
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime time = Convert.ToDateTime(source);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 验证手机号
|
||||
/// <summary>
|
||||
/// 验证手机号
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsMobile(this string source)
|
||||
{
|
||||
return Regex.IsMatch(source, @"^1[35678]\d{9}$", RegexOptions.IgnoreCase);
|
||||
}
|
||||
public static bool HasMobile(this string source)
|
||||
{
|
||||
return Regex.IsMatch(source, @"1[35678]\d{9}", RegexOptions.IgnoreCase);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 验证身份证是否有效
|
||||
/// <summary>
|
||||
/// 验证身份证是否有效
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsIDCard(this string Id)
|
||||
{
|
||||
if (Id.Length == 18)
|
||||
{
|
||||
bool check = IsIDCard18(Id);
|
||||
return check;
|
||||
}
|
||||
else if (Id.Length == 15)
|
||||
{
|
||||
bool check = IsIDCard15(Id);
|
||||
return check;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static bool IsIDCard18(this string Id)
|
||||
{
|
||||
long n = 0;
|
||||
if (long.TryParse(Id.Remove(17), out n) == false || n < Math.Pow(10, 16) || long.TryParse(Id.Replace('x', '0').Replace('X', '0'), out n) == false)
|
||||
{
|
||||
return false;//数字验证
|
||||
}
|
||||
string address = "11x22x35x44x53x12x23x36x45x54x13x31x37x46x61x14x32x41x50x62x15x33x42x51x63x21x34x43x52x64x65x71x81x82x91";
|
||||
if (address.IndexOf(Id.Remove(2)) == -1)
|
||||
{
|
||||
return false;//省份验证
|
||||
}
|
||||
string birth = Id.Substring(6, 8).Insert(6, "-").Insert(4, "-");
|
||||
DateTime time = new DateTime();
|
||||
if (DateTime.TryParse(birth, out time) == false)
|
||||
{
|
||||
return false;//生日验证
|
||||
}
|
||||
string[] arrVarifyCode = ("1,0,x,9,8,7,6,5,4,3,2").Split(',');
|
||||
string[] Wi = ("7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2").Split(',');
|
||||
char[] Ai = Id.Remove(17).ToCharArray();
|
||||
int sum = 0;
|
||||
for (int i = 0; i < 17; i++)
|
||||
{
|
||||
sum += int.Parse(Wi[i]) * int.Parse(Ai[i].ToString());
|
||||
}
|
||||
int y = -1;
|
||||
Math.DivRem(sum, 11, out y);
|
||||
if (arrVarifyCode[y] != Id.Substring(17, 1).ToLower())
|
||||
{
|
||||
return false;//校验码验证
|
||||
}
|
||||
return true;//符合GB11643-1999标准
|
||||
}
|
||||
public static bool IsIDCard15(this string Id)
|
||||
{
|
||||
long n = 0;
|
||||
if (long.TryParse(Id, out n) == false || n < Math.Pow(10, 14))
|
||||
{
|
||||
return false;//数字验证
|
||||
}
|
||||
string address = "11x22x35x44x53x12x23x36x45x54x13x31x37x46x61x14x32x41x50x62x15x33x42x51x63x21x34x43x52x64x65x71x81x82x91";
|
||||
if (address.IndexOf(Id.Remove(2)) == -1)
|
||||
{
|
||||
return false;//省份验证
|
||||
}
|
||||
string birth = Id.Substring(6, 6).Insert(4, "-").Insert(2, "-");
|
||||
DateTime time = new DateTime();
|
||||
if (DateTime.TryParse(birth, out time) == false)
|
||||
{
|
||||
return false;//生日验证
|
||||
}
|
||||
return true;//符合15位身份证标准
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 是不是Int型的
|
||||
/// <summary>
|
||||
/// 是不是Int型的
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsInt(this string source)
|
||||
{
|
||||
Regex regex = new Regex(@"^(-){0,1}\d+$");
|
||||
if (regex.Match(source).Success)
|
||||
{
|
||||
if ((long.Parse(source) > 0x7fffffffL) || (long.Parse(source) < -2147483648L))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 看字符串的长度是不是在限定数之间 一个中文为两个字符
|
||||
/// <summary>
|
||||
/// 看字符串的长度是不是在限定数之间 一个中文为两个字符
|
||||
/// </summary>
|
||||
/// <param name="source">字符串</param>
|
||||
/// <param name="begin">大于等于</param>
|
||||
/// <param name="end">小于等于</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsLengthStr(this string source, int begin, int end)
|
||||
{
|
||||
int length = Regex.Replace(source, @"[^\x00-\xff]", "OK").Length;
|
||||
if ((length <= begin) && (length >= end))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 是不是中国电话,格式010-85849685
|
||||
/// <summary>
|
||||
/// 是不是中国电话,格式010-85849685
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsTel(this string source)
|
||||
{
|
||||
return Regex.IsMatch(source, @"^\d{3,4}-?\d{6,8}$", RegexOptions.IgnoreCase);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 邮政编码 6个数字
|
||||
/// <summary>
|
||||
/// 邮政编码 6个数字
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsPostCode(this string source)
|
||||
{
|
||||
return Regex.IsMatch(source, @"^\d{6}$", RegexOptions.IgnoreCase);
|
||||
}
|
||||
#endregion
|
||||
#region 中文
|
||||
/// <summary>
|
||||
/// 中文
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsChinese(this string source)
|
||||
{
|
||||
return Regex.IsMatch(source, @"^[\u4e00-\u9fa5]+$", RegexOptions.IgnoreCase);
|
||||
}
|
||||
public static bool hasChinese(this string source)
|
||||
{
|
||||
return Regex.IsMatch(source, @"[\u4e00-\u9fa5]+", RegexOptions.IgnoreCase);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 验证是不是正常字符 字母,数字,下划线的组合
|
||||
/// <summary>
|
||||
/// 验证是不是正常字符 字母,数字,下划线的组合
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsNormalChar(this string source)
|
||||
{
|
||||
return Regex.IsMatch(source, @"[\w\d_]+", RegexOptions.IgnoreCase);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 验证用户名:必须以字母开头,可以包含字母、数字、“_”、“.”,至少5个字符
|
||||
/// <summary>
|
||||
/// 验证用户名:必须以字母开头,可以包含字母、数字、“_”、“.”,至少5个字符
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static bool checkUserId(this string str)
|
||||
{
|
||||
Regex regex = new Regex("[a-zA-Z]{1}([a-zA-Z0-9]|[._]){4,19}");
|
||||
if (regex.Match(str).Success)
|
||||
if (regex.Matches(str)[0].Value.Length == str.Length)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 是否是Base64字符串
|
||||
/// </summary>
|
||||
/// <param name="eStr"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsBase64(string eStr)
|
||||
{
|
||||
if ((eStr.Length % 4) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Regex.IsMatch(eStr, "^[A-Z0-9/+=]*$", RegexOptions.IgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#region 验证是否为小数
|
||||
public static bool IsValidDecimal(this string strIn)
|
||||
{
|
||||
return Regex.IsMatch(strIn, @"[0].d{1,2}|[1]");
|
||||
}
|
||||
#endregion
|
||||
#region 验证年月日
|
||||
public static bool IsValidDate(this string strIn)
|
||||
{
|
||||
return Regex.IsMatch(strIn, @"^2d{3}-(?:0?[1-9]|1[0-2])-(?:0?[1-9]|[1-2]d|3[0-1])(?:0?[1-9]|1d|2[0-3]):(?:0?[1-9]|[1-5]d):(?:0?[1-9]|[1-5]d)$");
|
||||
}
|
||||
#endregion
|
||||
#region 验证日期格式
|
||||
//检察是否正确的日期格式
|
||||
public static bool IsDate(this string str)
|
||||
{
|
||||
//考虑到了4年一度的366天,还有特殊的2月的日期
|
||||
Regex reg = new Regex(@"^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-)) (20|21|22|23|[0-1]?\d):[0-5]?\d:[0-5]?\d$");
|
||||
return reg.IsMatch(str);
|
||||
}
|
||||
#endregion
|
||||
#region 验证后缀名
|
||||
public static bool IsValidPostfix(this string strIn)
|
||||
{
|
||||
return Regex.IsMatch(strIn, @".(?i:gif|jpg)$");
|
||||
}
|
||||
#endregion
|
||||
#region 验证字符是否在4至12之间
|
||||
public static bool IsValidByte(this string strIn)
|
||||
{
|
||||
return Regex.IsMatch(strIn, @"^[a-z]{4,12}$");
|
||||
}
|
||||
#endregion
|
||||
#region 判断字符串是否为数字
|
||||
/// <summary>
|
||||
/// 判断字符串是否为数字
|
||||
/// </summary>
|
||||
/// <param name="str">待验证的字符窜</param>
|
||||
/// <returns>bool</returns>
|
||||
public static bool IsNumber(this string str)
|
||||
{
|
||||
bool result = true;
|
||||
foreach (char ar in str)
|
||||
{
|
||||
if (!char.IsNumber(ar))
|
||||
{
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
#region 是否为数字型
|
||||
/// <summary>
|
||||
/// 是否为数字型
|
||||
/// </summary>
|
||||
/// <param name="strNumber"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsDecimal(this string strNumber)
|
||||
{
|
||||
return new System.Text.RegularExpressions.Regex(@"^([0-9])[0-9]*(\.\w*)?$").IsMatch(strNumber);
|
||||
}
|
||||
#endregion
|
||||
#region 验证是否包含汉语/全部汉语
|
||||
/// <summary>
|
||||
/// 验证是否包含汉语
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsHanyu(this string str)
|
||||
{
|
||||
Regex regex = new Regex("[\u4e00-\u9fa5]");
|
||||
if (regex.Match(str).Success)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 验证是否全部汉语
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsHanyuAll(this string str)
|
||||
{
|
||||
Regex regex = new Regex("[\u4e00-\u9fa5]");
|
||||
//匹配的内容长度和被验证的内容长度相同时,验证通过
|
||||
if (regex.Match(str).Success)
|
||||
if (regex.Matches(str).Count == str.Length)
|
||||
return true;
|
||||
//其它,未通过
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
464
电子展板/Utility/Core/ChineseDateTime.cs
Normal file
@@ -0,0 +1,464 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
|
||||
namespace 电子展板.Utility.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// ChineseDateTime
|
||||
/// 一日有十二时辰,一时辰有四刻,一刻有三盏茶,一盏茶有两柱香
|
||||
/// 一柱香有五分,一分有六弹指,一弹指有十刹那,一刹那为一念
|
||||
/// </summary>
|
||||
public class ChineseDateTime
|
||||
{
|
||||
#region ====== 内部常量 ======
|
||||
private readonly ChineseLunisolarCalendar _chineseDateTime;
|
||||
private readonly DateTime _dateTime;
|
||||
private readonly int _serialMonth;
|
||||
|
||||
private static readonly string[] _chineseNumber = { "〇", "一", "二", "三", "四", "五", "六", "七", "八", "九" };
|
||||
private static readonly string[] _chineseMonth =
|
||||
{
|
||||
"正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "冬", "腊"
|
||||
};
|
||||
private static readonly string[] _chineseDay =
|
||||
{
|
||||
"初一", "初二", "初三", "初四", "初五", "初六", "初七", "初八", "初九", "初十",
|
||||
"十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十",
|
||||
"廿一", "廿二", "廿三", "廿四", "廿五", "廿六", "廿七", "廿八", "廿九", "三十"
|
||||
};
|
||||
private static readonly string[] _chineseWeek =
|
||||
{
|
||||
"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"
|
||||
};
|
||||
|
||||
private static readonly string[] _celestialStem = { "甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸" };
|
||||
private static readonly string[] _terrestrialBranch = { "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥" };
|
||||
private static readonly string[] _chineseZodiac = { "鼠", "牛", "虎", "免", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪" };
|
||||
|
||||
private static readonly string[] _solarTerm =
|
||||
{
|
||||
"小寒", "大寒", "立春", "雨水", "惊蛰", "春分",
|
||||
"清明", "谷雨", "立夏", "小满", "芒种", "夏至",
|
||||
"小暑", "大暑", "立秋", "处暑", "白露", "秋分",
|
||||
"寒露", "霜降", "立冬", "小雪", "大雪", "冬至"
|
||||
};
|
||||
private static readonly int[] _solarTermInfo = {
|
||||
0, 21208, 42467, 63836, 85337, 107014, 128867, 150921, 173149, 195551, 218072, 240693, 263343, 285989,
|
||||
308563, 331033, 353350, 375494, 397447, 419210, 440795, 462224, 483532, 504758
|
||||
};
|
||||
#endregion
|
||||
|
||||
#region ======= 构建日期 ======
|
||||
|
||||
public ChineseDateTime(DateTime dateTime)
|
||||
{
|
||||
_chineseDateTime = new ChineseLunisolarCalendar();
|
||||
if (dateTime < _chineseDateTime.MinSupportedDateTime || dateTime > _chineseDateTime.MaxSupportedDateTime)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(
|
||||
$"参数日期不在有效的范围内:只支持{_chineseDateTime.MinSupportedDateTime.ToShortTimeString()}到{_chineseDateTime.MaxSupportedDateTime}");
|
||||
}
|
||||
|
||||
Year = _chineseDateTime.GetYear(dateTime);
|
||||
Month = _chineseDateTime.GetMonth(dateTime);
|
||||
Day = _chineseDateTime.GetDayOfMonth(dateTime);
|
||||
IsLeep = _chineseDateTime.IsLeapMonth(Year, Month);
|
||||
_dateTime = dateTime;
|
||||
_serialMonth = Month;
|
||||
var leepMonth = _chineseDateTime.GetLeapMonth(Year);
|
||||
if (leepMonth > 0 && leepMonth <= Month) Month--;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 参数为农历的年月日及是否润月
|
||||
/// </summary>
|
||||
/// <param name="year"></param>
|
||||
/// <param name="month"></param>
|
||||
/// <param name="day"></param>
|
||||
/// <param name="isLeap"></param>
|
||||
public ChineseDateTime(int year, int month, int day, bool isLeap = false)
|
||||
: this(year, month, day, 0, 0, 0, isLeap)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ChineseDateTime(int year, int month, int day, int hour, int minute, int second, bool isLeap = false)
|
||||
: this(year, month, day, hour, minute, second, 0, isLeap)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ChineseDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, bool isLeap = false)
|
||||
{
|
||||
_chineseDateTime = new ChineseLunisolarCalendar();
|
||||
if (year < _chineseDateTime.MinSupportedDateTime.Year || year >= _chineseDateTime.MaxSupportedDateTime.Year)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(
|
||||
$"参数年份不在有效的范围内,只支持{_chineseDateTime.MinSupportedDateTime.Year}到{_chineseDateTime.MaxSupportedDateTime.Year - 1}");
|
||||
}
|
||||
|
||||
if (month < 1 || month > 12) throw new ArgumentOutOfRangeException($"月份只支持1-12");
|
||||
IsLeep = isLeap;
|
||||
var leepMonth = _chineseDateTime.GetLeapMonth(year);
|
||||
if (leepMonth - 1 != month)
|
||||
IsLeep = false;
|
||||
_serialMonth = month;
|
||||
if (leepMonth > 0 && (month == leepMonth - 1 && isLeap || month > leepMonth - 1))
|
||||
_serialMonth = month + 1;
|
||||
|
||||
if (_chineseDateTime.GetDaysInMonth(year, _serialMonth) < day || day < 1)
|
||||
throw new ArgumentOutOfRangeException($"指定的月份天数,不在有效的范围内");
|
||||
|
||||
Year = year;
|
||||
Month = month;
|
||||
Day = day;
|
||||
_dateTime = _chineseDateTime.ToDateTime(Year, _serialMonth, Day, hour, minute, second, millisecond);
|
||||
}
|
||||
|
||||
public static ChineseDateTime Now => new ChineseDateTime(DateTime.Now);
|
||||
|
||||
#endregion
|
||||
|
||||
#region ====== 年月日润属性 ======
|
||||
public int Year { get; }
|
||||
public int Month { get; }
|
||||
public int Day { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为润月
|
||||
/// </summary>
|
||||
public bool IsLeep { get; }
|
||||
#endregion
|
||||
|
||||
#region ====== 输出常规日期 ======
|
||||
/// <summary>
|
||||
/// 转换为公历
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DateTime ToDateTime()
|
||||
{
|
||||
return _chineseDateTime.ToDateTime(Year, _serialMonth, Day, _dateTime.Hour,
|
||||
_dateTime.Minute,
|
||||
_dateTime.Second, _dateTime.Millisecond);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 短日期(农历)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string ToShortDateString()
|
||||
{
|
||||
return $"{Year}-{GetLeap(false)}{Month}-{Day}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 长日期(农历)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string ToLongDateString()
|
||||
{
|
||||
return $"{Year}年{GetLeap()}{Month}月-{Day}日";
|
||||
}
|
||||
|
||||
public new string ToString()
|
||||
{
|
||||
return $"{Year}-{GetLeap(false)}{Month}-{Day} {_dateTime.Hour}:{_dateTime.Minute}:{_dateTime.Second}";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ====== 输出中文日期及星期 ======
|
||||
public string ToChineseString()
|
||||
{
|
||||
return ToChineseString("yMd");
|
||||
}
|
||||
|
||||
public string GetChineseDate()
|
||||
{
|
||||
var date = new StringBuilder();
|
||||
date.Append(GetMonth() + "月");
|
||||
date.Append(GetDay() + "");
|
||||
date.AppendLine();
|
||||
date.Append(GetEraYear() + ChineseZodiac + "年");
|
||||
date.AppendLine();
|
||||
return date.ToString();
|
||||
}
|
||||
|
||||
public string ToChineseString(string format)
|
||||
{
|
||||
var year = GetYear();
|
||||
var month = GetMonth();
|
||||
var day = GetDay();
|
||||
|
||||
var date = new StringBuilder();
|
||||
foreach (var item in format.ToCharArray())
|
||||
{
|
||||
switch (item)
|
||||
{
|
||||
case 'y':
|
||||
date.Append($"{year}年");
|
||||
break;
|
||||
case 'M':
|
||||
date.Append($"{month}月");
|
||||
break;
|
||||
case 'd':
|
||||
date.Append($"{day}");
|
||||
break;
|
||||
default:
|
||||
date.Append(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
var def = $"{year}年{month}月{day}";
|
||||
var result = date.ToString();
|
||||
return string.IsNullOrEmpty(result) ? def : result;
|
||||
}
|
||||
|
||||
public string ChineseWeek => _chineseWeek[(int)_dateTime.DayOfWeek];
|
||||
#endregion
|
||||
|
||||
#region ====== 输出天干地支生肖 ======
|
||||
|
||||
public string ToChineseEraString()
|
||||
{
|
||||
return ToChineseEraString("yMdHm");
|
||||
}
|
||||
|
||||
public string ToChineseEraString(string format)
|
||||
{
|
||||
var year = GetEraYear();
|
||||
var month = GetEraMonth();
|
||||
var day = GetEraDay();
|
||||
var hour = GetEraHour();
|
||||
var minute = GetEraMinute();
|
||||
|
||||
var date = new StringBuilder();
|
||||
foreach (var item in format.ToCharArray())
|
||||
{
|
||||
switch (item)
|
||||
{
|
||||
case 'y':
|
||||
date.Append($"{year}年");
|
||||
break;
|
||||
case 'M':
|
||||
date.Append($"{month}月");
|
||||
break;
|
||||
case 'd':
|
||||
date.Append($"{day}日");
|
||||
break;
|
||||
case 'H':
|
||||
date.Append($"{hour}时");
|
||||
break;
|
||||
case 'm':
|
||||
date.Append($"{minute}刻");
|
||||
break;
|
||||
default:
|
||||
date.Append(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
var def = $"{year}年{month}月{day}日{hour}时";
|
||||
var result = date.ToString();
|
||||
return result.IsNullOrEmpty() ? def : result;
|
||||
}
|
||||
|
||||
public string ChineseZodiac => _chineseZodiac[(Year - 4) % 12];
|
||||
#endregion
|
||||
|
||||
#region ====== 辅助方法(Chinese) ======
|
||||
private string GetYear()
|
||||
{
|
||||
var yearArray = Array.ConvertAll(Year.ToString().ToCharArray(), x => int.Parse(x.ToString()));
|
||||
var year = new StringBuilder();
|
||||
foreach (var item in yearArray)
|
||||
year.Append(_chineseNumber[item]);
|
||||
return year.ToString();
|
||||
}
|
||||
|
||||
private string GetMonth()
|
||||
{
|
||||
return $"{GetLeap()}{_chineseMonth[Month - 1]}";
|
||||
}
|
||||
|
||||
private string GetDay()
|
||||
{
|
||||
return _chineseDay[Day - 1];
|
||||
}
|
||||
|
||||
private string GetLeap(bool isChinese = true)
|
||||
{
|
||||
return IsLeep ? isChinese ? "润" : "L" : "";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ====== 输助方法(天干地支)======
|
||||
//年采用的头尾法,月采用的是节令法,主流日历基本上都这种结合,如百度的日历
|
||||
|
||||
private string GetEraYear()
|
||||
{
|
||||
var sexagenaryYear = _chineseDateTime.GetSexagenaryYear(_dateTime);
|
||||
var stemIndex = _chineseDateTime.GetCelestialStem(sexagenaryYear) - 1;
|
||||
var branchIndex = _chineseDateTime.GetTerrestrialBranch(sexagenaryYear) - 1;
|
||||
return $"{_celestialStem[stemIndex]}{_terrestrialBranch[branchIndex]}";
|
||||
}
|
||||
|
||||
private string GetEraMonth()
|
||||
{
|
||||
#region ====== 节令法 ======
|
||||
var solarIndex = SolarTermFunc((x, y) => x <= y, out var dt);
|
||||
solarIndex = solarIndex == -1 ? 23 : solarIndex;
|
||||
var currentIndex = (int)Math.Floor(solarIndex / (decimal)2);
|
||||
|
||||
//天干
|
||||
var solarMonth = currentIndex == 0 ? 11 : currentIndex - 1; //计算天干序(月份)
|
||||
var sexagenaryYear = _chineseDateTime.GetSexagenaryYear(_dateTime);
|
||||
var stemYear = _chineseDateTime.GetCelestialStem(sexagenaryYear) - 1;
|
||||
if (solarMonth == 0) //立春时,春节前后的不同处理
|
||||
{
|
||||
var year = _chineseDateTime.GetYear(dt);
|
||||
var month = _chineseDateTime.GetMonth(dt);
|
||||
stemYear = year == Year && month != 1 ? stemYear + 1 : stemYear;
|
||||
}
|
||||
if (solarMonth == 11) //立春在春节后,对前一节气春节前后不同处理
|
||||
{
|
||||
var year = _chineseDateTime.GetYear(dt);
|
||||
stemYear = year != Year ? stemYear - 1 : stemYear;
|
||||
}
|
||||
int stemIndex;
|
||||
switch (stemYear)
|
||||
{
|
||||
case 0:
|
||||
case 5:
|
||||
stemIndex = 3;
|
||||
break;
|
||||
case 1:
|
||||
case 6:
|
||||
stemIndex = 5;
|
||||
break;
|
||||
case 2:
|
||||
case 7:
|
||||
stemIndex = 7;
|
||||
break;
|
||||
case 3:
|
||||
case 8:
|
||||
stemIndex = 9;
|
||||
break;
|
||||
default:
|
||||
stemIndex = 1;
|
||||
break;
|
||||
}
|
||||
//天干序
|
||||
stemIndex = (stemIndex - 1 + solarMonth) % 10;
|
||||
|
||||
//地支序
|
||||
var branchIndex = currentIndex >= 11 ? currentIndex - 11 : currentIndex + 1;
|
||||
|
||||
return $"{_celestialStem[stemIndex]}{_terrestrialBranch[branchIndex]}";
|
||||
|
||||
#endregion
|
||||
|
||||
#region ====== 头尾法 ======
|
||||
//这里算法要容易些,原理和节令法一样,只需取农历整年整月即可。未贴上来
|
||||
#endregion
|
||||
}
|
||||
|
||||
private string GetEraDay()
|
||||
{
|
||||
var ts = _dateTime - new DateTime(1901, 2, 15);
|
||||
var offset = ts.Days;
|
||||
var sexagenaryDay = offset % 60;
|
||||
return $"{_celestialStem[sexagenaryDay % 10]}{_terrestrialBranch[sexagenaryDay % 12]}";
|
||||
}
|
||||
|
||||
private string GetEraHour()
|
||||
{
|
||||
var hourIndex = (int)Math.Floor((_dateTime.Hour + 1) / (decimal)2);
|
||||
hourIndex = hourIndex == 12 ? 0 : hourIndex;
|
||||
return _terrestrialBranch[hourIndex];
|
||||
}
|
||||
|
||||
private string GetEraMinute()
|
||||
{
|
||||
var realMinute = (_dateTime.Hour % 2 == 0 ? 60 : 0) + _dateTime.Minute;
|
||||
return $"{_chineseNumber[(int)Math.Floor(realMinute / (decimal)30) + 1]}";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ====== 24节气 ======
|
||||
/// <summary>
|
||||
/// 当前节气,没有则返回空
|
||||
/// </summary>
|
||||
public string SolarTerm
|
||||
{
|
||||
get
|
||||
{
|
||||
var i = SolarTermFunc((x, y) => x == y, out var dt);
|
||||
return i == -1 ? "" : _solarTerm[i];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上一个节气
|
||||
/// </summary>
|
||||
public string SolarTermPrev
|
||||
{
|
||||
get
|
||||
{
|
||||
var i = SolarTermFunc((x, y) => x < y, out var dt);
|
||||
return i == -1 ? "" : _solarTerm[i];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下一个节气
|
||||
/// </summary>
|
||||
public string SolarTermNext
|
||||
{
|
||||
get
|
||||
{
|
||||
var i = SolarTermFunc((x, y) => x > y, out var dt);
|
||||
return i == -1 ? "" : $"{_solarTerm[i]}";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 节气计算(当前年),返回指定条件的节气序及日期(公历)
|
||||
/// </summary>
|
||||
/// <param name="func"></param>
|
||||
/// <param name="dateTime"></param>
|
||||
/// <returns>-1时即没找到</returns>
|
||||
private int SolarTermFunc(Expression<Func<int, int, bool>> func, out DateTime dateTime)
|
||||
{
|
||||
var baseDateAndTime = new DateTime(1900, 1, 6, 2, 5, 0); //#1/6/1900 2:05:00 AM#
|
||||
var year = _dateTime.Year;
|
||||
int[] solar = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 };
|
||||
var expressionType = func.Body.NodeType;
|
||||
if (expressionType != ExpressionType.LessThan && expressionType != ExpressionType.LessThanOrEqual &&
|
||||
expressionType != ExpressionType.GreaterThan && expressionType != ExpressionType.GreaterThanOrEqual &&
|
||||
expressionType != ExpressionType.Equal)
|
||||
{
|
||||
throw new NotSupportedException("不受支持的操作符");
|
||||
}
|
||||
|
||||
if (expressionType == ExpressionType.LessThan || expressionType == ExpressionType.LessThanOrEqual)
|
||||
{
|
||||
solar = solar.OrderByDescending(x => x).ToArray();
|
||||
}
|
||||
foreach (var item in solar)
|
||||
{
|
||||
var num = 525948.76 * (year - 1900) + _solarTermInfo[item - 1];
|
||||
var newDate = baseDateAndTime.AddMinutes(num); //按分钟计算
|
||||
if (func.Compile()(newDate.DayOfYear, _dateTime.DayOfYear))
|
||||
{
|
||||
dateTime = newDate;
|
||||
return item - 1;
|
||||
}
|
||||
}
|
||||
dateTime = _chineseDateTime.MinSupportedDateTime;
|
||||
return -1;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
1149
电子展板/Utility/Core/ConvertHelper.cs
Normal file
55
电子展板/Utility/Core/EnumHelper.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace 电子展板.Utility.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 枚举类型操作公共类。
|
||||
/// </summary>
|
||||
public static class EnumHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取枚举所有成员名称。
|
||||
/// </summary>
|
||||
/// <typeparam name="T">枚举类型</typeparam>
|
||||
public static string[] GetNames<T>()
|
||||
{
|
||||
return Enum.GetNames(typeof(T));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检测枚举是否包含指定成员。
|
||||
/// </summary>
|
||||
/// <typeparam name="T">枚举类型</typeparam>
|
||||
/// <param name="member">成员名或成员值</param>
|
||||
public static bool IsDefined(this Enum value)
|
||||
{
|
||||
Type type = value.GetType();
|
||||
return Enum.IsDefined(type, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回指定枚举类型的指定值的描述。
|
||||
/// </summary>
|
||||
/// <param name="t">枚举类型</param>
|
||||
/// <param name="v">枚举值</param>
|
||||
/// <returns></returns>
|
||||
public static string GetDescription(this Enum value)
|
||||
{
|
||||
try
|
||||
{
|
||||
Type type = value.GetType();
|
||||
FieldInfo field = type.GetField(value.ToString());
|
||||
DescriptionAttribute[] attributes = (DescriptionAttribute[])field.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||
return (attributes.Length > 0) ? attributes[0].Description : string.Empty;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
247
电子展板/Utility/Core/ExtDateTime.cs
Normal file
@@ -0,0 +1,247 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace 电子展板.Utility.Core
|
||||
{
|
||||
public static class ExtDateTime
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取格式化字符串,不带时分秒。格式:"yyyy-MM-dd"
|
||||
/// </summary>
|
||||
/// <param name="dateTime">日期</param>
|
||||
public static string ToDateString(this DateTime dateTime)
|
||||
{
|
||||
return dateTime.ToString("yyyy-MM-dd");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取格式化字符串,不带时分秒。格式:"yyyy-MM-dd"
|
||||
/// </summary>
|
||||
/// <param name="dateTime">日期</param>
|
||||
public static string ToDateString(this DateTime? dateTime)
|
||||
{
|
||||
if (dateTime == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return ToDateString(dateTime.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取格式化字符串,不带年月日,格式:"HH:mm:ss"
|
||||
/// </summary>
|
||||
/// <param name="dateTime">日期</param>
|
||||
public static string ToTimeString(this DateTime dateTime)
|
||||
{
|
||||
return dateTime.ToString("HH:mm:ss");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取格式化字符串,不带年月日,格式:"HH:mm:ss"
|
||||
/// </summary>
|
||||
/// <param name="dateTime">日期</param>
|
||||
public static string ToTimeString(this DateTime? dateTime)
|
||||
{
|
||||
if (dateTime == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return ToTimeString(dateTime.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取格式化字符串,带毫秒,格式:"yyyy-MM-dd HH:mm:ss.fff"
|
||||
/// </summary>
|
||||
/// <param name="dateTime">日期</param>
|
||||
public static string ToMillisecondString(this DateTime dateTime)
|
||||
{
|
||||
return dateTime.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取格式化字符串,带毫秒,格式:"yyyy-MM-dd HH:mm:ss.fff"
|
||||
/// </summary>
|
||||
/// <param name="dateTime">日期</param>
|
||||
public static string ToMillisecondString(this DateTime? dateTime)
|
||||
{
|
||||
if (dateTime == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return ToMillisecondString(dateTime.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取格式化字符串,不带时分秒,格式:"yyyy年MM月dd日"
|
||||
/// </summary>
|
||||
/// <param name="dateTime">日期</param>
|
||||
public static string ToChineseDateString(this DateTime dateTime)
|
||||
{
|
||||
return string.Format("{0}年{1}月{2}日", dateTime.Year, dateTime.Month, dateTime.Day);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取格式化字符串,带时分秒,格式:"yyyy年MM月dd日 HH时mm分"
|
||||
/// </summary>
|
||||
/// <param name="dateTime">日期</param>
|
||||
/// <param name="isRemoveSecond">是否移除秒</param>
|
||||
public static string ToChineseDateTimeString(this DateTime dateTime, bool isRemoveSecond = false)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.AppendFormat("{0}年{1}月{2}日", dateTime.Year, dateTime.Month, dateTime.Day);
|
||||
result.AppendFormat(" {0}时{1}分", dateTime.Hour, dateTime.Minute);
|
||||
|
||||
if (isRemoveSecond == false)
|
||||
{
|
||||
result.AppendFormat("{0}秒", dateTime.Second);
|
||||
}
|
||||
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取格式化字符串,带时分秒,格式:"yyyy年MM月dd日 HH时mm分"
|
||||
/// </summary>
|
||||
/// <param name="dateTime">日期</param>
|
||||
/// <param name="isRemoveSecond">是否移除秒</param>
|
||||
public static string ToChineseDateTimeString(this DateTime? dateTime, bool isRemoveSecond = false)
|
||||
{
|
||||
if (dateTime == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return ToChineseDateTimeString(dateTime.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回指定日期起始时间。
|
||||
/// </summary>
|
||||
/// <param name="dateTime"></param>
|
||||
/// <returns></returns>
|
||||
public static DateTime StartDateTime(this DateTime dateTime)
|
||||
{
|
||||
return new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, 0, 0, 0);
|
||||
}
|
||||
/// <summary>
|
||||
/// 返回指定日期结束时间。
|
||||
/// </summary>
|
||||
/// <param name="dateTime"></param>
|
||||
/// <returns></returns>
|
||||
public static DateTime EndDateTime(this DateTime dateTime)
|
||||
{
|
||||
return new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, 23, 59, 59);
|
||||
}
|
||||
|
||||
|
||||
#region 获取时间戳
|
||||
/// <summary>
|
||||
/// 获取时间戳
|
||||
/// </summary>
|
||||
public static string GetTimeStamp(DateTime dateTime)
|
||||
{
|
||||
DateTime dtStart = new DateTime(1970, 1, 1, 8, 0, 0);
|
||||
return Convert.ToInt64(dateTime.Subtract(dtStart).TotalMilliseconds).ToString();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 根据时间戳获取时间
|
||||
/// <summary>
|
||||
/// 根据时间戳获取时间
|
||||
/// </summary>
|
||||
public static DateTime TimeStampToDateTime(string timeStamp)
|
||||
{
|
||||
DateTime dtStart = new DateTime(1970, 1, 1, 8, 0, 0);
|
||||
return dtStart.AddMilliseconds(Convert.ToInt64(timeStamp));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 本周开始时间
|
||||
/// <summary>
|
||||
/// 本周开始时间
|
||||
/// </summary>
|
||||
public static DateTime GetCurrentWeekStart()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
int day = Convert.ToInt32(now.DayOfWeek.ToString("d"));
|
||||
return now.AddDays(1 - day).Date;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 本周结束时间
|
||||
/// <summary>
|
||||
/// 本周结束时间
|
||||
/// </summary>
|
||||
public static DateTime GetCurrentWeekEnd()
|
||||
{
|
||||
return GetCurrentWeekStart().AddDays(7).AddSeconds(-1);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 本月开始时间
|
||||
/// <summary>
|
||||
/// 本月开始时间
|
||||
/// </summary>
|
||||
public static DateTime GetCurrentMonthStart()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
return now.AddDays(1 - now.Day).Date;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 本月结束时间
|
||||
/// <summary>
|
||||
/// 本月结束时间
|
||||
/// </summary>
|
||||
public static DateTime GetCurrentMonthEnd()
|
||||
{
|
||||
return GetCurrentWeekStart().AddMonths(1).AddSeconds(-1);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 本季度开始时间
|
||||
/// <summary>
|
||||
/// 本季度开始时间
|
||||
/// </summary>
|
||||
public static DateTime GetCurrentQuarterStart()
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
return now.AddMonths(0 - (now.Month - 1) % 3).AddDays(1 - now.Day).Date;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 本季度结束时间
|
||||
/// <summary>
|
||||
/// 本季度结束时间
|
||||
/// </summary>
|
||||
public static DateTime GetCurrentQuarterthEnd()
|
||||
{
|
||||
return GetCurrentWeekStart().AddMonths(3).AddSeconds(-1);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 本年开始时间
|
||||
/// <summary>
|
||||
/// 本年开始时间
|
||||
/// </summary>
|
||||
public static DateTime GetCurrentYearStart()
|
||||
{
|
||||
return new DateTime(DateTime.Now.Year, 1, 1);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 本年结束时间
|
||||
/// <summary>
|
||||
/// 本年结束时间
|
||||
/// </summary>
|
||||
public static DateTime GetCurrentYearEnd()
|
||||
{
|
||||
return new DateTime(DateTime.Now.Year, 12, 31, 23, 59, 59);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
59
电子展板/Utility/Core/JsonHelper.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
||||
namespace 电子展板.Utility.Core
|
||||
{
|
||||
public static class JsonHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 对象序列化成JSON字符串。
|
||||
/// </summary>
|
||||
/// <param name="obj">序列化对象</param>
|
||||
/// <param name="ignoreProperties">设置需要忽略的属性</param>
|
||||
/// <returns></returns>
|
||||
public static string ToJson(this object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return string.Empty;
|
||||
IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
|
||||
timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
return JsonConvert.SerializeObject(obj, timeConverter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// JSON字符串序列化成对象。
|
||||
/// </summary>
|
||||
/// <typeparam name="T">对象类型</typeparam>
|
||||
/// <param name="json">JSON字符串</param>
|
||||
/// <returns></returns>
|
||||
public static T ToObject<T>(this string json)
|
||||
{
|
||||
return json.IsNullOrEmpty() ? default(T) : JsonConvert.DeserializeObject<T>(json);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// JSON字符串序列化成集合。
|
||||
/// </summary>
|
||||
/// <typeparam name="T">集合类型</typeparam>
|
||||
/// <param name="json">JSON字符串</param>
|
||||
/// <returns></returns>
|
||||
public static List<T> ToList<T>(this string json)
|
||||
{
|
||||
return json.IsNullOrEmpty() ? null : JsonConvert.DeserializeObject<List<T>>(json);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// JSON字符串序列化成DataTable。
|
||||
/// </summary>
|
||||
/// <param name="json">JSON字符串</param>
|
||||
/// <returns></returns>
|
||||
public static DataTable ToTable(this string json)
|
||||
{
|
||||
return json.IsNullOrEmpty() ? null : JsonConvert.DeserializeObject<DataTable>(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
255
电子展板/Utility/Core/LinqExtension.cs
Normal file
@@ -0,0 +1,255 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
|
||||
namespace 电子展板.Utility.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// LINQ扩展方法
|
||||
/// </summary>
|
||||
public static class LinqExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// 与连接
|
||||
/// </summary>
|
||||
/// <typeparam name="T">类型</typeparam>
|
||||
/// <param name="left">左条件</param>
|
||||
/// <param name="right">右条件</param>
|
||||
/// <returns>新表达式</returns>
|
||||
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> left, Expression<Func<T, bool>> right)
|
||||
{
|
||||
return CombineLambdas(left, right, ExpressionType.AndAlso);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 或连接
|
||||
/// </summary>
|
||||
/// <typeparam name="T">类型</typeparam>
|
||||
/// <param name="left">左条件</param>
|
||||
/// <param name="right">右条件</param>
|
||||
/// <returns>新表达式</returns>
|
||||
public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> left, Expression<Func<T, bool>> right)
|
||||
{
|
||||
return CombineLambdas(left, right, ExpressionType.OrElse);
|
||||
}
|
||||
|
||||
private static Expression<Func<T, bool>> CombineLambdas<T>(this Expression<Func<T, bool>> left, Expression<Func<T, bool>> right, ExpressionType expressionType)
|
||||
{
|
||||
var visitor = new SubstituteParameterVisitor
|
||||
{
|
||||
Sub =
|
||||
{
|
||||
[right.Parameters[0]] = left.Parameters[0]
|
||||
}
|
||||
};
|
||||
|
||||
Expression body = Expression.MakeBinary(expressionType, left.Body, visitor.Visit(right.Body));
|
||||
return Expression.Lambda<Func<T, bool>>(body, left.Parameters[0]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取最大值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <typeparam name="TResult"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="selector"></param>
|
||||
/// <returns></returns>
|
||||
public static TResult MaxOrDefault<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector) => source.Select(selector).OrderByDescending(_ => _).FirstOrDefault();
|
||||
|
||||
/// <summary>
|
||||
/// 取最大值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <typeparam name="TResult"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="selector"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
public static TResult MaxOrDefault<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector, TResult defaultValue)
|
||||
{
|
||||
TResult result = source.Select(selector).OrderByDescending(_ => _).FirstOrDefault();
|
||||
if (result != null)
|
||||
return result;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取最大值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static TSource MaxOrDefault<TSource>(this IQueryable<TSource> source)
|
||||
{
|
||||
return source.OrderByDescending(_ => _).FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取最大值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
public static TSource MaxOrDefault<TSource>(this IQueryable<TSource> source, TSource defaultValue)
|
||||
{
|
||||
TSource result = source.OrderByDescending(_ => _).FirstOrDefault();
|
||||
if (result != null)
|
||||
return result;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取最大值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <typeparam name="TResult"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="selector"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
public static TResult MaxOrDefault<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector, TResult defaultValue)
|
||||
{
|
||||
TResult result = source.Select(selector).OrderByDescending(_ => _).FirstOrDefault();
|
||||
if (result != null)
|
||||
return result;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取最大值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static TSource MaxOrDefault<TSource>(this IEnumerable<TSource> source) => source.OrderByDescending(_ => _).FirstOrDefault();
|
||||
|
||||
/// <summary>
|
||||
/// 取最大值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
public static TSource MaxOrDefault<TSource>(this IEnumerable<TSource> source, TSource defaultValue)
|
||||
{
|
||||
TSource result = source.OrderByDescending(_ => _).FirstOrDefault();
|
||||
if (result != null)
|
||||
return result;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取最小值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <typeparam name="TResult"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="selector"></param>
|
||||
/// <returns></returns>
|
||||
public static TResult MinOrDefault<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector) => source.Select(selector).OrderBy(_ => _).FirstOrDefault();
|
||||
|
||||
/// <summary>
|
||||
/// 取最小值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <typeparam name="TResult"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="selector"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
public static TResult MinOrDefault<TSource, TResult>(this IQueryable<TSource> source, Expression<Func<TSource, TResult>> selector, TResult defaultValue)
|
||||
{
|
||||
TResult result = source.Select(selector).OrderBy(_ => _).FirstOrDefault();
|
||||
if (result != null)
|
||||
return result;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取最小值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static TSource MinOrDefault<TSource>(this IQueryable<TSource> source) => source.OrderBy(_ => _).FirstOrDefault();
|
||||
|
||||
/// <summary>
|
||||
/// 取最小值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
public static TSource MinOrDefault<TSource>(this IQueryable<TSource> source, TSource defaultValue)
|
||||
{
|
||||
TSource result = source.OrderBy(_ => _).FirstOrDefault();
|
||||
if (result != null)
|
||||
return result;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取最小值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <typeparam name="TResult"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="selector"></param>
|
||||
/// <returns></returns>
|
||||
public static TResult MinOrDefault<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector) => source.Select(selector).OrderBy(_ => _).FirstOrDefault();
|
||||
|
||||
/// <summary>
|
||||
/// 取最小值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <typeparam name="TResult"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="selector"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
public static TResult MinOrDefault<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector, TResult defaultValue)
|
||||
{
|
||||
TResult result = source.Select(selector).OrderBy(_ => _).FirstOrDefault();
|
||||
if (result != null)
|
||||
return result;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取最小值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static TSource MinOrDefault<TSource>(this IEnumerable<TSource> source) => source.OrderBy(_ => _).FirstOrDefault();
|
||||
|
||||
/// <summary>
|
||||
/// 取最小值
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <returns></returns>
|
||||
public static TSource MinOrDefault<TSource>(this IEnumerable<TSource> source, TSource defaultValue)
|
||||
{
|
||||
TSource result = source.OrderBy(_ => _).FirstOrDefault();
|
||||
if (result != null)
|
||||
return result;
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
internal class SubstituteParameterVisitor : ExpressionVisitor
|
||||
{
|
||||
public Dictionary<Expression, Expression> Sub = new Dictionary<Expression, Expression>();
|
||||
|
||||
protected override Expression VisitParameter(ParameterExpression node)
|
||||
{
|
||||
return Sub.TryGetValue(node, out var newValue) ? newValue : node;
|
||||
}
|
||||
}
|
||||
}
|
||||
163
电子展板/Utility/Core/RMB.cs
Normal file
@@ -0,0 +1,163 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace 电子展板.Utility.Core
|
||||
{
|
||||
public static class RMB
|
||||
{/// <summary>
|
||||
/// 转换人民币大小金额
|
||||
/// </summary>
|
||||
/// <param name="num">金额</param>
|
||||
/// <returns>返回大写形式</returns>
|
||||
public static string ToRMB(this decimal num)
|
||||
{
|
||||
string str1 = "零壹贰叁肆伍陆柒捌玖"; //0-9所对应的汉字
|
||||
string str2 = "万仟佰拾亿仟佰拾万仟佰拾元角分"; //数字位所对应的汉字
|
||||
string str3 = ""; //从原num值中取出的值
|
||||
string str4 = ""; //数字的字符串形式
|
||||
string str5 = ""; //人民币大写金额形式
|
||||
int i; //循环变量
|
||||
int j; //num的值乘以100的字符串长度
|
||||
string ch1 = ""; //数字的汉语读法
|
||||
string ch2 = ""; //数字位的汉字读法
|
||||
int nzero = 0; //用来计算连续的零值是几个
|
||||
int temp; //从原num值中取出的值
|
||||
|
||||
num = Math.Round(Math.Abs(num), 2); //将num取绝对值并四舍五入取2位小数
|
||||
str4 = ((long)(num * 100)).ToString(); //将num乘100并转换成字符串形式
|
||||
j = str4.Length; //找出最高位
|
||||
if (j > 15) { return "溢出"; }
|
||||
str2 = str2.Substring(15 - j); //取出对应位数的str2的值。如:200.55,j为5所以str2=佰拾元角分
|
||||
|
||||
//循环取出每一位需要转换的值
|
||||
for (i = 0; i < j; i++)
|
||||
{
|
||||
str3 = str4.Substring(i, 1); //取出需转换的某一位的值
|
||||
temp = Convert.ToInt32(str3); //转换为数字
|
||||
if (i != (j - 3) && i != (j - 7) && i != (j - 11) && i != (j - 15))
|
||||
{
|
||||
//当所取位数不为元、万、亿、万亿上的数字时
|
||||
if (str3 == "0")
|
||||
{
|
||||
ch1 = "";
|
||||
ch2 = "";
|
||||
nzero = nzero + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (str3 != "0" && nzero != 0)
|
||||
{
|
||||
ch1 = "零" + str1.Substring(temp * 1, 1);
|
||||
ch2 = str2.Substring(i, 1);
|
||||
nzero = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ch1 = str1.Substring(temp * 1, 1);
|
||||
ch2 = str2.Substring(i, 1);
|
||||
nzero = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//该位是万亿,亿,万,元位等关键位
|
||||
if (str3 != "0" && nzero != 0)
|
||||
{
|
||||
ch1 = "零" + str1.Substring(temp * 1, 1);
|
||||
ch2 = str2.Substring(i, 1);
|
||||
nzero = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (str3 != "0" && nzero == 0)
|
||||
{
|
||||
ch1 = str1.Substring(temp * 1, 1);
|
||||
ch2 = str2.Substring(i, 1);
|
||||
nzero = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (str3 == "0" && nzero >= 3)
|
||||
{
|
||||
ch1 = "";
|
||||
ch2 = "";
|
||||
nzero = nzero + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (j >= 11)
|
||||
{
|
||||
ch1 = "";
|
||||
nzero = nzero + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ch1 = "";
|
||||
ch2 = str2.Substring(i, 1);
|
||||
nzero = nzero + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i == (j - 11) || i == (j - 3))
|
||||
{
|
||||
//如果该位是亿位或元位,则必须写上
|
||||
ch2 = str2.Substring(i, 1);
|
||||
}
|
||||
str5 = str5 + ch1 + ch2;
|
||||
|
||||
if (i == j - 1 && str3 == "0")
|
||||
{
|
||||
//最后一位(分)为0时,加上“整”
|
||||
str5 = str5 + '整';
|
||||
}
|
||||
}
|
||||
if (num == 0)
|
||||
{
|
||||
str5 = "零元整";
|
||||
}
|
||||
return str5;
|
||||
}
|
||||
|
||||
public static string ToRMB(this int num)
|
||||
{
|
||||
return ToRMB(Convert.ToString(num));
|
||||
}
|
||||
|
||||
public static string ToRMB(this float num)
|
||||
{
|
||||
return ToRMB(Convert.ToString(num));
|
||||
}
|
||||
|
||||
public static string ToRMB(this double num)
|
||||
{
|
||||
return ToRMB(Convert.ToString(num));
|
||||
}
|
||||
|
||||
public static string ToRMB(this long num)
|
||||
{
|
||||
return ToRMB(Convert.ToString(num));
|
||||
}
|
||||
/// <summary>
|
||||
/// 一个重载,将字符串先转换成数字在调用CmycurD(decimal num)
|
||||
/// </summary>
|
||||
/// <param name="num">用户输入的金额,字符串形式未转成decimal</param>
|
||||
/// <returns></returns>
|
||||
public static string ToRMB(this string numstr)
|
||||
{
|
||||
try
|
||||
{
|
||||
decimal num = Convert.ToDecimal(numstr);
|
||||
return ToRMB(num);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "非数字形式!";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
61
电子展板/Utility/Core/RandomHelper.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace 电子展板.Utility.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 使用Random类生成伪随机数
|
||||
/// </summary>
|
||||
public static class RandomHelper
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 生成一个指定范围的随机整数,该随机数范围包括最小值,但不包括最大值
|
||||
/// </summary>
|
||||
/// <param name="minNum">最小值</param>
|
||||
/// <param name="maxNum">最大值</param>
|
||||
public static int GetRandomInt(int minNum, int maxNum)
|
||||
{
|
||||
return new Random().Next(minNum, maxNum);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成一个0.0到1.0的随机小数
|
||||
/// </summary>
|
||||
public static double GetRandomDouble()
|
||||
{
|
||||
return new Random().NextDouble();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 对一个数组进行随机排序
|
||||
/// </summary>
|
||||
/// <typeparam name="T">数组的类型</typeparam>
|
||||
/// <param name="arr">需要随机排序的数组</param>
|
||||
public static void GetRandomArray<T>(T[] arr)
|
||||
{
|
||||
//对数组进行随机排序的算法:随机选择两个位置,将两个位置上的值交换
|
||||
|
||||
//交换的次数,这里使用数组的长度作为交换次数
|
||||
int count = arr.Length;
|
||||
|
||||
//开始交换
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//生成两个随机数位置
|
||||
int targetIndex1 = GetRandomInt(0, arr.Length);
|
||||
int targetIndex2 = GetRandomInt(0, arr.Length);
|
||||
|
||||
//定义临时变量
|
||||
T temp;
|
||||
|
||||
//交换两个随机数位置的值
|
||||
temp = arr[targetIndex1];
|
||||
arr[targetIndex1] = arr[targetIndex2];
|
||||
arr[targetIndex2] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
35
电子展板/Utility/Core/RegexHelper.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace 电子展板.Utility.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 操作正则表达式的公共类
|
||||
/// </summary>
|
||||
public class RegexHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 验证输入字符串是否与模式字符串匹配,匹配返回true
|
||||
/// </summary>
|
||||
/// <param name="input">输入字符串</param>
|
||||
/// <param name="pattern">模式字符串</param>
|
||||
public static bool IsMatch(string input, string pattern)
|
||||
{
|
||||
return IsMatch(input, pattern, RegexOptions.IgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证输入字符串是否与模式字符串匹配,匹配返回true
|
||||
/// </summary>
|
||||
/// <param name="input">输入的字符串</param>
|
||||
/// <param name="pattern">模式字符串</param>
|
||||
/// <param name="options">筛选条件</param>
|
||||
public static bool IsMatch(string input, string pattern, RegexOptions options)
|
||||
{
|
||||
return Regex.IsMatch(input, pattern, options);
|
||||
}
|
||||
}
|
||||
}
|
||||
279
电子展板/Utility/Core/RegisterHelper.cs
Normal file
@@ -0,0 +1,279 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.Win32;
|
||||
using System.Reflection;
|
||||
|
||||
namespace 电子展板.Utility.Core
|
||||
{
|
||||
#if NETFRAMEWORK
|
||||
/// <summary>
|
||||
/// 注册表辅助类
|
||||
/// </summary>
|
||||
public class RegisterHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 默认注册表基项
|
||||
/// </summary>
|
||||
private string baseKey = "Software";
|
||||
|
||||
#region 构造函数
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="baseKey">基项的名称</param>
|
||||
public RegisterHelper()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="baseKey">基项的名称</param>
|
||||
public RegisterHelper(string baseKey)
|
||||
{
|
||||
this.baseKey = baseKey;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 公共方法
|
||||
|
||||
/// <summary>
|
||||
/// 写入注册表,如果指定项已经存在,则修改指定项的值
|
||||
/// </summary>
|
||||
/// <param name="keytype">注册表基项枚举</param>
|
||||
/// <param name="key">注册表项,不包括基项</param>
|
||||
/// <param name="name">值名称</param>
|
||||
/// <param name="values">值</param>
|
||||
public void SetValue(KeyType keytype, string key, string name, string values)
|
||||
{
|
||||
|
||||
RegistryKey rk = (RegistryKey)GetRegistryKey(keytype);
|
||||
RegistryKey software = rk.OpenSubKey(baseKey, true);
|
||||
RegistryKey rkt = software.CreateSubKey(key);
|
||||
if (rkt != null)
|
||||
{
|
||||
rkt.SetValue(name, values);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 读取注册表
|
||||
/// </summary>
|
||||
/// <param name="keytype">注册表基项枚举</param>
|
||||
/// <param name="key">注册表项,不包括基项</param>
|
||||
/// <param name="name">值名称</param>
|
||||
/// <returns>返回字符串</returns>
|
||||
public string GetValue(KeyType keytype, string key, string name)
|
||||
{
|
||||
RegistryKey rk = (RegistryKey)GetRegistryKey(keytype);
|
||||
RegistryKey software = rk.OpenSubKey(baseKey, true);
|
||||
RegistryKey rkt = software.OpenSubKey(key);
|
||||
|
||||
if (rkt != null)
|
||||
{
|
||||
return rkt.GetValue(name).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除注册表中的值
|
||||
/// </summary>
|
||||
/// <param name="keytype">注册表基项枚举</param>
|
||||
/// <param name="key">注册表项名称,不包括基项</param>
|
||||
/// <param name="name">值名称</param>
|
||||
public void DeleteValue(KeyType keytype, string key, string name)
|
||||
{
|
||||
RegistryKey rk = (RegistryKey)GetRegistryKey(keytype);
|
||||
RegistryKey software = rk.OpenSubKey(baseKey, true);
|
||||
RegistryKey rkt = software.OpenSubKey(key, true);
|
||||
|
||||
if (rkt != null)
|
||||
{
|
||||
object value = rkt.GetValue(name);
|
||||
if (value != null)
|
||||
{
|
||||
rkt.DeleteValue(name, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除注册表中的指定项
|
||||
/// </summary>
|
||||
/// <param name="keytype">注册表基项枚举</param>
|
||||
/// <param name="key">注册表中的项,不包括基项</param>
|
||||
/// <returns>返回布尔值,指定操作是否成功</returns>
|
||||
public void DeleteSubKey(KeyType keytype, string key)
|
||||
{
|
||||
RegistryKey rk = (RegistryKey)GetRegistryKey(keytype);
|
||||
RegistryKey software = rk.OpenSubKey(baseKey, true);
|
||||
if (software != null)
|
||||
{
|
||||
software.DeleteSubKeyTree(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 判断指定项是否存在
|
||||
/// </summary>
|
||||
/// <param name="keytype">基项枚举</param>
|
||||
/// <param name="key">指定项字符串</param>
|
||||
/// <returns>返回布尔值,说明指定项是否存在</returns>
|
||||
public bool IsExist(KeyType keytype, string key)
|
||||
{
|
||||
RegistryKey rk = (RegistryKey)GetRegistryKey(keytype);
|
||||
RegistryKey software = rk.OpenSubKey(baseKey);
|
||||
RegistryKey rkt = software.OpenSubKey(key);
|
||||
if (rkt != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检索指定项关联的所有值
|
||||
/// </summary>
|
||||
/// <param name="keytype">基项枚举</param>
|
||||
/// <param name="key">指定项字符串</param>
|
||||
/// <returns>返回指定项关联的所有值的字符串数组</returns>
|
||||
public string[] GetValues(KeyType keytype, string key)
|
||||
{
|
||||
RegistryKey rk = (RegistryKey)GetRegistryKey(keytype);
|
||||
RegistryKey software = rk.OpenSubKey(baseKey, true);
|
||||
RegistryKey rkt = software.OpenSubKey(key);
|
||||
string[] names = rkt.GetValueNames();
|
||||
|
||||
if (names.Length == 0)
|
||||
{
|
||||
return names;
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] values = new string[names.Length];
|
||||
|
||||
int i = 0;
|
||||
|
||||
foreach (string name in names)
|
||||
{
|
||||
values[i] = rkt.GetValue(name).ToString();
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将对象所有属性写入指定注册表中
|
||||
/// </summary>
|
||||
/// <param name="keytype">注册表基项枚举</param>
|
||||
/// <param name="key">注册表项,不包括基项</param>
|
||||
/// <param name="obj">传入的对象</param>
|
||||
public void SetObjectValue(KeyType keyType, string key, Object obj)
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
Type t = obj.GetType();
|
||||
|
||||
string name;
|
||||
object value;
|
||||
foreach (var p in t.GetProperties())
|
||||
{
|
||||
if (p != null)
|
||||
{
|
||||
name = p.Name;
|
||||
value = p.GetValue(obj, null);
|
||||
this.SetValue(keyType, key, name, value.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 私有方法
|
||||
|
||||
/// <summary>
|
||||
/// 返回RegistryKey对象
|
||||
/// </summary>
|
||||
/// <param name="keyType">注册表基项枚举</param>
|
||||
/// <returns></returns>
|
||||
private object GetRegistryKey(KeyType keyType)
|
||||
{
|
||||
RegistryKey rk = null;
|
||||
|
||||
switch (keyType)
|
||||
{
|
||||
case KeyType.HKEY_CLASS_ROOT:
|
||||
rk = Registry.ClassesRoot;
|
||||
break;
|
||||
case KeyType.HKEY_CURRENT_USER:
|
||||
rk = Registry.CurrentUser;
|
||||
break;
|
||||
case KeyType.HKEY_LOCAL_MACHINE:
|
||||
rk = Registry.LocalMachine;
|
||||
break;
|
||||
case KeyType.HKEY_USERS:
|
||||
rk = Registry.Users;
|
||||
break;
|
||||
case KeyType.HKEY_CURRENT_CONFIG:
|
||||
rk = Registry.CurrentConfig;
|
||||
break;
|
||||
}
|
||||
|
||||
return rk;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 枚举
|
||||
/// <summary>
|
||||
/// 注册表基项枚举
|
||||
/// </summary>
|
||||
public enum KeyType : int
|
||||
{
|
||||
/// <summary>
|
||||
/// 注册表基项 HKEY_CLASSES_ROOT
|
||||
/// </summary>
|
||||
HKEY_CLASS_ROOT,
|
||||
/// <summary>
|
||||
/// 注册表基项 HKEY_CURRENT_USER
|
||||
/// </summary>
|
||||
HKEY_CURRENT_USER,
|
||||
/// <summary>
|
||||
/// 注册表基项 HKEY_LOCAL_MACHINE
|
||||
/// </summary>
|
||||
HKEY_LOCAL_MACHINE,
|
||||
/// <summary>
|
||||
/// 注册表基项 HKEY_USERS
|
||||
/// </summary>
|
||||
HKEY_USERS,
|
||||
/// <summary>
|
||||
/// 注册表基项 HKEY_CURRENT_CONFIG
|
||||
/// </summary>
|
||||
HKEY_CURRENT_CONFIG
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
316
电子展板/Utility/Core/StringHelper.cs
Normal file
@@ -0,0 +1,316 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace 电子展板.Utility.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 字符串操作类
|
||||
/// </summary>
|
||||
public static class StringHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 把字符串按照分隔符转换成 List
|
||||
/// </summary>
|
||||
/// <param name="str">源字符串</param>
|
||||
/// <param name="speater">分隔符</param>
|
||||
/// <param name="toLower">是否转换为小写</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> SplitToList(this string str, char speater = ',', bool toLower = false)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
string[] ss = str.Split(speater);
|
||||
foreach (string s in ss)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(s) && s != speater.ToString())
|
||||
{
|
||||
string strVal = s;
|
||||
if (toLower)
|
||||
{
|
||||
strVal = s.ToLower();
|
||||
}
|
||||
list.Add(strVal);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 把 List<string> 按照分隔符组装成 string
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
/// <param name="speater"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetStrArray(this List<string> list, string speater = ",")
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (i == list.Count - 1)
|
||||
{
|
||||
sb.Append(list[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append(list[i]);
|
||||
sb.Append(speater);
|
||||
}
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除最后结尾的指定字符后的字符
|
||||
/// </summary>
|
||||
public static string DelLastChar(this string str, string strChar = ",")
|
||||
{
|
||||
return str.Substring(0, str.LastIndexOf(strChar));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 转全角的函数(SBC case)
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToSBC(string input)
|
||||
{
|
||||
//半角转全角:
|
||||
char[] c = input.ToCharArray();
|
||||
for (int i = 0; i < c.Length; i++)
|
||||
{
|
||||
if (c[i] == 32)
|
||||
{
|
||||
c[i] = (char)12288;
|
||||
continue;
|
||||
}
|
||||
if (c[i] < 127)
|
||||
c[i] = (char)(c[i] + 65248);
|
||||
}
|
||||
return new string(c);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 转半角的函数(SBC case)
|
||||
/// </summary>
|
||||
/// <param name="input">输入</param>
|
||||
/// <returns></returns>
|
||||
public static string ToDBC(string input)
|
||||
{
|
||||
char[] c = input.ToCharArray();
|
||||
for (int i = 0; i < c.Length; i++)
|
||||
{
|
||||
if (c[i] == 12288)
|
||||
{
|
||||
c[i] = (char)32;
|
||||
continue;
|
||||
}
|
||||
if (c[i] > 65280 && c[i] < 65375)
|
||||
c[i] = (char)(c[i] - 65248);
|
||||
}
|
||||
return new string(c);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取正确的Id,如果不是正整数,返回0
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns>返回正确的整数ID,失败返回0</returns>
|
||||
public static int ToInt32(this string value)
|
||||
{
|
||||
if (IsNumberId(value))
|
||||
return int.Parse(value);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查一个字符串是否是纯数字构成的,一般用于查询字符串参数的有效性验证。(0除外)
|
||||
/// </summary>
|
||||
/// <param name="_value">需验证的字符串。。</param>
|
||||
/// <returns>是否合法的bool值。</returns>
|
||||
public static bool IsNumberId(string _value)
|
||||
{
|
||||
return QuickValidate("^[1-9]*[0-9]*$", _value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 快速验证一个字符串是否符合指定的正则表达式。
|
||||
/// </summary>
|
||||
/// <param name="_express">正则表达式的内容。</param>
|
||||
/// <param name="_value">需验证的字符串。</param>
|
||||
/// <returns>是否合法的bool值。</returns>
|
||||
public static bool QuickValidate(string _express, string _value)
|
||||
{
|
||||
if (_value == null) return false;
|
||||
Regex myRegex = new Regex(_express);
|
||||
if (_value.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return myRegex.IsMatch(_value);
|
||||
}
|
||||
/// <summary>
|
||||
/// 得到字符串长度,一个汉字长度为2
|
||||
/// </summary>
|
||||
/// <param name="inputString">参数字符串</param>
|
||||
/// <returns></returns>
|
||||
public static int StrLength(this string inputString)
|
||||
{
|
||||
System.Text.ASCIIEncoding ascii = new System.Text.ASCIIEncoding();
|
||||
int tempLen = 0;
|
||||
byte[] s = ascii.GetBytes(inputString);
|
||||
for (int i = 0; i < s.Length; i++)
|
||||
{
|
||||
if ((int)s[i] == 63)
|
||||
tempLen += 2;
|
||||
else
|
||||
tempLen += 1;
|
||||
}
|
||||
return tempLen;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 截取指定长度字符串
|
||||
/// </summary>
|
||||
/// <param name="inputString">要处理的字符串</param>
|
||||
/// <param name="len">指定长度</param>
|
||||
/// <returns>返回处理后的字符串</returns>
|
||||
public static string splitString(this string inputString, int len)
|
||||
{
|
||||
bool isShowFix = false;
|
||||
if (len % 2 == 1)
|
||||
{
|
||||
isShowFix = true;
|
||||
len--;
|
||||
}
|
||||
System.Text.ASCIIEncoding ascii = new System.Text.ASCIIEncoding();
|
||||
int tempLen = 0;
|
||||
string tempString = "";
|
||||
byte[] s = ascii.GetBytes(inputString);
|
||||
for (int i = 0; i < s.Length; i++)
|
||||
{
|
||||
if ((int)s[i] == 63)
|
||||
tempLen += 2;
|
||||
else
|
||||
tempLen += 1;
|
||||
|
||||
try
|
||||
{
|
||||
tempString += inputString.Substring(i, 1);
|
||||
}
|
||||
catch
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (tempLen > len)
|
||||
break;
|
||||
}
|
||||
|
||||
byte[] mybyte = System.Text.Encoding.Default.GetBytes(inputString);
|
||||
if (isShowFix && mybyte.Length > len)
|
||||
tempString += "…";
|
||||
return tempString;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// HTML转行成TEXT
|
||||
/// </summary>
|
||||
/// <param name="strHtml"></param>
|
||||
/// <returns></returns>
|
||||
public static string HtmlToTxt(this string strHtml)
|
||||
{
|
||||
string[] aryReg ={
|
||||
@"<script[^>]*?>.*?</script>",
|
||||
@"<(\/\s*)?!?((\w+:)?\w+)(\w+(\s*=?\s*(([""'])(\\[""'tbnr]|[^\7])*?\7|\w+)|.{0})|\s)*?(\/\s*)?>",
|
||||
@"([\r\n])[\s]+",
|
||||
@"&(quot|#34);",
|
||||
@"&(amp|#38);",
|
||||
@"&(lt|#60);",
|
||||
@"&(gt|#62);",
|
||||
@"&(nbsp|#160);",
|
||||
@"&(iexcl|#161);",
|
||||
@"&(cent|#162);",
|
||||
@"&(pound|#163);",
|
||||
@"&(copy|#169);",
|
||||
@"&#(\d+);",
|
||||
@"-->",
|
||||
@"<!--.*\n"
|
||||
};
|
||||
|
||||
string newReg = aryReg[0];
|
||||
string strOutput = strHtml;
|
||||
for (int i = 0; i < aryReg.Length; i++)
|
||||
{
|
||||
Regex regex = new Regex(aryReg[i], RegexOptions.IgnoreCase);
|
||||
strOutput = regex.Replace(strOutput, string.Empty);
|
||||
}
|
||||
|
||||
strOutput.Replace("<", "");
|
||||
strOutput.Replace(">", "");
|
||||
strOutput.Replace("\r\n", "");
|
||||
|
||||
|
||||
return strOutput;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 判断对象是否为空,为空返回true
|
||||
/// </summary>
|
||||
/// <typeparam name="T">要验证的对象的类型</typeparam>
|
||||
/// <param name="data">要验证的对象</param>
|
||||
public static bool IsNullOrEmpty(this string data)
|
||||
{
|
||||
//如果为null
|
||||
if (data == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (string.IsNullOrEmpty(data.ToString().Trim()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 判断对象是否为空,为空返回true
|
||||
/// </summary>
|
||||
/// <typeparam name="T">要验证的对象的类型</typeparam>
|
||||
/// <param name="data">要验证的对象</param>
|
||||
public static bool IsNullOrEmpty<T>(this List<T> collection)
|
||||
{
|
||||
if (collection == null)
|
||||
return true;
|
||||
if (collection.Count() == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsNullOrEmpty(this DataSet ds)
|
||||
{
|
||||
if (ds == null)
|
||||
return true;
|
||||
if (ds.Tables.Count == 0)
|
||||
return true;
|
||||
return ds.Tables[0].IsNullOrEmpty();
|
||||
}
|
||||
|
||||
public static bool IsNullOrEmpty(this DataTable dt)
|
||||
{
|
||||
if (dt == null)
|
||||
return true;
|
||||
if (dt.Rows.Count == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
50
电子展板/Utility/Extension/MyEnvironment.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace 电子展板.Utility.Extension
|
||||
{
|
||||
public class MyEnvironment
|
||||
{
|
||||
public static string WebRootPath(string path)
|
||||
{
|
||||
if (!path.StartsWith("/"))
|
||||
{
|
||||
path += "/";
|
||||
}
|
||||
return Root("/wwwroot" + path);
|
||||
}
|
||||
public static string Root(string vPath)
|
||||
{
|
||||
string path = Environment.CurrentDirectory.Replace("/", "\\");
|
||||
if (!path.EndsWith("\\")) path += "\\";
|
||||
vPath = vPath.Replace("/", "\\");
|
||||
if (vPath.StartsWith("\\"))
|
||||
{
|
||||
vPath = vPath.Substring(1);
|
||||
}
|
||||
return path + vPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 插件所在路径
|
||||
/// </summary>
|
||||
/// <param name="plugType"></param>
|
||||
/// <param name="vPath"></param>
|
||||
/// <returns></returns>
|
||||
public static string PlugRoot(Type plugType, string vPath)
|
||||
{
|
||||
string path = plugType.Assembly.Location;
|
||||
path = path.Substring(0, path.LastIndexOf("\\"));
|
||||
if (!path.EndsWith("\\")) path += "\\";
|
||||
vPath = vPath.Replace("/", "\\");
|
||||
if (vPath.StartsWith("\\"))
|
||||
{
|
||||
vPath = vPath.Substring(1);
|
||||
}
|
||||
return path + vPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
94
电子展板/Utility/Logs/LogHelper.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using System;
|
||||
using 电子展板.Utility.Extension;
|
||||
|
||||
namespace 电子展板.Utility.Logs
|
||||
{
|
||||
public class LogHelper
|
||||
{
|
||||
private readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private static LogHelper _obj;
|
||||
|
||||
private LogHelper()
|
||||
{
|
||||
LogManager.Configuration = new XmlLoggingConfiguration(MyEnvironment.Root("/Configs/NLog.config"));
|
||||
}
|
||||
public static LogHelper Instance => _obj ?? (new LogHelper());
|
||||
|
||||
|
||||
|
||||
#region Debug,调试
|
||||
public void Debug(string msg)
|
||||
{
|
||||
_logger.Debug(msg);
|
||||
}
|
||||
|
||||
public void Debug(string msg, Exception err)
|
||||
{
|
||||
_logger.Debug(err, msg);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Info,信息
|
||||
public void Info(string msg)
|
||||
{
|
||||
_logger.Info(msg);
|
||||
}
|
||||
|
||||
public void Info(string msg, Exception err)
|
||||
{
|
||||
_logger.Info(err, msg);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Warn,警告
|
||||
public void Warn(string msg)
|
||||
{
|
||||
_logger.Warn(msg);
|
||||
}
|
||||
|
||||
public void Warn(string msg, Exception err)
|
||||
{
|
||||
_logger.Warn(err, msg);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Trace,追踪
|
||||
public void Trace(string msg)
|
||||
{
|
||||
_logger.Trace(msg);
|
||||
}
|
||||
|
||||
public void Trace(string msg, Exception err)
|
||||
{
|
||||
_logger.Trace(err, msg);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Error,错误
|
||||
public void Error(string msg)
|
||||
{
|
||||
_logger.Error(msg);
|
||||
}
|
||||
|
||||
public void Error(string msg, Exception err)
|
||||
{
|
||||
_logger.Error(err, msg);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Fatal,致命错误
|
||||
public void Fatal(string msg)
|
||||
{
|
||||
_logger.Fatal(msg);
|
||||
}
|
||||
|
||||
public void Fatal(string msg, Exception err)
|
||||
{
|
||||
_logger.Fatal(err, msg);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
58
电子展板/Utility/ResponseModels/AjaxResult.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace 电子展板.Utility.ResponseModels
|
||||
{
|
||||
/// <summary>
|
||||
/// 通用AJAX请求响应数据格式模型。
|
||||
/// </summary>
|
||||
public class AjaxResult
|
||||
{
|
||||
public AjaxResult(ResultType state, string message, object data = null)
|
||||
{
|
||||
this.state = state;
|
||||
this.message = message;
|
||||
this.data = data;
|
||||
}
|
||||
/// <summary>
|
||||
/// 结果类型。
|
||||
/// </summary>
|
||||
public ResultType state { get; set; }
|
||||
/// <summary>
|
||||
/// 消息内容。
|
||||
/// </summary>
|
||||
public string message { get; set; }
|
||||
/// <summary>
|
||||
/// 返回数据。
|
||||
/// </summary>
|
||||
public object data { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 结果类型枚举。
|
||||
/// </summary>
|
||||
public enum ResultType
|
||||
{
|
||||
/// <summary>
|
||||
/// 警告。
|
||||
/// </summary>
|
||||
Warning = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 成功。
|
||||
/// </summary>
|
||||
Success = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 异常。
|
||||
/// </summary>
|
||||
Error = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 消息。
|
||||
/// </summary>
|
||||
Info = 6
|
||||
}
|
||||
}
|
||||
51
电子展板/Utility/ResponseModels/LayNavbar.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace 电子展板.Utility.ResponseModels
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 菜单视图模型。
|
||||
/// </summary>
|
||||
public class LayNavbar
|
||||
{
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
public string title { get; set; }
|
||||
/// <summary>
|
||||
/// 图标
|
||||
/// </summary>
|
||||
public string icon { get; set; }
|
||||
/// <summary>
|
||||
/// 是否展开
|
||||
/// </summary>
|
||||
public bool spread { get; set; }
|
||||
/// <summary>
|
||||
/// 子级菜单集合
|
||||
/// </summary>
|
||||
public List<LayChildNavbar> children { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 子级菜单模型。
|
||||
/// </summary>
|
||||
public class LayChildNavbar
|
||||
{
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
public string title { get; set; }
|
||||
/// <summary>
|
||||
/// 图标
|
||||
/// </summary>
|
||||
public string icon { get; set; }
|
||||
/// <summary>
|
||||
/// 链接
|
||||
/// </summary>
|
||||
public string href { get; set; }
|
||||
}
|
||||
}
|
||||
37
电子展板/Utility/ResponseModels/LayPadding.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace 电子展板.Utility.ResponseModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Laytpl + Laypage 分页模型。
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
public class LayPadding<TEntity> where TEntity : class
|
||||
{
|
||||
public int code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取结果。
|
||||
/// </summary>
|
||||
public bool result { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注信息。
|
||||
/// </summary>
|
||||
public string msg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据列表。
|
||||
/// </summary>
|
||||
public List<TEntity> list { get; set; }
|
||||
|
||||
public string backgroundImage { get; set; }
|
||||
/// <summary>
|
||||
/// 记录条数。
|
||||
/// </summary>
|
||||
public long count { get; set; }
|
||||
}
|
||||
}
|
||||
35
电子展板/Utility/ResponseModels/LayPaddingDataTable.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace 电子展板.Utility.ResponseModels
|
||||
{
|
||||
public class LayPaddingDataTable
|
||||
{
|
||||
public int code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取结果。
|
||||
/// </summary>
|
||||
public bool result { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注信息。
|
||||
/// </summary>
|
||||
public string msg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据列表。
|
||||
/// </summary>
|
||||
public DataTable list { get; set; }
|
||||
|
||||
public string backgroundImage { get; set; }
|
||||
/// <summary>
|
||||
/// 记录条数。
|
||||
/// </summary>
|
||||
public long count { get; set; }
|
||||
}
|
||||
}
|
||||
11
电子展板/Utility/ResponseModels/RetStr.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace 电子展板.Utility.ResponseModels
|
||||
{
|
||||
public class RetStr
|
||||
{
|
||||
public string Data { get; set; }
|
||||
}
|
||||
}
|
||||
55
电子展板/Utility/ResponseModels/TreeSelect.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace 电子展板.Utility.ResponseModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Select2树形下拉列表模型。
|
||||
/// </summary>
|
||||
public class TreeSelect
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string text { get; set; }
|
||||
public string parentId { get; set; }
|
||||
public object data { get; set; }
|
||||
}
|
||||
|
||||
public static class TreeSelectHelper
|
||||
{
|
||||
public static string ToTreeSelectJson(this List<TreeSelect> data)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("[");
|
||||
sb.Append(ToTreeSelectJson(data, "0", ""));
|
||||
sb.Append("]");
|
||||
return sb.ToString();
|
||||
}
|
||||
private static string ToTreeSelectJson(List<TreeSelect> data, string parentId, string blank)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
var childList = data.FindAll(t => t.parentId == parentId);
|
||||
|
||||
var tabline = "";
|
||||
if (parentId != "0")
|
||||
{
|
||||
tabline = " ";
|
||||
}
|
||||
if (childList.Count > 0)
|
||||
{
|
||||
tabline = tabline + blank;
|
||||
}
|
||||
foreach (TreeSelect entity in childList)
|
||||
{
|
||||
entity.text = tabline + entity.text;
|
||||
string strJson = JsonConvert.SerializeObject(entity);
|
||||
sb.Append(strJson);
|
||||
sb.Append(ToTreeSelectJson(data, entity.id, tabline));
|
||||
}
|
||||
return sb.ToString().Replace("}{", "},{");
|
||||
}
|
||||
}
|
||||
}
|
||||
34
电子展板/Utility/ResponseModels/ZTreeNode.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace 电子展板.Utility.ResponseModels
|
||||
{
|
||||
/// <summary>
|
||||
/// zTree单层节点数据模型。
|
||||
/// </summary>
|
||||
public class ZTreeNode
|
||||
{
|
||||
/// <summary>
|
||||
/// 节点ID。
|
||||
/// </summary>
|
||||
public string id { get; set; }
|
||||
/// <summary>
|
||||
/// 父节点ID。
|
||||
/// </summary>
|
||||
public string pId { get; set; }
|
||||
/// <summary>
|
||||
/// 节点名称。
|
||||
/// </summary>
|
||||
public string name { get; set; }
|
||||
/// <summary>
|
||||
/// 是否展开。
|
||||
/// </summary>
|
||||
public bool open { get; set; }
|
||||
/// <summary>
|
||||
/// 是否选中。
|
||||
/// </summary>
|
||||
public bool @checked { get; set; }
|
||||
}
|
||||
}
|
||||
70
电子展板/WebServer.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using Beginor.Owin.StaticFile;
|
||||
using JinianNet.JNTemplate;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Owin.Hosting;
|
||||
using Owin;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Formatting;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using 电子展板.Utility.Extension;
|
||||
using 电子展板.Utility.Logs;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace 电子展板
|
||||
{
|
||||
public class WebServer
|
||||
{
|
||||
private static IDisposable host;
|
||||
public static void Start()
|
||||
{
|
||||
LogHelper.Instance.Info("正在开启Web服务");
|
||||
StartOptions startOptions = new StartOptions();
|
||||
startOptions.Urls.Add($"http://*:80/");
|
||||
host = WebApp.Start<Startup>(startOptions);
|
||||
}
|
||||
|
||||
public static void Stop()
|
||||
{
|
||||
if (host == null)
|
||||
return;
|
||||
LogHelper.Instance.Info("正在停止Web服务");
|
||||
host.Dispose();
|
||||
host = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Web启动类
|
||||
/// </summary>
|
||||
public class Startup
|
||||
{
|
||||
private HttpConfiguration _config;
|
||||
/// <summary>
|
||||
/// 配置
|
||||
/// </summary>
|
||||
/// <param name="app"></param>
|
||||
/// <param name="env"></param>
|
||||
public void Configuration(IAppBuilder app)
|
||||
{
|
||||
_config = new HttpConfiguration();
|
||||
_config.MapHttpAttributeRoutes();
|
||||
_config.Formatters.XmlFormatter.SupportedMediaTypes.Clear();
|
||||
_config.Formatters.JsonFormatter.MediaTypeMappings.Add(new QueryStringMapping("datatype", "json", "application/json"));
|
||||
app.UseWebApi(_config);
|
||||
//配置模板引擎
|
||||
Engine.Configure(c =>
|
||||
{
|
||||
c.TagPrefix = "${";
|
||||
c.TagSuffix = "}";
|
||||
c.TagFlag = '^';
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
79
电子展板/app.manifest
Normal file
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC 清单选项
|
||||
如果想要更改 Windows 用户帐户控制级别,请使用
|
||||
以下节点之一替换 requestedExecutionLevel 节点。
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
|
||||
如果你的应用程序需要此虚拟化来实现向后兼容性,则移除此
|
||||
元素。
|
||||
-->
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
|
||||
Windows 版本的列表。取消评论适当的元素,
|
||||
Windows 将自动选择最兼容的环境。 -->
|
||||
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
|
||||
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
|
||||
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
|
||||
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
|
||||
|
||||
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
|
||||
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
|
||||
<!--
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
</assembly>
|
||||
BIN
电子展板/favicon.ico
Normal file
|
After Width: | Height: | Size: 66 KiB |
54
电子展板/电子展板.csproj
Normal file
@@ -0,0 +1,54 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
<Version>1.0.1</Version>
|
||||
<ApplicationIcon>favicon.ico</ApplicationIcon>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="favicon.ico" />
|
||||
<Resource Include="Assets\**" />
|
||||
<None Update="Configs\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Costura.Fody" Version="6.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="HandyControl" Version="3.5.1" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<!-- JSON框架 -->
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<!-- 模板引擎 -->
|
||||
<PackageReference Include="JinianNet.JNTemplate" Version="2.4.3" />
|
||||
<!-- 日志框架 -->
|
||||
<PackageReference Include="NLog" Version="6.0.2" />
|
||||
<!-- WEB 自宿主 -->
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="9.0.9" />
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Owin" version="5.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.3.0" />
|
||||
<PackageReference Include="Microsoft.Owin" Version="4.2.3" />
|
||||
<PackageReference Include="Microsoft.Owin.Host.SystemWeb" Version="4.2.3" />
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.OwinSelfHost" Version="5.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNet.Identity.Owin" Version="2.2.4" />
|
||||
<PackageReference Include="Swashbuckle.Core" version="5.6.0" />
|
||||
<PackageReference Include="Beginor.Owin.StaticFile" Version="0.3.1" />
|
||||
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.3.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="ViewModels\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||