creat stand
63
.gitattributes
vendored
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
###############################################################################
|
||||||
|
# Set default behavior to automatically normalize line endings.
|
||||||
|
###############################################################################
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Set default behavior for command prompt diff.
|
||||||
|
#
|
||||||
|
# This is need for earlier builds of msysgit that does not have it on by
|
||||||
|
# default for csharp files.
|
||||||
|
# Note: This is only used by command line
|
||||||
|
###############################################################################
|
||||||
|
#*.cs diff=csharp
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Set the merge driver for project and solution files
|
||||||
|
#
|
||||||
|
# Merging from the command prompt will add diff markers to the files if there
|
||||||
|
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||||
|
# the diff markers are never inserted). Diff markers may cause the following
|
||||||
|
# file extensions to fail to load in VS. An alternative would be to treat
|
||||||
|
# these files as binary and thus will always conflict and require user
|
||||||
|
# intervention with every merge. To do so, just uncomment the entries below
|
||||||
|
###############################################################################
|
||||||
|
#*.sln merge=binary
|
||||||
|
#*.csproj merge=binary
|
||||||
|
#*.vbproj merge=binary
|
||||||
|
#*.vcxproj merge=binary
|
||||||
|
#*.vcproj merge=binary
|
||||||
|
#*.dbproj merge=binary
|
||||||
|
#*.fsproj merge=binary
|
||||||
|
#*.lsproj merge=binary
|
||||||
|
#*.wixproj merge=binary
|
||||||
|
#*.modelproj merge=binary
|
||||||
|
#*.sqlproj merge=binary
|
||||||
|
#*.wwaproj merge=binary
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# behavior for image files
|
||||||
|
#
|
||||||
|
# image files are treated as binary by default.
|
||||||
|
###############################################################################
|
||||||
|
#*.jpg binary
|
||||||
|
#*.png binary
|
||||||
|
#*.gif binary
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# diff behavior for common document formats
|
||||||
|
#
|
||||||
|
# Convert binary document formats to text before diffing them. This feature
|
||||||
|
# is only available from the command line. Turn it on by uncommenting the
|
||||||
|
# entries below.
|
||||||
|
###############################################################################
|
||||||
|
#*.doc diff=astextplain
|
||||||
|
#*.DOC diff=astextplain
|
||||||
|
#*.docx diff=astextplain
|
||||||
|
#*.DOCX diff=astextplain
|
||||||
|
#*.dot diff=astextplain
|
||||||
|
#*.DOT diff=astextplain
|
||||||
|
#*.pdf diff=astextplain
|
||||||
|
#*.PDF diff=astextplain
|
||||||
|
#*.rtf diff=astextplain
|
||||||
|
#*.RTF diff=astextplain
|
||||||
365
.gitignore
vendored
Normal file
@ -0,0 +1,365 @@
|
|||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
##
|
||||||
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.rsuser
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Mono auto generated files
|
||||||
|
mono_crash.*
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
[Ww][Ii][Nn]32/
|
||||||
|
[Aa][Rr][Mm]/
|
||||||
|
[Aa][Rr][Mm]64/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Oo]ut/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# Visual Studio 2017 auto generated files
|
||||||
|
Generated\ Files/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUnit
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
nunit-*.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# Benchmark Results
|
||||||
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
|
# .NET Core
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
# ASP.NET Scaffolding
|
||||||
|
ScaffoldingReadMe.txt
|
||||||
|
|
||||||
|
# StyleCop
|
||||||
|
StyleCopReport.xml
|
||||||
|
|
||||||
|
# Files built by Visual Studio
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_h.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.iobj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.ipdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*_wpftmp.csproj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# Visual Studio Trace Files
|
||||||
|
*.e2e
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool
|
||||||
|
.axoCover/*
|
||||||
|
!.axoCover/settings.json
|
||||||
|
|
||||||
|
# Coverlet is a free, cross platform Code Coverage Tool
|
||||||
|
coverage*.json
|
||||||
|
coverage*.xml
|
||||||
|
coverage*.info
|
||||||
|
|
||||||
|
# Visual Studio code coverage results
|
||||||
|
*.coverage
|
||||||
|
*.coveragexml
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# NuGet Symbol Packages
|
||||||
|
*.snupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/[Pp]ackages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/[Pp]ackages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/[Pp]ackages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
*.appx
|
||||||
|
*.appxbundle
|
||||||
|
*.appxupload
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!?*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Including strong name files can present a security risk
|
||||||
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
|
#*.snk
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
ServiceFabricBackup/
|
||||||
|
*.rptproj.bak
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
*.ndf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
*.rptproj.rsuser
|
||||||
|
*- [Bb]ackup.rdl
|
||||||
|
*- [Bb]ackup ([0-9]).rdl
|
||||||
|
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# CodeRush personal settings
|
||||||
|
.cr/personal
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it
|
||||||
|
# tools/**
|
||||||
|
# !tools/packages.config
|
||||||
|
|
||||||
|
# Tabs Studio
|
||||||
|
*.tss
|
||||||
|
|
||||||
|
# Telerik's JustMock configuration file
|
||||||
|
*.jmconfig
|
||||||
|
|
||||||
|
# BizTalk build output
|
||||||
|
*.btp.cs
|
||||||
|
*.btm.cs
|
||||||
|
*.odx.cs
|
||||||
|
*.xsd.cs
|
||||||
|
|
||||||
|
# OpenCover UI analysis results
|
||||||
|
OpenCover/
|
||||||
|
|
||||||
|
# Azure Stream Analytics local run output
|
||||||
|
ASALocalRun/
|
||||||
|
|
||||||
|
# MSBuild Binary and Structured Log
|
||||||
|
*.binlog
|
||||||
|
|
||||||
|
# NVidia Nsight GPU debugger configuration file
|
||||||
|
*.nvuser
|
||||||
|
|
||||||
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
|
.mfractor/
|
||||||
|
|
||||||
|
# Local History for Visual Studio
|
||||||
|
.localhistory/
|
||||||
|
|
||||||
|
# BeatPulse healthcheck temp database
|
||||||
|
healthchecksdb
|
||||||
|
|
||||||
|
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||||
|
MigrationBackup/
|
||||||
|
|
||||||
|
# Ionide (cross platform F# VS Code tools) working folder
|
||||||
|
.ionide/
|
||||||
|
|
||||||
|
# Fody - auto-generated XML schema
|
||||||
|
FodyWeavers.xsd
|
||||||
|
|
||||||
|
*.accdb
|
||||||
2273
Community/ADTMC.cs
Normal file
176
Community/AccHelpers.cs
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.OleDb;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Community
|
||||||
|
{
|
||||||
|
public class AccHelpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Appconfig中用于连接数据库的字符串
|
||||||
|
/// </summary>
|
||||||
|
public static string connStr = ConfigurationManager.ConnectionStrings["dbConnstr"].ConnectionString;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据库执行操作的方法,只返回受影响的行数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sql"></param>
|
||||||
|
/// <param name="parameter"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int ExecuteNonQuery(string sql, params OleDbParameter[] parameter)
|
||||||
|
{
|
||||||
|
//using (OleDbConnection conn = new OleDbConnection(connStr))
|
||||||
|
//{
|
||||||
|
// conn.Open();
|
||||||
|
|
||||||
|
// using (OleDbCommand cmd = new OleDbCommand(sql, conn))
|
||||||
|
// {
|
||||||
|
// cmd.Parameters.AddRange(parameter);
|
||||||
|
// return cmd.ExecuteNonQuery();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//速度更快
|
||||||
|
ConnectOpen();
|
||||||
|
using (OleDbCommand cmd = new OleDbCommand(sql, conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddRange(parameter);
|
||||||
|
return cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int ExecuteNonQuery(CommandType type, string sql, params OleDbParameter[] parameter)
|
||||||
|
{
|
||||||
|
using (OleDbConnection conn = new OleDbConnection(connStr))
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
using (OleDbCommand cmd = new OleDbCommand(sql, conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddRange(parameter);
|
||||||
|
cmd.CommandType = type;
|
||||||
|
|
||||||
|
return cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询获取单个结果集的方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sql"></param>
|
||||||
|
/// <param name="parameter"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static object ExecuteScalar(string sql, params OleDbParameter[] parameter)
|
||||||
|
{
|
||||||
|
//速度更快
|
||||||
|
ConnectOpen();
|
||||||
|
using (OleDbCommand cmd = new OleDbCommand(sql, conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddRange(parameter);
|
||||||
|
return cmd.ExecuteScalar();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static object ExecuteScalar(CommandType type, string sql, params OleDbParameter[] parameter)
|
||||||
|
{
|
||||||
|
//速度更快
|
||||||
|
ConnectOpen();
|
||||||
|
|
||||||
|
conn.Open();
|
||||||
|
using (OleDbCommand cmd = new OleDbCommand(sql, conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddRange(parameter);
|
||||||
|
cmd.CommandType = type;
|
||||||
|
return cmd.ExecuteScalar();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询获取结果集的方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sql"></param>
|
||||||
|
/// <param name="paramaeter"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static DataTable ExecuteDataTable(string sql, params OleDbParameter[] paramaeter)
|
||||||
|
{
|
||||||
|
|
||||||
|
//using (OleDbConnection conn = new OleDbConnection(connStr))
|
||||||
|
//{
|
||||||
|
|
||||||
|
// conn.Open();
|
||||||
|
// using (OleDbCommand cmd = new OleDbCommand(sql, conn))
|
||||||
|
// {
|
||||||
|
// cmd.Parameters.AddRange(paramaeter);
|
||||||
|
// OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
|
||||||
|
// DataSet dataset = new DataSet();
|
||||||
|
// adapter.Fill(dataset);
|
||||||
|
// return dataset.Tables[0];
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//速度更快
|
||||||
|
ConnectOpen();
|
||||||
|
using (OleDbCommand cmd = new OleDbCommand(sql, conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddRange(paramaeter);
|
||||||
|
OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
|
||||||
|
DataSet dataset = new DataSet();
|
||||||
|
adapter.Fill(dataset);
|
||||||
|
return dataset.Tables[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
static OleDbConnection conn;
|
||||||
|
/// <summary>
|
||||||
|
/// 数据库连接
|
||||||
|
/// </summary>
|
||||||
|
public static bool ConnectOpen()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (conn == null)
|
||||||
|
{
|
||||||
|
conn = new OleDbConnection(connStr);
|
||||||
|
conn.Open();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (conn.State == ConnectionState.Open)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
conn = new OleDbConnection(connStr);
|
||||||
|
conn.Open();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// MessageBox.Show("本地数据库连接失败");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
92
Community/Community.csproj
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{40BD9B86-2281-4E16-BFAB-558CB18E873C}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Community</RootNamespace>
|
||||||
|
<AssemblyName>Community</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="ControlzEx, Version=4.0.0.0, Culture=neutral, PublicKeyToken=69f1c32f803d307e, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\ControlzEx.4.3.2\lib\net45\ControlzEx.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="MahApps.Metro, Version=2.0.0.0, Culture=neutral, PublicKeyToken=51482d6f650b2b3f, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\MahApps.Metro.2.2.0\lib\net452\MahApps.Metro.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.19\lib\net45\Microsoft.Xaml.Behaviors.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
|
<Reference Include="System.configuration" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Web" />
|
||||||
|
<Reference Include="System.Web.Extensions" />
|
||||||
|
<Reference Include="System.Xaml" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="AccHelpers.cs" />
|
||||||
|
<Compile Include="adtIO3224.cs" />
|
||||||
|
<Compile Include="ADTMC.cs" />
|
||||||
|
<Compile Include="DelegateCommand.cs" />
|
||||||
|
<Compile Include="IOC0640.cs" />
|
||||||
|
<Compile Include="LTDMC.cs" />
|
||||||
|
<Compile Include="LTSMC.cs" />
|
||||||
|
<Compile Include="MyMessageBox.cs" />
|
||||||
|
<Compile Include="NotificationObject.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="SerialCom.cs" />
|
||||||
|
<Compile Include="ShareHelp.cs" />
|
||||||
|
<Compile Include="SqlHelpers.cs" />
|
||||||
|
<Compile Include="Zmcaux.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
37
Community/DelegateCommand.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace Community
|
||||||
|
{
|
||||||
|
public class DelegateCommand : ICommand
|
||||||
|
{
|
||||||
|
public event EventHandler CanExecuteChanged;
|
||||||
|
|
||||||
|
public bool CanExecute(object parameter)
|
||||||
|
{
|
||||||
|
if (this.CanExecuteFunc == null)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.CanExecuteFunc(parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Execute(object parameter)
|
||||||
|
{
|
||||||
|
if (this.ExecuteAction == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.ExecuteAction(parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action<object> ExecuteAction { get; set; }
|
||||||
|
public Func<object, bool> CanExecuteFunc { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
61
Community/IOC0640.cs
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Community
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 雷赛IO640卡
|
||||||
|
/// </summary>
|
||||||
|
public class IOC0640
|
||||||
|
{
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_board_init", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern int ioc_board_init();
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_board_close", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern void ioc_board_close();
|
||||||
|
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_read_inbit", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern int ioc_read_inbit(ushort cardno, ushort bitno);
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_read_outbit", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern int ioc_read_outbit(ushort cardno, ushort bitno);
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_write_outbit", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern uint ioc_write_outbit(ushort cardno, ushort bitno, int on_off);
|
||||||
|
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_read_inport", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern int ioc_read_inport(ushort cardno, ushort m_PortNo);
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_read_outport", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern int ioc_read_outport(ushort cardno, ushort m_PortNo);
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_write_outport", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern uint ioc_write_outport(ushort cardno, ushort m_PortNo, uint port_value);
|
||||||
|
|
||||||
|
public delegate uint IOC0640_OPERATE(IntPtr operate_data);
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_int_enable", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern uint ioc_int_enable(ushort cardno, IOC0640_OPERATE funcIntHandler, IntPtr operate_data);
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_int_disable", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern uint ioc_int_disable(ushort cardno);
|
||||||
|
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_config_intbitmode", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern uint ioc_config_intbitmode(ushort cardno, ushort bitno, ushort enable, ushort logic);
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_config_intbitmode", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern uint ioc_config_intbitmode(ushort cardno, ushort bitno, ushort[] enable, ushort[] logic);
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_read_intbitstatus", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern int ioc_read_intbitstatus(ushort cardno, ushort bitno);
|
||||||
|
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_config_intporten", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern uint ioc_config_intporten(ushort cardno, ushort m_PortNo, uint port_en);
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_config_intportlogic", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern uint ioc_config_intportlogic(ushort cardno, ushort m_PortNo, uint port_logic);
|
||||||
|
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_read_intportmode", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern uint ioc_read_intportmode(ushort cardno, ushort m_PortNo, uint[] enable, uint[] logic);
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_read_intportstatus", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern int ioc_read_intportstatus(ushort cardno, ushort m_PortNo);
|
||||||
|
|
||||||
|
[DllImport("IOC0640.dll", EntryPoint = "ioc_set_filter", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
|
||||||
|
public static extern uint ioc_set_filter(ushort cardno, double filter);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
4075
Community/LTDMC.cs
Normal file
1369
Community/LTSMC.cs
Normal file
36
Community/MyMessageBox.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using MahApps.Metro.Controls;
|
||||||
|
using MahApps.Metro.Controls.Dialogs;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Community
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 自定义提示框
|
||||||
|
/// </summary>
|
||||||
|
public class MyMessageBox
|
||||||
|
{
|
||||||
|
#region MetroWindow相关参数
|
||||||
|
/// <summary>
|
||||||
|
/// 窗体对象
|
||||||
|
/// </summary>
|
||||||
|
public static MetroWindow MetroWin { get; set; }
|
||||||
|
static MetroDialogSettings settings = new MetroDialogSettings() { AffirmativeButtonText="确定", NegativeButtonText = "取消"};
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示提醒窗
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="title"></param>
|
||||||
|
/// <param name="message"></param>
|
||||||
|
/// <param name="style"></param>
|
||||||
|
public static MessageDialogResult Show(string message, string title="", MessageDialogStyle style = MessageDialogStyle.Affirmative)
|
||||||
|
{
|
||||||
|
return MetroWin.ShowModalMessageExternal(title, message, style, settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
Community/NotificationObject.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Community
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据变更UI触发器
|
||||||
|
/// </summary>
|
||||||
|
public class NotificationObject : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
public void RaisePropertyChanged(string propertyName)
|
||||||
|
{
|
||||||
|
if (this.PropertyChanged != null)
|
||||||
|
{
|
||||||
|
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
36
Community/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// 有关程序集的一般信息由以下
|
||||||
|
// 控制。更改这些特性值可修改
|
||||||
|
// 与程序集关联的信息。
|
||||||
|
[assembly: AssemblyTitle("Community")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Community")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
//将 ComVisible 设置为 false 将使此程序集中的类型
|
||||||
|
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||||
|
//请将此类型的 ComVisible 特性设置为 true。
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||||
|
[assembly: Guid("40bd9b86-2281-4e16-bfab-558cb18e873c")]
|
||||||
|
|
||||||
|
// 程序集的版本信息由下列四个值组成:
|
||||||
|
//
|
||||||
|
// 主版本
|
||||||
|
// 次版本
|
||||||
|
// 生成号
|
||||||
|
// 修订号
|
||||||
|
//
|
||||||
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||||
|
// 方法是按如下所示使用“*”: :
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
288
Community/SerialCom.cs
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO.Ports;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Community
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 串口类
|
||||||
|
/// </summary>
|
||||||
|
public class SerialCom : NotificationObject
|
||||||
|
{
|
||||||
|
#region 串口对象
|
||||||
|
/// <summary>
|
||||||
|
/// 串口对象
|
||||||
|
/// </summary>
|
||||||
|
public SerialPort ComPort { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 串口号
|
||||||
|
private string portName;
|
||||||
|
/// <summary>
|
||||||
|
/// 串口号
|
||||||
|
/// </summary>
|
||||||
|
public string PortName
|
||||||
|
{
|
||||||
|
get { return portName; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
portName = value;
|
||||||
|
this.RaisePropertyChanged("PortName");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 波特率
|
||||||
|
private int baudRate;
|
||||||
|
/// <summary>
|
||||||
|
/// 波特率
|
||||||
|
/// </summary>
|
||||||
|
public int BaudRate
|
||||||
|
{
|
||||||
|
get { return baudRate; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
baudRate = value;
|
||||||
|
this.RaisePropertyChanged("BaudRate");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 校验位
|
||||||
|
private int parityNumber;
|
||||||
|
/// <summary>
|
||||||
|
/// 校验位
|
||||||
|
/// </summary>
|
||||||
|
public int ParityNumber
|
||||||
|
{
|
||||||
|
get { return parityNumber; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
parityNumber = value;
|
||||||
|
this.RaisePropertyChanged("ParityNumber");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 数据位
|
||||||
|
private int dataBits;
|
||||||
|
/// <summary>
|
||||||
|
/// 数据位
|
||||||
|
/// </summary>
|
||||||
|
public int DataBits
|
||||||
|
{
|
||||||
|
get { return dataBits; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
dataBits = value;
|
||||||
|
this.RaisePropertyChanged("DataBits");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 停止位
|
||||||
|
private int stopBitsNumber;
|
||||||
|
/// <summary>
|
||||||
|
/// 停止位
|
||||||
|
/// </summary>
|
||||||
|
public int StopBitsNumber
|
||||||
|
{
|
||||||
|
get { return stopBitsNumber; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
stopBitsNumber = value;
|
||||||
|
this.RaisePropertyChanged("StopBitsNumber");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region 可用串口名称集合
|
||||||
|
|
||||||
|
private List<string> comPortList;
|
||||||
|
/// <summary>
|
||||||
|
/// 可用串口名称集合
|
||||||
|
/// </summary>
|
||||||
|
public List<string> ComPortList
|
||||||
|
{
|
||||||
|
get { return comPortList; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
comPortList = value;
|
||||||
|
this.RaisePropertyChanged("ComPortList");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 接收到的字符串
|
||||||
|
|
||||||
|
private string receiveStr;
|
||||||
|
/// <summary>
|
||||||
|
/// 接收到的字符串
|
||||||
|
/// </summary>
|
||||||
|
public string ReceiveStr
|
||||||
|
{
|
||||||
|
get { return receiveStr; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
receiveStr = value;
|
||||||
|
this.RaisePropertyChanged("ReceiveStr");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 发送的字符串
|
||||||
|
private string sendStr;
|
||||||
|
/// <summary>
|
||||||
|
/// 发送的字符串
|
||||||
|
/// </summary>
|
||||||
|
public string SendStr
|
||||||
|
{
|
||||||
|
get { return sendStr; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
sendStr = value;
|
||||||
|
this.RaisePropertyChanged("SendStr");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 错误信息
|
||||||
|
private string errorMag;
|
||||||
|
/// <summary>
|
||||||
|
/// 错误信息
|
||||||
|
/// </summary>
|
||||||
|
public string ErrorMag
|
||||||
|
{
|
||||||
|
get { return errorMag; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
errorMag = value;
|
||||||
|
this.RaisePropertyChanged("ErrorMag");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
public SerialCom()
|
||||||
|
{
|
||||||
|
GetPortList();
|
||||||
|
ReceiveStr = "没有接收到任何信息";
|
||||||
|
SendStr = "请输入要发送的内容";
|
||||||
|
//OpenSerialCom();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SerialCom(string protName, int BaudRate, Parity p, int DataBits, StopBits sp)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ComPort = new SerialPort();
|
||||||
|
ComPort.PortName = protName; //ComPortList[0];//设置要打开的串口
|
||||||
|
ComPort.BaudRate = BaudRate;//设置当前波特率
|
||||||
|
ComPort.Parity = p;//设置当前校验位
|
||||||
|
ComPort.DataBits = DataBits;//设置当前数据位
|
||||||
|
ComPort.StopBits = sp;//设置当前停止位
|
||||||
|
ComPort.Open();//打开串口
|
||||||
|
ComPort.DataReceived += ComPort_DataReceived;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 接收数据回调函数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void ComPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||||
|
{
|
||||||
|
//byte[] recBuffer = new byte[ComPort.BytesToRead];//接收数据缓存大小
|
||||||
|
//ComPort.Read(recBuffer, 0, recBuffer.Length);//读取数据
|
||||||
|
//ReceiveStr = System.Text.Encoding.Default.GetString(recBuffer);//转码
|
||||||
|
|
||||||
|
ReceiveStr = ComPort.ReadTo("\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 获取可用串口集合
|
||||||
|
/// <summary>
|
||||||
|
/// 获取可用串口集合
|
||||||
|
/// </summary>
|
||||||
|
public void GetPortList()
|
||||||
|
{
|
||||||
|
ComPortList = new List<string>();
|
||||||
|
ComPortList = SerialPort.GetPortNames().ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 打开串口
|
||||||
|
/// <summary>
|
||||||
|
/// 打开串口
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ComNumber">串口号</param>
|
||||||
|
public bool OpenSerialCom(string ComNumber)
|
||||||
|
{
|
||||||
|
if (ComPortList.Count <= 0)
|
||||||
|
{
|
||||||
|
ErrorMag = "无可用串口";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!ComPortList.Contains(ComNumber))
|
||||||
|
{
|
||||||
|
ErrorMag = "指定的串口号不存在";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ComPort = new SerialPort();
|
||||||
|
ComPort.PortName = ComNumber; //ComPortList[0];//设置要打开的串口
|
||||||
|
ComPort.BaudRate = 19200;//设置当前波特率
|
||||||
|
ComPort.Parity = Parity.None;//设置当前校验位
|
||||||
|
ComPort.DataBits = 8;//设置当前数据位
|
||||||
|
ComPort.StopBits = StopBits.One;//设置当前停止位
|
||||||
|
ComPort.Open();//打开串口
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch//如果串口被其他占用,则无法打开
|
||||||
|
{
|
||||||
|
ErrorMag = "无法打开串口,请检测此串口是否有效或被其他占用!";
|
||||||
|
GetPortList();
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 发送
|
||||||
|
/// <summary>
|
||||||
|
/// 发送
|
||||||
|
/// </summary>
|
||||||
|
public void Send(string SendStr)
|
||||||
|
{
|
||||||
|
if (ComPort != null)
|
||||||
|
{
|
||||||
|
byte[] sendBuffer = System.Text.Encoding.Default.GetBytes(SendStr);//转码
|
||||||
|
ComPort.Write(sendBuffer, 0, sendBuffer.Length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
231
Community/ShareHelp.cs
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Web.Script.Serialization;
|
||||||
|
|
||||||
|
namespace Community
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 公共帮助类
|
||||||
|
/// </summary>
|
||||||
|
public class ShareHelp
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户名
|
||||||
|
/// </summary>
|
||||||
|
public static string UserID = "";
|
||||||
|
public static string UserName = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 是否是管理员
|
||||||
|
/// </summary>
|
||||||
|
public static bool TheManage = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备是否处于运行中
|
||||||
|
/// </summary>
|
||||||
|
public static bool RunIng { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
#region 记录用户用户操作
|
||||||
|
static byte[] data { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件夹路径
|
||||||
|
/// </summary>
|
||||||
|
static string path { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 文件路径
|
||||||
|
/// </summary>
|
||||||
|
static string paths { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 打开的文件流对象
|
||||||
|
/// </summary>
|
||||||
|
static FileStream FS { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 记录用户用户操作
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="info"></param>
|
||||||
|
public static void UserLog(string showMag)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
object TraceObj = new object();
|
||||||
|
lock (TraceObj)
|
||||||
|
{
|
||||||
|
path = @"D:\\Log\UserLog\" + ShareHelp.UserID + "\\"; //文件夹路径
|
||||||
|
|
||||||
|
paths = @"D:\\Log\UserLog\" + ShareHelp.UserID + "\\" + DateTime.Now.ToString("D") + ".txt"; //文件路径 以年月日为名称
|
||||||
|
|
||||||
|
//创建文件夹
|
||||||
|
if (!Directory.Exists(path))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
//打开或创建文件
|
||||||
|
FS = File.Open(paths, FileMode.Append);
|
||||||
|
|
||||||
|
//获得字节数组
|
||||||
|
|
||||||
|
data = System.Text.Encoding.Default.GetBytes(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.fff") + "【" + showMag + "】\r\n");
|
||||||
|
//开始写入
|
||||||
|
FS.Write(data, 0, data.Length);
|
||||||
|
//清空缓冲区、关闭流
|
||||||
|
FS.Flush();
|
||||||
|
FS.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Json序列化
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// js 序列化器
|
||||||
|
/// </summary>
|
||||||
|
static JavaScriptSerializer jss = new JavaScriptSerializer();
|
||||||
|
|
||||||
|
#region 1、将对象转换成Json字符创
|
||||||
|
/// <summary>
|
||||||
|
/// 将对象转换成Json字符创(泛型)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string ObjToJson(object obj)
|
||||||
|
{
|
||||||
|
// return JsonConvert.SerializeObject(obj);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var json = jss.Serialize(obj);
|
||||||
|
//将时间格式转换为适合阅读习惯的格式,
|
||||||
|
json = System.Text.RegularExpressions.Regex.Replace(json, @"\\/Date\((\d+)\)\\/", match =>
|
||||||
|
{
|
||||||
|
DateTime dt = new DateTime(1970, 1, 1);
|
||||||
|
dt = dt.AddMilliseconds(long.Parse(match.Groups[1].Value));
|
||||||
|
dt = dt.ToLocalTime(); //本地时间
|
||||||
|
return dt.ToString(); ;
|
||||||
|
});
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
// return jss.Serialize(obj);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 2、将Json还原成对象(泛型)
|
||||||
|
/// <summary>
|
||||||
|
/// 将Json还原成对象(泛型)
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="json"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static T JsonToObj<T>(string json)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var deserializedResult = jss.Deserialize<T>(json);
|
||||||
|
return deserializedResult;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return default(T);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 磁盘空间是否已满
|
||||||
|
/// <summary>
|
||||||
|
/// 获取指定驱动器的空间总大小(单位为B)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str_HardDiskName">只需输入代表驱动器的字母即可 (大写)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static long GetHardDiskSpace(string str_HardDiskName)
|
||||||
|
{
|
||||||
|
long totalSize = new long();
|
||||||
|
str_HardDiskName = str_HardDiskName + ":\\";
|
||||||
|
System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();
|
||||||
|
foreach (System.IO.DriveInfo drive in drives)
|
||||||
|
{
|
||||||
|
if (drive.Name == str_HardDiskName)
|
||||||
|
{
|
||||||
|
totalSize = drive.TotalSize / (1024 * 1024 * 1024);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return totalSize;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取指定驱动器的剩余空间总大小(单位为B)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str_HardDiskName">只需输入代表驱动器的字母即可 (大写)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static double GetHardDiskFreeSpace(string str_HardDiskName)
|
||||||
|
{
|
||||||
|
double freeSpace = new long();
|
||||||
|
str_HardDiskName = str_HardDiskName + ":\\";
|
||||||
|
System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();
|
||||||
|
foreach (System.IO.DriveInfo drive in drives)
|
||||||
|
{
|
||||||
|
if (drive.Name == str_HardDiskName)
|
||||||
|
{
|
||||||
|
freeSpace = drive.TotalFreeSpace / (1024 * 1024 * 1024);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return freeSpace;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 获取时间戳
|
||||||
|
/// <summary>
|
||||||
|
/// 获取时间戳
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static long GetTimeStamp()
|
||||||
|
{
|
||||||
|
TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0);
|
||||||
|
return Convert.ToInt64(ts.TotalSeconds);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 深度复制对象
|
||||||
|
/// <summary>
|
||||||
|
/// 深度复制对象
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="Coperobj"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static T FeiyuCoper<T>(T Coperobj)
|
||||||
|
{
|
||||||
|
T a = System.Activator.CreateInstance<T>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string json = ObjToJson(Coperobj);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(json))
|
||||||
|
{
|
||||||
|
a = JsonToObj<T>(json);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
275
Community/SqlHelpers.cs
Normal file
@ -0,0 +1,275 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.Sql;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Community
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 数据库帮助类
|
||||||
|
/// </summary>
|
||||||
|
public class SqlHelpers
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Appconfig中用于连接数据库的字符串
|
||||||
|
/// </summary>
|
||||||
|
private static string connStr = ConfigurationManager.ConnectionStrings["MydbConnstr"].ConnectionString;
|
||||||
|
|
||||||
|
static SqlConnection conn = new SqlConnection(connStr);
|
||||||
|
/// <summary>
|
||||||
|
/// 数据库执行操作的方法,只返回受影响的行数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sql"></param>
|
||||||
|
/// <param name="parameter"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int ExecuteNonQuery(string sql, params SqlParameter[] parameter)
|
||||||
|
{
|
||||||
|
//using (SqlConnection conn = new SqlConnection(connStr))
|
||||||
|
//{
|
||||||
|
// conn.Open();
|
||||||
|
// using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||||
|
// {
|
||||||
|
// cmd.Parameters.AddRange(parameter);
|
||||||
|
// return cmd.ExecuteNonQuery();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (ConnectOpen())
|
||||||
|
{
|
||||||
|
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddRange(parameter);
|
||||||
|
return cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int ExecuteNonQuery(CommandType type, string sql, params SqlParameter[] parameter)
|
||||||
|
{
|
||||||
|
//using (SqlConnection conn = new SqlConnection(connStr))
|
||||||
|
//{
|
||||||
|
// conn.Open();
|
||||||
|
// using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||||
|
// {
|
||||||
|
// cmd.Parameters.AddRange(parameter);
|
||||||
|
// cmd.CommandType = type;
|
||||||
|
// return cmd.ExecuteNonQuery();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (ConnectOpen())
|
||||||
|
{
|
||||||
|
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddRange(parameter);
|
||||||
|
cmd.CommandType = type;
|
||||||
|
return cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询获取单个结果集的方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sql"></param>
|
||||||
|
/// <param name="parameter"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static object ExecuteScalar(string sql, params SqlParameter[] parameter)
|
||||||
|
{
|
||||||
|
//using (SqlConnection conn = new SqlConnection(connStr))
|
||||||
|
//{
|
||||||
|
|
||||||
|
// conn.Open();
|
||||||
|
// using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||||
|
// {
|
||||||
|
// cmd.Parameters.AddRange(parameter);
|
||||||
|
// return cmd.ExecuteScalar();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (ConnectOpen())
|
||||||
|
{
|
||||||
|
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddRange(parameter);
|
||||||
|
return cmd.ExecuteScalar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static object ExecuteScalar(CommandType type, string sql, params SqlParameter[] parameter)
|
||||||
|
{
|
||||||
|
//using (SqlConnection conn = new SqlConnection(connStr))
|
||||||
|
//{
|
||||||
|
|
||||||
|
// conn.Open();
|
||||||
|
// using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||||
|
// {
|
||||||
|
// cmd.Parameters.AddRange(parameter);
|
||||||
|
// cmd.CommandType = type;
|
||||||
|
// return cmd.ExecuteScalar();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (ConnectOpen())
|
||||||
|
{
|
||||||
|
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddRange(parameter);
|
||||||
|
cmd.CommandType = type;
|
||||||
|
return cmd.ExecuteScalar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询获取结果集的方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sql"></param>
|
||||||
|
/// <param name="paramaeter"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static DataTable ExecuteDataTable(string sql, params SqlParameter[] paramaeter)
|
||||||
|
{
|
||||||
|
//using (SqlConnection conn = new SqlConnection(connStr))
|
||||||
|
//{
|
||||||
|
// conn.Open();
|
||||||
|
// using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||||
|
// {
|
||||||
|
// cmd.Parameters.AddRange(paramaeter);
|
||||||
|
// SqlDataAdapter adapter = new SqlDataAdapter(cmd);
|
||||||
|
// DataSet dataset = new DataSet();
|
||||||
|
// adapter.Fill(dataset);
|
||||||
|
// return dataset.Tables[0];
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (ConnectOpen())
|
||||||
|
{
|
||||||
|
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddRange(paramaeter);
|
||||||
|
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
|
||||||
|
DataSet dataset = new DataSet();
|
||||||
|
adapter.Fill(dataset);
|
||||||
|
return dataset.Tables[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new DataTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询获取结果集集合的方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sql"></param>
|
||||||
|
/// <param name="paramaeter"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static DataTableCollection ExecuteDataTableList(string sql, params SqlParameter[] paramaeter)
|
||||||
|
{
|
||||||
|
//using (SqlConnection conn = new SqlConnection(connStr))
|
||||||
|
//{
|
||||||
|
|
||||||
|
// conn.Open();
|
||||||
|
// using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||||
|
// {
|
||||||
|
// cmd.Parameters.AddRange(paramaeter);
|
||||||
|
// SqlDataAdapter adapter = new SqlDataAdapter(cmd);
|
||||||
|
// DataSet dataset = new DataSet();
|
||||||
|
// adapter.Fill(dataset);
|
||||||
|
// return dataset.Tables;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (ConnectOpen())
|
||||||
|
{
|
||||||
|
using (SqlCommand cmd = new SqlCommand(sql, conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddRange(paramaeter);
|
||||||
|
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
|
||||||
|
DataSet dataset = new DataSet();
|
||||||
|
adapter.Fill(dataset);
|
||||||
|
return dataset.Tables;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new DataSet().Tables;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据库连接测试
|
||||||
|
/// </summary>
|
||||||
|
public static bool ConnectOpen()
|
||||||
|
{
|
||||||
|
bool bl = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (conn.State != ConnectionState.Open)
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
bl = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bl = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return bl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
3558
Community/Zmcaux.cs
Normal file
111
Community/adtIO3224.cs
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Community
|
||||||
|
{
|
||||||
|
public class adtIO3224
|
||||||
|
{
|
||||||
|
[DllImport("adtIO3224.dll")]
|
||||||
|
public static extern Int32 adtIO3224_initial();
|
||||||
|
/************************************************
|
||||||
|
功能:初始化运动控制卡
|
||||||
|
(1)返回值>0时,表示adt-IO3224卡的数量。如果为3,则下面的可用卡号可通过拨码开关设置;
|
||||||
|
(2)返回值=0时,说明没有安装adt-IO3224卡;
|
||||||
|
(3)返回值<0时,-1 表示没有安装端口驱动程序,
|
||||||
|
-2 表示PCI桥存在故障。
|
||||||
|
-3 表示拨码开关设置存在重复。
|
||||||
|
************************************************/
|
||||||
|
|
||||||
|
[DllImport("adtIO3224.dll")]
|
||||||
|
public static extern Int32 adtIO3224_get_lib_version(Int32 cardno);
|
||||||
|
/************************************************
|
||||||
|
功能:获取当前库版本号
|
||||||
|
返回值为库版本的版本号;-1:卡号错误
|
||||||
|
************************************************/
|
||||||
|
|
||||||
|
[DllImport("adtIO3224.dll")]
|
||||||
|
public static extern float adtIO3224_get_hardware_ver(Int32 cardno);
|
||||||
|
/**************功能:获取当前硬件版本**************
|
||||||
|
返回值为硬件版本号;-1:卡号错误
|
||||||
|
************************************************/
|
||||||
|
|
||||||
|
[DllImport("adtIO3224.dll")]
|
||||||
|
public static extern Int32 adtIO3224_get_card_index();
|
||||||
|
/************************************************
|
||||||
|
功能:获取当前所有可用卡的拨码开关号,通过位数表示
|
||||||
|
比如:只有1张卡,拨码开关设置为1,则返回值为1
|
||||||
|
有2张卡,按照靠近CPU的顺序,拨码开关依次设置为1,2,返回值为21;
|
||||||
|
有3张卡,按照靠近CPU的顺序,拨码开关设置为3,1,2,则返回值为213;
|
||||||
|
返回值:可用卡的拨码开关号;-1:卡号错误
|
||||||
|
************************************************/
|
||||||
|
|
||||||
|
//-------------------------------------------------//
|
||||||
|
// 开关量输入输出类 //
|
||||||
|
//-------------------------------------------------//
|
||||||
|
[DllImport("adtIO3224.dll")]
|
||||||
|
public static extern Int32 adtIO3224_read_bit(Int32 cardno, Int32 number);
|
||||||
|
/*********************************************************
|
||||||
|
功能:读取单个输入点
|
||||||
|
参数:
|
||||||
|
cardno 卡号
|
||||||
|
number 输入点(0-32)
|
||||||
|
返回值 0:低电平 1:高电平 -1:错误
|
||||||
|
*********************************************************/
|
||||||
|
|
||||||
|
[DllImport("adtIO3224.dll")]
|
||||||
|
public static extern Int32 adtIO3224_write_bit(Int32 cardno, Int32 number, Int32 value);
|
||||||
|
/********************************************************
|
||||||
|
功能:写单个输出
|
||||||
|
参数:
|
||||||
|
cardno 卡号
|
||||||
|
number 输出点(0-24)
|
||||||
|
value 0: 低电平 1: 高电平
|
||||||
|
返回值 0:正确 1:错误
|
||||||
|
*********************************************************/
|
||||||
|
|
||||||
|
[DllImport("adtIO3224.dll")]
|
||||||
|
public static extern Int32 adtIO3224_get_out(Int32 cardno, Int32 number);
|
||||||
|
/**********************************
|
||||||
|
功能:获取输出状态
|
||||||
|
参数:
|
||||||
|
cardno 卡号
|
||||||
|
number 端口号(0-24)
|
||||||
|
返回值:获取端口的当前状态,0: 低电平 1: 高电平 -1表示参数错误
|
||||||
|
************************************************/
|
||||||
|
|
||||||
|
[DllImport("adtIO3224.dll")]
|
||||||
|
public static extern Int32 adtIO3224_read_in(Int32 cardno, out Int32 value);
|
||||||
|
/*********************************************************
|
||||||
|
功能:读取所有32个输入点
|
||||||
|
参数:
|
||||||
|
cardno 卡号
|
||||||
|
value 存储32个输入点状态值,通过二进制32位上的0,1表示:0表示低电平,1表示高电平
|
||||||
|
返回值 0:正确 1:错误
|
||||||
|
*********************************************************/
|
||||||
|
|
||||||
|
[DllImport("adtIO3224.dll")]
|
||||||
|
public static extern Int32 adtIO3224_read_out(Int32 cardno, out Int32 value);
|
||||||
|
/*********************************************************
|
||||||
|
功能:读取所有24个输出点
|
||||||
|
参数:
|
||||||
|
cardno 卡号
|
||||||
|
value 24个输入点状态值,通过二进制低24位的0,1表示:0表示输出为低电平,1表示输出为高电平
|
||||||
|
返回值 0:正确 1:错误
|
||||||
|
*********************************************************/
|
||||||
|
|
||||||
|
[DllImport("adtIO3224.dll")]
|
||||||
|
public static extern Int32 adtIO3224_write_out(Int32 cardno, out Int32 value);
|
||||||
|
/*********************************************************
|
||||||
|
功能:写所有24个输出点
|
||||||
|
参数:
|
||||||
|
cardno 卡号
|
||||||
|
value 24个输入点状态值,通过二进制低24位的0,1表示:0表示写低电平,1表示写高电平
|
||||||
|
返回值 0:正确 1:错误
|
||||||
|
*********************************************************/
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
6
Community/packages.config
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="ControlzEx" version="4.3.2" targetFramework="net452" requireReinstallation="true" />
|
||||||
|
<package id="MahApps.Metro" version="2.2.0" targetFramework="net452" requireReinstallation="true" />
|
||||||
|
<package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.19" targetFramework="net452" />
|
||||||
|
</packages>
|
||||||
91
DAL/DAL.csproj
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{189029A5-B035-4838-994B-F408EB9776F4}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>DAL</RootNamespace>
|
||||||
|
<AssemblyName>DAL</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="ControlzEx, Version=4.0.0.0, Culture=neutral, PublicKeyToken=69f1c32f803d307e, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\ControlzEx.4.3.2\lib\net45\ControlzEx.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="MahApps.Metro, Version=2.0.0.0, Culture=neutral, PublicKeyToken=51482d6f650b2b3f, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\MahApps.Metro.2.2.0\lib\net452\MahApps.Metro.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.19\lib\net45\Microsoft.Xaml.Behaviors.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Web" />
|
||||||
|
<Reference Include="System.Web.Extensions" />
|
||||||
|
<Reference Include="System.Xaml" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="MainWindowDAL.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="VisualDAL.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Community\Community.csproj">
|
||||||
|
<Project>{40bd9b86-2281-4e16-bfab-558cb18e873c}</Project>
|
||||||
|
<Name>Community</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Model\Model.csproj">
|
||||||
|
<Project>{7ec8f22d-631c-4b92-8d55-4b0f32d9318d}</Project>
|
||||||
|
<Name>Model</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
1709
DAL/MainWindowDAL.cs
Normal file
36
DAL/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// 有关程序集的一般信息由以下
|
||||||
|
// 控制。更改这些特性值可修改
|
||||||
|
// 与程序集关联的信息。
|
||||||
|
[assembly: AssemblyTitle("DAL")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("DAL")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
//将 ComVisible 设置为 false 将使此程序集中的类型
|
||||||
|
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||||
|
//请将此类型的 ComVisible 特性设置为 true。
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||||
|
[assembly: Guid("189029a5-b035-4838-994b-f408eb9776f4")]
|
||||||
|
|
||||||
|
// 程序集的版本信息由下列四个值组成:
|
||||||
|
//
|
||||||
|
// 主版本
|
||||||
|
// 次版本
|
||||||
|
// 生成号
|
||||||
|
// 修订号
|
||||||
|
//
|
||||||
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||||
|
// 方法是按如下所示使用“*”: :
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
826
DAL/VisualDAL.cs
Normal file
@ -0,0 +1,826 @@
|
|||||||
|
using Community;
|
||||||
|
using Model.Vision;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.OleDb;
|
||||||
|
|
||||||
|
namespace DAL
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 视觉DAL
|
||||||
|
/// </summary>
|
||||||
|
public class VisualDAL
|
||||||
|
{
|
||||||
|
|
||||||
|
#region 1、相机参数相关
|
||||||
|
|
||||||
|
#region 1、读取相机参数
|
||||||
|
/// <summary>
|
||||||
|
/// 获取所有相机
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<FeiYuCamere> GetCameraList()
|
||||||
|
{
|
||||||
|
string sqlstr = "select * from Camera ";
|
||||||
|
DataTable table = AccHelpers.ExecuteDataTable(sqlstr);
|
||||||
|
return TableToCameraList(table);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<FeiYuCamere> TableToCameraList(DataTable table)
|
||||||
|
{
|
||||||
|
List<FeiYuCamere> list = new List<FeiYuCamere>();
|
||||||
|
FeiYuCamere camere;
|
||||||
|
foreach (DataRow row in table.Rows)
|
||||||
|
{
|
||||||
|
int br = (int)row["CamBrand"];
|
||||||
|
if (br == 1)
|
||||||
|
{
|
||||||
|
camere = new BaslerCamera();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
camere = new HikCamera();
|
||||||
|
}
|
||||||
|
camere.ID = (int)row["ID"];
|
||||||
|
camere.VisualName = row["VisualName"].ToString();
|
||||||
|
camere.MachineID = (int)row["MachineID"];
|
||||||
|
camere.CamType = (int)row["CamType"];
|
||||||
|
camere.Img_Height = (int)row["Img_Height"];
|
||||||
|
camere.Img_Width = (int)row["Img_Width"];
|
||||||
|
camere.CamName = row["CamName"].ToString();
|
||||||
|
camere.CamBrand = (int)row["CamBrand"];
|
||||||
|
camere.ExposureTime = Convert.ToInt64(row["ExposureTime"]);
|
||||||
|
camere.FPS = Convert.ToInt32(row["FPS"]);
|
||||||
|
camere.Gain = (int)row["Gain"];
|
||||||
|
camere.SaveImangeOK = Convert.ToBoolean(row["SaveImangeOK"]);
|
||||||
|
camere.SaveImangeNG = Convert.ToBoolean(row["SaveImangeNG"]);
|
||||||
|
camere.SaveImageOri = Convert.ToBoolean(row["SaveImageOri"]);
|
||||||
|
camere.RotateAngle = Convert.ToDouble(row["RotateAngle"]);
|
||||||
|
list.Add(camere);
|
||||||
|
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取相机对象
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="machineID">机种ID</param>
|
||||||
|
/// <param name="CamType">相机类型</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public FeiYuCamere GetCamera(int machineID, int CamType)
|
||||||
|
{
|
||||||
|
string sqlstr = "select * from Camera where MachineID=@MachineID and CamType=@CamType";
|
||||||
|
DataTable table = AccHelpers.ExecuteDataTable(sqlstr, new OleDbParameter("@MachineID", machineID), new OleDbParameter("@CamType", CamType));
|
||||||
|
return CamereaDatataleToList(table, CamType);
|
||||||
|
}
|
||||||
|
|
||||||
|
private FeiYuCamere CamereaDatataleToList(DataTable table, int camtype)
|
||||||
|
{
|
||||||
|
FeiYuCamere cam = null;
|
||||||
|
if (table.Rows.Count > 0)
|
||||||
|
{
|
||||||
|
DataRow row = table.Rows[0];
|
||||||
|
|
||||||
|
if ((int)row["CamBrand"] == 1)
|
||||||
|
{
|
||||||
|
cam = new BaslerCamera() { CamType = camtype };
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cam = new HikCamera() { CamType = camtype };
|
||||||
|
}
|
||||||
|
cam.ID = (int)row["ID"];
|
||||||
|
cam.MachineID = (int)row["MachineID"];
|
||||||
|
cam.CamType = (int)row["CamType"];
|
||||||
|
cam.Img_Height = (int)row["Img_Height"];
|
||||||
|
cam.Img_Width = (int)row["Img_Width"];
|
||||||
|
cam.CamName = row["CamName"].ToString();
|
||||||
|
cam.CamBrand = (int)row["CamBrand"];
|
||||||
|
cam.ExposureTime = Convert.ToInt64(row["ExposureTime"]);
|
||||||
|
cam.FPS = Convert.ToInt32(row["FPS"]);
|
||||||
|
cam.Gain = (int)row["Gain"];
|
||||||
|
cam.SaveImangeOK = Convert.ToBoolean(row["SaveImangeOK"]);
|
||||||
|
cam.SaveImangeNG = Convert.ToBoolean(row["SaveImangeNG"]);
|
||||||
|
cam.SaveImageOri = Convert.ToBoolean(row["SaveImageOri"]);
|
||||||
|
}
|
||||||
|
return cam;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 2、新增相机参数
|
||||||
|
/// <summary>
|
||||||
|
/// 新增相机参数
|
||||||
|
/// </summary>
|
||||||
|
public int AddCamera(FeiYuCamere cam)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string sqlstr = "insert into Camera ([MachineID],[CamType],CamName,FPS,ExposureTime,Gain,Img_Width,Img_Height,SaveImangeOK,SaveImangeNG,SaveImageOri)values(@MachineID,@CamType,@CamName,@FPS,@ExposureTime,@Gain,@Img_Width,@Img_Height,@SaveImangeOK,@SaveImangeNG,@SaveImageOri)";
|
||||||
|
return AccHelpers.ExecuteNonQuery(sqlstr, new OleDbParameter("@MachineID", cam.MachineID),
|
||||||
|
new OleDbParameter("@CamType", cam.CamType),
|
||||||
|
new OleDbParameter("@CamName", cam.CamName),
|
||||||
|
new OleDbParameter("@FPS", cam.FPS),
|
||||||
|
new OleDbParameter("@ExposureTime", cam.ExposureTime),
|
||||||
|
new OleDbParameter("@Gain", cam.Gain),
|
||||||
|
new OleDbParameter("@Img_Width", cam.Img_Width),
|
||||||
|
new OleDbParameter("@Img_Height", cam.Img_Height),
|
||||||
|
new OleDbParameter("@SaveImangeOK", cam.SaveImangeOK),
|
||||||
|
new OleDbParameter("@SaveImangeNG", cam.SaveImangeNG),
|
||||||
|
new OleDbParameter("@SaveImageOri", cam.SaveImageOri));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 3、更新相机参数
|
||||||
|
/// <summary>
|
||||||
|
/// 更新相机参数
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cam"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int UpdateCamera(FeiYuCamere cam)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string sqlstr = "update Camera set [MachineID]=@MachineID,[CamType]=@CamType,CamName=@CamName,FPS=@FPS,ExposureTime=@ExposureTime,Gain=@Gain,Img_Width=@Img_Width,Img_Height=@Img_Height,SaveImangeOK=@SaveImangeOK,SaveImangeNG=@SaveImangeNG,SaveImageOri=@SaveImageOri,RotateAngle=@RotateAngle where ID=@ID";
|
||||||
|
return AccHelpers.ExecuteNonQuery(sqlstr, new OleDbParameter("@MachineID", cam.MachineID),
|
||||||
|
new OleDbParameter("@CamType", cam.CamType),
|
||||||
|
new OleDbParameter("@CamName", cam.CamName),
|
||||||
|
new OleDbParameter("@FPS", cam.FPS),
|
||||||
|
new OleDbParameter("@ExposureTime", cam.ExposureTime),
|
||||||
|
new OleDbParameter("@Gain", cam.Gain),
|
||||||
|
new OleDbParameter("@Img_Width", cam.Img_Width),
|
||||||
|
new OleDbParameter("@Img_Height", cam.Img_Height),
|
||||||
|
new OleDbParameter("@SaveImangeOK", cam.SaveImangeOK),
|
||||||
|
new OleDbParameter("@SaveImangeNG", cam.SaveImangeNG),
|
||||||
|
new OleDbParameter("@SaveImageOri", cam.SaveImageOri),
|
||||||
|
new OleDbParameter("@RotateAngle", cam.RotateAngle),
|
||||||
|
new OleDbParameter("@ID", cam.ID));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 区域模型
|
||||||
|
|
||||||
|
#region 一、根据机种ID获取区域模型
|
||||||
|
/// <summary>
|
||||||
|
/// 根据项目ID及区域类型获取区域模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="machineID">机种ID</param>
|
||||||
|
/// <param name="modelTye">模型区域类型</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ObservableCollection<V_RectangleModel> GetAllRecangleModelList(int machineID, int modelTye)
|
||||||
|
{
|
||||||
|
string sqlstr = "select * from V_RectangleModel where VeiID=@VeiID and AreaType=@AreaType ORDER BY ID";
|
||||||
|
DataTable table = AccHelpers.ExecuteDataTable(sqlstr, new OleDbParameter("@MachineID", machineID),
|
||||||
|
new OleDbParameter("@AreaType", modelTye));
|
||||||
|
return TableToRecangleModelList(table);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 根据工程项目ID区域模型集合
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="veiID">工程项目功能ID</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ObservableCollection<V_RectangleModel> GetAllRecangleModelList(int veiID)
|
||||||
|
{
|
||||||
|
string sqlstr = "select * from V_RectangleModel where VeiID=@VeiID ORDER BY ID";
|
||||||
|
DataTable table = AccHelpers.ExecuteDataTable(sqlstr, new OleDbParameter("@MachineID", veiID));
|
||||||
|
return TableToRecangleModelList(table);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 据工程项目功能ID区域模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="veiID">工程项目功能ID</param>
|
||||||
|
/// <param name="areaType">区域类型</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public V_RectangleModel GetRectangleModel(int veiID, int areaType)
|
||||||
|
{
|
||||||
|
string sqlstr = "select * from V_RectangleModel where VeiID=@VeiID and AreaType=@AreaType ORDER BY ID";
|
||||||
|
DataTable table = AccHelpers.ExecuteDataTable(sqlstr, new OleDbParameter("@MachineID", veiID),
|
||||||
|
new OleDbParameter("@AreaType", areaType));
|
||||||
|
if (table.Rows.Count <= 0)
|
||||||
|
{
|
||||||
|
return new V_RectangleModel() { VeiID = veiID, AreaType = areaType };
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return TableToRecangleModelList(table)[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private ObservableCollection<V_RectangleModel> TableToRecangleModelList(DataTable table)
|
||||||
|
{
|
||||||
|
ObservableCollection<V_RectangleModel> list = new ObservableCollection<V_RectangleModel>();
|
||||||
|
if (table == null || table.Rows.Count <= 0)
|
||||||
|
{
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (DataRow row in table.Rows)
|
||||||
|
{
|
||||||
|
V_RectangleModel rm = new V_RectangleModel();
|
||||||
|
rm.ID = (int)(row["ID"]);
|
||||||
|
rm.VeiID = Convert.ToInt32(row["VeiID"]);
|
||||||
|
rm.AreaType = Convert.ToInt32(row["AreaType"]);
|
||||||
|
rm.Point_Column1 = Convert.ToDouble(row["Point_Column1"]);
|
||||||
|
rm.Point_Column2 = Convert.ToDouble(row["Point_Column2"]);
|
||||||
|
rm.Point_Row1 = Convert.ToDouble(row["Point_Row1"]);
|
||||||
|
rm.Point_Row2 = Convert.ToDouble(row["Point_Row2"]);
|
||||||
|
rm.PassagewayBrightness1 = Convert.ToInt32(row["PassagewayBrightness1"]);
|
||||||
|
rm.PassagewayBrightness2 = Convert.ToInt32(row["PassagewayBrightness2"]);
|
||||||
|
rm.PassagewayBrightness3 = Convert.ToInt32(row["PassagewayBrightness3"]);
|
||||||
|
rm.PassagewayBrightness4 = Convert.ToInt32(row["PassagewayBrightness4"]);
|
||||||
|
rm.MyROI = GetROI(rm.ID, 1);
|
||||||
|
rm.MyRoiList = GetROIList(rm.ID, 2);
|
||||||
|
rm.MyCorner = ShareHelp.JsonToObj<V_CornerPoint>(row["MyCorner"].ToString());
|
||||||
|
rm.LocateList = ShareHelp.JsonToObj<List<V_Piont>>(row["LocateList"].ToString());
|
||||||
|
rm.RoiList = ShareHelp.JsonToObj<List<ROI>>(row["RoiList"].ToString());
|
||||||
|
|
||||||
|
list.Add(rm);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 1、更新模型
|
||||||
|
/// <summary>
|
||||||
|
/// 更新模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int UpdateRectangleModel(V_RectangleModel model)
|
||||||
|
{
|
||||||
|
var s =ShareHelp.ObjToJson(model.RoiList) ;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (model.ID > 0)
|
||||||
|
{
|
||||||
|
string sqlstr = "update V_RectangleModel set Point_Row1=@Point_Row1,Point_Column1=@Point_Column1,Point_Row2=@Point_Row2,Point_Column2=@Point_Column2,PassagewayBrightness1=@PassagewayBrightness1,PassagewayBrightness2=@PassagewayBrightness2,PassagewayBrightness3=@PassagewayBrightness3,PassagewayBrightness4=@PassagewayBrightness4,MyCorner=@MyCorner,LocateList=@LocateList,RoiList=@RoiList where ID=@ID";
|
||||||
|
return AccHelpers.ExecuteNonQuery(sqlstr, new OleDbParameter("@Point_Row1", model.Point_Row1),
|
||||||
|
new OleDbParameter("@Point_Column1", model.Point_Column1),
|
||||||
|
new OleDbParameter("@Point_Row2", model.Point_Row2),
|
||||||
|
new OleDbParameter("@Point_Column2", model.Point_Column2),
|
||||||
|
new OleDbParameter("@PassagewayBrightness1", model.PassagewayBrightness1),
|
||||||
|
new OleDbParameter("@PassagewayBrightness2", model.PassagewayBrightness2),
|
||||||
|
new OleDbParameter("@PassagewayBrightness3", model.PassagewayBrightness3),
|
||||||
|
new OleDbParameter("@PassagewayBrightness4", model.PassagewayBrightness4),
|
||||||
|
new OleDbParameter("@MyCorner", ShareHelp.ObjToJson(model.MyCorner)),
|
||||||
|
new OleDbParameter("@LocateList", ShareHelp.ObjToJson(model.LocateList)),
|
||||||
|
new OleDbParameter("@RoiList", ShareHelp.ObjToJson(model.RoiList)),
|
||||||
|
new OleDbParameter("@ID", model.ID));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return AddRectangleModel(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
string str = ex.ToString();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 2、新增模型
|
||||||
|
/// <summary>
|
||||||
|
/// 新增模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int AddRectangleModel(V_RectangleModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string sqlstr = "insert into V_RectangleModel (VeiID,AreaType,Point_Row1,Point_Column1,Point_Row2,Point_Column2)values(@MachineID,@AreaType,@Point_Row1,@Point_Column1,@Point_Row2,@Point_Column2)";
|
||||||
|
int a = AccHelpers.ExecuteNonQuery(sqlstr, new OleDbParameter("@VeiID", model.VeiID),
|
||||||
|
new OleDbParameter("@AreaType", model.AreaType),
|
||||||
|
new OleDbParameter("@Point_Row1", model.Point_Row1),
|
||||||
|
new OleDbParameter("@Point_Column1", model.Point_Column1),
|
||||||
|
new OleDbParameter("@Point_Row2", model.Point_Row2),
|
||||||
|
new OleDbParameter("@Point_Column2", model.Point_Column2));
|
||||||
|
if (a > 0)
|
||||||
|
{
|
||||||
|
model.ID = GetInsertID();
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 3、删除产品模型
|
||||||
|
/// <summary>
|
||||||
|
/// 删除产品区域模型
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
public int DelModelDAL(V_RectangleModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DelROI(model.MyROI);
|
||||||
|
if (model.MyRoiList != null)
|
||||||
|
{
|
||||||
|
foreach (V_ROI roi in model.MyRoiList)
|
||||||
|
{
|
||||||
|
DelROI(roi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
string sqlstr = "delete from V_RectangleModel where ID=@ID";
|
||||||
|
return AccHelpers.ExecuteNonQuery(sqlstr, new OleDbParameter("@ID", model.ID));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 二、根据区域模型ID获取全部ROI
|
||||||
|
/// <summary>
|
||||||
|
/// 根据区域模型ID获取ROI集合
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="modelID">区域模型ID</param>
|
||||||
|
/// <param name="ROIType">ROI类型</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public ObservableCollection<V_ROI> GetROIList(int modelID, int ROIType)
|
||||||
|
{
|
||||||
|
string sqlstr = "select * from V_ROI where ModelID=@ModelID and ROIType=@ROIType ORDER BY ID";
|
||||||
|
DataTable table = AccHelpers.ExecuteDataTable(sqlstr, new OleDbParameter("@ModelID", modelID),
|
||||||
|
new OleDbParameter("@ROIType", ROIType));
|
||||||
|
return DataTableRecangleToList(table);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据产品区域模型ID获取全部ROI
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="modelID"></param>
|
||||||
|
/// <param name="ROIType"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public V_ROI GetROI(int modelID, int ROIType)
|
||||||
|
{
|
||||||
|
string sqlstr = "select * from V_ROI where ModelID=@ModelID and ROIType=@ROIType";
|
||||||
|
DataTable table = AccHelpers.ExecuteDataTable(sqlstr, new OleDbParameter("@ModelID", modelID),
|
||||||
|
new OleDbParameter("@ROIType", ROIType));
|
||||||
|
if (table.Rows.Count > 0)
|
||||||
|
{
|
||||||
|
return DataTableRecangleToList(table)[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new V_ROI() { ModelID = modelID };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObservableCollection<V_ROI> DataTableRecangleToList(DataTable table)
|
||||||
|
{
|
||||||
|
ObservableCollection<V_ROI> list = new ObservableCollection<V_ROI>();
|
||||||
|
if (table == null || table.Rows.Count <= 0)
|
||||||
|
{
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
foreach (DataRow row in table.Rows)
|
||||||
|
{
|
||||||
|
V_ROI va = new V_ROI();
|
||||||
|
va.ID = (int)row["ID"];
|
||||||
|
va.ModelID = (int)row["ModelID"];
|
||||||
|
va.CodeTypeID = (int)(row["CodeTypeID"]);
|
||||||
|
va.CodeStr = Convert.ToString(row["CodeStr"]);
|
||||||
|
va.MultiCode = Convert.ToBoolean(row["MultiCode"]);
|
||||||
|
va.ROIType = (int)row["ROIType"];
|
||||||
|
va.hv_Column = Convert.ToDouble(row["hv_Column"]);
|
||||||
|
va.hv_Column1 = Convert.ToDouble(row["hv_Column1"]);
|
||||||
|
va.hv_Row = Convert.ToDouble(row["hv_Row"]);
|
||||||
|
va.hv_Row1 = Convert.ToDouble(row["hv_Row1"]);
|
||||||
|
va.hv_Phi = Convert.ToDouble(row["hv_Phi"]);
|
||||||
|
va.hv_length1 = Convert.ToDouble(row["hv_length1"]);
|
||||||
|
va.hv_length2 = Convert.ToDouble(row["hv_length2"]);
|
||||||
|
va.hv_Radius = Convert.ToDouble(row["hv_Radius"]);
|
||||||
|
va.RoiShape = (DrawRoiEmn)Enum.Parse(typeof(DrawRoiEmn), row["RoiShape"].ToString());//Convert.ToBoolean(row["InCircleROI"]);
|
||||||
|
va.RecognitionCoefficient = Math.Round(Convert.ToDouble(row["RecognitionCoefficient"]), 1);
|
||||||
|
va.ModelFeaturePiont = ShareHelp.JsonToObj<V_Piont>(row["ModelFeaturePiont"].ToString());
|
||||||
|
va.HelpFileName = row["HelpFileName"].ToString();
|
||||||
|
va.Enable = Convert.ToBoolean(row["Enable"]);
|
||||||
|
va.Notes = row["Notes"].ToString();
|
||||||
|
va.MeasurePar = row["MeasurePar"].ToString();
|
||||||
|
va.ThresholdMin = (int)row["ThresholdMin"];
|
||||||
|
va.ThresholdMax = (int)row["ThresholdMax"];
|
||||||
|
va.ShapeA_Min = (int)row["ShapeA_Min"];
|
||||||
|
va.ShapeA_Max = (int)row["ShapeA_Max"];
|
||||||
|
va.ShapeB_Min = (int)row["ShapeB_Min"];
|
||||||
|
va.ShapeB_Max = (int)row["ShapeB_Max"];
|
||||||
|
va.ShapeC_Min = (int)row["ShapeC_Min"];
|
||||||
|
va.ShapeC_Max = (int)row["ShapeC_Max"];
|
||||||
|
va.ShapeD_Min = (int)row["ShapeD_Min"];
|
||||||
|
va.ShapeD_Max = (int)row["ShapeD_Max"];
|
||||||
|
list.Add(va);
|
||||||
|
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 1、更新ROI
|
||||||
|
/// <summary>
|
||||||
|
/// 更新ROI
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="roi"></param>
|
||||||
|
public int UpdateROI(V_ROI roi)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (roi.ID > 0)
|
||||||
|
{
|
||||||
|
string sqlstr = "update V_ROI set ModelID=@ModelID,CodeTypeID=@CodeTypeID,CodeStr=@CodeStr,MultiCode=@MultiCode,hv_Row=@hv_Row,hv_Row1=@hv_Row1,hv_Column=@hv_Column,hv_Column1=@hv_Column1,hv_Phi=@hv_Phi,hv_length1=@hv_length1,hv_length2=@hv_length2,hv_Radius=@hv_Radius,RoiShape=@RoiShape,RecognitionCoefficient=@RecognitionCoefficient,ModelFeaturePiont=@ModelFeaturePiont,HelpFileName=@HelpFileName,Enable=@Enable,Notes=@Notes,MeasurePar=@MeasurePar,ThresholdMin=@ThresholdMin,ThresholdMax=@ThresholdMax,ShapeA_Min=@ShapeA_Min,ShapeA_Max=@ShapeA_Max,ShapeB_Min=@ShapeB_Min,ShapeB_Max=@ShapeB_Max,ShapeC_Min=@ShapeC_Min,ShapeC_Max=@ShapeC_Max,ShapeD_Min=@ShapeD_Min,ShapeD_Max=@ShapeD_Max where ID=@ID";
|
||||||
|
return AccHelpers.ExecuteNonQuery(sqlstr, new OleDbParameter("@ModelID", roi.ModelID),
|
||||||
|
new OleDbParameter("@CodeTypeID", roi.CodeTypeID),
|
||||||
|
new OleDbParameter("@CodeStr", roi.CodeStr),
|
||||||
|
new OleDbParameter("@MultiCode", roi.MultiCode),
|
||||||
|
new OleDbParameter("@hv_Row", roi.hv_Row),
|
||||||
|
new OleDbParameter("@hv_Row1", roi.hv_Row1),
|
||||||
|
new OleDbParameter("@hv_Column", roi.hv_Column),
|
||||||
|
new OleDbParameter("@hv_Column1", roi.hv_Column1),
|
||||||
|
new OleDbParameter("@hv_Phi", roi.hv_Phi),
|
||||||
|
new OleDbParameter("@hv_length1", roi.hv_length1),
|
||||||
|
new OleDbParameter("@hv_length2", roi.hv_length2),
|
||||||
|
new OleDbParameter("@hv_Radius", roi.hv_Radius),
|
||||||
|
new OleDbParameter("@RoiShape", roi.RoiShape),
|
||||||
|
new OleDbParameter("@RecognitionCoefficient", roi.RecognitionCoefficient),
|
||||||
|
new OleDbParameter("@ModelFeaturePiont", ShareHelp.ObjToJson(roi.ModelFeaturePiont)),
|
||||||
|
new OleDbParameter("@HelpFileName", roi.HelpFileName),
|
||||||
|
new OleDbParameter("@Enable", roi.Enable),
|
||||||
|
new OleDbParameter("@Notes", roi.Notes),
|
||||||
|
new OleDbParameter("@MeasurePar", roi.MeasurePar),
|
||||||
|
new OleDbParameter("@ThresholdMin", roi.ThresholdMin),
|
||||||
|
new OleDbParameter("@ThresholdMax", roi.ThresholdMax),
|
||||||
|
new OleDbParameter("@ShapeA_Min", roi.ShapeA_Min),
|
||||||
|
new OleDbParameter("@ShapeA_Max", roi.ShapeA_Max),
|
||||||
|
new OleDbParameter("@ShapeB_Min", roi.ShapeB_Min),
|
||||||
|
new OleDbParameter("@ShapeB_Max", roi.ShapeB_Max),
|
||||||
|
new OleDbParameter("@ShapeC_Min", roi.ShapeC_Min),
|
||||||
|
new OleDbParameter("@ShapeC_Max", roi.ShapeC_Max),
|
||||||
|
new OleDbParameter("@ShapeD_Min", roi.ShapeD_Min),
|
||||||
|
new OleDbParameter("@ShapeD_Max", roi.ShapeD_Max),
|
||||||
|
new OleDbParameter("@ID", roi.ID));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return AddRectangleROI(roi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 2、新增矩形ROI
|
||||||
|
/// <summary>
|
||||||
|
/// 新增ROI
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ROI"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int AddRectangleROI(V_ROI ROI)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string sqlstr = "insert into V_ROI (ModelID,ROIType,CodeTypeID,CodeStr,MultiCode,hv_Row,hv_Row1,hv_Column,hv_Column1,hv_Phi,hv_length1,hv_length2,hv_Radius,RoiShape,RecognitionCoefficient,ModelFeaturePiont,HelpFileName,Enable,Notes,MeasurePar,ThresholdMin,ThresholdMax,ShapeA_Min,ShapeA_Max,ShapeB_Min,ShapeB_Max,ShapeC_Min,ShapeC_Max,ShapeD_Min,ShapeD_Max)values(@ModelID,@ROIType,@CodeTypeID,@CodeStr,@MultiCode,@hv_Row,@hv_Row1,@hv_Column,@hv_Column1,@hv_Phi,@hv_length1,@hv_length2,@hv_Radius,@RoiShape,@RecognitionCoefficient,@ModelFeaturePiont,@HelpFileName,@Enable,@Notes,@MeasurePar,@ThresholdMin,@ThresholdMax,@ShapeA_Min,@ShapeA_Max,@ShapeB_Min,@ShapeB_Max,@ShapeC_Min,@ShapeC_Max,@ShapeD_Min,@ShapeD_Max)";
|
||||||
|
int a = AccHelpers.ExecuteNonQuery(sqlstr, new OleDbParameter("@ModelID", ROI.ModelID),
|
||||||
|
new OleDbParameter("@ROIType", ROI.ROIType),
|
||||||
|
new OleDbParameter("@CodeTypeID", ROI.CodeTypeID),
|
||||||
|
new OleDbParameter("@CodeStr", ROI.CodeStr),
|
||||||
|
new OleDbParameter("@MultiCode", ROI.MultiCode),
|
||||||
|
new OleDbParameter("@hv_Row", ROI.hv_Row),
|
||||||
|
new OleDbParameter("@hv_Row1", ROI.hv_Row1),
|
||||||
|
new OleDbParameter("@hv_Column", ROI.hv_Column),
|
||||||
|
new OleDbParameter("@hv_Column1", ROI.hv_Column1),
|
||||||
|
new OleDbParameter("@hv_Phi", ROI.hv_Phi),
|
||||||
|
new OleDbParameter("@hv_length1", ROI.hv_length1),
|
||||||
|
new OleDbParameter("@hv_length2", ROI.hv_length2),
|
||||||
|
new OleDbParameter("@hv_Radius", ROI.hv_Radius),
|
||||||
|
new OleDbParameter("@RoiShape", ROI.RoiShape),
|
||||||
|
new OleDbParameter("@RecognitionCoefficient", ROI.RecognitionCoefficient),
|
||||||
|
new OleDbParameter("@ModelFeaturePiont", ShareHelp.ObjToJson(ROI.ModelFeaturePiont)),
|
||||||
|
new OleDbParameter("@HelpFileName", ROI.HelpFileName),
|
||||||
|
new OleDbParameter("@Enable", ROI.Enable),
|
||||||
|
new OleDbParameter("@Notes", ROI.Notes),
|
||||||
|
new OleDbParameter("@MeasurePar", ROI.MeasurePar),
|
||||||
|
new OleDbParameter("@ThresholdMin", ROI.ThresholdMin),
|
||||||
|
new OleDbParameter("@ThresholdMax", ROI.ThresholdMax),
|
||||||
|
new OleDbParameter("@ShapeA_Min", ROI.ShapeA_Min),
|
||||||
|
new OleDbParameter("@ShapeA_Max", ROI.ShapeA_Max),
|
||||||
|
new OleDbParameter("@ShapeB_Min", ROI.ShapeB_Min),
|
||||||
|
new OleDbParameter("@ShapeB_Max", ROI.ShapeB_Max),
|
||||||
|
new OleDbParameter("@ShapeC_Min", ROI.ShapeC_Min),
|
||||||
|
new OleDbParameter("@ShapeC_Max", ROI.ShapeC_Max),
|
||||||
|
new OleDbParameter("@ShapeD_Min", ROI.ShapeD_Min),
|
||||||
|
new OleDbParameter("@ShapeD_Max", ROI.ShapeD_Max));
|
||||||
|
|
||||||
|
if (a > 0)
|
||||||
|
{
|
||||||
|
ROI.ID = GetInsertID();
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 3、删除矩形ROI
|
||||||
|
/// <summary>
|
||||||
|
/// 删除矩形ROI
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="roi"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int DelROI(V_ROI roi)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string sqlstr = "delete from V_ROI where ID=@ID";
|
||||||
|
return AccHelpers.ExecuteNonQuery(sqlstr, new OleDbParameter("@ID", roi.ID));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 视觉工程项目相关
|
||||||
|
|
||||||
|
#region 1、获取视觉工程项目集合
|
||||||
|
/// <summary>
|
||||||
|
/// 获取视觉工程项目集合
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="machineID">机种ID</param>
|
||||||
|
/// <param name="CamID">相机ID</param>
|
||||||
|
public ObservableCollection<VisualEngineering> GetVisualEngineeringList(int machineID, int CamID)
|
||||||
|
{
|
||||||
|
string sqlstr = "select * from VisualEngineering where MachineID=@MachineID and CameraID=@CameraID";
|
||||||
|
DataTable table = AccHelpers.ExecuteDataTable(sqlstr, new OleDbParameter("@MachineID", machineID),
|
||||||
|
new OleDbParameter("@CameraID", CamID));
|
||||||
|
|
||||||
|
return VisualEngineeringTableToList(table);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObservableCollection<VisualEngineering> VisualEngineeringTableToList(DataTable table)
|
||||||
|
{
|
||||||
|
ObservableCollection<VisualEngineering> list = new ObservableCollection<VisualEngineering>();
|
||||||
|
if (table == null || table.Rows.Count <= 0)
|
||||||
|
{
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
VisualEngineering ve;
|
||||||
|
foreach (DataRow row in table.Rows)
|
||||||
|
{
|
||||||
|
ve = new VisualEngineering();
|
||||||
|
ve.CameraID = Convert.ToInt32(row["CameraID"]);
|
||||||
|
ve.EName = row["EName"].ToString();
|
||||||
|
ve.ID = Convert.ToInt32(row["ID"]);
|
||||||
|
ve.MachineID = Convert.ToInt32(row["MachineID"]);
|
||||||
|
ve.MechanicalPointID = Convert.ToInt32(row["MechanicalPointID"]);
|
||||||
|
ve.Notes = row["Notes"].ToString();
|
||||||
|
ve.NType = Convert.ToInt32(row["NType"]);
|
||||||
|
ve.Enable = Convert.ToBoolean(row["Enable"]);
|
||||||
|
ve.VisualEngineeringItemsList = GetVisualEngineeringItemsList(ve.ID);
|
||||||
|
list.Add(ve);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 2、新增视觉工程项目
|
||||||
|
/// <summary>
|
||||||
|
/// 新增视觉工程项目
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ve"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int AddVisualEngineering(VisualEngineering ve)
|
||||||
|
{
|
||||||
|
string sqlstr = "insert into VisualEngineering(MachineID,CameraID,EName,Notes,NType,MechanicalPointID,Enable)values(@MachineID,@CameraID,@EName,@Notes,@NType,@MechanicalPointID,@Enable)";
|
||||||
|
int a = AccHelpers.ExecuteNonQuery(sqlstr, new OleDbParameter("@MachineID", ve.MachineID),
|
||||||
|
new OleDbParameter("@CameraID", ve.CameraID),
|
||||||
|
new OleDbParameter("@EName", ve.EName),
|
||||||
|
new OleDbParameter("@Notes", ve.Notes),
|
||||||
|
new OleDbParameter("@NType", ve.NType),
|
||||||
|
new OleDbParameter("@MechanicalPointID", ve.MechanicalPointID),
|
||||||
|
new OleDbParameter("@Enable", ve.Enable));
|
||||||
|
if (a > 0)
|
||||||
|
{
|
||||||
|
ve.ID = GetInsertID();
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 3、更新视觉工程项目
|
||||||
|
/// <summary>
|
||||||
|
/// 更新视觉工程项目
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ve"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int UpdateVisualEngineering(VisualEngineering ve)
|
||||||
|
{
|
||||||
|
string sqlstr = "update VisualEngineering set MachineID=@MachineID,CameraID=@CameraID,EName=@EName,Notes=@Notes,NType=@NType,MechanicalPointID=@MechanicalPointID,Enable=@Enable where ID=@ID";
|
||||||
|
return AccHelpers.ExecuteNonQuery(sqlstr, new OleDbParameter("@MachineID", ve.MachineID),
|
||||||
|
new OleDbParameter("@CameraID", ve.CameraID),
|
||||||
|
new OleDbParameter("@EName", ve.EName),
|
||||||
|
new OleDbParameter("@Notes", ve.Notes),
|
||||||
|
new OleDbParameter("@NType", ve.NType),
|
||||||
|
new OleDbParameter("@MechanicalPointID", ve.MechanicalPointID),
|
||||||
|
new OleDbParameter("@Enable", ve.Enable),
|
||||||
|
new OleDbParameter("@ID", ve.ID));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 4、删除视觉工程项目
|
||||||
|
/// <summary>
|
||||||
|
/// 删除视觉工程项目
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ve"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int DelVisualEngineering(VisualEngineering ve)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (ve.VisualEngineeringItemsList != null && ve.VisualEngineeringItemsList.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (VisualEngineeringItems vei in ve.VisualEngineeringItemsList)
|
||||||
|
{
|
||||||
|
DelVisualEngineeringItems(vei);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string sqlstr = "delete from VisualEngineering where ID=@ID";
|
||||||
|
return AccHelpers.ExecuteNonQuery(sqlstr, new OleDbParameter("@ID", ve.ID));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 视觉工程项目功能相关
|
||||||
|
|
||||||
|
#region 1、获取视觉工程项目功能集合
|
||||||
|
/// <summary>
|
||||||
|
/// 获取视觉工程项目功能集合
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="visualEngineeringID">视觉工程项目ID</param>
|
||||||
|
public ObservableCollection<VisualEngineeringItems> GetVisualEngineeringItemsList(int visualEngineeringID)
|
||||||
|
{
|
||||||
|
string sqlstr = "select * from VisualEngineeringItems where VisualEngineeringID=@VisualEngineeringID";
|
||||||
|
DataTable table = AccHelpers.ExecuteDataTable(sqlstr, new OleDbParameter("@VisualEngineeringID", visualEngineeringID));
|
||||||
|
return VisualEngineeringItemsTableToLsit(table);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObservableCollection<VisualEngineeringItems> VisualEngineeringItemsTableToLsit(DataTable table)
|
||||||
|
{
|
||||||
|
ObservableCollection<VisualEngineeringItems> list = new ObservableCollection<VisualEngineeringItems>();
|
||||||
|
if (table == null || table.Rows.Count <= 0)
|
||||||
|
{
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
VisualEngineeringItems vei;
|
||||||
|
foreach (DataRow row in table.Rows)
|
||||||
|
{
|
||||||
|
vei = new VisualEngineeringItems();
|
||||||
|
vei.HandleType = Convert.ToInt32(row["HandleType"]);
|
||||||
|
vei.ID = Convert.ToInt32(row["ID"]);
|
||||||
|
vei.Notes = row["Notes"].ToString();
|
||||||
|
vei.VEIname = row["VEIname"].ToString();
|
||||||
|
vei.VisualEngineeringID = Convert.ToInt32(row["VisualEngineeringID"]);
|
||||||
|
vei.Enable = Convert.ToBoolean(row["Enable"]);
|
||||||
|
vei.MyRectangleModel = GetRectangleModel(vei.ID, 1);
|
||||||
|
vei.ImageCorrectionRM = GetRectangleModel(vei.ID, 2);
|
||||||
|
vei.ExposureTime = Convert.ToInt64(row["ExposureTime"]);
|
||||||
|
list.Add(vei);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 2、新增视觉项目功能
|
||||||
|
/// <summary>
|
||||||
|
/// 新增视觉项目功能
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="vei"></param>
|
||||||
|
public int AddVisualEngineeringItems(VisualEngineeringItems vei)
|
||||||
|
{
|
||||||
|
|
||||||
|
string sqlstr = "insert into VisualEngineeringItems (VisualEngineeringID,HandleType,VEIname,Notes,ExposureTime,Enable)values(@VisualEngineeringID,@HandleType,@VEIname,@Notes,@ExposureTime,@Enable)";
|
||||||
|
int a = AccHelpers.ExecuteNonQuery(sqlstr, new OleDbParameter("@VisualEngineeringID", vei.VisualEngineeringID),
|
||||||
|
new OleDbParameter("@HandleType", vei.HandleType),
|
||||||
|
new OleDbParameter("@VEIname", vei.VEIname),
|
||||||
|
new OleDbParameter("@Notes", vei.Notes),
|
||||||
|
new OleDbParameter("@ExposureTime", vei.ExposureTime),
|
||||||
|
new OleDbParameter("@Enable", vei.Enable));
|
||||||
|
if (a > 0)
|
||||||
|
{
|
||||||
|
vei.ID = GetInsertID();
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 3、更新视觉项目功能
|
||||||
|
/// <summary>
|
||||||
|
/// 更新视觉项目功能
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="vei"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int UpdateVisualEngineeringItems(VisualEngineeringItems vei)
|
||||||
|
{
|
||||||
|
string sqlstr = "update VisualEngineeringItems set VisualEngineeringID=@VisualEngineeringID,HandleType=@HandleType,VEIname=@VEIname,Notes=@Notes,Enable=@Enable,ExposureTime=@ExposureTime where ID=@ID";
|
||||||
|
return AccHelpers.ExecuteNonQuery(sqlstr, new OleDbParameter("@VisualEngineeringID", vei.VisualEngineeringID),
|
||||||
|
new OleDbParameter("@HandleType", vei.HandleType),
|
||||||
|
new OleDbParameter("@VEIname", vei.VEIname),
|
||||||
|
new OleDbParameter("@Notes", vei.Notes),
|
||||||
|
new OleDbParameter("@Enable", vei.Enable),
|
||||||
|
new OleDbParameter("@ExposureTime", vei.ExposureTime),
|
||||||
|
new OleDbParameter("@ID", vei.ID));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 4、视觉删除项目功能
|
||||||
|
/// <summary>
|
||||||
|
/// 视觉删除项目功能
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="vei"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int DelVisualEngineeringItems(VisualEngineeringItems vei)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DelModelDAL(vei.MyRectangleModel);
|
||||||
|
DelModelDAL(vei.ImageCorrectionRM);
|
||||||
|
string sqlstr = "delete from VisualEngineeringItems where ID=@ID";
|
||||||
|
return AccHelpers.ExecuteNonQuery(sqlstr, new OleDbParameter("@ID", vei.ID));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 获取插入数据后的ID(此方法必须用于 插入数据执行成功之后才有效)
|
||||||
|
/// <summary>
|
||||||
|
/// 获取插入数据后的ID(此方法必须用于 插入数据执行成功之后才有效)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int GetInsertID()
|
||||||
|
{
|
||||||
|
string sqlstr = "SELECT @@IDENTITY AS 'Id'";
|
||||||
|
object obj = AccHelpers.ExecuteScalar(sqlstr);
|
||||||
|
int a = Convert.ToInt32(obj);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
6
DAL/packages.config
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="ControlzEx" version="4.3.2" targetFramework="net452" requireReinstallation="true" />
|
||||||
|
<package id="MahApps.Metro" version="2.2.0" targetFramework="net452" requireReinstallation="true" />
|
||||||
|
<package id="Microsoft.Xaml.Behaviors.Wpf" version="1.1.19" targetFramework="net452" />
|
||||||
|
</packages>
|
||||||
52
FeiYu.sln
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 14
|
||||||
|
VisualStudioVersion = 14.0.25420.1
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FeiYu", "FeiYu\FeiYu.csproj", "{6C4B0F0C-9A52-42FC-B9AF-C26E965C85BC}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Community", "Community\Community.csproj", "{40BD9B86-2281-4E16-BFAB-558CB18E873C}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Views", "Views\Views.csproj", "{8DB056A3-3190-4310-8D27-4DAA1A1C11B4}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DAL", "DAL\DAL.csproj", "{189029A5-B035-4838-994B-F408EB9776F4}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Model", "Model\Model.csproj", "{7EC8F22D-631C-4B92-8D55-4B0F32D9318D}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ViewModel", "ViewModel\ViewModel.csproj", "{0BBBCA73-E902-497E-B629-68C7C88365BA}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{6C4B0F0C-9A52-42FC-B9AF-C26E965C85BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{6C4B0F0C-9A52-42FC-B9AF-C26E965C85BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{6C4B0F0C-9A52-42FC-B9AF-C26E965C85BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{6C4B0F0C-9A52-42FC-B9AF-C26E965C85BC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{40BD9B86-2281-4E16-BFAB-558CB18E873C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{40BD9B86-2281-4E16-BFAB-558CB18E873C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{40BD9B86-2281-4E16-BFAB-558CB18E873C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{40BD9B86-2281-4E16-BFAB-558CB18E873C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{8DB056A3-3190-4310-8D27-4DAA1A1C11B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{8DB056A3-3190-4310-8D27-4DAA1A1C11B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{8DB056A3-3190-4310-8D27-4DAA1A1C11B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{8DB056A3-3190-4310-8D27-4DAA1A1C11B4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{189029A5-B035-4838-994B-F408EB9776F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{189029A5-B035-4838-994B-F408EB9776F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{189029A5-B035-4838-994B-F408EB9776F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{189029A5-B035-4838-994B-F408EB9776F4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{7EC8F22D-631C-4B92-8D55-4B0F32D9318D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{7EC8F22D-631C-4B92-8D55-4B0F32D9318D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{7EC8F22D-631C-4B92-8D55-4B0F32D9318D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{7EC8F22D-631C-4B92-8D55-4B0F32D9318D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{0BBBCA73-E902-497E-B629-68C7C88365BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{0BBBCA73-E902-497E-B629-68C7C88365BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{0BBBCA73-E902-497E-B629-68C7C88365BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{0BBBCA73-E902-497E-B629-68C7C88365BA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
20
FeiYu/App.config
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||||
|
</startup>
|
||||||
|
<connectionStrings>
|
||||||
|
<add name="dbConnstr" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Data\DataBase.accdb"/>
|
||||||
|
<add name="dbConnstr1" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Data\DataBase1.accdb"/>
|
||||||
|
<add name="dbConnstr2" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Data\DataBase2.accdb"/>
|
||||||
|
|
||||||
|
<!--<add name="dbConnstr1" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\23.accdb;Jet OLEDB:Database Password=123456" />-->
|
||||||
|
|
||||||
|
<add name="ITAssets.Properties.Settings.ITAssetsConnectionString" connectionString="Data Source=10.110.8.34;Initial Catalog=ITAssets;User ID=sa;Password=omron@01" providerName="System.Data.SqlClient"/>
|
||||||
|
<!--通讯连接IP-->
|
||||||
|
<add name="CommunicationIP" connectionString="192.168.20.88"/>
|
||||||
|
<!--通讯连接端口号-->
|
||||||
|
<add name="CommunicationPort" connectionString="16818"/>
|
||||||
|
<add name="CommunicationPort1" connectionString="2000"/>
|
||||||
|
</connectionStrings>
|
||||||
|
</configuration>
|
||||||
17
FeiYu/App.xaml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<Application x:Class="FeiYu.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:FeiYu" StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
|
||||||
|
|
||||||
|
<!-- 自定义样式类 -->
|
||||||
|
<ResourceDictionary Source="Styles.xaml" />
|
||||||
|
<!-- 加载语言(默认英文) -->
|
||||||
|
<!--<ResourceDictionary Source="./Language/zh-cn.xaml"/>-->
|
||||||
|
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
34
FeiYu/App.xaml.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace FeiYu
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// App.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
|
||||||
|
//protected override void OnStartup(StartupEventArgs e)
|
||||||
|
//{
|
||||||
|
// // get the current app style (theme and accent) from the application
|
||||||
|
// // you can then use the current theme and custom accent instead set a new theme
|
||||||
|
// Tuple<AppTheme, Accent> appStyle = ThemeManager.DetectAppStyle(Application.Current);
|
||||||
|
|
||||||
|
// // now set the Green accent and dark theme
|
||||||
|
// ThemeManager.ChangeAppStyle(Application.Current,
|
||||||
|
// ThemeManager.GetAccent("Green"),
|
||||||
|
// ThemeManager.GetAppTheme("BaseDark")); // or appStyle.Item1
|
||||||
|
|
||||||
|
// base.OnStartup(e);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
285
FeiYu/FeiYu.csproj
Normal file
@ -0,0 +1,285 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{6C4B0F0C-9A52-42FC-B9AF-C26E965C85BC}</ProjectGuid>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>FeiYu</RootNamespace>
|
||||||
|
<AssemblyName>FeiYu</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<PublishUrl>publish\</PublishUrl>
|
||||||
|
<Install>true</Install>
|
||||||
|
<InstallFrom>Disk</InstallFrom>
|
||||||
|
<UpdateEnabled>false</UpdateEnabled>
|
||||||
|
<UpdateMode>Foreground</UpdateMode>
|
||||||
|
<UpdateInterval>7</UpdateInterval>
|
||||||
|
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||||
|
<UpdatePeriodically>false</UpdatePeriodically>
|
||||||
|
<UpdateRequired>false</UpdateRequired>
|
||||||
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<ApplicationIcon>Resources\logo1.ico</ApplicationIcon>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Basler.Pylon, Version=1.1.0.0, Culture=neutral, PublicKeyToken=e389355f398382ab, processorArchitecture=AMD64">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>bin\Debug\Basler.Pylon.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="ControlzEx, Version=4.0.0.0, Culture=neutral, PublicKeyToken=69f1c32f803d307e, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\ControlzEx.4.3.2\lib\net45\ControlzEx.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="halcondotnet">
|
||||||
|
<HintPath>C:\Program Files\MVTec\HALCON-17.12-Progress\bin\dotnet35\halcondotnet.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="MahApps.Metro, Version=2.0.0.0, Culture=neutral, PublicKeyToken=51482d6f650b2b3f, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\MahApps.Metro.2.2.0\lib\net452\MahApps.Metro.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Microsoft.Xaml.Behaviors.Wpf.1.1.19\lib\net45\Microsoft.Xaml.Behaviors.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="MvCameraControl.Net, Version=3.4.0.1, Culture=neutral, PublicKeyToken=52fddfb3f94be800, processorArchitecture=AMD64">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>bin\Debug\MvCameraControl.Net.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Web" />
|
||||||
|
<Reference Include="System.Web.Extensions" />
|
||||||
|
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>bin\Debug\System.Windows.Interactivity.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xaml">
|
||||||
|
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="WindowsBase" />
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ApplicationDefinition Include="App.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</ApplicationDefinition>
|
||||||
|
<Compile Include="PwdAlter.xaml.cs">
|
||||||
|
<DependentUpon>PwdAlter.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="PwdInput.xaml.cs">
|
||||||
|
<DependentUpon>PwdInput.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="SoftSelect.xaml.cs">
|
||||||
|
<DependentUpon>SoftSelect.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Page Include="MainWindow.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Compile Include="App.xaml.cs">
|
||||||
|
<DependentUpon>App.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="MainWindow.xaml.cs">
|
||||||
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Page Include="PwdAlter.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="PwdInput.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Resources\Icons.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Resources\IconsNonShared.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="SoftSelect.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Styles.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Properties\Settings.Designer.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
|
</Compile>
|
||||||
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
<None Include="Properties\Settings.settings">
|
||||||
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
|
<AppDesigner Include="Properties\" />
|
||||||
|
<None Include="Resources\LoginTip\Thumbs.db" />
|
||||||
|
<Resource Include="Resources\Entypo.ttf" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Community\Community.csproj">
|
||||||
|
<Project>{40bd9b86-2281-4e16-bfab-558cb18e873c}</Project>
|
||||||
|
<Name>Community</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\DAL\DAL.csproj">
|
||||||
|
<Project>{189029a5-b035-4838-994b-f408eb9776f4}</Project>
|
||||||
|
<Name>DAL</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Model\Model.csproj">
|
||||||
|
<Project>{7ec8f22d-631c-4b92-8d55-4b0f32d9318d}</Project>
|
||||||
|
<Name>Model</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\ViewModel\ViewModel.csproj">
|
||||||
|
<Project>{0bbbca73-e902-497e-b629-68c7c88365ba}</Project>
|
||||||
|
<Name>ViewModel</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Views\Views.csproj">
|
||||||
|
<Project>{8db056a3-3190-4310-8d27-4daa1a1c11b4}</Project>
|
||||||
|
<Name>Views</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\1.jpg" />
|
||||||
|
<Resource Include="Resources\10.jpg" />
|
||||||
|
<Resource Include="Resources\11.jpg" />
|
||||||
|
<Resource Include="Resources\12.jpg" />
|
||||||
|
<Resource Include="Resources\13.jpg" />
|
||||||
|
<Resource Include="Resources\14.jpg" />
|
||||||
|
<Resource Include="Resources\15.jpg" />
|
||||||
|
<Resource Include="Resources\16.jpg" />
|
||||||
|
<Resource Include="Resources\17.jpg" />
|
||||||
|
<Resource Include="Resources\18.jpg" />
|
||||||
|
<Resource Include="Resources\19.jpg" />
|
||||||
|
<Resource Include="Resources\2.jpg" />
|
||||||
|
<Resource Include="Resources\20.jpg" />
|
||||||
|
<Resource Include="Resources\21.jpg" />
|
||||||
|
<Resource Include="Resources\22.jpg" />
|
||||||
|
<Resource Include="Resources\3.jpg" />
|
||||||
|
<Resource Include="Resources\4.jpg" />
|
||||||
|
<Resource Include="Resources\5.jpg" />
|
||||||
|
<Resource Include="Resources\6.jpg" />
|
||||||
|
<Resource Include="Resources\7.jpg" />
|
||||||
|
<Resource Include="Resources\8.jpg" />
|
||||||
|
<Resource Include="Resources\9.jpg" />
|
||||||
|
<Resource Include="Resources\arrow.png" />
|
||||||
|
<Resource Include="Resources\Home_03.jpg" />
|
||||||
|
<Resource Include="Resources\Home_04.jpg" />
|
||||||
|
<Resource Include="Resources\log.png" />
|
||||||
|
<Resource Include="Resources\logo1.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Data\DataBase.accdb" />
|
||||||
|
<Resource Include="Resources\23.jpg" />
|
||||||
|
<Resource Include="Resources\24.jpg" />
|
||||||
|
<Resource Include="Resources\25.jpg" />
|
||||||
|
<Resource Include="Resources\26.jpg" />
|
||||||
|
<Resource Include="Resources\27.jpg" />
|
||||||
|
<Resource Include="Resources\28.jpg" />
|
||||||
|
<Resource Include="Resources\29.jpg" />
|
||||||
|
<Resource Include="Resources\30.jpg" />
|
||||||
|
<Resource Include="Resources\31.jpg" />
|
||||||
|
<Resource Include="Resources\32.jpg" />
|
||||||
|
<Resource Include="Resources\liteno.bmp" />
|
||||||
|
<Resource Include="Resources\LoginTip\close0.png" />
|
||||||
|
<Resource Include="Resources\LoginTip\close1.png" />
|
||||||
|
<Resource Include="Resources\LoginTip\cloud.png" />
|
||||||
|
<Resource Include="Resources\LoginTip\loginbody.png" />
|
||||||
|
<Resource Include="Resources\LoginTip\logo1.ico" />
|
||||||
|
<Resource Include="Resources\LoginTip\mini0.png" />
|
||||||
|
<Resource Include="Resources\LoginTip\mini1.png" />
|
||||||
|
<Resource Include="Resources\LoginTip\sun2.png" />
|
||||||
|
<Resource Include="Resources\LoginTip\yezi2.png" />
|
||||||
|
<Resource Include="Resources\LoginTip\yezi3.png" />
|
||||||
|
<Resource Include="Resources\LoginTip\zhuce.png" />
|
||||||
|
<Resource Include="Resources\LoginTip\zhuce_hover.png" />
|
||||||
|
<Resource Include="Resources\LoginTip\zhuce_press.png" />
|
||||||
|
<SplashScreen Include="StartIng.jpg" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>Microsoft .NET Framework 4.5.2 %28x86 和 x64%29</ProductName>
|
||||||
|
<Install>true</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||||
|
<Install>false</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
||||||
77
FeiYu/MainWindow.xaml
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<mah:MetroWindow x:Class="FeiYu.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:Motion="clr-namespace:Views.Motion;assembly=Views"
|
||||||
|
xmlns:MyNamespace="clr-namespace:Views;assembly=Views"
|
||||||
|
xmlns:Vision="clr-namespace:Views.Vision;assembly=Views"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:FeiYu"
|
||||||
|
xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
Title="{Binding SystemPar.MachineName}"
|
||||||
|
Width="1920" Height="1080" Closing="MetroWindow_Closing"
|
||||||
|
Icon="Resources/logo1.ico"
|
||||||
|
WindowStartupLocation="CenterScreen" WindowState="Maximized"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<mah:MetroWindow.Background>
|
||||||
|
<!--<ImageBrush ImageSource="Resources/3.jpg"/>-->
|
||||||
|
<ImageBrush ImageSource="{Binding SystemPar.SystemBackgroundPath}" />
|
||||||
|
</mah:MetroWindow.Background>
|
||||||
|
<!-- FontFamily="方正宋一繁体" -->
|
||||||
|
|
||||||
|
<mah:MetroWindow.RightWindowCommands>
|
||||||
|
<mah:WindowCommands>
|
||||||
|
<!--<CheckBox Content="空跑模式" IsChecked="{Binding RunningMode}" />-->
|
||||||
|
<!--<ComboBox Grid.Row="4" Grid.Column="5" VerticalContentAlignment="Center" Margin="1" Text="请选择串口" ItemsSource="{Binding LightCOM.ComPortList}" SelectedItem="{Binding SerialProt}"/>-->
|
||||||
|
<Button Click="SubjectSwitch" Content="切换主题" />
|
||||||
|
<Button Click="BackgroundSwitch" Content="切换背景" />
|
||||||
|
<Menu Background="{x:Null}">
|
||||||
|
<MenuItem Background="{x:Null}" FontFamily="楷体" Foreground="White" Header="帮助">
|
||||||
|
<MenuItem Name="menSystemSet" Background="AliceBlue" Click="menSystemSet_Click" Foreground="Black" Header="{Binding PermissionButtonName}" />
|
||||||
|
<MenuItem Name="menPwdAlter" Background="AliceBlue" Click="menPwdAlter_Click" Foreground="Black" Header="修改密码" Visibility="{Binding AllVis}" />
|
||||||
|
<MenuItem Background="AliceBlue" Visibility="{Binding AllVis}" Command="{Binding CountClearedCommand}" Foreground="Black" Header="生产数据清零" />
|
||||||
|
<MenuItem Background="AliceBlue" Visibility="{Binding AllVis}" Command="{Binding ManulTest}" CommandParameter="手动贴左" Foreground="Black" Header="手动贴左" />
|
||||||
|
<MenuItem Background="AliceBlue" Visibility="{Binding AllVis}" Command="{Binding ManulTest}" CommandParameter="手动贴右" Foreground="Black" Header="手动贴右" />
|
||||||
|
<MenuItem Background="AliceBlue" Visibility="{Binding AllVis}" Command="{Binding ManulTest}" CommandParameter="手动检右" Foreground="Black" Header="手动检右" />
|
||||||
|
<MenuItem Background="AliceBlue" Visibility="{Binding AllVis}" Command="{Binding ManulTest}" CommandParameter="手动压合" Foreground="Black" Header="手动压合" />
|
||||||
|
|
||||||
|
<CheckBox Content="启用安全门" FontFamily="楷体" IsChecked="{Binding EnableAnquanmen}" Visibility="{Binding AllVis}" />
|
||||||
|
|
||||||
|
|
||||||
|
<ComboBox Height="26" VerticalAlignment="Center"
|
||||||
|
HorizontalContentAlignment="Center" Background="#4CFFFFFF"
|
||||||
|
DisplayMemberPath="MachineName"
|
||||||
|
ItemsSource="{Binding EnableMachineList}"
|
||||||
|
SelectedValue="{Binding CurrentMachineID}"
|
||||||
|
SelectedValuePath="ID" />
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
||||||
|
</mah:WindowCommands>
|
||||||
|
|
||||||
|
</mah:MetroWindow.RightWindowCommands>
|
||||||
|
<Grid>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="70*" />
|
||||||
|
<!--<ColumnDefinition Width="1"></ColumnDefinition>-->
|
||||||
|
<ColumnDefinition Width="{Binding GridWidth}" />
|
||||||
|
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TabControl Background="Transparent" ItemsSource="{Binding TabItemList}" SelectedItem="{Binding SelectTabItem}" />
|
||||||
|
<!--<GridSplitter Grid.Column="1" Background="Transparent"></GridSplitter>-->
|
||||||
|
<Border Grid.Column="2">
|
||||||
|
<MyNamespace:ControlPanel />
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
<!--<Grid Height="42" VerticalAlignment="Top">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition></ColumnDefinition>
|
||||||
|
<ColumnDefinition></ColumnDefinition>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Border Grid.Column="1" Height="42" Background="{Binding ShowStatu.StatusBackground}">
|
||||||
|
<TextBlock Text="{Binding ShowStatu.StatuInfo}" Tag="{Binding ShowStatu.StatuInfo}" FontSize="25" FontWeight="Bold" Foreground="{Binding ShowStatu.StatusForeground}" VerticalAlignment="Center" />
|
||||||
|
</Border>
|
||||||
|
</Grid>-->
|
||||||
|
</Grid>
|
||||||
|
</mah:MetroWindow>
|
||||||
151
FeiYu/MainWindow.xaml.cs
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
|
||||||
|
using ControlzEx.Theming;
|
||||||
|
using MahApps.Metro.Controls;
|
||||||
|
using MahApps.Metro.Controls.Dialogs;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using ViewModel;
|
||||||
|
using Views;
|
||||||
|
using Community;
|
||||||
|
using Model;
|
||||||
|
|
||||||
|
namespace FeiYu
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// MainWindow.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : MetroWindow
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 主逻辑对象
|
||||||
|
/// </summary>
|
||||||
|
MainWindowVM MVM { get; set; }
|
||||||
|
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
MyMessageBox.MetroWin = this;
|
||||||
|
MVM = new MainWindowVM(this);
|
||||||
|
this.DataContext = MVM;
|
||||||
|
ThemeManager.Current.ChangeTheme(this, BackgroundThemeList[0] + "." + ThemeList[MVM.SystemPar.SystemTheme]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 切换系统设置模式
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void menSystemSet_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (MVM.AllVis == Visibility.Collapsed)
|
||||||
|
{
|
||||||
|
PwdInput pwdInput = new PwdInput();
|
||||||
|
pwdInput.DataContext = this.DataContext;
|
||||||
|
pwdInput.ShowDialog();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MVM.AllVis = Visibility.Collapsed;
|
||||||
|
MVM.SelectTabItem = MVM.TabItemList[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PwdAlter pwdAlter { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 密码修改
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void menPwdAlter_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
pwdAlter = new PwdAlter();
|
||||||
|
pwdAlter.DataContext = this.DataContext;
|
||||||
|
pwdAlter.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 切换主题
|
||||||
|
//主题色
|
||||||
|
List<string> ThemeList = new List<string>() { "Red", "Green", "Blue", "Purple", "Orange", "Lime", "Emerald", "Teal", "Cyan", "Cobalt", "Indigo", "Violet", "Pink", "Magenta", "Crimson", "Amber", "Yellow", "Brown", "Olive", "Steel", "Mauve", "Taupe", "Sienna" };
|
||||||
|
//背景色
|
||||||
|
List<string> BackgroundThemeList = new List<string>() { "Light", "Dark" };
|
||||||
|
/// <summary>
|
||||||
|
/// 切换主题
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void SubjectSwitch(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (MVM.SystemPar.SystemTheme == ThemeList.Count - 1)
|
||||||
|
{
|
||||||
|
MVM.SystemPar.SystemTheme = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ThemeManager.Current.ChangeTheme(this, BackgroundThemeList[0] + "." + ThemeList[MVM.SystemPar.SystemTheme]);
|
||||||
|
MVM.SystemPar.SystemTheme++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int systemBackgroundNumber = 0;
|
||||||
|
/// <summary>
|
||||||
|
/// 切换背景
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void BackgroundSwitch(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
systemBackgroundNumber++;
|
||||||
|
MVM.SystemPar.SystemBackgroundPath = @"Resources/" + systemBackgroundNumber + ".jpg";
|
||||||
|
|
||||||
|
if (systemBackgroundNumber >= 32)
|
||||||
|
{
|
||||||
|
systemBackgroundNumber = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||||
|
{
|
||||||
|
MVM.Close(0);
|
||||||
|
if (MVM.CloseRes == MessageDialogResult.Negative)
|
||||||
|
{
|
||||||
|
e.Cancel = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool el = true;
|
||||||
|
/// <summary>
|
||||||
|
/// 切换语言
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (el)
|
||||||
|
{
|
||||||
|
Application.Current.Resources.MergedDictionaries[4].Source = new Uri(@"./Language/zh-cn.xaml", UriKind.RelativeOrAbsolute);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Application.Current.Resources.MergedDictionaries[4].Source = new Uri(@"./Language/en-us.xaml", UriKind.RelativeOrAbsolute);
|
||||||
|
}
|
||||||
|
el = !el;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
55
FeiYu/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
// 有关程序集的一般信息由以下
|
||||||
|
// 控制。更改这些特性值可修改
|
||||||
|
// 与程序集关联的信息。
|
||||||
|
[assembly: AssemblyTitle("FeiYu")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("FeiYu")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
//将 ComVisible 设置为 false 将使此程序集中的类型
|
||||||
|
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||||
|
//请将此类型的 ComVisible 特性设置为 true。
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
//若要开始生成可本地化的应用程序,请
|
||||||
|
//<PropertyGroup> 中的 .csproj 文件中
|
||||||
|
//例如,如果您在源文件中使用的是美国英语,
|
||||||
|
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
|
||||||
|
//对以下 NeutralResourceLanguage 特性的注释。 更新
|
||||||
|
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
|
||||||
|
|
||||||
|
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||||
|
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
|
||||||
|
//(当资源未在页面
|
||||||
|
//或应用程序资源字典中找到时使用)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
|
||||||
|
//(当资源未在页面
|
||||||
|
//、应用程序或任何主题专用资源字典中找到时使用)
|
||||||
|
)]
|
||||||
|
|
||||||
|
|
||||||
|
// 程序集的版本信息由下列四个值组成:
|
||||||
|
//
|
||||||
|
// 主版本
|
||||||
|
// 次版本
|
||||||
|
// 生成号
|
||||||
|
// 修订号
|
||||||
|
//
|
||||||
|
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||||
|
// 方法是按如下所示使用“*”: :
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
63
FeiYu/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 此代码由工具生成。
|
||||||
|
// 运行时版本:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||||
|
// 重新生成代码,这些更改将会丢失。
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace FeiYu.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||||
|
/// </summary>
|
||||||
|
// 此类是由 StronglyTypedResourceBuilder
|
||||||
|
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||||
|
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||||
|
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources {
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
|
get {
|
||||||
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FeiYu.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||||
|
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
117
FeiYu/Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
||||||
26
FeiYu/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 此代码由工具生成。
|
||||||
|
// 运行时版本:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||||
|
// 重新生成代码,这些更改将会丢失。
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace FeiYu.Properties {
|
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.11.0.0")]
|
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
|
public static Settings Default {
|
||||||
|
get {
|
||||||
|
return defaultInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
FeiYu/Properties/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
|
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||||
|
<Profiles>
|
||||||
|
<Profile Name="(Default)" />
|
||||||
|
</Profiles>
|
||||||
|
<Settings />
|
||||||
|
</SettingsFile>
|
||||||
32
FeiYu/PwdAlter.xaml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<Window x:Class="FeiYu.PwdAlter"
|
||||||
|
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:FeiYu"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="PwdAlter" Height="220" Width="600" WindowStyle="None" AllowsTransparency="True" ResizeMode="NoResize" Background="Transparent" WindowStartupLocation="CenterScreen">
|
||||||
|
<Grid Background="AliceBlue">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition></ColumnDefinition>
|
||||||
|
<ColumnDefinition></ColumnDefinition>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Label Content="密码修改" Grid.ColumnSpan="2" FontSize="30" FontWeight="Bold" Background="#CC119EDA" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
|
||||||
|
<Label Content="请输入原始密码" Grid.Row="1" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="20" FontWeight="Bold"></Label>
|
||||||
|
<Label Content="新密码" Grid.Row="2" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="20" FontWeight="Bold"></Label>
|
||||||
|
<Label Content="再次输入" Grid.Row="3" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="20" FontWeight="Bold"></Label>
|
||||||
|
<PasswordBox Name="pbOutPwd" Margin="2" Grid.Row="1" Grid.Column="1" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></PasswordBox>
|
||||||
|
<PasswordBox Name="pbNewPwd1" Margin="2" Grid.Row="2" Grid.Column="1" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></PasswordBox>
|
||||||
|
<PasswordBox Name="pbNewPwd2" Margin="2" Grid.Row="3" Grid.Column="1" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></PasswordBox>
|
||||||
|
<Button Name="btnClose" Content="取消" Grid.Row="4" Margin="2" Click="btnClose_Click" IsCancel="True" FontFamily="楷体" FontSize="25" FontWeight="Bold"></Button>
|
||||||
|
<Button Name="btnOK" Content="确定" Grid.Row="4" Grid.Column="1" Margin="2" Click="btnOK_Click" IsDefault="True" FontFamily="楷体" FontSize="25" FontWeight="Bold"></Button>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
56
FeiYu/PwdAlter.xaml.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using ViewModel;
|
||||||
|
|
||||||
|
|
||||||
|
namespace FeiYu
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// PwdAlter.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class PwdAlter : Window
|
||||||
|
{
|
||||||
|
public PwdAlter()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnClose_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnOK_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MainWindowVM MW = this.DataContext as MainWindowVM;
|
||||||
|
string pwd = SoftwareValidation.MD5(pbOutPwd.Password.Trim());
|
||||||
|
if (pwd != MW.SystemPar.SystemPwd)
|
||||||
|
{
|
||||||
|
MessageBox.Show("原始密码错误");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pbNewPwd1.Password.Trim() != pbNewPwd2.Password.Trim())
|
||||||
|
{
|
||||||
|
MessageBox.Show("两次密码输入不一致");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
string newPwd = SoftwareValidation.MD5(pbNewPwd1.Password.Trim());
|
||||||
|
MW.SystemPar.SystemPwd = newPwd;
|
||||||
|
MW.dal.UpdateSystemPWD(MW.SystemPar);
|
||||||
|
MessageBox.Show("密码更改成功,请牢记新密码");
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
24
FeiYu/PwdInput.xaml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<Window x:Class="FeiYu.PwdInput"
|
||||||
|
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:FeiYu"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="请输入密码" Height="200" Width="600" WindowStyle="None" AllowsTransparency="True" ResizeMode="NoResize" Background="Transparent" WindowStartupLocation="CenterScreen" FocusManager.FocusedElement="{Binding ElementName=pbPwd}">
|
||||||
|
<Grid Background="AliceBlue">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition></ColumnDefinition>
|
||||||
|
<ColumnDefinition></ColumnDefinition>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Label Name="labtTool" Content="请输入密码" FontSize="30" FontWeight="Bold" Grid.ColumnSpan="2" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
|
||||||
|
<PasswordBox Name="pbPwd" Margin="2" FontSize="30" FontWeight="Bold" Grid.Row="1" Grid.ColumnSpan="2" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></PasswordBox>
|
||||||
|
<Button Name="btnClose" Content="取消" Grid.Row="2" Margin="2" Click="btnClose_Click" IsCancel="True" FontFamily="楷体" FontSize="30" FontWeight="Bold"></Button>
|
||||||
|
<Button Name="btnOK" Content="确定" Grid.Row="2" Grid.Column="1" Margin="2" Click="btnOK_Click" IsDefault="True" FontFamily="楷体" FontSize="30" FontWeight="Bold"></Button>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
53
FeiYu/PwdInput.xaml.cs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using ViewModel;
|
||||||
|
|
||||||
|
namespace FeiYu
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// PwdInput.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class PwdInput : Window
|
||||||
|
{
|
||||||
|
public PwdInput()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnClose_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnOK_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MainWindowVM mw = this.DataContext as MainWindowVM;
|
||||||
|
string pwd = SoftwareValidation.MD5(pbPwd.Password.Trim());
|
||||||
|
if (pwd == mw.SystemPar.SystemPwd)
|
||||||
|
{
|
||||||
|
mw.AllVis = Visibility.Visible;
|
||||||
|
this.Close();
|
||||||
|
}else if(pwd==mw.SystemPar.SuperCode)
|
||||||
|
{
|
||||||
|
mw.SuperPrivilege = Visibility.Visible;
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("密码错误");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
FeiYu/Resources/1.jpg
Normal file
|
After Width: | Height: | Size: 266 KiB |
BIN
FeiYu/Resources/10.jpg
Normal file
|
After Width: | Height: | Size: 174 KiB |
BIN
FeiYu/Resources/11.jpg
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
FeiYu/Resources/12.jpg
Normal file
|
After Width: | Height: | Size: 280 KiB |
BIN
FeiYu/Resources/13.jpg
Normal file
|
After Width: | Height: | Size: 347 KiB |
BIN
FeiYu/Resources/14.jpg
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
FeiYu/Resources/15.jpg
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
FeiYu/Resources/16.jpg
Normal file
|
After Width: | Height: | Size: 291 KiB |
BIN
FeiYu/Resources/17.jpg
Normal file
|
After Width: | Height: | Size: 499 KiB |
BIN
FeiYu/Resources/18.jpg
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
FeiYu/Resources/19.jpg
Normal file
|
After Width: | Height: | Size: 1.5 MiB |
BIN
FeiYu/Resources/2.jpg
Normal file
|
After Width: | Height: | Size: 358 KiB |
BIN
FeiYu/Resources/20.jpg
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
FeiYu/Resources/21.jpg
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
FeiYu/Resources/22.jpg
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
FeiYu/Resources/23.jpg
Normal file
|
After Width: | Height: | Size: 434 KiB |
BIN
FeiYu/Resources/24.jpg
Normal file
|
After Width: | Height: | Size: 621 KiB |
BIN
FeiYu/Resources/25.jpg
Normal file
|
After Width: | Height: | Size: 162 KiB |
BIN
FeiYu/Resources/26.jpg
Normal file
|
After Width: | Height: | Size: 85 KiB |
BIN
FeiYu/Resources/27.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
FeiYu/Resources/28.jpg
Normal file
|
After Width: | Height: | Size: 980 KiB |
BIN
FeiYu/Resources/29.jpg
Normal file
|
After Width: | Height: | Size: 67 KiB |
BIN
FeiYu/Resources/3.jpg
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
FeiYu/Resources/30.jpg
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
FeiYu/Resources/31.jpg
Normal file
|
After Width: | Height: | Size: 979 KiB |
BIN
FeiYu/Resources/32.jpg
Normal file
|
After Width: | Height: | Size: 434 KiB |
BIN
FeiYu/Resources/4.jpg
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
FeiYu/Resources/5.jpg
Normal file
|
After Width: | Height: | Size: 218 KiB |
BIN
FeiYu/Resources/6.jpg
Normal file
|
After Width: | Height: | Size: 145 KiB |
BIN
FeiYu/Resources/7.jpg
Normal file
|
After Width: | Height: | Size: 288 KiB |
BIN
FeiYu/Resources/8.jpg
Normal file
|
After Width: | Height: | Size: 143 KiB |
BIN
FeiYu/Resources/9.jpg
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
FeiYu/Resources/Entypo.ttf
Normal file
5138
FeiYu/Resources/Icons.xaml
Normal file
5138
FeiYu/Resources/IconsNonShared.xaml
Normal file
BIN
FeiYu/Resources/LoginTip/close0.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
FeiYu/Resources/LoginTip/close1.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
FeiYu/Resources/LoginTip/cloud.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
FeiYu/Resources/LoginTip/loginbody.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
FeiYu/Resources/LoginTip/logo1.ico
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
FeiYu/Resources/LoginTip/mini0.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
FeiYu/Resources/LoginTip/mini1.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
FeiYu/Resources/LoginTip/sun2.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
FeiYu/Resources/LoginTip/yezi2.png
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
FeiYu/Resources/LoginTip/yezi3.png
Normal file
|
After Width: | Height: | Size: 9.7 KiB |
BIN
FeiYu/Resources/LoginTip/zhuce.png
Normal file
|
After Width: | Height: | Size: 539 B |
BIN
FeiYu/Resources/LoginTip/zhuce_hover.png
Normal file
|
After Width: | Height: | Size: 538 B |
BIN
FeiYu/Resources/LoginTip/zhuce_press.png
Normal file
|
After Width: | Height: | Size: 539 B |
BIN
FeiYu/Resources/UL.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
FeiYu/Resources/UR.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
FeiYu/Resources/XL.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
FeiYu/Resources/XR.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
FeiYu/Resources/YC.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
FeiYu/Resources/YT.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
FeiYu/Resources/arrow.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
FeiYu/Resources/liteno.bmp
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
FeiYu/Resources/logo1.ico
Normal file
|
After Width: | Height: | Size: 17 KiB |
70
FeiYu/SoftSelect.xaml
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<Window x:Class="FeiYu.SoftSelect"
|
||||||
|
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:FeiYu"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="登入" Height="350" Width="366" WindowStyle="None" AllowsTransparency="True" ResizeMode="NoResize" Background="Transparent" WindowStartupLocation="CenterScreen" Loaded="Window_Loaded" MouseDown="Window_MouseDown" Icon="Resources\LoginTip\logo1.ico">
|
||||||
|
<Window.Resources>
|
||||||
|
<Storyboard x:Key="leafLeave" RepeatBehavior="Forever">
|
||||||
|
<!--小树叶动画-->
|
||||||
|
<DoubleAnimation BeginTime="00:00:00" AutoReverse="True" Duration="00:00:02" From="0" To="10" Storyboard.TargetProperty="Angle" Storyboard.TargetName="igSmallLeaf">
|
||||||
|
</DoubleAnimation>
|
||||||
|
<!--大树叶动画-->
|
||||||
|
<DoubleAnimation BeginTime="00:00:00" AutoReverse="True" Duration="00:00:02" From="15" To="-15" Storyboard.TargetProperty="Angle" Storyboard.TargetName="igBigLeaf">
|
||||||
|
</DoubleAnimation>
|
||||||
|
</Storyboard>
|
||||||
|
<Storyboard x:Key="cloudMove" RepeatBehavior="Forever">
|
||||||
|
<!--白云移动-->
|
||||||
|
<DoubleAnimation BeginTime="00:00:00" Duration="00:00:20" From="0" To="200" Storyboard.TargetProperty="X" Storyboard.TargetName="igCloud" AutoReverse="False">
|
||||||
|
</DoubleAnimation>
|
||||||
|
<!--白云透明度-->
|
||||||
|
<DoubleAnimation BeginTime="00:00:00" Duration="00:00:14" From="0.8" To="0.1" AutoReverse="False" Storyboard.TargetName="imgCloud" Storyboard.TargetProperty="Opacity">
|
||||||
|
</DoubleAnimation>
|
||||||
|
</Storyboard>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid Margin="0,50,0,0">
|
||||||
|
<Border CornerRadius="5" BorderThickness="0" Height="246">
|
||||||
|
<Border.Background>
|
||||||
|
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
|
||||||
|
<GradientStop Color="#FF070741" Offset="0"></GradientStop>
|
||||||
|
<GradientStop Color="#FF06062B" Offset="0.415" />
|
||||||
|
<GradientStop Color="#FF03032B" Offset="0.989" />
|
||||||
|
<GradientStop Color="#FF0B0B4E" Offset="0.204" />
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</Border.Background>
|
||||||
|
</Border>
|
||||||
|
<Label Content="善易机械" Foreground="White" FontWeight="Bold" Margin="0,40,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"></Label>
|
||||||
|
<Image Source="Resources\LoginTip\Sun2.png" Width="105" Height="53" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-6,-25,0,0"></Image>
|
||||||
|
<Image Source="Resources\LoginTip\yezi2.png" HorizontalAlignment="Left" VerticalAlignment="Top"></Image>
|
||||||
|
<Image Source="Resources\LoginTip\yezi3.png" Width="68" Height="65" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="117,46,0,0">
|
||||||
|
<Image.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<RotateTransform x:Name="igSmallLeaf"></RotateTransform>
|
||||||
|
</TransformGroup>
|
||||||
|
</Image.RenderTransform>
|
||||||
|
</Image>
|
||||||
|
<Image Source="Resources\LoginTip\yezi3.png" Width="40" Height="42" Margin="57,40,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
|
||||||
|
<Image.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<RotateTransform x:Name="igBigLeaf"></RotateTransform>
|
||||||
|
</TransformGroup>
|
||||||
|
</Image.RenderTransform>
|
||||||
|
</Image>
|
||||||
|
<Image Source="Resources\LoginTip\cloud.png" Width="190" Height="50" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,-25" x:Name="imgCloud">
|
||||||
|
<Image.RenderTransform>
|
||||||
|
<TransformGroup>
|
||||||
|
<TranslateTransform x:Name="igCloud"></TranslateTransform>
|
||||||
|
</TransformGroup>
|
||||||
|
</Image.RenderTransform>
|
||||||
|
</Image>
|
||||||
|
<Image Source="Resources\LoginTip\close0.png" Width="22" Height="22" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,50,0,0" MouseEnter="Image_MouseEnter" MouseLeave="Image_MouseLeave" Tag="close" MouseLeftButtonDown="Image_MouseLeftButtonDown"></Image>
|
||||||
|
<Image Source="Resources\LoginTip\mini0.png" Width="22" Height="22" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,50,25,0" MouseEnter="Image_MouseEnter" MouseLeave="Image_MouseLeave" Tag="mini" MouseLeftButtonDown="Image_MouseLeftButtonDown"/>
|
||||||
|
<TextBox Text="请选择对应的机器软件" FontSize="25" FontFamily="楷体" FontWeight="Bold" Width="280" Height="50" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Foreground="White" VerticalAlignment="Center" Margin="0,-10,0,0" Background="{x:Null}" BorderBrush="{x:Null}" ></TextBox>
|
||||||
|
<ComboBox Name="comb" Width="280" Height="30" HorizontalAlignment="Center" VerticalContentAlignment="Center" Margin="43,174,43,96" Background="Transparent" Foreground="White" ItemsSource="{Binding SystemList}" SelectedItem="{Binding SystemSelectItems}" DisplayMemberPath="CommonName"></ComboBox>
|
||||||
|
<Button Name="butLogin" Width="200" Height="30" Margin="126,210,40,60" Content="确定" Style="{StaticResource styleButton}" IsDefault="True" FontSize="22" FontFamily="楷体" Click="butLogin_Click"/>
|
||||||
|
<Button Name="btnKeep" Margin="42,210,245,60" Style="{StaticResource styleButton}" Height="30" Content="取消" FontFamily="楷体" FontSize="22" Click="btnKeep_Click"/>
|
||||||
|
<TextBlock Name="showstr" Margin="45,0,0,33" HorizontalAlignment="Left" VerticalAlignment="Bottom" Text="{Binding LoginShowstr}" FontSize="20" Foreground="Red"></TextBlock>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
253
FeiYu/SoftSelect.xaml.cs
Normal file
@ -0,0 +1,253 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Animation;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using Model;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using DAL;
|
||||||
|
using Community;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace FeiYu
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// SoftSelect.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class SoftSelect : Window
|
||||||
|
{
|
||||||
|
SoftSelectClass ssc;
|
||||||
|
public SoftSelect()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
ssc = new SoftSelectClass();
|
||||||
|
this.DataContext = ssc;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
Storyboard sbd = Resources["leafLeave"] as Storyboard;
|
||||||
|
sbd.Begin();
|
||||||
|
|
||||||
|
Storyboard baiyun = Resources["cloudMove"] as Storyboard;
|
||||||
|
baiyun.Begin();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 拖动窗体
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void Window_MouseDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.LeftButton == MouseButtonState.Pressed)
|
||||||
|
{
|
||||||
|
DragMove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获得鼠标焦点时
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void Image_MouseEnter(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
Image ig = sender as Image;
|
||||||
|
if (ig.Tag.ToString() == "close")
|
||||||
|
{
|
||||||
|
Uri ur = new Uri(@"Resources\LoginTip\close1.png", UriKind.Relative);
|
||||||
|
BitmapImage bp = new BitmapImage(ur);
|
||||||
|
ig.Source = bp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Uri ur = new Uri(@"Resources\LoginTip\mini1.png", UriKind.Relative);
|
||||||
|
BitmapImage bp = new BitmapImage(ur);
|
||||||
|
ig.Source = bp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 鼠标焦点离开时
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void Image_MouseLeave(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
Image ig = sender as Image;
|
||||||
|
if (ig.Tag.ToString() == "close")
|
||||||
|
{
|
||||||
|
Uri ur = new Uri(@"Resources\LoginTip\close0.png", UriKind.Relative);
|
||||||
|
BitmapImage bp = new BitmapImage(ur);
|
||||||
|
ig.Source = bp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Uri ur = new Uri(@"Resources\LoginTip\mini0.png", UriKind.Relative);
|
||||||
|
BitmapImage bp = new BitmapImage(ur);
|
||||||
|
ig.Source = bp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 最小化
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
Image ig = sender as Image;
|
||||||
|
if (ig.Tag.ToString() == "close")
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
else this.WindowState = System.Windows.WindowState.Minimized;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 主窗体对象
|
||||||
|
/// </summary>
|
||||||
|
public MainWindow MWVM { get; set; }
|
||||||
|
private void butLogin_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
//if (ssc.SystemSelectItems != null)
|
||||||
|
//{
|
||||||
|
// MWVM = new MainWindow(ssc.SystemSelectItems.ShortCode);
|
||||||
|
// this.Close();
|
||||||
|
// ssc.UpdataFile(ssc.SystemSelectItems.ShortCode);
|
||||||
|
// MWVM.ShowDialog();
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// MessageBox.Show("请选择要登入的机台对应软件");
|
||||||
|
//}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnKeep_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 软件系统选择逻辑类
|
||||||
|
/// <summary>
|
||||||
|
/// 软件系统选择逻辑类
|
||||||
|
/// </summary>
|
||||||
|
public class SoftSelectClass : NotificationObject
|
||||||
|
{
|
||||||
|
private List<CommonClass> systemList;
|
||||||
|
/// <summary>
|
||||||
|
/// 所有系统软件集合
|
||||||
|
/// </summary>
|
||||||
|
public List<CommonClass> SystemList
|
||||||
|
{
|
||||||
|
get { return systemList; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
systemList = value;
|
||||||
|
this.RaisePropertyChanged("SystemList");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private CommonClass systemSelectItems;
|
||||||
|
/// <summary>
|
||||||
|
/// 选中的软件对象
|
||||||
|
/// </summary>
|
||||||
|
public CommonClass SystemSelectItems
|
||||||
|
{
|
||||||
|
get { return systemSelectItems; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
systemSelectItems = value;
|
||||||
|
this.RaisePropertyChanged("SystemSelectItems");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SoftSelectClass()
|
||||||
|
{
|
||||||
|
SystemList = new List<CommonClass>() { new CommonClass() { ID=1, CommonName="点胶机", ShortCode="djj"},
|
||||||
|
new CommonClass() { ID=2, CommonName="螺丝机",ShortCode="lsj"}};
|
||||||
|
string str = ReadFile();
|
||||||
|
if (!string.IsNullOrEmpty(str))
|
||||||
|
{
|
||||||
|
SystemSelectItems = SystemList.Where(a => a.ShortCode == str).First();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SystemSelectItems = SystemList[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读取默认软件
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private string ReadFile()
|
||||||
|
{
|
||||||
|
string str = "";
|
||||||
|
//指定路径地址
|
||||||
|
string textFile = @"Config.txt";
|
||||||
|
//如果指定路径的文件存在 就打开并显示
|
||||||
|
if (File.Exists(textFile))
|
||||||
|
{
|
||||||
|
using (StreamReader sr = new StreamReader(textFile, Encoding.Default))
|
||||||
|
{
|
||||||
|
|
||||||
|
while (sr.Peek() > 0)
|
||||||
|
{
|
||||||
|
str = str + sr.ReadLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存默认软件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str"></param>
|
||||||
|
public void UpdataFile(string str)
|
||||||
|
{
|
||||||
|
//指定路径地址
|
||||||
|
string textFile = @"Config.txt";
|
||||||
|
|
||||||
|
//打开或创建文件并覆盖
|
||||||
|
FileStream FS = File.Open(textFile, FileMode.Create);
|
||||||
|
//获得字节数组
|
||||||
|
byte[] data = System.Text.Encoding.Default.GetBytes(str);
|
||||||
|
//写入通讯信息
|
||||||
|
FS.Write(data, 0, data.Length);
|
||||||
|
//清空缓冲区、关闭流
|
||||||
|
FS.Flush();
|
||||||
|
FS.Close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
FeiYu/StartIng.jpg
Normal file
|
After Width: | Height: | Size: 54 KiB |
542
FeiYu/Styles.xaml
Normal file
@ -0,0 +1,542 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:FeiYu">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 程序自带字体 -->
|
||||||
|
<FontFamily x:Key="ziti1">../Resources/#方正宋一繁体,Segoe UI,Lucida Sans Unicode,Verdana</FontFamily>
|
||||||
|
<FontFamily x:Key="ziti2">../Resources/#苹果丽黑w36,Segoe UI,Lucida Sans Unicode,Verdana</FontFamily>
|
||||||
|
<FontFamily x:Key="ziti3">../Resources/#微软繁宋体,Segoe UI,Lucida Sans Unicode,Verdana</FontFamily>
|
||||||
|
<FontFamily x:Key="ziti4">../Resources/#宋体-粗体,Segoe UI,Lucida Sans Unicode,Verdana</FontFamily>
|
||||||
|
<FontFamily x:Key="ziti5">../Resources/#行楷体,Segoe UI,Lucida Sans Unicode,Verdana</FontFamily>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Fill Brushes -->
|
||||||
|
<LinearGradientBrush x:Key="WindowBrush" StartPoint="0,0" EndPoint="0,1">
|
||||||
|
<GradientBrush.GradientStops>
|
||||||
|
<GradientStopCollection>
|
||||||
|
<GradientStop Offset="0.0" Color="#ecf5fc" />
|
||||||
|
<GradientStop Offset="1.0" Color="#92cbf8" />
|
||||||
|
</GradientStopCollection>
|
||||||
|
</GradientBrush.GradientStops>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
|
||||||
|
<!-- 输入信号Label样式 -->
|
||||||
|
<Style x:Key="LabelStyle" TargetType="{x:Type Label}">
|
||||||
|
<Setter Property="Content" Value="Black" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<!-- 设置样式 -->
|
||||||
|
<ControlTemplate TargetType="{x:Type Label}">
|
||||||
|
<Grid>
|
||||||
|
<!-- 设置背景透明度 -->
|
||||||
|
<Rectangle x:Name="Rectangle" Fill="{TemplateBinding Background}" Opacity="0.8" />
|
||||||
|
<!-- 显示原有文字内容 -->
|
||||||
|
<ContentPresenter x:Name="ContentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 定义按钮样式 -->
|
||||||
|
<Style x:Key="RoundedButton" TargetType="{x:Type Button}">
|
||||||
|
<Setter Property="Foreground" Value="Black" />
|
||||||
|
<!-- 修改模板属性 -->
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<!-- 控件模板 -->
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<!-- 背景色 -->
|
||||||
|
<Border x:Name="back" CornerRadius="3" Opacity="0.8">
|
||||||
|
<Border.BitmapEffect>
|
||||||
|
<OuterGlowBitmapEffect GlowColor="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" GlowSize="0" Opacity="0.7" />
|
||||||
|
</Border.BitmapEffect>
|
||||||
|
<Border.Background>
|
||||||
|
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1.5">
|
||||||
|
<GradientBrush.GradientStops>
|
||||||
|
<GradientStopCollection>
|
||||||
|
<GradientStop Offset="0" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" />
|
||||||
|
<GradientStop Offset="0.4" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" />
|
||||||
|
<GradientStop Offset="1" Color="#FFF" />
|
||||||
|
</GradientStopCollection>
|
||||||
|
</GradientBrush.GradientStops>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</Border.Background>
|
||||||
|
<!-- 前景色及边框 -->
|
||||||
|
<Border x:Name="fore" BorderBrush="#5555" BorderThickness="2" CornerRadius="3">
|
||||||
|
<Border.Background>
|
||||||
|
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
|
||||||
|
<GradientBrush.GradientStops>
|
||||||
|
<GradientStopCollection>
|
||||||
|
<GradientStop Offset="0.5" Color="#6FFF" />
|
||||||
|
<GradientStop Offset="0.51" Color="#1111" />
|
||||||
|
</GradientStopCollection>
|
||||||
|
</GradientBrush.GradientStops>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</Border.Background>
|
||||||
|
<!-- 按钮内容 -->
|
||||||
|
<ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}">
|
||||||
|
<ContentPresenter.BitmapEffect>
|
||||||
|
<DropShadowBitmapEffect Direction="-90" Opacity="0.3" ShadowDepth="2" Softness="0.1" Color="#000" />
|
||||||
|
</ContentPresenter.BitmapEffect>
|
||||||
|
</ContentPresenter>
|
||||||
|
</Border>
|
||||||
|
</Border>
|
||||||
|
<!-- 触发器 -->
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<!-- 鼠标移入移出 -->
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Trigger.EnterActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" To="6" Duration="0:0:0.2" />
|
||||||
|
<ColorAnimation BeginTime="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#AFFF" Duration="0:0:0.2" />
|
||||||
|
<ColorAnimation BeginTime="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#3FFF" Duration="0:0:0.2" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.EnterActions>
|
||||||
|
<Trigger.ExitActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" Duration="0:0:0.2" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.2" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.2" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.ExitActions>
|
||||||
|
</Trigger>
|
||||||
|
<!-- 按钮按下弹起 -->
|
||||||
|
<Trigger Property="IsPressed" Value="True">
|
||||||
|
<Trigger.EnterActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" To="3" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#3AAA" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#2111" Duration="0:0:0.1" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.EnterActions>
|
||||||
|
<Trigger.ExitActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.1" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.ExitActions>
|
||||||
|
</Trigger>
|
||||||
|
<!-- 按钮失效 -->
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Foreground" Value="#B444" />
|
||||||
|
<Trigger.EnterActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" To="0" Duration="0:0:0.3" />
|
||||||
|
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" To="1" Duration="0:0:0.1" />
|
||||||
|
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" To="-135" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" To="#FFF" Duration="0:0:0.3" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#D555" Duration="0:0:0.3" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#CEEE" Duration="0:0:0.3" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#CDDD" Duration="0:0:0.3" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.EnterActions>
|
||||||
|
<Trigger.ExitActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" Duration="0:0:0.1" />
|
||||||
|
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" Duration="0:0:0.1" />
|
||||||
|
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.1" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.ExitActions>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- 自定义checkBox控件 -->
|
||||||
|
<Style x:Key="CheckBoxStyle" TargetType="{x:Type CheckBox}">
|
||||||
|
<Setter Property="SnapsToDevicePixels" Value="true" />
|
||||||
|
<Setter Property="OverridesDefaultStyle" Value="False" />
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource CheckBoxFocusVisual}" />
|
||||||
|
<Setter Property="Height" Value="25" />
|
||||||
|
<Setter Property="IsChecked" Value="False" />
|
||||||
|
<Setter Property="Margin" Value="0,20" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="CheckBox">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid Width="{TemplateBinding Height}" Height="{TemplateBinding Height}">
|
||||||
|
<Rectangle x:Name="CheckBoxRectangle" Fill="{TemplateBinding Background}" Opacity="1" RadiusX="5" RadiusY="5" />
|
||||||
|
<Rectangle x:Name="CheckBoxRectangleOut" RadiusX="5" RadiusY="5" Stroke="#FF06DAD1" StrokeThickness="1" />
|
||||||
|
<Grid x:Name="CheckedMark" Width="20" Height="20" Visibility="Collapsed">
|
||||||
|
<Path Data="M1,9 L10,17" SnapsToDevicePixels="False" Stroke="White" StrokeThickness="3" />
|
||||||
|
<Path Data="M8,17 L20,4" SnapsToDevicePixels="False" Stroke="White" StrokeThickness="3" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<TextBlock Grid.Column="1" Margin="10,0,0,0" VerticalAlignment="Center" FontSize="{TemplateBinding FontSize}" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" />
|
||||||
|
</Grid>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsChecked" Value="True">
|
||||||
|
<Setter TargetName="CheckedMark" Property="Visibility" Value="Visible" />
|
||||||
|
<!--<Setter TargetName="CheckBoxRectangle" Property="Fill" Value="#FF00A8E0"></Setter> -->
|
||||||
|
<!-- Value="#FF00A8E0" -->
|
||||||
|
<!--
|
||||||
|
<Setter TargetName="CheckBoxRectangle" Property="Opacity" Value="1"></Setter>-->
|
||||||
|
|
||||||
|
<Setter TargetName="CheckBoxRectangleOut" Property="Stroke" Value="Transparent" />
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="CheckBoxStyle1" TargetType="{x:Type CheckBox}">
|
||||||
|
<Setter Property="SnapsToDevicePixels" Value="true" />
|
||||||
|
<Setter Property="OverridesDefaultStyle" Value="False" />
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource CheckBoxFocusVisual}" />
|
||||||
|
<Setter Property="Height" Value="25" />
|
||||||
|
<Setter Property="IsChecked" Value="False" />
|
||||||
|
<Setter Property="Margin" Value="1" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="CheckBox">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid Width="{TemplateBinding Height}" Height="{TemplateBinding Height}">
|
||||||
|
<Rectangle x:Name="CheckBoxRectangle" Fill="{TemplateBinding Background}" Opacity="1" RadiusX="5" RadiusY="5" />
|
||||||
|
<Rectangle x:Name="CheckBoxRectangleOut" RadiusX="5" RadiusY="5" Stroke="#FF06DAD1" StrokeThickness="1" />
|
||||||
|
<Grid x:Name="CheckedMark" Width="20" Height="20" Visibility="Collapsed">
|
||||||
|
<Path Data="M1,9 L10,17" SnapsToDevicePixels="False" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="3" />
|
||||||
|
<Path Data="M8,17 L20,4" SnapsToDevicePixels="False" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="3" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<TextBlock Grid.Column="1" Margin="10,0,0,0" VerticalAlignment="Center" FontSize="{TemplateBinding FontSize}" Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" />
|
||||||
|
</Grid>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsChecked" Value="True">
|
||||||
|
<Setter TargetName="CheckedMark" Property="Visibility" Value="Visible" />
|
||||||
|
<Setter TargetName="CheckBoxRectangleOut" Property="Stroke" Value="Transparent" />
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- *************************************************************************datagrid样式1******************************************************************************************** -->
|
||||||
|
<Style TargetType="DataGrid">
|
||||||
|
<!-- 网格线颜色 -->
|
||||||
|
<Setter Property="CanUserResizeColumns" Value="false" />
|
||||||
|
<Setter Property="Background" Value="{x:Null}" />
|
||||||
|
<Setter Property="BorderBrush" Value="#FF9BBED6" />
|
||||||
|
<Setter Property="HorizontalGridLinesBrush">
|
||||||
|
<Setter.Value>
|
||||||
|
<SolidColorBrush Color="#FF7FAABD" />
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Setter Property="VerticalGridLinesBrush">
|
||||||
|
<Setter.Value>
|
||||||
|
<SolidColorBrush Color="#FF7FAABD" />
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Setter Property="AlternatingRowBackground" Value="AliceBlue" />
|
||||||
|
|
||||||
|
|
||||||
|
</Style>
|
||||||
|
<!-- Datagrid标题栏样式 -->
|
||||||
|
<Style TargetType="DataGridColumnHeader">
|
||||||
|
<!-- 标题居中 -->
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||||
|
<!--<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||||
|
<Setter Property="MinWidth" Value="0" />
|
||||||
|
<Setter Property="MinHeight" Value="28" />
|
||||||
|
<Setter Property="Foreground" Value="#323433" />
|
||||||
|
<Setter Property="FontSize" Value="14" />
|
||||||
|
<Setter Property="Cursor" Value="Hand" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="DataGridColumnHeader">
|
||||||
|
<Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1"
|
||||||
|
BorderBrush="#FF7FAABD"
|
||||||
|
Width="Auto">
|
||||||
|
<Grid >
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
|
<Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill" Grid.Column="2" Width="8" Height="6" Fill="White" Margin="0,0,50,0"
|
||||||
|
VerticalAlignment="Center" RenderTransformOrigin="1,1" />
|
||||||
|
<Rectangle Width="1" Fill="#FF9BBED6" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>-->
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- *************************************************************************datagrid样式1******************************************************************************************** -->
|
||||||
|
|
||||||
|
<!-- *************************************************************************datagrid样式2******************************************************************************************** -->
|
||||||
|
<Style x:Key="DataGridStyle" TargetType="{x:Type DataGrid}">
|
||||||
|
<Setter Property="Background" Value="Transparent" />
|
||||||
|
<Setter Property="BorderBrush" Value="#FF9BBED6" />
|
||||||
|
<Setter Property="AlternatingRowBackground" Value="AliceBlue" />
|
||||||
|
<Setter Property="HorizontalGridLinesBrush" Value="#FF7FAABD" />
|
||||||
|
<Setter Property="VerticalGridLinesBrush" Value="#FF7FAABD" />
|
||||||
|
<!-- 不显示最左边的白框 -->
|
||||||
|
<Setter Property="HeadersVisibility" Value="Column" />
|
||||||
|
<!-- 不显示边框 -->
|
||||||
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
|
<!-- 不自动生成列 -->
|
||||||
|
<Setter Property="AutoGenerateColumns" Value="False" />
|
||||||
|
<!-- 不自动生成行 -->
|
||||||
|
<Setter Property="CanUserAddRows" Value="False" />
|
||||||
|
<Setter Property="Margin" Value="0" />
|
||||||
|
<Setter Property="SelectionMode" Value="Single" />
|
||||||
|
|
||||||
|
</Style>
|
||||||
|
<!-- 行样式 -->
|
||||||
|
<Style x:Key="DataGridRowStyle" TargetType="{x:Type DataGridRow}">
|
||||||
|
<Setter Property="Background" Value="Transparent" />
|
||||||
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
|
||||||
|
</Style>
|
||||||
|
<!-- 标题样式 -->
|
||||||
|
<Style x:Key="DataGridHadeStyle" TargetType="{x:Type DataGridColumnHeader}">
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="Height" Value="20" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
|
<Setter Property="Background" Value="Transparent" />
|
||||||
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
<Setter Property="BorderThickness" Value="1" />
|
||||||
|
<Setter Property="BorderBrush" Value="AliceBlue" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- DataGrid的行样式居中显示 -->
|
||||||
|
<Style x:Key="DataGridTextColumnCenterSytle" TargetType="{x:Type TextBlock}">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
|
</Style>
|
||||||
|
<!-- *************************************************************************datagrid样式2******************************************************************************************** -->
|
||||||
|
|
||||||
|
<!-- 透明按钮2 -->
|
||||||
|
<Style x:Key="commBtn" TargetType="Button">
|
||||||
|
<Setter Property="Foreground" Value="White" />
|
||||||
|
<!-- 修改模板属性 -->
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<!-- 控件模板 -->
|
||||||
|
<ControlTemplate TargetType="Button">
|
||||||
|
<!-- 背景色 -->
|
||||||
|
<Border x:Name="back" CornerRadius="3" Opacity="1">
|
||||||
|
<Border.BitmapEffect>
|
||||||
|
<OuterGlowBitmapEffect GlowColor="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" GlowSize="0" Opacity="0.7" />
|
||||||
|
</Border.BitmapEffect>
|
||||||
|
<Border.Background>
|
||||||
|
<LinearGradientBrush Opacity="0.5" StartPoint="0,0" EndPoint="0,1.5">
|
||||||
|
<GradientBrush.GradientStops>
|
||||||
|
<GradientStopCollection>
|
||||||
|
<GradientStop Offset="0" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" />
|
||||||
|
<GradientStop Offset="0.4" Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" />
|
||||||
|
<GradientStop Offset="1" Color="#FFF" />
|
||||||
|
</GradientStopCollection>
|
||||||
|
</GradientBrush.GradientStops>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</Border.Background>
|
||||||
|
<!-- 前景色及边框 -->
|
||||||
|
<Border x:Name="fore" BorderBrush="#5555" BorderThickness="1" CornerRadius="3">
|
||||||
|
<Border.Background>
|
||||||
|
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
|
||||||
|
<GradientBrush.GradientStops>
|
||||||
|
<GradientStopCollection>
|
||||||
|
<GradientStop Offset="0.1" Color="#6FFF" />
|
||||||
|
<GradientStop Offset="0.9" Color="#1111" />
|
||||||
|
</GradientStopCollection>
|
||||||
|
</GradientBrush.GradientStops>
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</Border.Background>
|
||||||
|
<!-- 按钮内容 -->
|
||||||
|
<ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}">
|
||||||
|
<ContentPresenter.BitmapEffect>
|
||||||
|
<!-- 文字阴影效果 -->
|
||||||
|
<!--<DropShadowBitmapEffect Color="White" Direction="-90" ShadowDepth="2" Softness="0.1" Opacity="0.3" />-->
|
||||||
|
<OuterGlowBitmapEffect GlowColor="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" GlowSize="0" Opacity="0.7" />
|
||||||
|
</ContentPresenter.BitmapEffect>
|
||||||
|
</ContentPresenter>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
</Border>
|
||||||
|
<!-- 触发器 -->
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<!-- 鼠标移入移出 -->
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Trigger.EnterActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" To="6" Duration="0:0:0.2" />
|
||||||
|
<ColorAnimation BeginTime="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#AFFF" Duration="0:0:0.2" />
|
||||||
|
<ColorAnimation BeginTime="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#3FFF" Duration="0:0:0.2" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.EnterActions>
|
||||||
|
<Trigger.ExitActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" Duration="0:0:0.2" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.2" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.2" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.ExitActions>
|
||||||
|
</Trigger>
|
||||||
|
<!-- 按钮按下弹起 -->
|
||||||
|
<Trigger Property="IsPressed" Value="True">
|
||||||
|
<Trigger.EnterActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" To="3" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#3AAA" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#2111" Duration="0:0:0.1" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.EnterActions>
|
||||||
|
<Trigger.ExitActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.1" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.ExitActions>
|
||||||
|
</Trigger>
|
||||||
|
<!-- 按钮失效 -->
|
||||||
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
|
<Setter Property="Foreground" Value="#B444" />
|
||||||
|
<Trigger.EnterActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" To="0" Duration="0:0:0.3" />
|
||||||
|
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" To="1" Duration="0:0:0.1" />
|
||||||
|
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" To="-135" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" To="#FFF" Duration="0:0:0.3" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="#D555" Duration="0:0:0.3" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" To="#CEEE" Duration="0:0:0.3" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" To="#CDDD" Duration="0:0:0.3" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.EnterActions>
|
||||||
|
<Trigger.ExitActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" Duration="0:0:0.1" />
|
||||||
|
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" Duration="0:0:0.1" />
|
||||||
|
<DoubleAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" Duration="0:0:0.1" />
|
||||||
|
<ColorAnimation Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" Duration="0:0:0.1" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.ExitActions>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
|
||||||
|
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- 按钮样式1 -->
|
||||||
|
<Style x:Key="styleButton" TargetType="Button">
|
||||||
|
<Setter Property="FocusVisualStyle">
|
||||||
|
<Setter.Value>
|
||||||
|
<Style>
|
||||||
|
<Setter Property="Control.Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate>
|
||||||
|
<Border>
|
||||||
|
<Rectangle Margin="4" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeDashArray="1 2" StrokeThickness="1" />
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
|
||||||
|
<Setter Property="BorderBrush" Value="#00000000" />
|
||||||
|
<Setter Property="BorderThickness" Value="3" />
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="Padding" Value="0,0,1,1" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type Button}">
|
||||||
|
<Border x:Name="ContentContainer" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="3" CornerRadius="5" SnapsToDevicePixels="True">
|
||||||
|
<ContentPresenter Margin="{TemplateBinding Padding}"
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
Content="{TemplateBinding Content}"
|
||||||
|
ContentStringFormat="{TemplateBinding ContentStringFormat}"
|
||||||
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
|
RecognizesAccessKey="True"
|
||||||
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- 字体随控件大小变化的label自定义控件 -->
|
||||||
|
<Style x:Key="Mylabel1" TargetType="{x:Type Label}">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Label">
|
||||||
|
<Border Background="{TemplateBinding Background}">
|
||||||
|
<Viewbox>
|
||||||
|
<ContentControl Content="{TemplateBinding Content}" />
|
||||||
|
</Viewbox>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- 字体随控件大小变化的label自定义控件 -->
|
||||||
|
<Style x:Key="MyTextBox" TargetType="{x:Type TextBox}">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="TextBox">
|
||||||
|
<Border Background="{TemplateBinding Background}">
|
||||||
|
<Viewbox>
|
||||||
|
<TextBox Text="{TemplateBinding Text}" />
|
||||||
|
</Viewbox>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
||||||