Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
SO827-OutletEquip
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 978cd024
由
LN
编写于
2021-03-01 13:43:46 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
2c0bdca5
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
302 行增加
和
96 行删除
source/DeviceLibrary/bean/EquipBean.cs
source/DeviceLibrary/bean/EquipBean_Partial.cs
source/DeviceLibrary/mananger/HttpServer.cs
source/DeviceLibrary/mananger/RFIDManager.cs
source/DeviceLibrary/model/EquipBase.cs
source/DeviceLibrary/model/StoreMoveInfo.cs
source/DeviceLibrary/model/StoreStep.cs
source/HCSingleStore/Class1.cs
source/HCSingleStore/ManagerUtil.cs
source/HCSingleStore/OutletEquip.csproj
source/DeviceLibrary/bean/EquipBean.cs
查看文件 @
978cd02
...
...
@@ -784,16 +784,20 @@ namespace OnlineStore.DeviceLibrary
return
;
}
string
shelfRfid
=
ReadyShelf
();
if
(
String
.
IsNullOrEmpty
(
shelfRfid
))
{
//无可用料架
WarnMsg
=
$
"{LineConnect.DoorPosInfo.ToStr()}暂无可用料架"
;
return
;
}
ClearWarnMsg
(
"暂无可用料架"
);
//获取库位号
string
outMsg
=
""
;
CurrTray
=
HttpServer
.
Get
DiskInfo
(
1
,
shelfRfid
,
out
outMsg
);
CurrTray
=
HttpServer
.
Get
Location
(
1
,
shelfRfid
,
out
outMsg
);
//需要取放料,且料架已准备好
if
(
String
.
IsNullOrEmpty
(
CurrTray
.
getP
).
Equals
(
false
)
&&
outMsg
.
Equals
(
""
))
{
if
(
WarnMsg
.
Contains
(
"getLocation"
))
{
WarnMsg
=
""
;
}
{
ClearWarnMsg
(
"getLocation"
);
string
targetP
=
GetShelfPosId
();
if
(!
String
.
IsNullOrEmpty
(
targetP
))
{
...
...
@@ -816,6 +820,13 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
Name
+
"InShelfProcess:"
+
ex
.
ToString
());
}
}
private
void
ClearWarnMsg
(
string
str
)
{
if
(
WarnMsg
.
Contains
(
str
))
{
WarnMsg
=
""
;
}
}
internal
string
GetShelfPosId
()
{
string
str
=
""
;
...
...
@@ -939,8 +950,9 @@ namespace OnlineStore.DeviceLibrary
{
if
(
isInSuddenDown
||
isNoAirCheck
||
(!
storeRunStatus
.
Equals
(
StoreRunStatus
.
Runing
))
||
storeStatus
.
Equals
(
StoreStatus
.
InStoreExecute
)
||
storeStatus
.
Equals
(
StoreStatus
.
OutStoreExecute
)
||
storeStatus
.
Equals
(
StoreStatus
.
InStoreEnd
)
||
storeStatus
.
Equals
(
StoreStatus
.
OutStoreBoxEnd
))
//|| storeStatus.Equals(StoreStatus.InStoreExecute) || storeStatus.Equals(StoreStatus.InStoreEnd)
||
storeStatus
.
Equals
(
StoreStatus
.
OutStoreExecute
)
||
storeStatus
.
Equals
(
StoreStatus
.
OutStoreBoxEnd
))
{
return
false
;
}
...
...
@@ -958,10 +970,7 @@ namespace OnlineStore.DeviceLibrary
}
return
msg
;
}
#
region
出料命令处理
public
void
CylinderMove
(
string
IoLowType
,
string
IoHighType
,
StoreMoveInfo
moveInfo
=
null
)
{
try
...
...
@@ -978,10 +987,9 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil
.
error
(
Name
+
"CylinderMove ["
+
IoLowType
+
"] ["
+
IoHighType
+
"] 出错:"
+
ex
.
ToString
());
}
}
#
endregion
}
#
region
与服务器通信定时器,每
1
秒向服务器通知一次状态
,
同时执行出库操作
#
region
通信定时器
private
bool
isInProcess
=
false
;
private
DateTime
lastConTime
=
DateTime
.
Now
;
...
...
@@ -1053,7 +1061,7 @@ namespace OnlineStore.DeviceLibrary
isNeedAlarmLed
=
true
;
}
if
(
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
In
Store
))
if
(
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
Out
Store
))
{
isInOut
=
true
;
}
...
...
source/DeviceLibrary/bean/EquipBean_Partial.cs
查看文件 @
978cd02
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/mananger/HttpServer.cs
查看文件 @
978cd02
...
...
@@ -175,7 +175,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
/// <param name="robot">ABB机器人索引号</param>
/// <param name="currRFID">当前工位的RFID</param>
public
static
TrayInfo
Get
DiskInfo
(
int
robot
,
string
currRFID
,
out
string
msg
)
public
static
TrayInfo
Get
Location
(
int
robot
,
string
currRFID
,
out
string
msg
)
{
TrayInfo
tray
=
new
TrayInfo
();
string
api
=
"getLocation"
;
...
...
source/DeviceLibrary/mananger/RFIDManager.cs
查看文件 @
978cd02
...
...
@@ -104,8 +104,10 @@ namespace OnlineStore.DeviceLibrary
internal
static
bool
IsRealRfid
(
string
shelfRfid
)
{
//判断料架号是否是真实的料架号
if
(
shelfRfid
.
StartsWith
(
"C"
)
||
shelfRfid
.
StartsWith
(
"D"
))
{
//混合料架用F
if
(
shelfRfid
.
StartsWith
(
"F"
))
//if (shelfRfid.StartsWith("C") || shelfRfid.StartsWith("D"))
{
int
num
=
-
1
;
try
{
...
...
source/DeviceLibrary/model/EquipBase.cs
查看文件 @
978cd02
...
...
@@ -71,7 +71,7 @@ namespace OnlineStore.DeviceLibrary
{
switch
(
MoveInfo
.
MoveType
)
{
case
StoreMoveType
.
In
Store
:
case
StoreMoveType
.
Out
Store
:
OutProcess
();
isInPro
=
false
;
break
;
...
...
@@ -98,11 +98,11 @@ namespace OnlineStore.DeviceLibrary
{
alarmMsg
=
alarmMsg
.
Replace
(
Name
,
""
);
int
inoutStatus
=
0
;
if
(
storeMoveType
.
Equals
(
StoreMoveType
.
In
Store
))
if
(
storeMoveType
.
Equals
(
StoreMoveType
.
Out
Store
))
{
inoutStatus
=
1
;
}
else
if
(
storeMoveType
.
Equals
(
StoreMoveType
.
In
Store
))
else
if
(
storeMoveType
.
Equals
(
StoreMoveType
.
Out
Store
))
{
inoutStatus
=
2
;
}
...
...
@@ -306,12 +306,12 @@ namespace OnlineStore.DeviceLibrary
case
StoreStatus
.
Debugging
:
aa
=
"设备调试中"
;
break
;
case
StoreStatus
.
InStoreEnd
:
aa
=
"料盘入仓位完成"
;
break
;
case
StoreStatus
.
InStoreExecute
:
aa
=
"出料执行中"
;
break
;
//
case StoreStatus.InStoreEnd:
//
aa = "料盘入仓位完成";
//
break;
//
case StoreStatus.InStoreExecute:
//
aa = "出料执行中";
//
break;
case
StoreStatus
.
InTrouble
:
aa
=
"故障中"
;
break
;
...
...
@@ -327,15 +327,15 @@ namespace OnlineStore.DeviceLibrary
case
StoreStatus
.
SuddenStop
:
aa
=
"急停中"
;
break
;
case
StoreStatus
.
OutMoveExecute
:
aa
=
"出库完成"
;
break
;
case
StoreStatus
.
InStoreFaild
:
aa
=
"出料失败("
+
WarnMsg
+
")"
;
break
;
case
StoreStatus
.
OutStoreFaild
:
aa
=
"出库失败("
+
WarnMsg
+
")"
;
break
;
//
case StoreStatus.OutMoveExecute:
//
aa = "出库完成";
//
break;
//
case StoreStatus.InStoreFaild:
//
aa = "出料失败(" + WarnMsg + ")";
//
break;
//
case StoreStatus.OutStoreFaild:
//
aa = "出库失败(" + WarnMsg + ")";
//
break;
case
StoreStatus
.
Check_PosMove
:
aa
=
"盘点中"
;
break
;
...
...
@@ -344,7 +344,7 @@ namespace OnlineStore.DeviceLibrary
{
string
inout
=
""
;
if
(
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
In
Store
)&&
MoveInfo
.
MoveParam
!=
null
&&
MoveInfo
.
MoveParam
.
PosInfo
!=
null
)
if
(
MoveInfo
.
MoveType
.
Equals
(
StoreMoveType
.
Out
Store
)&&
MoveInfo
.
MoveParam
!=
null
&&
MoveInfo
.
MoveParam
.
PosInfo
!=
null
)
{
inout
=
"_出料:"
+
MoveInfo
.
MoveParam
.
PosInfo
.
ToStr
();
}
...
...
source/DeviceLibrary/model/StoreMoveInfo.cs
查看文件 @
978cd02
...
...
@@ -317,7 +317,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 出料
/// </summary>
In
Store
=
1
,
Out
Store
=
1
,
/// <summary>
/// 原点返回
...
...
source/DeviceLibrary/model/StoreStep.cs
查看文件 @
978cd02
...
...
@@ -74,18 +74,18 @@ namespace OnlineStore.DeviceLibrary
/// 5=设备调试中
/// </summary>
Debugging
=
5
,
/// <summary>
/// 6=出料执行中
/// </summary>
InStoreExecute
=
6
,
/// <summary>
/// 7= 入仓位完成(料仓Box把料盘放入对应的库位中,装置还未恢复原始状态)
/// </summary>
InStoreEnd
=
7
,
/// <summary>
/// 8=出料失败
/// </summary>
InStoreFaild
=
8
,
///
//
<summary>
///
//
6=出料执行中
///
//
</summary>
//
InStoreExecute = 6,
///
//
<summary>
///
//
7= 入仓位完成(料仓Box把料盘放入对应的库位中,装置还未恢复原始状态)
///
//
</summary>
//
InStoreEnd = 7,
///
//
<summary>
///
//
8=出料失败
///
//
</summary>
//
InStoreFaild = 8,
/// <summary>
/// 9=出库执行中",
/// </summary>
...
...
@@ -94,18 +94,18 @@ namespace OnlineStore.DeviceLibrary
///10= 出仓位完成( 料盘已经放到Box门口)
/// </summary>
OutStoreBoxEnd
=
10
,
/// <summary>
/// 12=移栽出库移栽过程中(移栽完成后变成OnLine)
/// </summary>
OutMoveExecute
=
12
,
/// <summary>
///11=出库失败
/// </summary>
OutStoreFaild
=
11
,
///
//
<summary>
///
//
12=移栽出库移栽过程中(移栽完成后变成OnLine)
///
//
</summary>
//
OutMoveExecute = 12,
///
//
<summary>
///
//
11=出库失败
///
//
</summary>
//
OutStoreFaild = 11,
/// <summary>
/// 重置中(原点返回和重置都发此状态)
/// </summary>
ResetMove
=
13
,
ResetMove
=
13
,
/// <summary>
/// 库位盘点中
/// </summary>
...
...
@@ -161,105 +161,89 @@ namespace OnlineStore.DeviceLibrary
#
region
出料
///// <summary>
///// 出料:等待入口检测有料
///// </summary>
//SI_01_TrayCheck = 201,
///// <summary>
/////出料:获取料架库位号
///// </summary>
//SI_02_GetPosition,
///// <summary>
/////出料:等待料架准备完成
///// </summary>
//SI_03_WaitShelf,
///// <summary>
/////出料:顶升气缸上升
///// </summary>
//SI_04_LocationUp,
/// <summary>
/// 出料:进出轴(叉子)先返回P1
/// </summary>
S
I
_11_InOutToP1
=
211
,
S
O
_11_InOutToP1
=
211
,
/// <summary>
/// 出料:所有轴先回到待机点,轴2、轴1 动作到P1,,轴4动作至P3
/// </summary>
S
I
_12_AxisToP1
,
S
O
_12_AxisToP1
,
/// <summary>
/// 出料:压紧物品 压紧轴到P3(压紧前点)
/// </summary>
S
I
_13_ComToP3
,
S
O
_13_ComToP3
,
/// <summary>
/// 出料:叉子进入出料口,进出轴到P2
/// </summary>
S
I
_14_InoutToP2
,
S
O
_14_InoutToP2
,
/// <summary>
/// 出料:把物品放入叉子上,升降轴到P2,压紧物品,压紧轴到P2(压紧点)
/// </summary>
S
I
_15_GetReel
,
S
O
_15_GetReel
,
/// <summary>
/// 出料: 进出轴到P1( 待机点)
/// </summary>
S
I
_16_InoutBack
,
S
O
_16_InoutBack
,
/// <summary>
/// 出料:等待检测到料盘
/// </summary>
S
I
_17_TrayCheck
,
S
O
_17_TrayCheck
,
/// <summary>
/// 出料到料架:移动到库位点,旋转轴到P2( 库位点)升降轴到P3
/// </summary>
S
I
_21_MoveToBag
=
221
,
S
O
_21_MoveToBag
=
221
,
/// <summary>
/// 出料到料架:叉子进出料位中,进出轴到P3
/// </summary>
S
I
_22_InoutToP3
,
S
O
_22_InoutToP3
,
/// <summary>
/// 出料到料架:放下物品,升降轴到P4 ,压紧轴到P3( 压紧前点)
/// </summary>
S
I
_23_PutReel
,
S
O
_23_PutReel
,
/// <summary>
/// 出料到料架:叉子从库位中返回,轴3( 叉子) 动作至P1( 待机点)
/// </summary>
S
I
_24_InoutBack
,
S
O
_24_InoutBack
,
/// <summary>
/// 出料到料架:返回待机点,轴2/轴1/轴4动作至P1( 待机点))开始
/// </summary>
S
I
_25_GoBack
,
S
O
_25_GoBack
,
/// <summary>
///出料到料架:等待叉子无信号
/// </summary>
S
I
_26_WaitNoReel
,
S
O
_26_WaitNoReel
,
/// <summary>
/// NG料:移动到NG位,旋转轴到P3 升降轴到P5
/// </summary>
S
I
_31_MoveToNG
=
231
,
S
O
_31_MoveToNG
=
231
,
/// <summary>
/// </summary>
/// NG料:进出轴到P4
S
I
_32_InoutToP4
,
S
O
_32_InoutToP4
,
/// <summary>
/// NG料: 升降轴到P6, 压紧轴到P3( 压紧前点)
/// </summary>
S
I
_33_PutReel
,
S
O
_33_PutReel
,
/// <summary>
/// NG料:进出轴返回P1
/// </summary>
S
I
_34_InoutToP1
,
S
O
_34_InoutToP1
,
/// <summary>
/// NG料:返回待机点,轴2/轴1/轴4动作至P1( 待机点))开始
/// </summary>
S
I
_35_GoBack
,
S
O
_35_GoBack
,
/// <summary>
///NG料:等待叉子无信号
/// </summary>
S
I
_36_WaitNoReel
,
S
O
_36_WaitNoReel
,
...
...
source/HCSingleStore/Class1.cs
0 → 100644
查看文件 @
978cd02
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
OnlineStore.HCSingleStore
{
class
Class1
{
// <Query Kind = "Program" >
// < Reference > < RuntimeDirectory>\System.Net.Http.dll</Reference>
// <Reference><RuntimeDirectory>\System.Windows.Forms.dll</Reference>
// <NuGetReference>Newtonsoft.Json</NuGetReference>
// <NuGetReference>SharpDX</NuGetReference>
// <NuGetReference>SharpDX.Direct2D1</NuGetReference>
// <NuGetReference>SharpDX.Mathematics</NuGetReference>
// <Namespace>D2D = SharpDX.Direct2D1</Namespace>
// <Namespace>DWrite = SharpDX.DirectWrite</Namespace>
// <Namespace>Newtonsoft.Json.Linq</Namespace>
// <Namespace>SharpDX.Direct2D1</Namespace>
// <Namespace>SharpDX.IO</Namespace>
// <Namespace>SharpDX.Mathematics.Interop</Namespace>
// <Namespace>System.Net.Http</Namespace>
// <Namespace>System.Threading.Tasks</Namespace>
// <Namespace>WIC = SharpDX.WIC</Namespace>
// <Namespace>SharpDX</Namespace>
// <Namespace>System.Runtime.InteropServices</Namespace>
// <Namespace>Microsoft.Win32</Namespace>
// <Namespace>System.Windows.Forms</Namespace>
//</Query>
HttpClient
http
=
new
HttpClient
();
async
Task
Main
()
{
$
"Get bing url..."
.
Dump
();
string
url
=
await
GetBingPicture
();
$
"Get quote..."
.
Dump
();
string
english
=
await
GetQuote
();
$
"Download {url}..."
.
Dump
();
string
file
=
await
DownloadUrlAsFileName
(
url
);
$
"Generating..."
.
Dump
();
string
wallpaperFileName
=
GenerateWallpaper
(
file
,
english
);
Wallpaper
.
Set
(
wallpaperFileName
,
UserQuery
.
Wallpaper
.
Style
.
Centered
);
Util
.
Image
(
wallpaperFileName
.
Dump
()).
Dump
();
}
string
GenerateWallpaper
(
string
pictureFileName
,
string
english
)
{
var
wic
=
new
WIC
.
ImagingFactory2
();
var
d2d
=
new
D2D
.
Factory
();
float
dpi
=
d2d
.
DesktopDpi
.
Width
;
Size2
size
=
new
Size2
(
Screen
.
PrimaryScreen
.
Bounds
.
Width
,
Screen
.
PrimaryScreen
.
Bounds
.
Height
);
WIC
.
FormatConverter
image
=
CreateWicImage
(
wic
,
pictureFileName
);
using
(
var
wicBitmap
=
new
WIC
.
Bitmap
(
wic
,
size
.
Width
,
size
.
Height
,
WIC
.
PixelFormat
.
Format32bppPBGRA
,
WIC
.
BitmapCreateCacheOption
.
CacheOnDemand
))
using
(
var
target
=
new
D2D
.
WicRenderTarget
(
d2d
,
wicBitmap
,
new
D2D
.
RenderTargetProperties
()))
using
(
var
dc
=
target
.
QueryInterface
<
D2D
.
DeviceContext
>())
using
(
var
bmpPicture
=
D2D
.
Bitmap
.
FromWicBitmap
(
target
,
image
))
using
(
var
dwriteFactory
=
new
SharpDX
.
DirectWrite
.
Factory
())
using
(
var
brush
=
new
SolidColorBrush
(
target
,
SharpDX
.
Color
.
Yellow
))
using
(
var
bmpLayer
=
new
D2D
.
Bitmap1
(
dc
,
target
.
PixelSize
,
new
D2D
.
BitmapProperties1
(
new
D2D
.
PixelFormat
(
SharpDX
.
DXGI
.
Format
.
B8G8R8A8_UNorm
,
D2D
.
AlphaMode
.
Premultiplied
),
dpi
,
dpi
,
D2D
.
BitmapOptions
.
Target
)))
{
var
oldTarget
=
dc
.
Target
;
dc
.
Target
=
bmpLayer
;
target
.
BeginDraw
();
{
var
textFormat
=
new
DWrite
.
TextFormat
(
dwriteFactory
,
"Tahoma"
,
size
.
Height
/
27
);
// draw English
{
var
textLayout
=
new
DWrite
.
TextLayout
(
dwriteFactory
,
english
,
textFormat
,
target
.
Size
.
Width
*
0.75f
,
float
.
MaxValue
);
var
center
=
new
Vector2
((
target
.
Size
.
Width
-
textLayout
.
Metrics
.
Width
)
/
2
,
(
target
.
Size
.
Height
-
textLayout
.
Metrics
.
Height
)
/
2
);
target
.
DrawTextLayout
(
new
Vector2
(
center
.
X
,
center
.
Y
),
textLayout
,
brush
);
}
}
target
.
EndDraw
();
// shadow
var
shadow
=
new
D2D
.
Effects
.
Shadow
(
dc
);
shadow
.
SetInput
(
0
,
bmpLayer
,
new
RawBool
(
false
));
dc
.
Target
=
oldTarget
;
target
.
BeginDraw
();
{
target
.
DrawBitmap
(
bmpPicture
,
new
RectangleF
(
0
,
0
,
target
.
Size
.
Width
,
target
.
Size
.
Height
),
1.0f
,
BitmapInterpolationMode
.
Linear
);
dc
.
DrawImage
(
shadow
,
new
Vector2
(
size
.
Height
/
150.0f
,
size
.
Height
/
150.0f
));
dc
.
UnitMode
=
UnitMode
.
Pixels
;
target
.
DrawBitmap
(
bmpLayer
,
1.0f
,
BitmapInterpolationMode
.
Linear
);
}
target
.
EndDraw
();
string
wallpaperFileName
=
Path
.
GetTempPath
()
+
"wallpaper.png"
;
using
(
var
wallpaperStream
=
File
.
OpenWrite
(
wallpaperFileName
))
{
SaveD2DBitmap
(
wic
,
wicBitmap
,
wallpaperStream
);
wallpaperStream
.
Close
();
return
wallpaperFileName
;
}
}
}
async
Task
<
string
>
GetQuote
()
{
var
url
=
@"https://favqs.com/api/qotd"
;
var
content
=
await
http
.
GetStringAsync
(
url
);
var
json
=
JToken
.
Parse
(
content
);
return
json
[
"quote"
][
"body"
]
+
"\r\n\t\t\t\t——"
+
json
[
"quote"
][
"author"
];
}
async
Task
<
string
>
GetBingPicture
()
{
var
url
=
@"https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=5&mkt=zh-cn"
;
var
content
=
await
http
.
GetStringAsync
(
url
);
var
json
=
JToken
.
Parse
(
content
);
var
images
=
json
[
"images"
]
.
Select
(
x
=>
x
[
"url"
].
ToString
())
.
Select
(
x
=>
"https://cn.bing.com"
+
x
);
return
images
.
First
();
}
async
Task
<
string
>
DownloadUrlAsFileName
(
string
url
)
{
var
fileName
=
Path
.
GetTempFileName
();
File
.
WriteAllBytes
(
fileName
,
await
http
.
GetByteArrayAsync
(
url
));
return
fileName
;
}
WIC
.
FormatConverter
CreateWicImage
(
WIC
.
ImagingFactory
wicFactory
,
string
filename
)
{
using
(
var
decoder
=
new
WIC
.
JpegBitmapDecoder
(
wicFactory
))
using
(
var
decodeStream
=
new
WIC
.
WICStream
(
wicFactory
,
filename
,
NativeFileAccess
.
Read
))
{
decoder
.
Initialize
(
decodeStream
,
WIC
.
DecodeOptions
.
CacheOnLoad
);
using
(
var
decodeFrame
=
decoder
.
GetFrame
(
0
))
{
var
converter
=
new
WIC
.
FormatConverter
(
wicFactory
);
converter
.
Initialize
(
decodeFrame
,
WIC
.
PixelFormat
.
Format32bppPBGRA
);
return
converter
;
}
}
}
void
SaveD2DBitmap
(
WIC
.
ImagingFactory
wicFactory
,
WIC
.
Bitmap
wicBitmap
,
Stream
outputStream
)
{
using
(
var
encoder
=
new
WIC
.
BitmapEncoder
(
wicFactory
,
WIC
.
ContainerFormatGuids
.
Png
))
{
encoder
.
Initialize
(
outputStream
);
using
(
var
frame
=
new
WIC
.
BitmapFrameEncode
(
encoder
))
{
frame
.
Initialize
();
frame
.
SetSize
(
wicBitmap
.
Size
.
Width
,
wicBitmap
.
Size
.
Height
);
var
pixelFormat
=
wicBitmap
.
PixelFormat
;
frame
.
SetPixelFormat
(
ref
pixelFormat
);
frame
.
WriteSource
(
wicBitmap
);
frame
.
Commit
();
encoder
.
Commit
();
}
}
}
public
sealed
class
Wallpaper
{
const
int
SPI_SETDESKWALLPAPER
=
20
;
const
int
SPIF_UPDATEINIFILE
=
0x01
;
const
int
SPIF_SENDWININICHANGE
=
0x02
;
[
DllImport
(
"user32.dll"
,
CharSet
=
CharSet
.
Auto
)]
static
extern
int
SystemParametersInfo
(
int
uAction
,
int
uParam
,
string
lpvParam
,
int
fuWinIni
);
public
enum
Style
:
int
{
Tiled
,
Centered
,
Stretched
}
public
static
void
Set
(
string
pictureFileName
,
Style
style
)
{
RegistryKey
key
=
Registry
.
CurrentUser
.
OpenSubKey
(
@"Control Panel\Desktop"
,
true
);
if
(
style
==
Style
.
Stretched
)
{
key
.
SetValue
(
@"WallpaperStyle"
,
2.
ToString
());
key
.
SetValue
(
@"TileWallpaper"
,
0.
ToString
());
}
if
(
style
==
Style
.
Centered
)
{
key
.
SetValue
(
@"WallpaperStyle"
,
1.
ToString
());
key
.
SetValue
(
@"TileWallpaper"
,
0.
ToString
());
}
if
(
style
==
Style
.
Tiled
)
{
key
.
SetValue
(
@"WallpaperStyle"
,
1.
ToString
());
key
.
SetValue
(
@"TileWallpaper"
,
1.
ToString
());
}
SystemParametersInfo
(
SPI_SETDESKWALLPAPER
,
0
,
pictureFileName
,
SPIF_UPDATEINIFILE
|
SPIF_SENDWININICHANGE
);
}
}
}
}
source/HCSingleStore/ManagerUtil.cs
查看文件 @
978cd02
...
...
@@ -29,5 +29,6 @@ namespace OnlineStore.ACSingleStore
MessageBox
.
Show
(
ex
.
ToString
());
}
}
}
}
source/HCSingleStore/OutletEquip.csproj
查看文件 @
978cd02
...
...
@@ -79,6 +79,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="FrmAxisDebug.cs">
<SubType>Form</SubType>
</Compile>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论