Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
cdy816
Mars
提交
30e490d8
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 搜索 >>
提交
30e490d8
编写于
6月 08, 2020
作者:
cdy816
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
变量桌面开发环境Bug修复
上级
e0dbaf49
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
813 addition
and
79 deletion
+813
-79
Common/Cdy.Tag/His/HisTag.cs
Common/Cdy.Tag/His/HisTag.cs
+11
-0
Common/Cdy.Tag/Real/RealDatabase.cs
Common/Cdy.Tag/Real/RealDatabase.cs
+39
-12
Common/Cdy.Tag/Real/RealDatabaseSerise.cs
Common/Cdy.Tag/Real/RealDatabaseSerise.cs
+19
-15
Common/Cdy.Tag/Real/Tagbase.cs
Common/Cdy.Tag/Real/Tagbase.cs
+33
-1
Develop/DBDevelopClientApi/DevelopServiceHelper.cs
Develop/DBDevelopClientApi/DevelopServiceHelper.cs
+19
-3
Develop/DBDevelopClientApi/developService.proto
Develop/DBDevelopClientApi/developService.proto
+27
-1
Develop/DBDevelopService/Protos/developService.proto
Develop/DBDevelopService/Protos/developService.proto
+27
-1
Develop/DBDevelopService/Services/DevelopServerService.cs
Develop/DBDevelopService/Services/DevelopServerService.cs
+81
-5
Develop/DbManager.Desktop/DBInStudio.Desktop.csproj
Develop/DbManager.Desktop/DBInStudio.Desktop.csproj
+2
-0
Develop/DbManager.Desktop/Image/mrdbd.ico
Develop/DbManager.Desktop/Image/mrdbd.ico
+0
-0
Develop/DbManager.Desktop/MainWindow.xaml
Develop/DbManager.Desktop/MainWindow.xaml
+12
-4
Develop/DbManager.Desktop/Properties/Resources.Designer.cs
Develop/DbManager.Desktop/Properties/Resources.Designer.cs
+18
-0
Develop/DbManager.Desktop/Properties/Resources.resx
Develop/DbManager.Desktop/Properties/Resources.resx
+6
-0
Develop/DbManager.Desktop/View/Convert/IndexConverter.cs
Develop/DbManager.Desktop/View/Convert/IndexConverter.cs
+43
-0
Develop/DbManager.Desktop/View/ListDatabaseView.xaml
Develop/DbManager.Desktop/View/ListDatabaseView.xaml
+65
-1
Develop/DbManager.Desktop/View/TagGroupDetailView.xaml
Develop/DbManager.Desktop/View/TagGroupDetailView.xaml
+97
-11
Develop/DbManager.Desktop/View/TagGroupDetailView.xaml.cs
Develop/DbManager.Desktop/View/TagGroupDetailView.xaml.cs
+4
-0
Develop/DbManager.Desktop/ViewModel/ITreeViewModel.cs
Develop/DbManager.Desktop/ViewModel/ITreeViewModel.cs
+110
-3
Develop/DbManager.Desktop/ViewModel/MainViewModel.cs
Develop/DbManager.Desktop/ViewModel/MainViewModel.cs
+32
-13
Develop/DbManager.Desktop/ViewModel/TagGroupDetailViewModel.cs
...op/DbManager.Desktop/ViewModel/TagGroupDetailViewModel.cs
+71
-6
Develop/DbManager.Desktop/ViewModel/TagViewModel.cs
Develop/DbManager.Desktop/ViewModel/TagViewModel.cs
+92
-2
Driver/SpiderDriver.ClientApi/SpiderDriver.ClientApi.csproj
Driver/SpiderDriver.ClientApi/SpiderDriver.ClientApi.csproj
+5
-1
未找到文件。
Common/Cdy.Tag/His/HisTag.cs
浏览文件 @
30e490d8
...
...
@@ -120,6 +120,17 @@ namespace Cdy.Tag
//hisTag.CompressParameter3 = float.Parse(xe.Attribute("CompressParameter3").Value);
return
hisTag
;
}
/// <summary>
///
/// </summary>
/// <param name="tag"></param>
/// <returns></returns>
public
static
HisTag
Clone
(
this
HisTag
tag
)
{
return
tag
.
SaveToXML
().
LoadHisTagFromXML
();
}
}
...
...
Common/Cdy.Tag/Real/RealDatabase.cs
浏览文件 @
30e490d8
...
...
@@ -75,6 +75,17 @@ namespace Cdy.Tag
}
}
/// <summary>
///
/// </summary>
public
void
BuildGroupMap
()
{
foreach
(
var
vv
in
Groups
)
{
vv
.
Value
.
Tags
.
AddRange
(
Tags
.
Where
(
e
=>
e
.
Value
.
Group
==
vv
.
Value
.
FullName
).
Select
(
e
=>
e
.
Value
));
}
}
/// <summary>
///
/// </summary>
...
...
@@ -198,13 +209,13 @@ namespace Cdy.Tag
CheckAndAddGroup
(
tag
.
Group
)?.
Tags
.
Add
(
tag
);
MaxId
=
Math
.
Max
(
MaxId
,
tag
.
Id
);
if
(!
NamedTags
.
ContainsKey
(
tag
.
Name
))
if
(!
NamedTags
.
ContainsKey
(
tag
.
Full
Name
))
{
NamedTags
.
Add
(
tag
.
Name
,
tag
);
NamedTags
.
Add
(
tag
.
Full
Name
,
tag
);
}
else
{
NamedTags
[
tag
.
Name
]
=
tag
;
NamedTags
[
tag
.
Full
Name
]
=
tag
;
}
return
true
;
...
...
@@ -213,13 +224,13 @@ namespace Cdy.Tag
{
Tags
[
tag
.
Id
]
=
tag
;
if
(!
NamedTags
.
ContainsKey
(
tag
.
Name
))
if
(!
NamedTags
.
ContainsKey
(
tag
.
Full
Name
))
{
NamedTags
.
Add
(
tag
.
Name
,
tag
);
NamedTags
.
Add
(
tag
.
Full
Name
,
tag
);
}
else
{
NamedTags
[
tag
.
Name
]
=
tag
;
NamedTags
[
tag
.
Full
Name
]
=
tag
;
}
}
return
false
;
...
...
@@ -236,26 +247,26 @@ namespace Cdy.Tag
Tags
.
Add
(
tag
.
Id
,
tag
);
CheckAndAddGroup
(
tag
.
Group
)?.
Tags
.
Add
(
tag
);
if
(!
NamedTags
.
ContainsKey
(
tag
.
Name
))
if
(!
NamedTags
.
ContainsKey
(
tag
.
Full
Name
))
{
NamedTags
.
Add
(
tag
.
Name
,
tag
);
NamedTags
.
Add
(
tag
.
Full
Name
,
tag
);
}
else
{
NamedTags
[
tag
.
Name
]
=
tag
;
NamedTags
[
tag
.
Full
Name
]
=
tag
;
}
}
else
{
Tags
[
tag
.
Id
]
=
tag
;
if
(!
NamedTags
.
ContainsKey
(
tag
.
Name
))
if
(!
NamedTags
.
ContainsKey
(
tag
.
Full
Name
))
{
NamedTags
.
Add
(
tag
.
Name
,
tag
);
NamedTags
.
Add
(
tag
.
Full
Name
,
tag
);
}
else
{
NamedTags
[
tag
.
Name
]
=
tag
;
NamedTags
[
tag
.
Full
Name
]
=
tag
;
}
}
MaxId
=
Math
.
Max
(
MaxId
,
tag
.
Id
);
...
...
@@ -396,6 +407,22 @@ namespace Cdy.Tag
return
Groups
.
Values
.
Where
(
e
=>
e
.
Parent
==
parent
).
ToList
();
}
/// <summary>
///
/// </summary>
/// <param name="parent"></param>
/// <param name="chileGroupName"></param>
/// <returns></returns>
public
bool
HasChildGroup
(
TagGroup
parent
,
string
childGroupName
)
{
var
vss
=
Groups
.
Values
.
Where
(
e
=>
e
.
Parent
==
parent
).
Select
(
e
=>
e
.
Name
);
if
(
vss
.
Count
()
>
0
&&
vss
.
Contains
(
childGroupName
))
{
return
true
;
}
return
false
;
}
/// <summary>
///
/// </summary>
...
...
Common/Cdy.Tag/Real/RealDatabaseSerise.cs
浏览文件 @
30e490d8
...
...
@@ -81,20 +81,7 @@ namespace Cdy.Tag
db
.
Name
=
xe
.
Attribute
(
"Name"
).
Value
;
db
.
Version
=
xe
.
Attribute
(
"Version"
).
Value
;
if
(
xe
.
Element
(
"Tags"
)
!=
null
)
{
Parallel
.
ForEach
(
xe
.
Element
(
"Tags"
).
Elements
(),
(
vv
)
=>
{
var
tag
=
vv
.
LoadTagFromXML
();
lock
(
db
.
Tags
)
db
.
Tags
.
Add
(
tag
.
Id
,
tag
);
});
db
.
BuildNameMap
();
//foreach(var vv in xe.Element("Tags").Elements())
//{
// var tag = vv.LoadTagFromXML();
// db.Tags.Add(tag.Id, tag);
//}
}
Dictionary
<
string
,
TagGroup
>
groups
=
new
Dictionary
<
string
,
TagGroup
>();
Dictionary
<
TagGroup
,
string
>
parents
=
new
Dictionary
<
TagGroup
,
string
>();
...
...
@@ -104,7 +91,7 @@ namespace Cdy.Tag
{
TagGroup
group
=
new
TagGroup
();
group
.
Name
=
vv
.
Attribute
(
"Name"
).
Value
;
string
parent
=
vv
.
Attribute
(
"Parent"
)
!=
null
?
xe
.
Attribute
(
"Parent"
).
Value
:
""
;
string
parent
=
vv
.
Attribute
(
"Parent"
)
!=
null
?
vv
.
Attribute
(
"Parent"
).
Value
:
""
;
string
fullName
=
vv
.
Attribute
(
"FullName"
).
Value
;
...
...
@@ -125,6 +112,23 @@ namespace Cdy.Tag
vv
.
Key
.
Parent
=
db
.
Groups
[
vv
.
Value
];
}
}
if
(
xe
.
Element
(
"Tags"
)
!=
null
)
{
Parallel
.
ForEach
(
xe
.
Element
(
"Tags"
).
Elements
(),
(
vv
)
=>
{
var
tag
=
vv
.
LoadTagFromXML
();
lock
(
db
.
Tags
)
db
.
Tags
.
Add
(
tag
.
Id
,
tag
);
});
db
.
BuildNameMap
();
db
.
BuildGroupMap
();
//foreach(var vv in xe.Element("Tags").Elements())
//{
// var tag = vv.LoadTagFromXML();
// db.Tags.Add(tag.Id, tag);
//}
}
if
(
xe
.
Attribute
(
"MaxId"
)
!=
null
)
{
db
.
MaxId
=
int
.
Parse
(
xe
.
Attribute
(
"MaxId"
).
Value
);
...
...
Common/Cdy.Tag/Real/Tagbase.cs
浏览文件 @
30e490d8
...
...
@@ -26,6 +26,8 @@ namespace Cdy.Tag
/// </summary>
public
abstract
class
Tagbase
{
private
string
mFullName
;
private
string
mGroup
;
/// <summary>
/// 编号
/// </summary>
...
...
@@ -41,10 +43,19 @@ namespace Cdy.Tag
/// </summary>
public
string
Name
{
get
;
set
;
}
=
""
;
/// <summary>
///
/// </summary>
public
string
FullName
{
get
{
return
mFullName
;
}
private
set
{
mFullName
=
value
;
}
}
/// <summary>
/// 组
/// </summary>
public
string
Group
{
get
;
set
;
}
=
""
;
public
string
Group
{
get
{
return
mGroup
;
}
set
{
mGroup
=
value
;
UpdateFullName
();
}
}
/// <summary>
/// 描述
...
...
@@ -76,6 +87,22 @@ namespace Cdy.Tag
/// </summary>
public
ReadWriteMode
ReadWriteType
{
get
;
set
;
}
/// <summary>
///
/// </summary>
private
void
UpdateFullName
()
{
if
(
string
.
IsNullOrEmpty
(
Group
))
{
mFullName
=
Name
;
}
else
{
mFullName
=
Group
+
"."
+
Name
;
}
}
}
/// <summary>
...
...
@@ -315,6 +342,11 @@ namespace Cdy.Tag
}
return
re
;
}
public
static
Tagbase
Clone
(
this
Tagbase
tag
)
{
return
tag
.
SaveToXML
().
LoadTagFromXML
();
}
}
}
Develop/DBDevelopClientApi/DevelopServiceHelper.cs
浏览文件 @
30e490d8
...
...
@@ -758,13 +758,29 @@ namespace DBDevelopClientApi
/// <param name="database"></param>
/// <param name="name"></param>
/// <param name="parentName"></param>
public
bool
AddTagGroup
(
string
database
,
string
name
,
string
parentName
)
public
string
AddTagGroup
(
string
database
,
string
name
,
string
parentName
)
{
if
(
mCurrentClient
!=
null
&&
!
string
.
IsNullOrEmpty
(
mLoginId
))
{
return
mCurrentClient
.
AddTagGroup
(
new
DBDevelopService
.
AddGroupRequest
()
{
Database
=
database
,
LoginId
=
mLoginId
,
Name
=
name
,
ParentName
=
parentName
}).
Result
;
return
mCurrentClient
.
AddTagGroup
(
new
DBDevelopService
.
AddGroupRequest
()
{
Database
=
database
,
LoginId
=
mLoginId
,
Name
=
name
,
ParentName
=
parentName
}).
Group
;
}
return
false
;
return
string
.
Empty
;
}
/// <summary>
///
/// </summary>
/// <param name="database"></param>
/// <param name="sourceGroup"></param>
/// <param name="targetParentGroup"></param>
/// <returns></returns>
public
string
PasteTagGroup
(
string
database
,
string
sourceGroup
,
string
targetParentGroup
)
{
if
(
mCurrentClient
!=
null
&&
!
string
.
IsNullOrEmpty
(
mLoginId
))
{
return
mCurrentClient
.
PasteTagGroup
(
new
DBDevelopService
.
PasteGroupRequest
()
{
Database
=
database
,
LoginId
=
mLoginId
,
GroupFullName
=
sourceGroup
,
TargetParentName
=
targetParentGroup
}).
Group
;
}
return
string
.
Empty
;
}
/// <summary>
...
...
Develop/DBDevelopClientApi/developService.proto
浏览文件 @
30e490d8
...
...
@@ -91,7 +91,10 @@ service DevelopServer {
rpc
GetTagGroup
(
GetRequest
)
returns
(
GetTagGroupMessageReply
);
//
rpc
AddTagGroup
(
AddGroupRequest
)
returns
(
BoolResultReplay
);
rpc
AddTagGroup
(
AddGroupRequest
)
returns
(
AddGroupReplay
);
//粘贴组
rpc
PasteTagGroup
(
PasteGroupRequest
)
returns
(
PasteGroupReplay
);
//
rpc
RemoveTagGroup
(
RemoveGroupRequest
)
returns
(
BoolResultReplay
);
...
...
@@ -356,6 +359,22 @@ message UpdateHisTagRequestMessage
HisTagMessage
tag
=
3
;
}
//复制组
message
PasteGroupRequest
{
string
LoginId
=
1
;
string
Database
=
2
;
string
GroupFullName
=
3
;
string
TargetParentName
=
4
;
}
message
PasteGroupReplay
{
bool
Result
=
1
;
string
ErroMessage
=
2
;
string
Group
=
3
;
}
//添加组
message
AddGroupRequest
{
...
...
@@ -365,6 +384,13 @@ message AddGroupRequest
string
ParentName
=
4
;
}
message
AddGroupReplay
{
bool
Result
=
1
;
string
ErroMessage
=
2
;
string
Group
=
3
;
}
//通过名称删除用户
message
RemoveByNameRequest
{
...
...
Develop/DBDevelopService/Protos/developService.proto
浏览文件 @
30e490d8
...
...
@@ -91,7 +91,10 @@ service DevelopServer {
rpc
GetTagGroup
(
GetRequest
)
returns
(
GetTagGroupMessageReply
);
//
rpc
AddTagGroup
(
AddGroupRequest
)
returns
(
BoolResultReplay
);
rpc
AddTagGroup
(
AddGroupRequest
)
returns
(
AddGroupReplay
);
//粘贴组
rpc
PasteTagGroup
(
PasteGroupRequest
)
returns
(
PasteGroupReplay
);
//
rpc
RemoveTagGroup
(
RemoveGroupRequest
)
returns
(
BoolResultReplay
);
...
...
@@ -356,6 +359,22 @@ message UpdateHisTagRequestMessage
HisTagMessage
tag
=
3
;
}
//复制组
message
PasteGroupRequest
{
string
LoginId
=
1
;
string
Database
=
2
;
string
GroupFullName
=
3
;
string
TargetParentName
=
4
;
}
message
PasteGroupReplay
{
bool
Result
=
1
;
string
ErroMessage
=
2
;
string
Group
=
3
;
}
//添加组
message
AddGroupRequest
{
...
...
@@ -365,6 +384,13 @@ message AddGroupRequest
string
ParentName
=
4
;
}
message
AddGroupReplay
{
bool
Result
=
1
;
string
ErroMessage
=
2
;
string
Group
=
3
;
}
//通过名称删除用户
message
RemoveByNameRequest
{
...
...
Develop/DBDevelopService/Services/DevelopServerService.cs
浏览文件 @
30e490d8
...
...
@@ -599,21 +599,97 @@ namespace DBDevelopService
/// <param name="request"></param>
/// <param name="context"></param>
/// <returns></returns>
public
override
Task
<
BoolResult
Replay
>
AddTagGroup
(
AddGroupRequest
request
,
ServerCallContext
context
)
public
override
Task
<
AddGroup
Replay
>
AddTagGroup
(
AddGroupRequest
request
,
ServerCallContext
context
)
{
if
(!
CheckLoginId
(
request
.
LoginId
,
PermissionDocument
.
NewPermission
))
{
return
Task
.
FromResult
(
new
BoolResult
Replay
()
{
Result
=
false
});
return
Task
.
FromResult
(
new
AddGroup
Replay
()
{
Result
=
false
});
}
string
name
=
request
.
Name
;
string
parentName
=
request
.
ParentName
;
var
db
=
DbManager
.
Instance
.
GetDatabase
(
request
.
Database
);
if
(
db
!=
null
)
{
db
.
RealDatabase
.
CheckAndAddGroup
(
parentName
+
"."
+
name
);
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
true
});
var
vtg
=
db
.
RealDatabase
.
Groups
.
ContainsKey
(
request
.
ParentName
)
?
db
.
RealDatabase
.
Groups
[
request
.
ParentName
]
:
null
;
int
i
=
1
;
while
(
db
.
RealDatabase
.
HasChildGroup
(
vtg
,
name
))
{
name
=
request
.
Name
+
i
;
i
++;
}
string
ntmp
=
name
;
if
(!
string
.
IsNullOrEmpty
(
parentName
))
{
name
=
parentName
+
"."
+
name
;
}
db
.
RealDatabase
.
CheckAndAddGroup
(
name
);
return
Task
.
FromResult
(
new
AddGroupReplay
()
{
Result
=
true
,
Group
=
ntmp
});
}
return
Task
.
FromResult
(
new
AddGroupReplay
()
{
Result
=
false
,
ErroMessage
=
"database not exist!"
});
}
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="context"></param>
/// <returns></returns>
public
override
Task
<
PasteGroupReplay
>
PasteTagGroup
(
PasteGroupRequest
request
,
ServerCallContext
context
)
{
if
(!
CheckLoginId
(
request
.
LoginId
,
PermissionDocument
.
NewPermission
))
{
return
Task
.
FromResult
(
new
PasteGroupReplay
()
{
Result
=
false
});
}
var
db
=
DbManager
.
Instance
.
GetDatabase
(
request
.
Database
);
if
(
db
!=
null
)
{
var
tags
=
db
.
RealDatabase
.
GetTagsByGroup
(
request
.
GroupFullName
);
var
vtg
=
db
.
RealDatabase
.
Groups
.
ContainsKey
(
request
.
TargetParentName
)
?
db
.
RealDatabase
.
Groups
[
request
.
TargetParentName
]
:
null
;
var
vsg
=
db
.
RealDatabase
.
Groups
.
ContainsKey
(
request
.
GroupFullName
)
?
db
.
RealDatabase
.
Groups
[
request
.
GroupFullName
]
:
null
;
if
(
vtg
==
vsg
)
{
return
Task
.
FromResult
(
new
PasteGroupReplay
()
{
Result
=
false
});
}
string
sname
=
vsg
.
Name
;
int
i
=
1
;
while
(
db
.
RealDatabase
.
HasChildGroup
(
vtg
,
sname
))
{
sname
=
vsg
.
Name
+
i
;
i
++;
}
Cdy
.
Tag
.
TagGroup
tgg
=
vsg
!=
null
?
new
Cdy
.
Tag
.
TagGroup
()
{
Name
=
sname
,
Parent
=
vtg
}
:
null
;
if
(
tgg
==
null
)
return
Task
.
FromResult
(
new
PasteGroupReplay
()
{
Result
=
false
});
tgg
=
db
.
RealDatabase
.
CheckAndAddGroup
(
tgg
.
FullName
);
foreach
(
var
vv
in
tags
)
{
var
tmp
=
vv
.
Clone
();
tmp
.
Group
=
tgg
.
FullName
;
db
.
RealDatabase
.
Append
(
tmp
);
var
vid
=
vv
.
Id
;
if
(
db
.
HisDatabase
.
HisTags
.
ContainsKey
(
vid
))
{
var
vhis
=
db
.
HisDatabase
.
HisTags
[
vid
].
Clone
();
vhis
.
Id
=
tmp
.
Id
;
db
.
HisDatabase
.
AddHisTags
(
vhis
);
}
}
return
Task
.
FromResult
(
new
PasteGroupReplay
()
{
Result
=
true
,
Group
=
sname
});
}
return
Task
.
FromResult
(
new
BoolResultReplay
()
{
Result
=
false
,
ErroMessage
=
"database not exist!"
});
return
Task
.
FromResult
(
new
PasteGroupReplay
()
{
Result
=
false
,
ErroMessage
=
"database not exist!"
});
}
/// <summary>
...
...
Develop/DbManager.Desktop/DBInStudio.Desktop.csproj
浏览文件 @
30e490d8
...
...
@@ -21,6 +21,7 @@
<None Remove="Image\export.png" />
<None Remove="Image\hidden.png" />
<None Remove="Image\import.png" />
<None Remove="Image\mrdbd.ico" />
<None Remove="Image\permissions.png" />
<None Remove="Image\save.png" />
<None Remove="Image\Security.png" />
...
...
@@ -41,6 +42,7 @@
<Resource Include="Image\export.png" />
<Resource Include="Image\hidden.png" />
<Resource Include="Image\import.png" />
<Resource Include="Image\mrdbd.ico" />
<Resource Include="Image\permissions.png" />
<Resource Include="Image\save.png" />
<Resource Include="Image\Security.png" />
...
...
Develop/DbManager.Desktop/Image/mrdbd.ico
0 → 100644
浏览文件 @
30e490d8
41.3 KB
Develop/DbManager.Desktop/MainWindow.xaml
浏览文件 @
30e490d8
...
...
@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:DBInStudio.Desktop"
mc:Ignorable="d"
Title="{local:ResMarker MainwindowTitle}" Height="450" Width="800" WindowState="Maximized" WindowStartupLocation="CenterScreen" Icon="/Image/
Database2.png
">
Title="{local:ResMarker MainwindowTitle}" Height="450" Width="800" WindowState="Maximized" WindowStartupLocation="CenterScreen" Icon="/Image/
mrdbd.ico
">
<Window.Resources>
<local:IndexConverter x:Key="ic" />
<BooleanToVisibilityConverter x:Key="btv" />
...
...
@@ -139,10 +139,18 @@
</Style>
<ContextMenu x:Key="groupMenu">
<MenuItem Header="{local:ResMarker Add}" Command="{Binding
DataContext.AddCommand,RelativeSource={RelativeSource AncestorType=Window,Mode=FindAncestor}
}" />
<MenuItem Header="{local:ResMarker Remove}" Command="{Binding
DataContext.RemoveCommand,RelativeSource={RelativeSource AncestorType=Window,Mode=FindAncestor}
}" />
<MenuItem Header="{local:ResMarker Add}" Command="{Binding
AddCommand
}" />
<MenuItem Header="{local:ResMarker Remove}" Command="{Binding
RemoveCommand
}" />
<MenuItem Header="{local:ResMarker ReName}" Command="{Binding ReNameCommand}" />
<MenuItem Header="{local:ResMarker Copy}" Command="{Binding CopyCommand}" />
<MenuItem Header="{local:ResMarker Paste}" Command="{Binding PasteCommand}" />
</ContextMenu>
<ContextMenu x:Key="rootgroupMenu">
<MenuItem Header="{local:ResMarker Add}" Command="{Binding AddCommand}" />
<MenuItem Header="{local:ResMarker Paste}" Command="{Binding PasteCommand}" />
</ContextMenu>
<HierarchicalDataTemplate DataType="{x:Type local:TagGroupViewModel}" ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal" Height="24">
<Image Focusable="False" Source="/Image/文件夹.png" Margin="0,0,4,0" Height="18" VerticalAlignment="Center" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
...
...
@@ -161,7 +169,7 @@
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type local:RootTagGroupViewModel}" ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal" Height="24">
<StackPanel
ContextMenu="{StaticResource rootgroupMenu}"
Orientation="Horizontal" Height="24">
<Image Focusable="False" Source="/Image/文件夹.png" VerticalAlignment="Center" Margin="0,0,4,0" Height="18" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" />
</StackPanel>
...
...
Develop/DbManager.Desktop/Properties/Resources.Designer.cs
浏览文件 @
30e490d8
...
...
@@ -123,6 +123,15 @@ namespace DBInStudio.Desktop.Properties {
}
}
/// <summary>
/// 查找类似 Copy 的本地化字符串。
/// </summary>
internal
static
string
Copy
{
get
{
return
ResourceManager
.
GetString
(
"Copy"
,
resourceCulture
);
}
}
/// <summary>
/// 查找类似 Database select 的本地化字符串。
/// </summary>
...
...
@@ -357,6 +366,15 @@ namespace DBInStudio.Desktop.Properties {
}
}
/// <summary>
/// 查找类似 Paste 的本地化字符串。
/// </summary>
internal
static
string
Paste
{
get
{
return
ResourceManager
.
GetString
(
"Paste"
,
resourceCulture
);
}
}
/// <summary>
/// 查找类似 Percent 的本地化字符串。
/// </summary>
...
...
Develop/DbManager.Desktop/Properties/Resources.resx
浏览文件 @
30e490d8
...
...
@@ -138,6 +138,9 @@
<data
name=
"Convert"
xml:space=
"preserve"
>
<value>
Convert
</value>
</data>
<data
name=
"Copy"
xml:space=
"preserve"
>
<value>
Copy
</value>
</data>
<data
name=
"databaseSelect"
xml:space=
"preserve"
>
<value>
Database select
</value>
<comment>
List database View Title
</comment>
...
...
@@ -218,6 +221,9 @@
<data
name=
"Password"
xml:space=
"preserve"
>
<value>
Password
</value>
</data>
<data
name=
"Paste"
xml:space=
"preserve"
>
<value>
Paste
</value>
</data>
<data
name=
"PercentValue"
xml:space=
"preserve"
>
<value>
Percent
</value>
</data>
...
...
Develop/DbManager.Desktop/View/Convert/IndexConverter.cs
浏览文件 @
30e490d8
...
...
@@ -110,4 +110,47 @@ namespace DBInStudio.Desktop
}
}
/// <summary>
///
/// </summary>
public
class
DoubleValueConvert
:
IValueConverter
{
public
object
Convert
(
object
value
,
Type
targetType
,
object
parameter
,
CultureInfo
culture
)
{
double
dtmp
=
(
double
)
value
;
if
(
dtmp
==
double
.
MaxValue
)
{
return
"Max"
;
}
else
if
(
dtmp
==
double
.
MinValue
)
{
return
"Min"
;
}
else
{
return
dtmp
;
}
}
public
object
ConvertBack
(
object
value
,
Type
targetType
,
object
parameter
,
CultureInfo
culture
)
{
if
(
value
is
double
)
{
return
value
;
}
else
{
if
(
value
.
ToString
().
Equals
(
"Max"
,
StringComparison
.
InvariantCultureIgnoreCase
))
{
return
double
.
MaxValue
;
}
else
if
(
value
.
ToString
().
Equals
(
"Min"
,
StringComparison
.
InvariantCultureIgnoreCase
))
{
return
double
.
MinValue
;
}
return
double
.
Parse
(
value
.
ToString
());
}
}
}
}
Develop/DbManager.Desktop/View/ListDatabaseView.xaml
浏览文件 @
30e490d8
...
...
@@ -7,13 +7,77 @@
xmlns:res="clr-namespace:DBInStudio.Desktop"
mc:Ignorable="d"
d:DesignHeight="200" d:DesignWidth="500">
<UserControl.Resources>
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" StrokeDashArray="1 2" SnapsToDevicePixels="true" StrokeThickness="1" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<SolidColorBrush x:Key="Item.MouseOver.Background" Color="#1F26A0DA"/>
<SolidColorBrush x:Key="Item.MouseOver.Border" Color="#a826A0Da"/>
<SolidColorBrush x:Key="Item.SelectedActive.Background" Color="#3D26A0DA"/>
<SolidColorBrush x:Key="Item.SelectedActive.Border" Color="#FF26A0DA"/>
<SolidColorBrush x:Key="Item.SelectedInactive.Background" Color="#3D26A0DA"/>
<SolidColorBrush x:Key="Item.SelectedInactive.Border" Color="#FF26A0DA"/>
<Style x:Key="ListBoxItemContainerStyle1" TargetType="{x:Type ListBoxItem}">
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Padding" Value="4,1"/>
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="Bd" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.MouseOver.Background}"/>
<Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.MouseOver.Border}"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Selector.IsSelectionActive" Value="False"/>
<Condition Property="IsSelected" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Background}"/>
<Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Border}"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Selector.IsSelectionActive" Value="True"/>
<Condition Property="IsSelected" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.SelectedActive.Background}"/>
<Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.SelectedActive.Border}"/>
</MultiTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="32"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Margin="10,0" Text="{res:ResMarker SelectDatabase}" HorizontalAlignment="Left" VerticalAlignment="Center" />
<ListBox Margin="-1" Grid.Row="1" ItemsSource="{Binding DatabaseItems}" SelectedItem="{Binding SelectDatabase,Mode=TwoWay}">
<ListBox
ItemContainerStyle="{DynamicResource ListBoxItemContainerStyle1}"
Margin="-1" Grid.Row="1" ItemsSource="{Binding DatabaseItems}" SelectedItem="{Binding SelectDatabase,Mode=TwoWay}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid MinHeight="28">
...
...
Develop/DbManager.Desktop/View/TagGroupDetailView.xaml
浏览文件 @
30e490d8
...
...
@@ -10,9 +10,96 @@
<local:IndexConverter x:Key="ic" />
<BooleanToVisibilityConverter x:Key="btv" />
<local:BoolInvertConvert x:Key="biv" />
<local:DoubleValueConvert x:Key="dvc" />
<ContextMenu x:Key="ctxmenu">
<MenuItem Header="{local:ResMarker Add}" Command="{Binding AddCommand}" />
<MenuItem Header="{local:ResMarker Remove}" Command="{Binding RemoveCommand}" />
<MenuItem Header="{local:ResMarker Import}" Command="{Binding ImportCommand}" />
<MenuItem Header="{local:ResMarker Export}" Command="{Binding ExportCommand}" />
<MenuItem Header="{local:ResMarker Copy}" Command="{Binding CopyCommand}" />
<MenuItem Header="{local:ResMarker Paste}" Command="{Binding PasteCommand}" />
</ContextMenu>
<Style x:Key="DataGridRowStyle1" TargetType="{x:Type DataGridRow}">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
<Setter Property="ValidationErrorTemplate">
<Setter.Value>
<ControlTemplate>
<TextBlock Foreground="Red" Margin="2,0,0,0" Text="!" VerticalAlignment="Center"/>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridRow}">
<Border x:Name="DGR_Border" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" SnapsToDevicePixels="True">
<SelectiveScrollingGrid>
<SelectiveScrollingGrid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</SelectiveScrollingGrid.ColumnDefinitions>
<SelectiveScrollingGrid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</SelectiveScrollingGrid.RowDefinitions>
<DataGridCellsPresenter Grid.Column="1" ItemsPanel="{TemplateBinding ItemsPanel}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<DataGridDetailsPresenter Grid.Column="1" Grid.Row="1" SelectiveScrollingGrid.SelectiveScrollingOrientation="{Binding AreRowDetailsFrozen, Converter={x:Static DataGrid.RowDetailsScrollingConverter}, ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Visibility="{TemplateBinding DetailsVisibility}"/>
<DataGridRowHeader Grid.RowSpan="2" SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{Binding HeadersVisibility, Converter={x:Static DataGrid.HeadersVisibilityConverter}, ConverterParameter={x:Static DataGridHeadersVisibility.Row}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</SelectiveScrollingGrid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsNewItem" Value="True">
<Setter Property="Margin" Value="{Binding NewItemMargin, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</Trigger>
</Style.Triggers>
</Style>
<SolidColorBrush x:Key="{x:Static DataGrid.FocusBorderBrushKey}" Color="#FF000000"/>
<Style x:Key="DataGridCellStyle1" TargetType="{x:Type DataGridCell}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" SnapsToDevicePixels="True">
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
</Trigger>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static DataGrid.FocusBorderBrushKey}}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid>
<DataGrid ScrollViewer.CanContentScroll="True" VerticalScrollBarVisibility="Auto" ScrollViewer.ScrollChanged="DataGrid_ScrollChanged" VirtualizingPanel.IsVirtualizing="True" RowDetailsVisibilityMode="VisibleWhenSelected" MinRowHeight="24" Margin="0,0,0,32" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding SelectGroupTags}" SelectedItem="{Binding CurrentSelectTag,Mode=TwoWay}" BorderThickness="0,0,0,1" Background="{x:Null}" >
<Grid.InputBindings>
<KeyBinding Command="{Binding CopyCommand}" Key="C" Modifiers="Ctrl" />
<KeyBinding Command="{Binding PasteCommand}" Key="C" Modifiers="Ctrl" />
<KeyBinding Command="{Binding RemoveCommand}" Key="Delete" />
<KeyBinding Command="{Binding AddCommand}" Key="A" Modifiers="Alt" />
<KeyBinding Command="{Binding ImportCommand}" Key="I" Modifiers="Alt" />
<KeyBinding Command="{Binding ExportCommand}" Key="O" Modifiers="Alt" />
</Grid.InputBindings>
<DataGrid CellStyle="{DynamicResource DataGridCellStyle1}" RowStyle="{DynamicResource DataGridRowStyle1}" ScrollViewer.CanContentScroll="True" ContextMenu="{StaticResource ctxmenu}" VerticalScrollBarVisibility="Auto" ScrollViewer.ScrollChanged="DataGrid_ScrollChanged" VirtualizingPanel.IsVirtualizing="True" RowDetailsVisibilityMode="VisibleWhenSelected" MinRowHeight="24" Margin="0,0,0,32" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding SelectGroupTags}" SelectedItem="{Binding CurrentSelectTag,Mode=TwoWay}" BorderThickness="0,0,0,1" Background="{x:Null}" >
<DataGrid.Columns>
<DataGridTemplateColumn IsReadOnly="True" Width="Auto" MinWidth="30" Header="{local:ResMarker Id}">
<DataGridTemplateColumn.CellTemplate>
...
...
@@ -21,8 +108,7 @@
<TextBlock.Text>
<MultiBinding Converter="{StaticResource ic}">
<Binding />
<Binding Path="ItemsSource" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGrid}}" />
<Binding Path="ItemsSource.Count" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGrid}}" />
<Binding Path="DataContext.SelectGroupTags" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGrid}}" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
...
...
@@ -80,21 +166,21 @@
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="5,0" Text="{Binding ConvertString}" VerticalAlignment="Center" />
<Button Content="..." VerticalAlignment="Center" VerticalContentAlignment="Top" C
lick
="{Binding ConvertEditCommand}" Width="30" />
<Button Content="..." VerticalAlignment="Center" VerticalContentAlignment="Top" C
ommand
="{Binding ConvertEditCommand}" Width="30" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="{local:ResMarker MaxValue}" MinWidth="100" IsReadOnly="{Binding IsNumberTag,Converter={StaticResource biv}}">
<DataGridTemplateColumn Header="{local:ResMarker MaxValue}" MinWidth="100"
IsReadOnly="{Binding IsNumberTag,Converter={StaticResource biv}}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="5,0" Text="{Binding MaxValue}" VerticalAlignment="Center" />
<TextBlock Margin="5,0" Text="{Binding MaxValue
,Converter={StaticResource dvc}}" IsEnabled="{Binding IsNumberTag
}" VerticalAlignment="Center" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<TextBox Margin="5,0" Text="{Binding MaxValue,Mode=TwoWay,UpdateSourceTrigger=LostFocus}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" />
<TextBox Margin="5,0" Text="{Binding MaxValue,Mode=TwoWay,UpdateSourceTrigger=LostFocus
,Converter={StaticResource dvc}}" IsEnabled="{Binding IsNumberTag
}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" />
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
...
...
@@ -102,12 +188,12 @@
<DataGridTemplateColumn Header="{local:ResMarker MinValue}" MinWidth="100" IsReadOnly="{Binding IsNumberTag,Converter={StaticResource biv}}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="5,0"
Text="{Binding MinValue
}" VerticalAlignment="Center" />
<TextBlock Margin="5,0"
IsEnabled="{Binding IsNumberTag}" Text="{Binding MinValue,Converter={StaticResource dvc}
}" VerticalAlignment="Center" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<TextBox Margin="5,0"
Text="{Binding MinValue,Mode=TwoWay,UpdateSourceTrigger=LostFocus
}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" />
<TextBox Margin="5,0"
IsEnabled="{Binding IsNumberTag}" Text="{Binding MinValue,Mode=TwoWay,UpdateSourceTrigger=LostFocus,Converter={StaticResource dvc}
}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" />
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
...
...
@@ -115,12 +201,12 @@
<DataGridTemplateColumn Header="{local:ResMarker Precision}" MinWidth="100" IsReadOnly="{Binding IsFloatingTag,Converter={StaticResource biv}}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="5,0" Text="{Binding Precision}" VerticalAlignment="Center" />
<TextBlock Margin="5,0" Text="{Binding Precision}"
IsEnabled="{Binding IsFloatingTag}"
VerticalAlignment="Center" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<TextBox Margin="5,0" Text="{Binding Precision,Mode=TwoWay,UpdateSourceTrigger=LostFocus}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" />
<TextBox Margin="5,0" Text="{Binding Precision,Mode=TwoWay,UpdateSourceTrigger=LostFocus}"
IsEnabled="{Binding IsFloatingTag}"
VerticalAlignment="Stretch" VerticalContentAlignment="Center" />
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
...
...
Develop/DbManager.Desktop/View/TagGroupDetailView.xaml.cs
浏览文件 @
30e490d8
using
DBInStudio.Desktop.ViewModel
;
using
System
;
using
System.Collections.Generic
;
using
System.Globalization
;
using
System.Text
;
using
System.Windows
;
using
System.Windows.Controls
;
...
...
@@ -34,4 +35,7 @@ namespace DBInStudio.Desktop.View
}
}
Develop/DbManager.Desktop/ViewModel/ITreeViewModel.cs
浏览文件 @
30e490d8
...
...
@@ -9,6 +9,7 @@
using
System
;
using
System.Collections.Generic
;
using
System.Net.Http.Headers
;
using
System.Text
;
using
System.Windows.Input
;
...
...
@@ -22,8 +23,11 @@ namespace DBInStudio.Desktop
private
bool
mIsSelected
=
false
;
private
bool
mIsExpanded
=
false
;
private
bool
mIsEdit
;
private
ICommand
mAddCommand
;
private
ICommand
mRenameCommand
;
private
ICommand
mRemoveCommand
;
private
ICommand
mCopyCommand
;
private
ICommand
mPasteCommand
;
private
TreeItemViewModel
mParent
;
#
endregion
...
Variables
...
...
...
@@ -36,6 +40,54 @@ namespace DBInStudio.Desktop
#
endregion
...
Constructor
...
#
region
...
Properties
...
public
ICommand
AddCommand
{
get
{
if
(
mAddCommand
==
null
)
{
mAddCommand
=
new
RelayCommand
(()
=>
{
Add
();
},()=>
{
return
CanAdd
();
});
}
return
mAddCommand
;
}
}
/// <summary>
///
/// </summary>
public
ICommand
CopyCommand
{
get
{
if
(
mCopyCommand
==
null
)
{
mCopyCommand
=
new
RelayCommand
(()
=>
{
Copy
();
},()=>
{
return
CanCopy
();
});
}
return
mCopyCommand
;
}
}
/// <summary>
///
/// </summary>
public
ICommand
PasteCommand
{
get
{
if
(
mPasteCommand
==
null
)
{
mPasteCommand
=
new
RelayCommand
(()
=>
{
Paste
();
},()=>
{
return
CanPaste
();
});
}
return
mPasteCommand
;
}
}
/// <summary>
///
/// </summary>
...
...
@@ -79,15 +131,18 @@ namespace DBInStudio.Desktop
}
}
public
ICommand
ReMoveCommand
/// <summary>
///
/// </summary>
public
ICommand
RemoveCommand
{
get
{
if
(
mRemoveCommand
==
null
)
{
mRemoveCommand
=
new
RelayCommand
(()
=>
{
IsEdit
=
true
;
});
Remove
()
;
}
,()=>
{
return
CanRemove
();
}
);
}
return
mRemoveCommand
;
}
...
...
@@ -176,6 +231,58 @@ namespace DBInStudio.Desktop
#
region
...
Methods
...
/// <summary>
///
/// </summary>
public
virtual
void
Add
()
{
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public
virtual
bool
CanAdd
()
{
return
false
;
}
/// <summary>
///
/// </summary>
public
virtual
void
Copy
()
{
}
/// <summary>
///
/// </summary>
public
virtual
void
Paste
()
{
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public
virtual
bool
CanCopy
()
{
return
true
;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public
virtual
bool
CanPaste
()
{
return
false
;
}
public
virtual
bool
CanAddChild
()
{
return
true
;
...
...
Develop/DbManager.Desktop/ViewModel/MainViewModel.cs
浏览文件 @
30e490d8
...
...
@@ -19,10 +19,11 @@ using System.Windows;
using
DBDevelopClientApi
;
using
Microsoft.Win32
;
using
System.IO
;
using
Cdy.Tag
;
namespace
DBInStudio.Desktop
{
public
class
MainViewModel
:
ViewModelBase
public
class
MainViewModel
:
ViewModelBase
,
ITagGroupAdd
{
#
region
...
Variables
...
...
...
@@ -64,6 +65,13 @@ namespace DBInStudio.Desktop
#
endregion
...
Events
...
#
region
...
Constructor
...
/// <summary>
///
/// </summary>
public
MainViewModel
()
{
ServiceLocator
.
Locator
.
Registor
<
ITagGroupAdd
>(
this
);
}
#
endregion
...
Constructor
...
...
...
@@ -226,7 +234,7 @@ namespace DBInStudio.Desktop
if
(
mRemoveGroupCommand
==
null
)
{
mRemoveGroupCommand
=
new
RelayCommand
(()
=>
{
(
CurrentSelectGroup
).
Re
M
oveCommand
.
Execute
(
null
);
(
CurrentSelectGroup
).
Re
m
oveCommand
.
Execute
(
null
);
},()=>
{
return
CurrentSelectGroup
!=
null
&&
CurrentSelectGroup
.
CanRemove
()
;
});
}
return
mRemoveGroupCommand
;
...
...
@@ -372,26 +380,31 @@ namespace DBInStudio.Desktop
}
}
/// <summary>
///
/// </summary>
private
void
NewGroup
()
public
bool
AddGroup
(
string
parent
)
{
string
sparent
=
mCurrentSelectTreeItem
!=
null
&&
mCurrentSelectTreeItem
is
TagGroupViewModel
?
(
mCurrentSelectTreeItem
as
TagGroupViewModel
).
FullName
:
string
.
Empty
;
string
name
=
GetNewGroupName
(
);
if
(
DevelopServiceHelper
.
Helper
.
AddTagGroup
(
mDatabase
,
name
,
sparent
))
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
()
{
Name
=
name
,
Parent
=
(
mCurrentSelectTreeItem
as
TagGroupViewModel
)
});
(
mCurrentSelectTreeItem
as
TagGroupViewModel
).
Children
.
Add
(
new
TagGroupViewModel
()
{
mName
=
chileName
,
Parent
=
(
mCurrentSelectTreeItem
as
TagGroupViewModel
),
Database
=
this
.
mDatabase
});
}
else
{
this
.
TagGroup
.
Add
(
new
TagGroupViewModel
()
{
Name
=
nam
e
});
this
.
TagGroup
.
Add
(
new
TagGroupViewModel
()
{
Name
=
chileName
,
Database
=
this
.
mDatabas
e
});
}
}
return
false
;
}
/// <summary>
///
/// </summary>
private
void
NewGroup
()
{
string
sparent
=
mCurrentSelectTreeItem
!=
null
&&
mCurrentSelectTreeItem
is
TagGroupViewModel
?
(
mCurrentSelectTreeItem
as
TagGroupViewModel
).
FullName
:
string
.
Empty
;
AddGroup
(
sparent
);
}
/// <summary>
...
...
@@ -526,4 +539,10 @@ namespace DBInStudio.Desktop
#
endregion
...
Interfaces
...
}
public
interface
ITagGroupAdd
{
bool
AddGroup
(
string
parent
);
}
}
Develop/DbManager.Desktop/ViewModel/TagGroupDetailViewModel.cs
浏览文件 @
30e490d8
...
...
@@ -34,6 +34,9 @@ namespace DBInStudio.Desktop.ViewModel
private
ICommand
mImportCommand
;
private
ICommand
mExportCommand
;
private
ICommand
mCopyCommand
;
private
ICommand
mPasteCommand
;
private
TagViewModel
mCurrentSelectTag
;
private
int
mTotalPageNumber
=
0
;
...
...
@@ -41,6 +44,8 @@ namespace DBInStudio.Desktop.ViewModel
private
bool
mIsLoading
=
false
;
private
static
List
<
TagViewModel
>
mCopyTags
=
new
List
<
TagViewModel
>();
#
endregion
...
Variables
...
#
region
...
Events
...
...
...
@@ -72,6 +77,36 @@ namespace DBInStudio.Desktop.ViewModel
}
}
public
ICommand
CopyCommand
{
get
{
if
(
mCopyCommand
==
null
)
{
mCopyCommand
=
new
RelayCommand
(()
=>
{
CopyTag
();
});
}
return
mCopyCommand
;
}
}
/// <summary>
///
/// </summary>
public
ICommand
PasteCommand
{
get
{
if
(
mPasteCommand
==
null
)
{
mPasteCommand
=
new
RelayCommand
(()
=>
{
PasteTag
();
},()=>
{
return
mCopyTags
.
Count
>
0
;
});
}
return
mPasteCommand
;
}
}
/// <summary>
///
...
...
@@ -298,7 +333,8 @@ namespace DBInStudio.Desktop.ViewModel
if
(
mTotalPageNumber
==
-
1
)
{
var
vtags
=
new
System
.
Collections
.
ObjectModel
.
ObservableCollection
<
TagViewModel
>();
SelectGroupTags
.
Clear
();
// var vtags = new System.Collections.ObjectModel.ObservableCollection<TagViewModel>();
mCurrentPageIndex
=
0
;
var
vv
=
DevelopServiceHelper
.
Helper
.
QueryTagByGroup
(
this
.
GroupModel
.
Database
,
this
.
GroupModel
.
FullName
,
mCurrentPageIndex
,
out
mTotalPageNumber
);
...
...
@@ -307,10 +343,9 @@ namespace DBInStudio.Desktop.ViewModel
foreach
(
var
vvv
in
vv
)
{
TagViewModel
model
=
new
TagViewModel
(
vvv
.
Value
.
Item1
,
vvv
.
Value
.
Item2
);
vt
ags
.
Add
(
model
);
SelectGroupT
ags
.
Add
(
model
);
}
}
SelectGroupTags
=
vtags
;
}
else
{
...
...
@@ -375,6 +410,36 @@ namespace DBInStudio.Desktop.ViewModel
}
}
private
void
CopyTag
()
{
mCopyTags
.
Clear
();
foreach
(
var
vv
in
mSelectGroupTags
.
Where
(
e
=>
e
.
IsSelected
))
{
mCopyTags
.
Add
(
vv
);
}
}
private
void
PasteTag
()
{
if
(
mCopyTags
.
Count
>
0
)
{
TagViewModel
tm
=
null
;
foreach
(
var
vv
in
mCopyTags
)
{
var
vtag
=
vv
.
Clone
();
vtag
.
Name
=
GetNewName
(
vv
.
Name
);
vtag
.
IsNew
=
true
;
if
(
UpdateTag
(
vtag
))
{
this
.
SelectGroupTags
.
Add
(
vtag
);
tm
=
vtag
;
}
}
if
(
tm
!=
null
)
CurrentSelectTag
=
tm
;
}
}
/// <summary>
///
/// </summary>
...
...
@@ -411,13 +476,13 @@ namespace DBInStudio.Desktop.ViewModel
///
/// </summary>
/// <returns></returns>
private
string
GetNewName
()
private
string
GetNewName
(
string
baseName
=
"tag"
)
{
var
vtmps
=
mSelectGroupTags
.
Select
(
e
=>
e
.
Name
).
ToList
();
string
tagName
=
"tag"
;
string
tagName
=
baseName
;
for
(
int
i
=
1
;
i
<
int
.
MaxValue
;
i
++)
{
tagName
=
"tag"
+
i
;
tagName
=
baseName
+
i
;
if
(!
vtmps
.
Contains
(
tagName
))
{
return
tagName
;
...
...
Develop/DbManager.Desktop/ViewModel/TagViewModel.cs
浏览文件 @
30e490d8
...
...
@@ -49,6 +49,8 @@ namespace DBInStudio.Desktop
private
ICommand
mConvertEditCommand
;
private
bool
mIsSelected
;
#
endregion
...
Variables
...
#
region
...
Events
...
...
...
@@ -92,6 +94,19 @@ namespace DBInStudio.Desktop
/// </summary>
public
bool
IsChanged
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
bool
IsSelected
{
get
{
return
mIsSelected
;
}
set
{
mIsSelected
=
value
;
OnPropertyChanged
(
"IsSelected"
);
}
}
/// <summary>
/// 是否新建
/// </summary>
...
...
@@ -297,6 +312,7 @@ namespace DBInStudio.Desktop
IsChanged
=
true
;
OnPropertyChanged
(
"Type"
);
OnPropertyChanged
(
"TypeString"
);
OnPropertyChanged
(
"IsNumberTag"
);
}
}
}
...
...
@@ -1087,7 +1103,7 @@ namespace DBInStudio.Desktop
{
#
region
...
Variables
...
public
static
TagGroupViewModel
CopyTarget
{
get
;
set
;
}
#
endregion
...
Variables
...
#
region
...
Events
...
...
...
@@ -1107,6 +1123,38 @@ namespace DBInStudio.Desktop
#
region
...
Methods
...
/// <summary>
///
/// </summary>
/// <returns></returns>
public
override
bool
CanPaste
()
{
return
CopyTarget
!=
null
&&
!(
this
.
FullName
.
Contains
(
CopyTarget
.
FullName
)
||
(
CopyTarget
.
FullName
.
Contains
(
this
.
FullName
)&&!
string
.
IsNullOrEmpty
(
this
.
FullName
)));
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public
override
bool
CanCopy
()
{
return
true
;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public
override
bool
CanAdd
()
{
return
true
;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public
override
bool
CanRemove
()
{
return
true
;
...
...
@@ -1125,9 +1173,42 @@ namespace DBInStudio.Desktop
(
Parent
as
HasChildrenTreeItemViewModel
).
Children
.
Remove
(
this
);
Parent
=
null
;
}
if
(
CopyTarget
==
this
)
CopyTarget
=
null
;
}
}
/// <summary>
///
/// </summary>
public
override
void
Add
()
{
ServiceLocator
.
Locator
.
Resolve
<
ITagGroupAdd
>().
AddGroup
(
this
.
FullName
);
base
.
Add
();
}
/// <summary>
///
/// </summary>
public
override
void
Copy
()
{
CopyTarget
=
this
;
}
/// <summary>
///
/// </summary>
public
override
void
Paste
()
{
string
sgroup
=
DevelopServiceHelper
.
Helper
.
PasteTagGroup
(
Database
,
CopyTarget
.
FullName
,
FullName
);
if
(!
string
.
IsNullOrEmpty
(
sgroup
))
{
this
.
Children
.
Add
(
new
TagGroupViewModel
()
{
Database
=
this
.
Database
,
mName
=
sgroup
});
}
}
/// <summary>
///
/// </summary>
...
...
@@ -1147,7 +1228,7 @@ namespace DBInStudio.Desktop
{
foreach
(
var
vv
in
groups
.
Where
(
e
=>
e
.
Value
==
this
.
FullName
))
{
TagGroupViewModel
groupViewModel
=
new
TagGroupViewModel
()
{
Name
=
vv
.
Key
,
Database
=
Database
};
TagGroupViewModel
groupViewModel
=
new
TagGroupViewModel
()
{
m
Name
=
vv
.
Key
,
Database
=
Database
};
groupViewModel
.
Parent
=
this
;
this
.
Children
.
Add
(
groupViewModel
);
}
...
...
@@ -1185,9 +1266,18 @@ namespace DBInStudio.Desktop
///
/// </summary>
public
override
string
FullName
=>
string
.
Empty
;
#
endregion
...
Properties
...
#
region
...
Methods
...
public
override
bool
CanCopy
()
{
return
false
;
}
/// <summary>
///
/// </summary>
...
...
Driver/SpiderDriver.ClientApi/SpiderDriver.ClientApi.csproj
浏览文件 @
30e490d8
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
...
...
@@ -9,4 +9,8 @@
<ProjectReference Include="..\..\Common\Cdy.Tag\Cdy.Tag.csproj" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy "$(TargetPath)" "$(SolutionDir)\Output" /y
copy "$(TargetDir)Config\*.cfg" "$(SolutionDir)\Output\Config" /y
if exist "$(TargetDir)$(TargetName).XML" copy "$(TargetDir)$(TargetName).XML" "$(SolutionDir)\Output\Xml" /y
if exist "$(TargetDir)$(TargetName).pdb" copy "$(TargetDir)$(TargetName).pdb" "$(SolutionDir)\Output" /y" />
</Target>
</Project>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录