Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cdy816
Mars
提交
3424cd29
Mars
项目概览
cdy816
/
Mars
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mars
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
3424cd29
编写于
8月 09, 2020
作者:
cdy816
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
开发客户端,增加控制运行环境启停等功能。
上级
cdaf82ba
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
577 addition
and
115 deletion
+577
-115
Develop/DBDevelopClientApi/DevelopServiceHelper.cs
Develop/DBDevelopClientApi/DevelopServiceHelper.cs
+56
-0
Develop/DBDevelopClientApi/developService.proto
Develop/DBDevelopClientApi/developService.proto
+15
-3
Develop/DBDevelopService/GrpcDBService.cs
Develop/DBDevelopService/GrpcDBService.cs
+6
-0
Develop/DBDevelopService/IDatabaseManager.cs
Develop/DBDevelopService/IDatabaseManager.cs
+62
-0
Develop/DBDevelopService/Protos/developService.proto
Develop/DBDevelopService/Protos/developService.proto
+15
-3
Develop/DBDevelopService/Services/DevelopServerService.cs
Develop/DBDevelopService/Services/DevelopServerService.cs
+33
-6
Develop/DBDevelopService/Startup.cs
Develop/DBDevelopService/Startup.cs
+8
-1
Develop/DBStudio/Program.cs
Develop/DBStudio/Program.cs
+129
-12
Develop/DBStudio/Properties/launchSettings.json
Develop/DBStudio/Properties/launchSettings.json
+1
-1
Develop/DbManager.Desktop/DBInStudio.Desktop.csproj
Develop/DbManager.Desktop/DBInStudio.Desktop.csproj
+10
-0
Develop/DbManager.Desktop/Image/rerun.png
Develop/DbManager.Desktop/Image/rerun.png
+0
-0
Develop/DbManager.Desktop/Image/start.png
Develop/DbManager.Desktop/Image/start.png
+0
-0
Develop/DbManager.Desktop/Image/start2.png
Develop/DbManager.Desktop/Image/start2.png
+0
-0
Develop/DbManager.Desktop/Image/stop.png
Develop/DbManager.Desktop/Image/stop.png
+0
-0
Develop/DbManager.Desktop/Image/stop2.png
Develop/DbManager.Desktop/Image/stop2.png
+0
-0
Develop/DbManager.Desktop/MainWindow.xaml
Develop/DbManager.Desktop/MainWindow.xaml
+51
-10
Develop/DbManager.Desktop/Properties/Resources.Designer.cs
Develop/DbManager.Desktop/Properties/Resources.Designer.cs
+27
-0
Develop/DbManager.Desktop/Properties/Resources.resx
Develop/DbManager.Desktop/Properties/Resources.resx
+9
-0
Develop/DbManager.Desktop/Properties/launchSettings.json
Develop/DbManager.Desktop/Properties/launchSettings.json
+1
-1
Develop/DbManager.Desktop/ViewModel/LoginViewModel.cs
Develop/DbManager.Desktop/ViewModel/LoginViewModel.cs
+1
-1
Develop/DbManager.Desktop/ViewModel/MainViewModel.cs
Develop/DbManager.Desktop/ViewModel/MainViewModel.cs
+127
-72
RunTime/DBInRun/Program.cs
RunTime/DBInRun/Program.cs
+25
-5
RunTime/DBRuntime/His/HisEnginer2.cs
RunTime/DBRuntime/His/HisEnginer2.cs
+1
-0
未找到文件。
Develop/DBDevelopClientApi/DevelopServiceHelper.cs
浏览文件 @
3424cd29
...
...
@@ -84,6 +84,62 @@ namespace DBDevelopClientApi
return
false
;
}
/// <summary>
///
/// </summary>
/// <param name="database"></param>
/// <returns></returns>
public
bool
StartDatabase
(
string
database
)
{
if
(
mCurrentClient
!=
null
&&
!
string
.
IsNullOrEmpty
(
mLoginId
))
{
return
mCurrentClient
.
Start
(
new
DBDevelopService
.
DatabasesRequest
()
{
Database
=
database
,
LoginId
=
mLoginId
}).
Result
;
}
return
false
;
}
/// <summary>
///
/// </summary>
/// <param name="database"></param>
/// <returns></returns>
public
bool
StopDatabase
(
string
database
)
{
if
(
mCurrentClient
!=
null
&&
!
string
.
IsNullOrEmpty
(
mLoginId
))
{
return
mCurrentClient
.
Stop
(
new
DBDevelopService
.
DatabasesRequest
()
{
Database
=
database
,
LoginId
=
mLoginId
}).
Result
;
}
return
false
;
}
/// <summary>
///
/// </summary>
/// <param name="database"></param>
/// <returns></returns>
public
bool
ReRunDatabase
(
string
database
)
{
if
(
mCurrentClient
!=
null
&&
!
string
.
IsNullOrEmpty
(
mLoginId
))
{
return
mCurrentClient
.
ReRun
(
new
DBDevelopService
.
DatabasesRequest
()
{
Database
=
database
,
LoginId
=
mLoginId
}).
Result
;
}
return
false
;
}
/// <summary>
///
/// </summary>
/// <param name="database"></param>
/// <returns></returns>
public
bool
IsDatabaseRunning
(
string
database
)
{
if
(
mCurrentClient
!=
null
&&
!
string
.
IsNullOrEmpty
(
mLoginId
))
{
return
mCurrentClient
.
IsDatabaseRunning
(
new
DBDevelopService
.
DatabasesRequest
()
{
Database
=
database
,
LoginId
=
mLoginId
}).
Result
;
}
return
false
;
}
/// <summary>
/// 放弃更改
/// </summary>
...
...
Develop/DBDevelopClientApi/developService.proto
浏览文件 @
3424cd29
...
...
@@ -24,7 +24,7 @@ service DevelopServer {
//修改当前用户密码
rpc
ModifyPassword
(
ModifyPasswordRequest
)
returns
(
BoolResultReplay
);
rpc
ReNameUser
(
ReNameUserRequest
)
returns
(
BoolResultReplay
);
rpc
ReNameUser
(
ReNameUserRequest
)
returns
(
BoolResultReplay
);
//修改用户信息
rpc
UpdateUser
(
UpdateUserRequest
)
returns
(
BoolResultReplay
);
...
...
@@ -174,10 +174,15 @@ service DevelopServer {
rpc
Logout
(
LogoutRequest
)
returns
(
BoolResultReplay
);
//启动数据库
rpc
Start
(
Get
Request
)
returns
(
BoolResultReplay
);
rpc
Start
(
Databases
Request
)
returns
(
BoolResultReplay
);
//停止数据库
rpc
Stop
(
GetRequest
)
returns
(
BoolResultReplay
);
rpc
Stop
(
DatabasesRequest
)
returns
(
BoolResultReplay
);
//在运行不中断的情况下加载数据库
rpc
ReRun
(
DatabasesRequest
)
returns
(
BoolResultReplay
);
rpc
IsDatabaseRunning
(
DatabasesRequest
)
returns
(
BoolResultReplay
);
}
...
...
@@ -370,6 +375,13 @@ message NewDatabaseRequest
string
Desc
=
3
;
}
message
DatabasesRequest
{
string
loginId
=
1
;
string
Database
=
2
;
}
message
QueryDatabaseRequest
{
string
loginId
=
1
;
...
...
Develop/DBDevelopService/GrpcDBService.cs
浏览文件 @
3424cd29
...
...
@@ -10,6 +10,7 @@ using System.Net.WebSockets;
using
Microsoft.AspNetCore.Http
;
using
System.Threading
;
using
Microsoft.AspNetCore.Routing
;
using
Microsoft.Extensions.Logging
;
namespace
DBDevelopService
{
...
...
@@ -99,6 +100,11 @@ namespace DBDevelopService
/// <returns></returns>
public
static
IHostBuilder
CreateHostBuilder
(
string
serverUrl
)
=>
Host
.
CreateDefaultBuilder
()
.
ConfigureLogging
(
logging
=>
{
logging
.
AddFilter
(
"Grpc"
,
LogLevel
.
Warning
);
logging
.
SetMinimumLevel
(
LogLevel
.
Warning
);
})
.
ConfigureWebHostDefaults
(
webBuilder
=>
{
webBuilder
.
UseStartup
<
Startup
>();
...
...
Develop/DBDevelopService/IDatabaseManager.cs
0 → 100644
浏览文件 @
3424cd29
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
DBDevelopService
{
/// <summary>
///
/// </summary>
public
interface
IDatabaseManager
{
#
region
...
Variables
...
#
endregion
...
Variables
...
#
region
...
Events
...
#
endregion
...
Events
...
#
region
...
Constructor
...
#
endregion
...
Constructor
...
#
region
...
Properties
...
#
endregion
...
Properties
...
#
region
...
Methods
...
/// <summary>
/// 启动
/// </summary>
/// <param name="name"></param>
bool
Start
(
string
name
);
/// <summary>
/// 停止运行
/// </summary>
/// <param name="name"></param>
bool
Stop
(
string
name
);
/// <summary>
/// 重新运行更改部分
/// </summary>
/// <param name="name"></param>
bool
Rerun
(
string
name
);
/// <summary>
/// 是否处于运行中
/// </summary>
/// <param name="name"></param>
bool
IsRunning
(
string
name
);
#
endregion
...
Methods
...
#
region
...
Interfaces
...
#
endregion
...
Interfaces
...
}
}
Develop/DBDevelopService/Protos/developService.proto
浏览文件 @
3424cd29
...
...
@@ -24,7 +24,7 @@ service DevelopServer {
//修改当前用户密码
rpc
ModifyPassword
(
ModifyPasswordRequest
)
returns
(
BoolResultReplay
);
rpc
ReNameUser
(
ReNameUserRequest
)
returns
(
BoolResultReplay
);
rpc
ReNameUser
(
ReNameUserRequest
)
returns
(
BoolResultReplay
);
//修改用户信息
rpc
UpdateUser
(
UpdateUserRequest
)
returns
(
BoolResultReplay
);
...
...
@@ -174,10 +174,15 @@ service DevelopServer {
rpc
Logout
(
LogoutRequest
)
returns
(
BoolResultReplay
);
//启动数据库
rpc
Start
(
Get
Request
)
returns
(
BoolResultReplay
);
rpc
Start
(
Databases
Request
)
returns
(
BoolResultReplay
);
//停止数据库
rpc
Stop
(
GetRequest
)
returns
(
BoolResultReplay
);
rpc
Stop
(
DatabasesRequest
)
returns
(
BoolResultReplay
);
//在运行不中断的情况下加载数据库
rpc
ReRun
(
DatabasesRequest
)
returns
(
BoolResultReplay
);
rpc
IsDatabaseRunning
(
DatabasesRequest
)
returns
(
BoolResultReplay
);
}
...
...
@@ -370,6 +375,13 @@ message NewDatabaseRequest
string
Desc
=
3
;
}
message
DatabasesRequest
{
string
loginId
=
1
;
string
Database
=
2
;
}
message
QueryDatabaseRequest
{
string
loginId
=
1
;
...
...
Develop/DBDevelopService/Services/DevelopServerService.cs
浏览文件 @
3424cd29
...
...
@@ -681,6 +681,8 @@ namespace DBDevelopService
{
return
Task
.
FromResult
(
new
QueryDatabaseReplay
()
{
Result
=
false
});
}
QueryDatabaseReplay
re
=
new
QueryDatabaseReplay
()
{
Result
=
true
};
var
user
=
SecurityManager
.
Manager
.
GetUser
(
request
.
LoginId
);
var
dbs
=
user
.
Databases
;
...
...
@@ -700,10 +702,13 @@ namespace DBDevelopService
/// <param name="request"></param>
/// <param name="context"></param>
/// <returns></returns>
public
override
Task
<
BoolResultReplay
>
Start
(
Get
Request
request
,
ServerCallContext
context
)
public
override
Task
<
BoolResultReplay
>
Start
(
Databases
Request
request
,
ServerCallContext
context
)
{
// to do start
return
base
.
Start
(
request
,
context
);
if
(!
IsAdmin
(
request
.
LoginId
))
{
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
false
});
}
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
ServiceLocator
.
Locator
.
Resolve
<
IDatabaseManager
>().
Start
(
request
.
Database
)
});
}
/// <summary>
...
...
@@ -712,11 +717,33 @@ namespace DBDevelopService
/// <param name="request"></param>
/// <param name="context"></param>
/// <returns></returns>
public
override
Task
<
BoolResultReplay
>
Stop
(
GetRequest
request
,
ServerCallContext
context
)
public
override
Task
<
BoolResultReplay
>
Stop
(
DatabasesRequest
request
,
ServerCallContext
context
)
{
if
(!
IsAdmin
(
request
.
LoginId
))
{
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
false
});
}
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
ServiceLocator
.
Locator
.
Resolve
<
IDatabaseManager
>().
Stop
(
request
.
Database
)
});
}
public
override
Task
<
BoolResultReplay
>
ReRun
(
DatabasesRequest
request
,
ServerCallContext
context
)
{
//to do stop
return
base
.
Stop
(
request
,
context
);
if
(!
IsAdmin
(
request
.
LoginId
))
{
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
false
});
}
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
ServiceLocator
.
Locator
.
Resolve
<
IDatabaseManager
>().
Rerun
(
request
.
Database
)
});
}
public
override
Task
<
BoolResultReplay
>
IsDatabaseRunning
(
DatabasesRequest
request
,
ServerCallContext
context
)
{
if
(!
SecurityManager
.
Manager
.
CheckKeyAvaiable
(
request
.
LoginId
))
{
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
false
});
}
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
ServiceLocator
.
Locator
.
Resolve
<
IDatabaseManager
>().
IsRunning
(
request
.
Database
)
});
}
#
endregion
/// <summary>
...
...
Develop/DBDevelopService/Startup.cs
浏览文件 @
3424cd29
...
...
@@ -31,8 +31,15 @@ namespace DBDevelopService
app
.
UseDeveloperExceptionPage
();
}
//LoggerFactory.Create((builder) => { builder.AddConsole(); });
//var loggerFactory = LoggerFactory.Create(logging =>
//{
// logging.ClearProviders();
// logging.AddConsole();
// logging.SetMinimumLevel(LogLevel.Warning);
// logging.AddFilter("Grpc", LogLevel.Warning);
//});
app
.
UseRouting
();
app
.
UseEndpoints
(
endpoints
=>
...
...
Develop/DBStudio/Program.cs
浏览文件 @
3424cd29
...
...
@@ -8,14 +8,20 @@ using System.Diagnostics;
using
System.IO.Pipes
;
using
System.Threading
;
using
Microsoft.Extensions.Logging
;
using
System.Net.Http.Headers
;
namespace
DBStudio
{
class
Program
class
Program
:
DBDevelopService
.
IDatabaseManager
{
static
bool
mIsExited
=
false
;
static
void
Main
(
string
[]
args
)
{
Program
pg
=
new
Program
();
ServiceLocator
.
Locator
.
Registor
(
typeof
(
DBDevelopService
.
IDatabaseManager
),
pg
);
int
port
=
5001
;
int
webPort
=
9000
;
if
(
args
.
Length
>
0
)
...
...
@@ -235,13 +241,24 @@ namespace DBStudio
Console
.
WriteLine
(
"database "
+
db
.
Name
+
" is in running."
);
}
}
else
if
(
cmsg
==
"rerun"
)
{
if
(!
CheckStart
(
db
.
Name
))
{
StartDb
(
db
.
Name
);
}
else
{
ReLoadDabtabase
(
db
.
Name
);
}
}
else
if
(
cmsg
==
"restart"
)
{
StopDatabase
(
db
.
Name
);
while
(
CheckStart
(
db
.
Name
))
Thread
.
Sleep
(
100
);
StartDb
(
db
.
Name
);
}
else
if
(
cmsg
==
"isstart"
)
else
if
(
cmsg
==
"isstart
ed
"
)
{
if
(
CheckStart
(
db
.
Name
))
{
...
...
@@ -310,13 +327,21 @@ namespace DBStudio
///
/// </summary>
/// <param name="name"></param>
private
static
void
StartDb
(
string
name
)
private
static
bool
StartDb
(
string
name
)
{
var
info
=
new
ProcessStartInfo
()
{
FileName
=
"DbInRun.exe"
};
info
.
UseShellExecute
=
true
;
info
.
Arguments
=
"start "
+
name
;
info
.
WorkingDirectory
=
System
.
IO
.
Path
.
GetDirectoryName
(
typeof
(
Program
).
Assembly
.
Location
);
Process
.
Start
(
info
);
try
{
var
info
=
new
ProcessStartInfo
()
{
FileName
=
"DbInRun.exe"
};
info
.
UseShellExecute
=
true
;
info
.
Arguments
=
"start "
+
name
;
info
.
WorkingDirectory
=
System
.
IO
.
Path
.
GetDirectoryName
(
typeof
(
Program
).
Assembly
.
Location
);
Process
.
Start
(
info
).
WaitForExit
(
1000
);
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
ex
.
Message
);
}
return
false
;
}
/// <summary>
...
...
@@ -1195,7 +1220,11 @@ namespace DBStudio
return
re
.
ToString
();
}
public
static
void
StopDatabase
(
string
name
)
/// <summary>
///
/// </summary>
/// <param name="name"></param>
public
static
bool
StopDatabase
(
string
name
)
{
using
(
var
client
=
new
NamedPipeClientStream
(
"."
,
name
,
PipeDirection
.
InOut
))
{
...
...
@@ -1207,16 +1236,52 @@ namespace DBStudio
var
res
=
client
.
ReadByte
();
if
(
res
==
1
)
{
Console
.
WriteLine
(
"Stop database"
+
name
+
" sucessfull."
);
Console
.
WriteLine
(
"Stop database
"
+
name
+
" sucessfull."
);
}
return
true
;
}
catch
{
Console
.
WriteLine
(
"Stop database "
+
name
+
" failed."
);
}
return
false
;
}
}
/// <summary>
///
/// </summary>
/// <param name="name"></param>
public
static
bool
ReLoadDabtabase
(
string
name
)
{
using
(
var
client
=
new
NamedPipeClientStream
(
"."
,
name
,
PipeDirection
.
InOut
))
{
try
{
client
.
Connect
(
2000
);
client
.
WriteByte
(
1
);
client
.
WaitForPipeDrain
();
var
res
=
client
.
ReadByte
();
if
(
res
==
1
)
{
Console
.
WriteLine
(
"Rerun database"
+
name
+
" sucessfull."
);
}
return
true
;
}
catch
{
Console
.
WriteLine
(
"Rerun database "
+
name
+
" failed."
);
}
return
false
;
}
}
/// <summary>
///
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public
static
bool
CheckStart
(
string
name
)
{
using
(
var
client
=
new
NamedPipeClientStream
(
"."
,
name
,
PipeDirection
.
InOut
))
...
...
@@ -1233,8 +1298,60 @@ namespace DBStudio
}
}
}
/// <summary>
///
/// </summary>
/// <param name="name"></param>
public
bool
Start
(
string
name
)
{
if
(!
CheckStart
(
name
))
{
return
StartDb
(
name
);
}
return
true
;
}
/// <summary>
///
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public
bool
Stop
(
string
name
)
{
//if (CheckStart(name))
{
return
StopDatabase
(
name
);
}
//return true;
}
/// <summary>
///
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public
bool
Rerun
(
string
name
)
{
if
(!
CheckStart
(
name
))
{
return
StartDb
(
name
);
}
else
{
return
ReLoadDabtabase
(
name
);
}
}
/// <summary>
///
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public
bool
IsRunning
(
string
name
)
{
return
CheckStart
(
name
);
}
}
}
Develop/DBStudio/Properties/launchSettings.json
浏览文件 @
3424cd29
...
...
@@ -2,7 +2,7 @@
"profiles"
:
{
"DBInStudioServer"
:
{
"commandName"
:
"Executable"
,
"executablePath"
:
"C:
\\
Users
\\
Lenovo
\\
source
\\
repos
\\
mars
\\
Output
\\
DBInStudioServer.exe"
"executablePath"
:
"C:
\\
Users
\\
cdy81
\\
source
\\
repos
\\
mars
\\
Output
\\
DBInStudioServer.exe"
}
}
}
\ No newline at end of file
Develop/DbManager.Desktop/DBInStudio.Desktop.csproj
浏览文件 @
3424cd29
...
...
@@ -29,10 +29,15 @@
<None Remove="Image\ok.png" />
<None Remove="Image\permissions.png" />
<None Remove="Image\remove.png" />
<None Remove="Image\rerun.png" />
<None Remove="Image\save.png" />
<None Remove="Image\Security.png" />
<None Remove="Image\server-security.png" />
<None Remove="Image\show.png" />
<None Remove="Image\start.png" />
<None Remove="Image\start2.png" />
<None Remove="Image\stop.png" />
<None Remove="Image\stop2.png" />
<None Remove="Image\Switch.png" />
<None Remove="Image\user.png" />
<None Remove="Image\UserSettings.png" />
...
...
@@ -60,10 +65,15 @@
<Resource Include="Image\ok.png" />
<Resource Include="Image\permissions.png" />
<Resource Include="Image\remove.png" />
<Resource Include="Image\rerun.png" />
<Resource Include="Image\save.png" />
<Resource Include="Image\Security.png" />
<Resource Include="Image\server-security.png" />
<Resource Include="Image\show.png" />
<Resource Include="Image\start.png" />
<Resource Include="Image\start2.png" />
<Resource Include="Image\stop.png" />
<Resource Include="Image\stop2.png" />
<Resource Include="Image\Switch.png" />
<Resource Include="Image\user.png" />
<Resource Include="Image\UserSettings.png" />
...
...
Develop/DbManager.Desktop/Image/rerun.png
0 → 100644
浏览文件 @
3424cd29
342 字节
Develop/DbManager.Desktop/Image/start.png
0 → 100644
浏览文件 @
3424cd29
217 字节
Develop/DbManager.Desktop/Image/start2.png
0 → 100644
浏览文件 @
3424cd29
191 字节
Develop/DbManager.Desktop/Image/stop.png
0 → 100644
浏览文件 @
3424cd29
517 字节
Develop/DbManager.Desktop/Image/stop2.png
0 → 100644
浏览文件 @
3424cd29
485 字节
Develop/DbManager.Desktop/MainWindow.xaml
浏览文件 @
3424cd29
...
...
@@ -41,9 +41,13 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<Grid>
<Border x:Name="border" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<Rectangle Visibility="Hidden" x:Name="vb" Fill="#2FFFFFFF" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsDefaulted" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
...
...
@@ -57,9 +61,13 @@
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Visibility" TargetName="vb" Value="Visible" />
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="True">
<Setter Property="Visibility" TargetName="vb" Value="Hidden" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
...
...
@@ -80,7 +88,7 @@
<Button.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="/Image/登录.png" Height="16" RenderOptions.BitmapScalingMode="
NearestNeighbor
"/>
<Image Source="/Image/登录.png" Height="16" RenderOptions.BitmapScalingMode="
HighQuality
"/>
<TextBlock Text="{local:ResMarker Login}" VerticalAlignment="Center" Margin="5,0"/>
</StackPanel>
</DataTemplate>
...
...
@@ -91,7 +99,7 @@
<Button.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Stretch" >
<Image Source="/Image/log-out.png" Height="16" RenderOptions.BitmapScalingMode="
NearestNeighbor
"/>
<Image Source="/Image/log-out.png" Height="16" RenderOptions.BitmapScalingMode="
HighQuality
"/>
<TextBlock Text="{local:ResMarker Logout}" Foreground="DarkRed" VerticalAlignment="Center" Margin="5,0"/>
</StackPanel>
</DataTemplate>
...
...
@@ -103,7 +111,7 @@
<Button.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="/Image/database-add.png" Height="24" RenderOptions.BitmapScalingMode="
NearestNeighbor
" />
<Image Source="/Image/database-add.png" Height="24" RenderOptions.BitmapScalingMode="
HighQuality
" />
<TextBlock Text="{local:ResMarker Add}" VerticalAlignment="Center" Margin="5,0"/>
</StackPanel>
</DataTemplate>
...
...
@@ -114,7 +122,7 @@
<Button.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="/Image/switch.png" Height="24" RenderOptions.BitmapScalingMode="
NearestNeighbor
" />
<Image Source="/Image/switch.png" Height="24" RenderOptions.BitmapScalingMode="
HighQuality
" />
<TextBlock Text="{local:ResMarker Switch}" VerticalAlignment="Center" Margin="5,0"/>
</StackPanel>
</DataTemplate>
...
...
@@ -127,18 +135,51 @@
<Button.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="/Image/Save.png" Height="24" RenderOptions.BitmapScalingMode="
NearestNeighbor
" />
<Image Source="/Image/Save.png" Height="24" RenderOptions.BitmapScalingMode="
HighQuality
" />
<TextBlock Text="{local:ResMarker Save}" VerticalAlignment="Center" Margin="5,0"/>
</StackPanel>
</DataTemplate>
</Button.ContentTemplate>
</Button>
<Button Style="{DynamicResource MenuButton}" Command="{Binding StartCommand}" HorizontalAlignment="Left" Margin="10,0,0,0" Height="32" VerticalAlignment="Center" Width="80" >
<Button.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="/Image/start.png" Height="16" RenderOptions.BitmapScalingMode="HighQuality" />
<TextBlock Text="{local:ResMarker Start}" VerticalAlignment="Center" Margin="5,0"/>
</StackPanel>
</DataTemplate>
</Button.ContentTemplate>
</Button>
<Button Style="{DynamicResource MenuButton}" Command="{Binding StopCommand}" HorizontalAlignment="Left" Margin="10,0,0,0" Height="32" VerticalAlignment="Center" Width="80" >
<Button.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="/Image/stop.png" Height="16" RenderOptions.BitmapScalingMode="HighQuality" />
<TextBlock Text="{local:ResMarker Stop}" VerticalAlignment="Center" Margin="5,0"/>
</StackPanel>
</DataTemplate>
</Button.ContentTemplate>
</Button>
<Button Style="{DynamicResource MenuButton}" Command="{Binding ReRunCommand}" HorizontalAlignment="Left" Margin="10,0,0,0" Height="32" VerticalAlignment="Center" Width="80" >
<Button.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="/Image/rerun.png" Height="16" RenderOptions.BitmapScalingMode="HighQuality" />
<TextBlock Text="{local:ResMarker ReRun}" VerticalAlignment="Center" Margin="5,0"/>
</StackPanel>
</DataTemplate>
</Button.ContentTemplate>
</Button>
<Button Style="{DynamicResource MenuButton}" Command="{Binding ExportCommand}" HorizontalAlignment="Left" Margin="10,0,0,0" Height="32" VerticalAlignment="Center" Width="80" >
<Button.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="/Image/export.png" Height="16" RenderOptions.BitmapScalingMode="
NearestNeighbor
" />
<Image Source="/Image/export.png" Height="16" RenderOptions.BitmapScalingMode="
HighQuality
" />
<TextBlock Text="{local:ResMarker Export}" VerticalAlignment="Center" Margin="5,0"/>
</StackPanel>
</DataTemplate>
...
...
@@ -148,7 +189,7 @@
<Button.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="/Image/import.png" Height="16" RenderOptions.BitmapScalingMode="
NearestNeighbor
" />
<Image Source="/Image/import.png" Height="16" RenderOptions.BitmapScalingMode="
HighQuality
" />
<TextBlock Text="{local:ResMarker Import}" VerticalAlignment="Center" Margin="5,0"/>
</StackPanel>
</DataTemplate>
...
...
Develop/DbManager.Desktop/Properties/Resources.Designer.cs
浏览文件 @
3424cd29
...
...
@@ -600,6 +600,15 @@ namespace DBInStudio.Desktop.Properties {
}
}
/// <summary>
/// 查找类似 ReRun 的本地化字符串。
/// </summary>
internal
static
string
ReRun
{
get
{
return
ResourceManager
.
GetString
(
"ReRun"
,
resourceCulture
);
}
}
/// <summary>
/// 查找类似 Save 的本地化字符串。
/// </summary>
...
...
@@ -708,6 +717,24 @@ namespace DBInStudio.Desktop.Properties {
}
}
/// <summary>
/// 查找类似 Start 的本地化字符串。
/// </summary>
internal
static
string
Start
{
get
{
return
ResourceManager
.
GetString
(
"Start"
,
resourceCulture
);
}
}
/// <summary>
/// 查找类似 Stop 的本地化字符串。
/// </summary>
internal
static
string
Stop
{
get
{
return
ResourceManager
.
GetString
(
"Stop"
,
resourceCulture
);
}
}
/// <summary>
/// 查找类似 Switch 的本地化字符串。
/// </summary>
...
...
Develop/DbManager.Desktop/Properties/Resources.resx
浏览文件 @
3424cd29
...
...
@@ -299,6 +299,9 @@
<data
name=
"ReplaceAll"
xml:space=
"preserve"
>
<value>
Replace all
</value>
</data>
<data
name=
"ReRun"
xml:space=
"preserve"
>
<value>
ReRun
</value>
</data>
<data
name=
"Save"
xml:space=
"preserve"
>
<value>
Save
</value>
</data>
...
...
@@ -336,6 +339,12 @@
<data
name=
"SlopeCompress"
xml:space=
"preserve"
>
<value>
Slope
</value>
</data>
<data
name=
"Start"
xml:space=
"preserve"
>
<value>
Start
</value>
</data>
<data
name=
"Stop"
xml:space=
"preserve"
>
<value>
Stop
</value>
</data>
<data
name=
"Switch"
xml:space=
"preserve"
>
<value>
Switch
</value>
</data>
...
...
Develop/DbManager.Desktop/Properties/launchSettings.json
浏览文件 @
3424cd29
...
...
@@ -2,7 +2,7 @@
"profiles"
:
{
"DBInStudio.Desktop"
:
{
"commandName"
:
"Executable"
,
"executablePath"
:
"C:
\\
Users
\\
Lenovo
\\
source
\\
repos
\\
mars
\\
Output
\\
DBInStudio.exe"
"executablePath"
:
"C:
\\
Users
\\
cdy81
\\
source
\\
repos
\\
mars
\\
Output
\\
DBInStudio.exe"
}
}
}
\ No newline at end of file
Develop/DbManager.Desktop/ViewModel/LoginViewModel.cs
浏览文件 @
3424cd29
...
...
@@ -150,7 +150,7 @@ namespace DBInStudio.Desktop.ViewModel
var
pps
=
Process
.
GetProcessesByName
(
"DBInStudioServer"
);
if
(
pps
==
null
||
pps
.
Length
==
0
)
{
Process
.
Start
(
"DBInStudioServer.exe"
).
WaitForExit
(
20
000
);
Process
.
Start
(
"DBInStudioServer.exe"
).
WaitForExit
(
5
000
);
}
}
}
...
...
Develop/DbManager.Desktop/ViewModel/MainViewModel.cs
浏览文件 @
3424cd29
...
...
@@ -21,6 +21,7 @@ using Microsoft.Win32;
using
System.IO
;
using
Cdy.Tag
;
using
System.Diagnostics
;
using
System.Timers
;
namespace
DBInStudio.Desktop
{
...
...
@@ -35,6 +36,12 @@ namespace DBInStudio.Desktop
private
ICommand
mSaveCommand
;
private
ICommand
mStartCommand
;
private
ICommand
mStopCommand
;
private
ICommand
mReRunCommand
;
private
ICommand
mLogoutCommand
;
private
ICommand
mAddGroupCommand
;
...
...
@@ -68,6 +75,10 @@ namespace DBInStudio.Desktop
private
bool
mIsLogin
;
private
bool
mIsDatabaseRunning
;
private
System
.
Timers
.
Timer
mCheckRunningTimer
;
#
endregion
...
Variables
...
#
region
...
Events
...
...
...
@@ -75,6 +86,7 @@ namespace DBInStudio.Desktop
#
endregion
...
Events
...
#
region
...
Constructor
...
/// <summary>
///
/// </summary>
...
...
@@ -82,14 +94,87 @@ namespace DBInStudio.Desktop
{
ServiceLocator
.
Locator
.
Registor
<
IProcessNotify
>(
this
);
CurrentUserManager
.
Manager
.
RefreshNameEvent
+=
Manager_RefreshNameEvent
;
mCheckRunningTimer
=
new
System
.
Timers
.
Timer
(
1000
);
mCheckRunningTimer
.
Elapsed
+=
MCheckRunningTimer_Elapsed
;
}
#
endregion
...
Constructor
...
#
region
...
Properties
...
/// <summary>
///
/// </summary>
public
bool
IsDatabaseRunning
{
get
{
return
mIsDatabaseRunning
;
}
set
{
if
(
mIsDatabaseRunning
!=
value
)
{
mIsDatabaseRunning
=
value
;
OnPropertyChanged
(
"IsDatabaseRunning"
);
}
}
}
/// <summary>
///
/// </summary>
public
ICommand
ReRunCommand
{
get
{
if
(
mReRunCommand
==
null
)
{
mReRunCommand
=
new
RelayCommand
(()
=>
{
DevelopServiceHelper
.
Helper
.
ReRunDatabase
(
mDatabase
);
},()=>
{
return
!
string
.
IsNullOrEmpty
(
mDatabase
);
});
}
return
mReRunCommand
;
}
}
/// <summary>
///
/// </summary>
public
ICommand
StartCommand
{
get
{
if
(
mStartCommand
==
null
)
{
mStartCommand
=
new
RelayCommand
(()
=>
{
IsDatabaseRunning
=
DevelopServiceHelper
.
Helper
.
StartDatabase
(
mDatabase
);
},
()
=>
{
return
!
mIsDatabaseRunning
&&
!
string
.
IsNullOrEmpty
(
mDatabase
);
});
}
return
mStartCommand
;
}
}
/// <summary>
///
/// </summary>
public
ICommand
StopCommand
{
get
{
if
(
mStopCommand
==
null
)
{
mStopCommand
=
new
RelayCommand
(()
=>
{
IsDatabaseRunning
=
!
DevelopServiceHelper
.
Helper
.
StopDatabase
(
mDatabase
);
},()=>
{
return
mIsDatabaseRunning
&&
!
string
.
IsNullOrEmpty
(
mDatabase
);
});
}
return
mStopCommand
;
}
}
/// <summary>
///
/// </summary>
...
...
@@ -452,6 +537,22 @@ namespace DBInStudio.Desktop
#
region
...
Methods
...
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private
void
MCheckRunningTimer_Elapsed
(
object
sender
,
ElapsedEventArgs
e
)
{
if
(!
string
.
IsNullOrEmpty
(
mDatabase
))
{
var
isrunning
=
DevelopServiceHelper
.
Helper
.
IsDatabaseRunning
(
mDatabase
);
Application
.
Current
.
Dispatcher
.
BeginInvoke
(
new
Action
(()
=>
{
IsDatabaseRunning
=
isrunning
;
}),
null
);
}
}
private
void
NewDatabase
()
{
NewDatabaseViewModel
ndm
=
new
NewDatabaseViewModel
();
...
...
@@ -661,6 +762,8 @@ namespace DBInStudio.Desktop
TagViewModel
.
Drivers
=
DevelopServiceHelper
.
Helper
.
GetRegistorDrivers
(
mDatabase
);
QueryGroups
();
});
IsDatabaseRunning
=
DevelopServiceHelper
.
Helper
.
IsDatabaseRunning
(
mDatabase
);
}
}
}
...
...
@@ -675,13 +778,29 @@ namespace DBInStudio.Desktop
OnPropertyChanged
(
"UserName"
);
}
/// <summary>
///
/// </summary>
private
void
StartCheckDatabaseRunning
()
{
mCheckRunningTimer
.
Start
();
}
/// <summary>
///
/// </summary>
private
void
StopCheckDatabaseRunning
()
{
mCheckRunningTimer
.
Stop
();
}
/// <summary>
///
/// </summary>
private
void
Logout
()
{
IsLogin
=
false
;
foreach
(
var
vv
in
this
.
TagGroup
)
foreach
(
var
vv
in
this
.
TagGroup
)
{
vv
.
Dispose
();
}
...
...
@@ -691,8 +810,9 @@ namespace DBInStudio.Desktop
if
(
ContentViewModel
!=
null
)
ContentViewModel
.
Dispose
();
ContentViewModel
=
null
;
Database
=
string
.
Empty
;
ContentViewModel
=
null
;
Database
=
string
.
Empty
;
StopCheckDatabaseRunning
();
}
/// <summary>
...
...
@@ -735,77 +855,12 @@ namespace DBInStudio.Desktop
TagViewModel
.
Drivers
=
DevelopServiceHelper
.
Helper
.
GetRegistorDrivers
(
mDatabase
);
QueryGroups
();
});
StartCheckDatabaseRunning
();
}
}
}
///// <summary>
/////
///// </summary>
///// <param name="parent"></param>
///// <returns></returns>
//public bool AddGroup(string parent)
//{
// string chileName = GetNewGroupName();
// chileName = DevelopServiceHelper.Helper.AddTagGroup(mDatabase, chileName, parent);
// if (!string.IsNullOrEmpty(chileName))
// {
// if (mCurrentSelectTreeItem != null && mCurrentSelectTreeItem is TagGroupViewModel)
// {
// (mCurrentSelectTreeItem as TagGroupViewModel).Children.Add(new TagGroupViewModel() { mName = chileName, Parent = (mCurrentSelectTreeItem as TagGroupViewModel), Database = this.mDatabase });
// }
// else
// {
// this.TagGroup.Add(new TagGroupViewModel() { mName = chileName, Database = this.mDatabase });
// }
// }
// return false;
//}
///// <summary>
/////
///// </summary>
//private void NewGroup()
//{
// string sparent = mCurrentSelectTreeItem!=null && mCurrentSelectTreeItem is TagGroupViewModel? (mCurrentSelectTreeItem as TagGroupViewModel).FullName:string.Empty;
// AddGroup(sparent);
//}
///// <summary>
/////
///// </summary>
///// <returns></returns>
//private string GetNewGroupName()
//{
// List<string> vtmps = mCurrentSelectTreeItem!=null && mCurrentSelectTreeItem is TagGroupViewModel? (mCurrentSelectTreeItem as TagGroupViewModel).Children.Select(e => e.Name).ToList():TagGroup.Select(e=>e.Name).ToList();
// string tagName = "group";
// for (int i = 1; i < int.MaxValue; i++)
// {
// tagName = "group" + i;
// if (!vtmps.Contains(tagName))
// {
// return tagName;
// }
// }
// return tagName;
//}
///// <summary>
/////
///// </summary>
//private void RemoveGroup()
//{
// string sname = (mCurrentSelectTreeItem as TagGroupViewModel).FullName;
// if(DevelopServiceHelper.Helper.RemoveGroup(mDatabase,sname))
// {
// if((mCurrentSelectTreeItem as TagGroupViewModel).Parent!=null)
// {
// (mCurrentSelectTreeItem as TagGroupViewModel).Parent.Children.Remove((mCurrentSelectTreeItem as TagGroupViewModel));
// (mCurrentSelectTreeItem as TagGroupViewModel).Parent = null;
// }
// }
//}
/// <summary>
///
/// </summary>
...
...
RunTime/DBInRun/Program.cs
浏览文件 @
3424cd29
using
Cdy.Tag
;
using
System
;
using
System.Diagnostics
;
using
System.IO
;
using
System.IO.Pipes
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
DBInRun
...
...
@@ -10,6 +12,9 @@ namespace DBInRun
class
Program
{
static
bool
mIsClosed
=
false
;
static
Thread
mainThread
;
//static MarshalMemoryBlock block;
static
void
Main
(
string
[]
args
)
{
...
...
@@ -22,6 +27,10 @@ namespace DBInRun
PrintLogo
();
if
(
args
.
Length
>
0
&&
args
[
0
]==
"start"
)
{
Task
.
Run
(()
=>
{
StartMonitor
(
args
.
Length
>
1
?
args
[
1
]
:
"local"
);
});
if
(
args
.
Length
>
1
)
{
int
port
=
14330
;
...
...
@@ -35,12 +44,10 @@ namespace DBInRun
{
Cdy
.
Tag
.
Runner
.
RunInstance
.
Start
();
}
Task
.
Run
(()
=>
{
StartMonitor
(
args
.
Length
>
1
?
args
[
1
]
:
"local"
);
});
}
mainThread
=
Thread
.
CurrentThread
;
Console
.
WriteLine
(
Res
.
Get
(
"HelpMsg"
));
while
(!
mIsClosed
)
{
...
...
@@ -160,10 +167,23 @@ namespace DBInRun
mIsClosed
=
true
;
server
.
WriteByte
(
1
);
server
.
WaitForPipeDrain
();
Console
.
WriteLine
(
Res
.
Get
(
"AnyKeyToExit"
));
Console
.
WriteLine
(
Res
.
Get
(
"AnyKeyToExit"
)+
"....."
);
//Task.Run(() => {
// Thread.Sleep(5000);
// System.Diagnostics.Process.GetCurrentProcess().Kill();
//});
break
;
//退出系统
}
else
if
(
cmd
==
1
)
{
Cdy
.
Tag
.
Runner
.
RunInstance
.
ReStartDatabase
();
server
.
WriteByte
(
1
);
server
.
WaitForPipeDrain
();
}
else
{
...
...
RunTime/DBRuntime/His/HisEnginer2.cs
浏览文件 @
3424cd29
...
...
@@ -458,6 +458,7 @@ namespace Cdy.Tag
foreach
(
var
vv
in
mValueChangedProcesser
)
{
if
(!
vv
.
IsStarted
)
vv
.
Start
();
}
mLogManager
.
InitHeadData
();
mRecordTimer
.
Start
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录