提交 4b5f6009 编写于 作者: cdy816's avatar cdy816

深色主题修改以及增加变量按条件查询功能

上级 fae53a10
......@@ -61,7 +61,7 @@ namespace Cdy.Tag
///
/// </summary>
/// <returns></returns>
ICollection<Tagbase> ListAllTags();
IEnumerable<Tagbase> ListAllTags();
}
}
......@@ -676,7 +676,7 @@ namespace Cdy.Tag
///
/// </summary>
/// <returns></returns>
public ICollection<Tagbase> ListAllTags()
public IEnumerable<Tagbase> ListAllTags()
{
return Tags.Values;
}
......
......@@ -777,14 +777,14 @@ namespace DBDevelopClientApi
/// <param name="database"></param>
/// <param name="group"></param>
/// <param name="callback"></param>
public void QueryTagByGroup(string database, string group, Action<int, int, Dictionary<int, Tuple<Cdy.Tag.Tagbase, Cdy.Tag.HisTag>>> callback)
public void QueryTagByGroup(string database, string group, Action<int, int, Dictionary<int, Tuple<Cdy.Tag.Tagbase, Cdy.Tag.HisTag>>> callback, Dictionary<string, string> mFilters = null)
{
int idx = 0;
int totalcount=0;
int tagcount;
do
{
var re = QueryTagByGroup(database, group, idx, out totalcount, out tagcount);
var re = QueryTagByGroup(database, group, idx, out totalcount, out tagcount,mFilters);
callback(idx, totalcount, re);
idx++;
}
......@@ -799,13 +799,22 @@ namespace DBDevelopClientApi
/// <param name="totalCount"></param>
/// <param name="index"></param>
/// <returns></returns>
public Dictionary<int, Tuple<Cdy.Tag.Tagbase, Cdy.Tag.HisTag>> QueryTagByGroup(string database, string group, int index, out int totalCount,out int tagCount)
public Dictionary<int, Tuple<Cdy.Tag.Tagbase, Cdy.Tag.HisTag>> QueryTagByGroup(string database, string group, int index, out int totalCount,out int tagCount,Dictionary<string,string> mFilters=null)
{
Dictionary<int, Tuple<Cdy.Tag.Tagbase, Cdy.Tag.HisTag>> re = new Dictionary<int, Tuple<Cdy.Tag.Tagbase, Cdy.Tag.HisTag>>();
if (mCurrentClient != null && !string.IsNullOrEmpty(mLoginId))
{
int idx = index;
var result = mCurrentClient.GetTagByGroup(new DBDevelopService.GetTagByGroupRequest() { Database = database, LoginId = mLoginId, Group = group, Index = idx });
var req = new DBDevelopService.GetTagByGroupRequest() { Database = database, LoginId = mLoginId, Group = group, Index = idx };
if (mFilters != null)
{
foreach (var vv in mFilters)
{
req.Filters.Add(new DBDevelopService.FilterMessageItem() { Key = vv.Key, Value = vv.Value });
}
}
var result = mCurrentClient.GetTagByGroup(req);
tagCount = result.TagCount;
totalCount = result.Count;
......@@ -879,7 +888,7 @@ namespace DBDevelopClientApi
/// <param name="database"></param>
/// <param name="group"></param>
/// <returns></returns>
public Dictionary<int,Tuple<Cdy.Tag.Tagbase,Cdy.Tag.HisTag>> QueryTagByGroup(string database,string group)
public Dictionary<int,Tuple<Cdy.Tag.Tagbase,Cdy.Tag.HisTag>> QueryTagByGroup(string database,string group, Dictionary<string, string> mFilters = null)
{
Dictionary<int, Tuple<Cdy.Tag.Tagbase, Cdy.Tag.HisTag>> re = new Dictionary<int, Tuple<Cdy.Tag.Tagbase, Cdy.Tag.HisTag>>();
if (mCurrentClient != null && !string.IsNullOrEmpty(mLoginId))
......@@ -888,7 +897,16 @@ namespace DBDevelopClientApi
int count = 0;
do
{
var result = mCurrentClient.GetTagByGroup(new DBDevelopService.GetTagByGroupRequest() { Database = database, LoginId = mLoginId, Group = group,Index=idx });
var req = new DBDevelopService.GetTagByGroupRequest() { Database = database, LoginId = mLoginId, Group = group, Index = idx };
if (mFilters != null)
{
foreach (var vv in mFilters)
{
req.Filters.Add(new DBDevelopService.FilterMessageItem() { Key = vv.Key, Value = vv.Value });
}
}
var result = mCurrentClient.GetTagByGroup(req);
idx = result.Index;
count = result.Count;
......
......@@ -569,6 +569,13 @@ message GetTagByGroupRequest
string Database=2;
string Group=3;
int32 Index=4;
repeated FilterMessageItem Filters=5;
}
message FilterMessageItem
{
string key=1;
string value=2;
}
//
......
......@@ -569,6 +569,13 @@ message GetTagByGroupRequest
string Database=2;
string Group=3;
int32 Index=4;
repeated FilterMessageItem Filters=5;
}
message FilterMessageItem
{
string key=1;
string value=2;
}
//
......
......@@ -953,6 +953,80 @@ namespace DBDevelopService
return Task.FromResult(re);
}
/// <summary>
///
/// </summary>
/// <param name="db"></param>
/// <param name="res"></param>
/// <param name="vfilters"></param>
/// <returns></returns>
private IEnumerable<Tagbase> FilterTags(Database db,IEnumerable<Tagbase> res,List<FilterMessageItem> vfilters)
{
return res.Where((tag) => {
var re = true;
foreach (var vv in vfilters)
{
switch (vv.Key)
{
case "keyword":
re = re && (tag.Name.Contains(vv.Value) || tag.Desc.Contains(vv.Value));
break;
case "type":
re = re && ((int)tag.Type == int.Parse(vv.Value));
break;
case "readwritetype":
re = re && ((int)tag.ReadWriteType == int.Parse(vv.Value));
break;
case "recordtype":
int ival = int.Parse(vv.Value);
if(ival==3)
{
re = true;
}
else
{
if (db.HisDatabase.HisTags.ContainsKey(tag.Id))
{
re = re && ((int)db.HisDatabase.HisTags[tag.Id].Type == ival);
}
else
{
re = false;
}
}
break;
case "compresstype":
ival = int.Parse(vv.Value);
if (ival == -1)
{
re = re && (db.HisDatabase.HisTags.ContainsKey(tag.Id));
}
else
{
if (db.HisDatabase.HisTags.ContainsKey(tag.Id))
{
re = re && ((int)db.HisDatabase.HisTags[tag.Id].CompressType == ival);
}
else
{
re = false;
}
}
break;
case "linkaddress":
re = re && (tag.LinkAddress.Contains(vv.Value));
break;
}
}
return re;
});
}
/// <summary>
///
/// </summary>
......@@ -977,6 +1051,12 @@ namespace DBDevelopService
{
int from = request.Index * PageCount;
var res = db.RealDatabase.ListAllTags().Where(e => e.Group == request.Group);
if(request.Filters.Count>0)
{
res = FilterTags(db, res, request.Filters.ToList());
}
total = res.Count();
totalpage = total / PageCount;
......@@ -1036,12 +1116,18 @@ namespace DBDevelopService
{
int from = request.Index * PageCount;
var res = db.RealDatabase.ListAllTags();
if (request.Filters.Count > 0)
{
res = FilterTags(db, res, request.Filters.ToList());
}
total = res.Count();
totalpage = total / PageCount;
totalpage = total % PageCount > 0 ? totalpage + 1 : totalpage;
int cc = 0;
foreach (var vv in res)
{
if (cc >= from && cc < (from + PageCount))
......
......@@ -23,6 +23,7 @@
<None Remove="Image\export.png" />
<None Remove="Image\export2.png" />
<None Remove="Image\hidden.png" />
<None Remove="Image\huoxing.jpg" />
<None Remove="Image\import.png" />
<None Remove="Image\import2.png" />
<None Remove="Image\log-out.png" />
......@@ -47,6 +48,7 @@
<None Remove="Image\wait.png" />
<None Remove="Image\文件夹.png" />
<None Remove="Image\登录.png" />
<None Remove="View\huoxing-003.jpg" />
</ItemGroup>
<ItemGroup>
......@@ -62,6 +64,7 @@
<Resource Include="Image\export.png" />
<Resource Include="Image\export2.png" />
<Resource Include="Image\hidden.png" />
<Resource Include="Image\huoxing.jpg" />
<Resource Include="Image\import.png" />
<Resource Include="Image\import2.png" />
<Resource Include="Image\log-out.png" />
......
......@@ -78,6 +78,9 @@
</Window.Resources>
<Border Margin="5" BorderThickness="1" BorderBrush="DarkGray">
<Border.Background>
<ImageBrush ImageSource="/Image/huoxing.jpg" Opacity="0.6" Stretch="Fill" TileMode="None"/>
</Border.Background>
<Grid x:Name="bg" Background="#CF26282C">
<Grid.RowDefinitions>
<RowDefinition Height="32"/>
......
......@@ -2,7 +2,7 @@
"profiles": {
"DBInStudio.Desktop": {
"commandName": "Executable",
"executablePath": "C:\\Users\\chongdaoyang\\source\\repos\\mars\\Output\\DBInStudio.exe"
"executablePath": "C:\\Users\\cdy81\\source\\repos\\mars\\Output\\DBInStudio.exe"
}
}
}
\ No newline at end of file
......@@ -108,7 +108,7 @@
</Grid.ColumnDefinitions>
<Border x:Name="checkBoxBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Grid x:Name="markGrid">
<Path x:Name="optionMark" Data="F1 M 9.97498,1.22334L 4.6983,9.09834L 4.52164,9.09834L 0,5.19331L 1.27664,3.52165L 4.255,6.08833L 8.33331,1.52588e-005L 9.97498,1.22334 Z " Fill="{TemplateBinding BorderBrush}" Margin="1" Opacity="0" Stretch="None"/>
<Path x:Name="optionMark" Data="F1 M 9.97498,1.22334L 4.6983,9.09834L 4.52164,9.09834L 0,5.19331L 1.27664,3.52165L 4.255,6.08833L 8.33331,1.52588e-005L 9.97498,1.22334 Z " Fill="{TemplateBinding Foreground}" Margin="1" Opacity="0" Stretch="None"/>
<Rectangle x:Name="indeterminateMark" Fill="{TemplateBinding BorderThickness}" Margin="2" Opacity="0"/>
</Grid>
</Border>
......@@ -126,8 +126,10 @@
<Setter Property="Fill" TargetName="indeterminateMark" Value="{StaticResource OptionMark.MouseOver.Glyph}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="checkBoxBorder" Value="{StaticResource OptionMark.Disabled.Background}"/>
<!--<Setter Property="Background" TargetName="checkBoxBorder" Value="{StaticResource OptionMark.Disabled.Background}"/>-->
<Setter Property="BorderBrush" TargetName="checkBoxBorder" Value="{StaticResource OptionMark.Disabled.Border}"/>
<Setter Property="Opacity" TargetName="checkBoxBorder" Value="0.5"/>
<Setter Property="Opacity" TargetName="contentPresenter" Value="0.5"/>
<Setter Property="Fill" TargetName="optionMark" Value="{StaticResource OptionMark.Disabled.Glyph}"/>
<Setter Property="Fill" TargetName="indeterminateMark" Value="{StaticResource OptionMark.Disabled.Glyph}"/>
</Trigger>
......@@ -844,4 +846,71 @@
</Style.Triggers>
</Style>
<!--RadioButton-->
<SolidColorBrush x:Key="RadioButton.Static.Background" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="RadioButton.Static.Border" Color="#FF707070"/>
<SolidColorBrush x:Key="RadioButton.Static.Glyph" Color="#FF212121"/>
<SolidColorBrush x:Key="RadioButton.MouseOver.Background" Color="#FFF3F9FF"/>
<SolidColorBrush x:Key="RadioButton.MouseOver.Border" Color="#FF5593FF"/>
<SolidColorBrush x:Key="RadioButton.MouseOver.Glyph" Color="#FF212121"/>
<SolidColorBrush x:Key="RadioButton.Pressed.Background" Color="#FFD9ECFF"/>
<SolidColorBrush x:Key="RadioButton.Pressed.Border" Color="#FF3C77DD"/>
<SolidColorBrush x:Key="RadioButton.Pressed.Glyph" Color="#FF212121"/>
<SolidColorBrush x:Key="RadioButton.Disabled.Background" Color="#FFE6E6E6"/>
<SolidColorBrush x:Key="RadioButton.Disabled.Border" Color="#FFBCBCBC"/>
<SolidColorBrush x:Key="RadioButton.Disabled.Glyph" Color="#FF707070"/>
<Style TargetType="{x:Type RadioButton}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="{StaticResource RadioButton.Static.Background}"/>
<Setter Property="BorderBrush" Value="{StaticResource RadioButton.Static.Border}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border x:Name="radioButtonBorder" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="100" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="1,1,2,1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Grid x:Name="markGrid" Margin="2">
<Ellipse x:Name="optionMark" Fill="{DynamicResource Window.Forground}" MinHeight="6" MinWidth="6" Opacity="0"/>
</Grid>
</Border>
<ContentPresenter x:Name="contentPresenter" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasContent" Value="true">
<Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}"/>
<Setter Property="Padding" Value="4,-1,0,0"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.MouseOver.Background}"/>
<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.MouseOver.Border}"/>
<!--<Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.MouseOver.Glyph}"/>-->
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<!--<Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Disabled.Background}"/>-->
<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Disabled.Border}"/>
<Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.Disabled.Glyph}"/>
<Setter Property="Opacity" TargetName="contentPresenter" Value="0.5"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Pressed.Background}"/>
<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Pressed.Border}"/>
<!--<Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.Pressed.Glyph}"/>-->
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter Property="Opacity" TargetName="optionMark" Value="1"/>
</Trigger>
<Trigger Property="IsChecked" Value="{x:Null}">
<Setter Property="Opacity" TargetName="optionMark" Value="0.56"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
......@@ -17,79 +17,7 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="OptionMarkFocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="14,0,0,0" StrokeDashArray="1 2" SnapsToDevicePixels="true" StrokeThickness="1" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<SolidColorBrush x:Key="RadioButton.Static.Background" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="RadioButton.Static.Border" Color="#FF707070"/>
<SolidColorBrush x:Key="RadioButton.Static.Glyph" Color="#FF212121"/>
<SolidColorBrush x:Key="RadioButton.MouseOver.Background" Color="#FFF3F9FF"/>
<SolidColorBrush x:Key="RadioButton.MouseOver.Border" Color="#FF5593FF"/>
<SolidColorBrush x:Key="RadioButton.MouseOver.Glyph" Color="#FF212121"/>
<SolidColorBrush x:Key="RadioButton.Pressed.Background" Color="#FFD9ECFF"/>
<SolidColorBrush x:Key="RadioButton.Pressed.Border" Color="#FF3C77DD"/>
<SolidColorBrush x:Key="RadioButton.Pressed.Glyph" Color="#FF212121"/>
<SolidColorBrush x:Key="RadioButton.Disabled.Background" Color="#FFE6E6E6"/>
<SolidColorBrush x:Key="RadioButton.Disabled.Border" Color="#FFBCBCBC"/>
<SolidColorBrush x:Key="RadioButton.Disabled.Glyph" Color="#FF707070"/>
<Style TargetType="{x:Type RadioButton}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="{StaticResource RadioButton.Static.Background}"/>
<Setter Property="BorderBrush" Value="{StaticResource RadioButton.Static.Border}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border x:Name="radioButtonBorder" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="100" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="1,1,2,1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Grid x:Name="markGrid" Margin="2">
<Ellipse x:Name="optionMark" Fill="{DynamicResource Window.Forground}" MinHeight="6" MinWidth="6" Opacity="0"/>
</Grid>
</Border>
<ContentPresenter x:Name="contentPresenter" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasContent" Value="true">
<Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}"/>
<Setter Property="Padding" Value="4,-1,0,0"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.MouseOver.Background}"/>
<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.MouseOver.Border}"/>
<!--<Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.MouseOver.Glyph}"/>-->
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Disabled.Background}"/>
<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Disabled.Border}"/>
<Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.Disabled.Glyph}"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Pressed.Background}"/>
<Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Pressed.Border}"/>
<!--<Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.Pressed.Glyph}"/>-->
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter Property="Opacity" TargetName="optionMark" Value="1"/>
</Trigger>
<Trigger Property="IsChecked" Value="{x:Null}">
<Setter Property="Opacity" TargetName="optionMark" Value="0.56"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
......@@ -97,7 +25,7 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<RadioButton Style="{DynamicResource RadioButtonStyle1}" BorderBrush="{DynamicResource Window.Forground}" Background="{x:Null}" Foreground="{DynamicResource Window.Forground}" Content="{res:ResMarker Replace}" GroupName="gg" IsChecked="{Binding IsReplace,Mode=TwoWay}" HorizontalAlignment="Center" Margin="0,0,0,0" VerticalAlignment="Center"/>
<RadioButton BorderBrush="{DynamicResource Window.Forground}" Background="{x:Null}" Foreground="{DynamicResource Window.Forground}" Content="{res:ResMarker Replace}" GroupName="gg" IsChecked="{Binding IsReplace,Mode=TwoWay}" HorizontalAlignment="Center" Margin="0,0,0,0" VerticalAlignment="Center"/>
<RadioButton BorderBrush="{DynamicResource Window.Forground}" Background="{x:Null}" Foreground="{DynamicResource Window.Forground}" Content="{res:ResMarker ReplaceAll}" GroupName="gg" IsChecked="{Binding IsReplaceMode,Mode=TwoWay}" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1"/>
<RadioButton BorderBrush="{DynamicResource Window.Forground}" Background="{x:Null}" Foreground="{DynamicResource Window.Forground}" Content="{res:ResMarker Append}" GroupName="gg" IsChecked="{Binding IsAddMode,Mode=TwoWay}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,0,0" Grid.Column="2"/>
</Grid>
......
......@@ -4,9 +4,10 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:DBInStudio.Desktop.View"
mc:Ignorable="d" Background="#7F000000"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid Background="#7F000000">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
......
......@@ -70,7 +70,7 @@
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox BorderBrush="{Binding Foreground,RelativeSource={RelativeSource AncestorType=UserControl}}" VerticalAlignment="Center" IsEnabled="{Binding IsEnableEdit}" IsChecked="{Binding EnableWrite,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="5,0" />
<CheckBox BorderBrush="{DynamicResource Window.Forground}" Foreground="{DynamicResource Window.Forground}" Background="Transparent" VerticalAlignment="Center" IsEnabled="{Binding IsEnableEdit}" IsChecked="{Binding EnableWrite,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="5,0" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
......@@ -85,8 +85,8 @@
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBox CaretBrush="White" Background="#1FFFFFFF" Foreground="{Binding Foreground,RelativeSource={RelativeSource AncestorType=UserControl}}" Margin="0,0" Padding="4,0" IsEnabled="{Binding IsEnableEdit}" MinWidth="200" BorderThickness="0" Text="{Binding GroupString,Mode=TwoWay,UpdateSourceTrigger=LostFocus}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" />
<Button Background="#1FFFFFFF" Foreground="{Binding Foreground,RelativeSource={RelativeSource AncestorType=UserControl}}" Margin="10,0,0,0" Content="..." IsEnabled="{Binding IsEnableEdit}" MinWidth="40" VerticalAlignment="Center" VerticalContentAlignment="Top" Command="{Binding GroupEditCommand}" />
<TextBox CaretBrush="White" Background="#7FFFFFFF" Foreground="{Binding Foreground,RelativeSource={RelativeSource AncestorType=UserControl}}" Margin="0,0" Padding="4,0" IsEnabled="{Binding IsEnableEdit}" MinWidth="200" BorderThickness="0" Text="{Binding GroupString,Mode=TwoWay,UpdateSourceTrigger=LostFocus}" VerticalAlignment="Stretch" VerticalContentAlignment="Center" />
<Button Background="#7FFFFFFF" Foreground="{Binding Foreground,RelativeSource={RelativeSource AncestorType=UserControl}}" Margin="10,0,0,0" Content="..." IsEnabled="{Binding IsEnableEdit}" MinWidth="40" VerticalAlignment="Center" VerticalContentAlignment="Top" Command="{Binding GroupEditCommand}" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
......
......@@ -131,13 +131,13 @@
<ListBox Style="{DynamicResource ListBoxStyle1}" Background="Transparent" ItemContainerStyle="{DynamicResource ListBoxItemContainerStyle1}" IsEnabled="{Binding IsAdmin,Converter={StaticResource bic}}" ItemsSource="{Binding PermissionModel}" Grid.Column="1" Grid.Row="4" Margin="10,10,0,0" Width="300" HorizontalAlignment="Left" >
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox BorderBrush="{Binding Foreground,RelativeSource={RelativeSource AncestorType=UserControl}}" Foreground="{Binding Foreground,RelativeSource={RelativeSource AncestorType=UserControl}}" IsChecked="{Binding IsSelected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Content="{Binding Name}" />
<CheckBox Background="Transparent" BorderBrush="{Binding Foreground,RelativeSource={RelativeSource AncestorType=UserControl}}" Foreground="{Binding Foreground,RelativeSource={RelativeSource AncestorType=UserControl}}" IsChecked="{Binding IsSelected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Content="{Binding Name}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<CheckBox BorderBrush="{Binding Foreground,RelativeSource={RelativeSource AncestorType=UserControl}}" Background="#1FFFFFFF" Grid.Column="1" IsChecked="{Binding IsAdmin,Mode=TwoWay}" HorizontalAlignment="Left" Margin="10,0,0,0" Grid.Row="2" VerticalAlignment="Center"/>
<CheckBox BorderBrush="{Binding Foreground,RelativeSource={RelativeSource AncestorType=UserControl}}" Background="#1FFFFFFF" Grid.Column="1" IsChecked="{Binding CanNewDatabase,Mode=TwoWay}" HorizontalAlignment="Left" Margin="10,0,0,0" Grid.Row="3" VerticalAlignment="Center"/>
<CheckBox BorderBrush="{DynamicResource Window.Forground}" Foreground="{Binding Foreground,RelativeSource={RelativeSource AncestorType=UserControl}}" Background="Transparent" Grid.Column="1" IsChecked="{Binding IsAdmin,Mode=TwoWay}" HorizontalAlignment="Left" Margin="10,0,0,0" Grid.Row="2" VerticalAlignment="Center"/>
<CheckBox BorderBrush="{DynamicResource Window.Forground}" Foreground="{Binding Foreground,RelativeSource={RelativeSource AncestorType=UserControl}}" Background="Transparent" Grid.Column="1" IsChecked="{Binding CanNewDatabase,Mode=TwoWay}" HorizontalAlignment="Left" Margin="10,0,0,0" Grid.Row="3" VerticalAlignment="Center"/>
</Grid>
......
......@@ -5,8 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:DBInStudio.Desktop"
mc:Ignorable="d" Foreground="{DynamicResource Window.Forground}"
d:DesignHeight="450" d:DesignWidth="1024" Name="tgd" Background="#7F000000"
>
d:DesignHeight="450" d:DesignWidth="1024" Name="tgd" Background="#7F000000">
<UserControl.Resources>
<local:IndexConverter x:Key="ic" />
<BooleanToVisibilityConverter x:Key="btv" />
......@@ -22,13 +21,18 @@
</ContextMenu>
</UserControl.Resources>
<Grid>
<Grid Height="84" VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="89" MaxHeight="89" />
<RowDefinition Height="*" />
<RowDefinition Height="32" />
</Grid.RowDefinitions>
<Grid VerticalAlignment="Stretch" Background="#0FFFFFFF">
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto" x:Name="row2"/>
</Grid.RowDefinitions>
<Label Background="#1FFFFFFF" Foreground="{DynamicResource Window.Forground}" Content="{local:ResMarker TagFilter}" VerticalContentAlignment="Center" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<Grid Grid.Row="1">
<Grid Grid.Row="1" TextElement.FontSize="12" Name="fg" Height="60" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
......@@ -46,31 +50,32 @@
<RowDefinition Height="30"/>
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<TextBlock Text="{local:ResMarker Keyword,:}" VerticalAlignment="Center" Margin="5,0" />
<TextBox CaretBrush="White" Margin="5,0" Foreground="{DynamicResource Window.Forground}" Background="#1FFFFFFF" Grid.Column="1" Text="{Binding FilterKeyName,Mode=TwoWay}" Width="120" HorizontalAlignment="Left" VerticalAlignment="Center" />
<TextBlock Text="{local:ResMarker Keyword,:}" VerticalAlignment="Center" Margin="5,0" />
<TextBox VerticalContentAlignment="Center" CaretBrush="White" Margin="10,0" Foreground="{DynamicResource Window.Forground}" Background="#1FFFFFFF" Grid.Column="1" Text="{Binding FilterKeyName,Mode=TwoWay,UpdateSourceTrigger=LostFocus}" Width="160" HorizontalAlignment="Left" VerticalAlignment="Center" Height="20" />
<CheckBox HorizontalAlignment="Right" Foreground="{DynamicResource Window.Forground}" Grid.Column="2" IsChecked="{Binding TagTypeFilterEnable}" Content="{local:ResMarker Type,:}" VerticalAlignment="Center" Margin="5,0" />
<ComboBox VerticalAlignment="Center" Grid.Column="3" Margin="0" Width="80" BorderThickness="1" ItemsSource="{Binding TagTypeList}" SelectedIndex="{Binding FilterType}" />
<CheckBox Background="Transparent" HorizontalAlignment="Right" Foreground="{DynamicResource Window.Forground}" Grid.Column="2" IsChecked="{Binding TagTypeFilterEnable}" Content="{local:ResMarker Type,:}" VerticalAlignment="Center" Margin="10,0" />
<ComboBox VerticalAlignment="Center" Grid.Column="3" Margin="10,0" Width="100" BorderThickness="1" IsEnabled="{Binding TagTypeFilterEnable}" ItemsSource="{Binding TagTypeList}" SelectedIndex="{Binding FilterType}" />
<CheckBox HorizontalAlignment="Right" Foreground="{DynamicResource Window.Forground}" Grid.Column="4" IsChecked="{Binding ReadWriteModeFilterEnable}" Content="{local:ResMarker ReadWriteMode}" VerticalAlignment="Center" Margin="5,0" />
<ComboBox VerticalAlignment="Center" Grid.Column="5" Margin="5,0" Width="80" BorderThickness="1" ItemsSource="{Binding TagTypeList}" SelectedIndex="{Binding FilterReadWriteMode}" />
<CheckBox Background="Transparent" HorizontalAlignment="Right" Foreground="{DynamicResource Window.Forground}" Grid.Column="4" IsChecked="{Binding ReadWriteModeFilterEnable}" Content="{local:ResMarker ReadWriteMode}" VerticalAlignment="Center" Margin="10,0" />
<ComboBox VerticalAlignment="Center" Grid.Column="5" Margin="10,0" Width="100" BorderThickness="1" IsEnabled="{Binding ReadWriteModeFilterEnable}" ItemsSource="{Binding ReadWriteModeList}" SelectedIndex="{Binding FilterReadWriteMode}" />
<CheckBox HorizontalAlignment="Left" Foreground="{DynamicResource Window.Forground}" Grid.Column="6" IsChecked="{Binding RecordFilterEnable}" Content="{local:ResMarker Record}" VerticalAlignment="Center" Margin="5,0" />
<CheckBox HorizontalAlignment="Left" Foreground="{DynamicResource Window.Forground}" Grid.Column="7" IsChecked="{Binding TimerRecordFilterEnable}" Content="{local:ResMarker Timer}" VerticalAlignment="Center" Margin="5,0" />
<CheckBox HorizontalAlignment="Left" Foreground="{DynamicResource Window.Forground}" Grid.Column="8" IsChecked="{Binding ValueChangedRecordFilterEnable}" Content="{local:ResMarker ValueChanged}" VerticalAlignment="Center" Margin="5,0" />
<CheckBox Background="Transparent" HorizontalAlignment="Left" Foreground="{DynamicResource Window.Forground}" Grid.Column="6" IsChecked="{Binding RecordFilterEnable}" Content="{local:ResMarker Record}" VerticalAlignment="Center" Margin="10,0" />
<RadioButton GroupName="rt" BorderBrush="{DynamicResource Window.Forground}" Background="Transparent" HorizontalAlignment="Left" Foreground="{DynamicResource Window.Forground}" IsEnabled="{Binding RecordFilterEnable}" Grid.Column="7" IsChecked="{Binding TimerRecordFilterEnable}" Content="{local:ResMarker Timer}" VerticalAlignment="Center" Margin="10,0" />
<RadioButton GroupName="rt" BorderBrush="{DynamicResource Window.Forground}" Background="Transparent" HorizontalAlignment="Left" Foreground="{DynamicResource Window.Forground}" IsEnabled="{Binding RecordFilterEnable}" Grid.Column="8" IsChecked="{Binding ValueChangedRecordFilterEnable}" Content="{local:ResMarker ValueChanged}" VerticalAlignment="Center" Margin="10,0" />
<CheckBox HorizontalAlignment="Right" Foreground="{DynamicResource Window.Forground}" Grid.Row="2" Grid.Column="6" IsChecked="{Binding CompressFilterEnable}" Content="{local:ResMarker CompressType}" VerticalAlignment="Center" Margin="5,0" />
<ComboBox VerticalAlignment="Center" Grid.Column="7" Margin="5,0" Width="80" Grid.Row="2" BorderThickness="1" ItemsSource="{Binding CompressTypeList}" SelectedIndex="{Binding FilterCompressType}" />
<CheckBox Background="Transparent" HorizontalAlignment="Right" Foreground="{DynamicResource Window.Forground}" Grid.Row="2" Grid.Column="6" IsChecked="{Binding CompressFilterEnable}" Content="{local:ResMarker CompressType}" VerticalAlignment="Center" Margin="10,0" />
<ComboBox VerticalAlignment="Center" Grid.Column="7" Margin="10,0" Width="100" Grid.Row="2" BorderThickness="1" IsEnabled="{Binding CompressFilterEnable}" ItemsSource="{Binding CompressTypeList}" SelectedIndex="{Binding FilterCompressType}" />
<CheckBox Foreground="{DynamicResource Window.Forground}" Content="{local:ResMarker Driver}" IsChecked="{Binding DriverFilterEnable}" HorizontalAlignment="Left" Grid.Column="2" Grid.Row="2" VerticalAlignment="Center" Margin="5,0" />
<ComboBox VerticalAlignment="Center" Grid.Row="2" Grid.Column="3" Margin="5,0" Width="80" BorderThickness="1" ItemsSource="{Binding DriverList}" SelectedIndex="{Binding FilterDriver}" />
<CheckBox Background="Transparent" Foreground="{DynamicResource Window.Forground}" Content="{local:ResMarker Driver}" IsChecked="{Binding DriverFilterEnable}" HorizontalAlignment="Left" Grid.Column="2" Grid.Row="2" VerticalAlignment="Center" Margin="10,0" />
<ComboBox VerticalAlignment="Center" Grid.Row="2" Grid.Column="3" Margin="10,0" Width="100" BorderThickness="1" IsEnabled="{Binding DriverFilterEnable}" ItemsSource="{Binding DriverList}" SelectedItem="{Binding FilterDriver}" />
<CheckBox Foreground="{DynamicResource Window.Forground}" Content="{local:ResMarker Registor}" IsChecked="{Binding DriverFilterEnable}" HorizontalAlignment="Left" Grid.Column="4" Grid.Row="2" VerticalAlignment="Center" Margin="5,0" />
<ComboBox VerticalAlignment="Center" Grid.Row="2" Grid.Column="5" Margin="5,0" Width="80" BorderThickness="1" ItemsSource="{Binding DriverList}" SelectedIndex="{Binding FilterDriver}" />
<CheckBox Background="Transparent" Foreground="{DynamicResource Window.Forground}" Content="{local:ResMarker Registor}" IsChecked="{Binding RegistorFilterEnable}" HorizontalAlignment="Left" Grid.Column="4" Grid.Row="2" VerticalAlignment="Center" Margin="10,0" />
<ComboBox VerticalAlignment="Center" IsEditable="False" Grid.Row="2" Grid.Column="5" Margin="10,0" Width="100" IsEnabled="{Binding RegistorFilterEnable}" BorderThickness="1" ItemsSource="{Binding RegistorList}" Text="{Binding FilterRegistorName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</Grid>
<DataGrid RowHeaderWidth="0" ColumnHeaderStyle="{DynamicResource DataGridColumnHeaderStyle1}" 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,84,0,32" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding SelectGroupTags}" SelectedItem="{Binding CurrentSelectTag,Mode=TwoWay}" BorderThickness="0,1,0,1" Background="Transparent" >
<GridSplitter HorizontalAlignment="Stretch" Height="5" VerticalAlignment="Bottom" Background="Transparent" />
<DataGrid Grid.Row="1" RowHeaderWidth="0" ColumnHeaderStyle="{DynamicResource DataGridColumnHeaderStyle1}" 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,0" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding SelectGroupTags}" SelectedItem="{Binding CurrentSelectTag,Mode=TwoWay}" BorderThickness="0,1,0,1" Background="Transparent" >
<DataGrid.InputBindings>
<KeyBinding Command="{Binding CopyCommand}" Key="C" Modifiers="Ctrl" />
<KeyBinding Command="{Binding PasteCommand}" Key="V" Modifiers="Ctrl" />
......@@ -194,7 +199,7 @@
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox Background="#1FFFFFFF" BorderBrush="{DynamicResource Window.Forground}" VerticalAlignment="Center" IsChecked="{Binding HasHisTag,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="5,0" />
<CheckBox Background="#1FFFFFFF" Foreground="{DynamicResource Window.Forground}" BorderBrush="{DynamicResource Window.Forground}" VerticalAlignment="Center" IsChecked="{Binding HasHisTag,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Margin="5,0" />
<TextBlock Foreground="{DynamicResource Window.Forground}" Text="{Binding RecordTypeString}" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
......@@ -268,7 +273,7 @@
</DataTemplate>
</DataGrid.RowDetailsTemplate>
</DataGrid>
<StackPanel Orientation="Horizontal" Grid.Column="1" Height="32" VerticalAlignment="Bottom" Background="#0FFFFFFF">
<StackPanel Grid.Row="2" Orientation="Horizontal" Grid.Column="1" Height="32" VerticalAlignment="Bottom" Background="#0FFFFFFF">
<Button BorderBrush="Green" BorderThickness="0,0,0,2" Content="{local:ResMarker Add}" Command="{Binding AddCommand}" Width="80" HorizontalAlignment="Left" VerticalAlignment="Center" Height="26" Margin="5,0" Padding="0">
<Button.ContentTemplate>
<DataTemplate>
......@@ -311,7 +316,7 @@
</Button.ContentTemplate>
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="1" Height="32" HorizontalAlignment="Right" VerticalAlignment="Bottom" >
<StackPanel Grid.Row="2" Orientation="Horizontal" Grid.Column="1" Height="32" HorizontalAlignment="Right" VerticalAlignment="Bottom" >
<Label VerticalAlignment="Center" Content="{local:ResMarker TagCount,:}" Foreground="{DynamicResource Window.Forground}"/>
<Label VerticalAlignment="Center" Content="{Binding TagCount}" Foreground="{DynamicResource Window.Forground}"/>
</StackPanel>
......
......@@ -9,6 +9,7 @@
using Cdy.Tag;
using DBDevelopClientApi;
using DBDevelopService;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
......@@ -53,6 +54,37 @@ namespace DBInStudio.Desktop.ViewModel
private int mTagCount = 0;
private string mFilterKeyName = string.Empty;
private bool mTagTypeFilterEnable;
private int mFilterType = -1;
private bool mReadWriteModeFilterEnable;
private int mFilterReadWriteMode = -1;
private bool mRecordFilterEnable;
private bool mTimerRecordFilterEnable=true;
private bool mValueChangedRecordFilterEnable;
private bool mCompressFilterEnable;
private int mFilterCompressType;
private bool mDriverFilterEnable;
private string mFilterDriver;
private bool mRegistorFilterEnable;
private string mFilterRegistorName = string.Empty;
private Dictionary<string, string> mFilters = new Dictionary<string, string>();
private bool mEnableFilter = true;
#endregion ...Variables...
#region ... Events ...
......@@ -65,6 +97,319 @@ namespace DBInStudio.Desktop.ViewModel
#region ... Properties ...
/// <summary>
///
/// </summary>
public string FilterRegistorName
{
get
{
return mFilterRegistorName;
}
set
{
if (mFilterRegistorName != value)
{
mFilterRegistorName = value;
NewQueryTags();
OnPropertyChanged("FilterRegistorName");
}
}
}
/// <summary>
///
/// </summary>
public bool RegistorFilterEnable
{
get
{
return mRegistorFilterEnable;
}
set
{
if (mRegistorFilterEnable != value)
{
mRegistorFilterEnable = value;
NewQueryTags();
if (!value) mFilterRegistorName = string.Empty;
OnPropertyChanged("RegistorFilterEnable");
}
}
}
/// <summary>
///
/// </summary>
public string FilterDriver
{
get
{
return mFilterDriver;
}
set
{
if (mFilterDriver != value)
{
mFilterDriver = value;
NewQueryTags();
if (DriverList != null && TagViewModel.Drivers.ContainsKey(value))
{
RegistorList = TagViewModel.Drivers[value];
}
else
{
RegistorList = null;
}
OnPropertyChanged("RegistorList");
OnPropertyChanged("FilterDriver");
}
}
}
/// <summary>
///
/// </summary>
public bool DriverFilterEnable
{
get
{
return mDriverFilterEnable;
}
set
{
if (mDriverFilterEnable != value)
{
mDriverFilterEnable = value;
NewQueryTags();
if (!value) mFilterDriver = string.Empty;
OnPropertyChanged("DriverFilterEnable");
}
}
}
/// <summary>
///
/// </summary>
public int FilterCompressType
{
get
{
return mFilterCompressType;
}
set
{
if (mFilterCompressType != value)
{
mFilterCompressType = value;
NewQueryTags();
OnPropertyChanged("FilterCompressType");
}
}
}
/// <summary>
///
/// </summary>
public bool CompressFilterEnable
{
get
{
return mCompressFilterEnable;
}
set
{
if (mCompressFilterEnable != value)
{
mCompressFilterEnable = value;
NewQueryTags();
OnPropertyChanged("CompressFilterEnable");
}
}
}
/// <summary>
///
/// </summary>
public bool ValueChangedRecordFilterEnable
{
get
{
return mValueChangedRecordFilterEnable;
}
set
{
if (mValueChangedRecordFilterEnable != value)
{
mValueChangedRecordFilterEnable = value;
if (value) NewQueryTags();
OnPropertyChanged("ValueChangedRecordFilterEnable");
}
}
}
/// <summary>
///
/// </summary>
public bool TimerRecordFilterEnable
{
get
{
return mTimerRecordFilterEnable;
}
set
{
if (mTimerRecordFilterEnable != value)
{
mTimerRecordFilterEnable = value;
if(value) NewQueryTags();
OnPropertyChanged("TimerRecordFilterEnable");
}
}
}
/// <summary>
///
/// </summary>
public bool RecordFilterEnable
{
get
{
return mRecordFilterEnable;
}
set
{
if (mRecordFilterEnable != value)
{
mRecordFilterEnable = value;
NewQueryTags();
OnPropertyChanged("RecordFilterEnable");
}
}
}
/// <summary>
///
/// </summary>
public int FilterReadWriteMode
{
get
{
return mFilterReadWriteMode;
}
set
{
if (mFilterReadWriteMode != value)
{
mFilterReadWriteMode = value;
NewQueryTags();
}
OnPropertyChanged("FilterReadWriteMode");
}
}
/// <summary>
///
/// </summary>
public bool ReadWriteModeFilterEnable
{
get
{
return mReadWriteModeFilterEnable;
}
set
{
if (mReadWriteModeFilterEnable != value)
{
mReadWriteModeFilterEnable = value;
if (!value)
{
mFilterReadWriteMode = -1;
NewQueryTags();
}
OnPropertyChanged("ReadWriteModeFilterEnable");
}
}
}
/// <summary>
///
/// </summary>
public int FilterType
{
get
{
return mFilterType;
}
set
{
if (mFilterType != value)
{
mFilterType = value;
NewQueryTags();
}
OnPropertyChanged("FilterType");
}
}
/// <summary>
///
/// </summary>
public string FilterKeyName
{
get
{
return mFilterKeyName;
}
set
{
if (mFilterKeyName != value)
{
mFilterKeyName = value;
NewQueryTags();
}
OnPropertyChanged("FilterKeyName");
}
}
/// <summary>
///
/// </summary>
public bool TagTypeFilterEnable
{
get
{
return mTagTypeFilterEnable;
}
set
{
if (mTagTypeFilterEnable != value)
{
mTagTypeFilterEnable = value;
if (!value)
{
mFilterType = -1;
NewQueryTags();
}
}
OnPropertyChanged("TagTypeFilterEnable");
}
}
/// <summary>
///
/// </summary>
......@@ -262,11 +607,122 @@ namespace DBInStudio.Desktop.ViewModel
}
}
/// <summary>
///
/// </summary>
public bool EnableFilter
{
get
{
return mEnableFilter;
}
set
{
if (mEnableFilter != value)
{
mEnableFilter = value;
OnPropertyChanged("EnableFilter");
}
}
}
/// <summary>
///
/// </summary>
public string[] TagTypeList { get { return TagViewModel.mTagTypeList; } }
/// <summary>
///
/// </summary>
public string[] ReadWriteModeList { get { return TagViewModel.mReadWriteModeList; } }
public string[] CompressTypeList { get { return TagViewModel.mCompressTypeList; } }
public string[] DriverList { get { return TagViewModel.Drivers.Keys.ToArray(); } }
/// <summary>
///
/// </summary>
public string[] RegistorList { get; set; }
#endregion ...Properties...
#region ... Methods ...
/// <summary>
///
/// </summary>
private void NewQueryTags()
{
EnableFilter = false;
Task.Run(() => {
BuildFilters();
mTotalPageNumber = -1;
ContinueQueryTags();
Application.Current.Dispatcher.Invoke(new Action(() => {
EnableFilter = true;
}));
});
}
private void BuildFilters()
{
mFilters.Clear();
if(!string.IsNullOrEmpty(this.FilterKeyName))
{
mFilters.Add("keyword", FilterKeyName);
}
if(this.TagTypeFilterEnable)
{
mFilters.Add("type", this.FilterType.ToString());
}
if(this.ReadWriteModeFilterEnable)
{
mFilters.Add("readwritetype", FilterReadWriteMode.ToString());
}
if (this.RecordFilterEnable)
{
if (this.TimerRecordFilterEnable && this.ValueChangedRecordFilterEnable)
{
mFilters.Add("recordtype", "3");
}
else if (this.TimerRecordFilterEnable)
{
mFilters.Add("recordtype", "0");
}
else if (this.ValueChangedRecordFilterEnable)
{
mFilters.Add("recordtype", "1");
}
else
{
mFilters.Add("recordtype", "3");
}
}
if(this.CompressFilterEnable)
{
mFilters.Add("compresstype", FilterCompressType.ToString());
}
string stmp = "";
if(this.DriverFilterEnable)
{
stmp = this.FilterDriver;
}
if(this.RegistorFilterEnable)
{
stmp += "." + this.FilterRegistorName;
}
if(!string.IsNullOrEmpty(stmp))
{
mFilters.Add("linkaddress", stmp);
}
}
/// <summary>
///
/// </summary>
......@@ -424,7 +880,7 @@ namespace DBInStudio.Desktop.ViewModel
// var vtags = new System.Collections.ObjectModel.ObservableCollection<TagViewModel>();
mCurrentPageIndex = 0;
var vv = DevelopServiceHelper.Helper.QueryTagByGroup(this.GroupModel.Database, this.GroupModel.FullName,mCurrentPageIndex, out mTotalPageNumber,out count);
var vv = DevelopServiceHelper.Helper.QueryTagByGroup(this.GroupModel.Database, this.GroupModel.FullName,mCurrentPageIndex, out mTotalPageNumber,out count,mFilters);
if (vv != null)
{
foreach (var vvv in vv)
......@@ -444,7 +900,7 @@ namespace DBInStudio.Desktop.ViewModel
mCurrentPageIndex++;
int totalcount = 0;
var vv = DevelopServiceHelper.Helper.QueryTagByGroup(this.GroupModel.Database, this.GroupModel.FullName, mCurrentPageIndex, out totalcount,out count);
var vv = DevelopServiceHelper.Helper.QueryTagByGroup(this.GroupModel.Database, this.GroupModel.FullName, mCurrentPageIndex, out totalcount,out count, mFilters);
if (vv != null)
{
foreach (var vvv in vv)
......@@ -467,8 +923,6 @@ namespace DBInStudio.Desktop.ViewModel
private void QueryTags()
{
var vtags = new System.Collections.ObjectModel.ObservableCollection<TagViewModel>();
var vv = DevelopServiceHelper.Helper.QueryTagByGroup(this.GroupModel.Database, this.GroupModel.FullName);
if (vv != null)
{
......@@ -480,9 +934,7 @@ namespace DBInStudio.Desktop.ViewModel
}));
}
}
SelectGroupTags = vtags;
}
......
......@@ -28,10 +28,10 @@ namespace DBInStudio.Desktop
private Cdy.Tag.Tagbase mRealTagMode;
private Cdy.Tag.HisTag mHisTagMode;
private static string[] mTagTypeList;
private static string[] mRecordTypeList;
private static string[] mCompressTypeList;
private static string[] mReadWriteModeList;
public static string[] mTagTypeList;
public static string[] mRecordTypeList;
public static string[] mCompressTypeList;
public static string[] mReadWriteModeList;
/// <summary>
///
......
......@@ -89,18 +89,18 @@ namespace SpiderDriver
{
int psize = 100000;
var vtags = mm.ListAllTags();
int tcount = vtags.Count / psize;
tcount += (vtags.Count % psize > 0 ? 1 : 0);
int tcount = vtags.Count() / psize;
tcount += (vtags.Count() % psize > 0 ? 1 : 0);
for(int i=0;i<tcount;i++)
{
if((i+1)*psize>vtags.Count)
if((i+1)*psize>vtags.Count())
{
var vv = vtags.Skip(i * psize).Take(psize);
Parent.AsyncCallback(client, GetTagBuffer(vv, (short)i, (short)tcount));
}
else
{
var vv = vtags.Skip(i * psize).Take(vtags.Count % psize);
var vv = vtags.Skip(i * psize).Take(vtags.Count() % psize);
Parent.AsyncCallback(client, GetTagBuffer(vv, (short)i, (short)tcount));
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册