浏览代码

mxg:添加隐藏按钮,反选,数据检查的检查项

mengxiangge 6 年之前
父节点
当前提交
c974c15b9e

+ 5 - 0
MBI/SAGA.MBI/ToolsData/CheckBase/ICheckBase.cs

@@ -24,6 +24,11 @@ namespace SAGA.MBI.ToolsData.CheckBase
         bool RIsChecked { get; set; }
 
         /// <summary>
+        /// 是否强制勾选
+        /// </summary>
+        bool RIsReadOnly { get; set; }
+
+        /// <summary>
         /// 是否通过较验
         /// </summary>
         bool IsRight { get; set; }

+ 15 - 2
MBI/SAGA.MBI/ToolsData/DataCheck/DataCheckBase.cs

@@ -6,6 +6,7 @@
 
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
 using NPOI.SS.UserModel;
 using SAGA.DotNetUtils.Others;
@@ -17,7 +18,7 @@ namespace SAGA.MBI.ToolsData.DataCheck
     /// <summary>
     /// CheckBase
     /// </summary>
-    public class DataCheckBase: ICheckBase
+    public class DataCheckBase: ICheckBase,INotifyPropertyChanged
     {
         public string Name { get; set; }
         public CheckContext Context { get; set; }
@@ -108,12 +109,24 @@ namespace SAGA.MBI.ToolsData.DataCheck
         /// 是否强制勾选
         /// </summary>
         public bool RIsReadOnly { get; set; }
+        private bool m_RIsChecked;
         /// <summary>
         /// 是否选中
         /// </summary>
-        public bool RIsChecked { get; set; }
+        public bool RIsChecked
+        {
+            get { return m_RIsChecked; }
+            set
+            {
+                m_RIsChecked = value;
+                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(RIsChecked)));
+            }
+        }
 
         private List<string> m_SpecificationSheet=new List<string>();
+
+        public event PropertyChangedEventHandler PropertyChanged;
+
         /// <summary>
         /// 关联规范项
         /// </summary>

+ 9 - 3
MBI/SAGA.MBI/ToolsData/DataCheck/WinDataCheckSetting.xaml

@@ -65,14 +65,20 @@
                     </TreeView>
                 </GroupBox>
             </Grid>
-            <Grid Grid.Column="1">
-                <GroupBox Header="请选择检查项">
+            <Grid Grid.Column="1"><!--Header=""-->
+                <GroupBox >
+                    <GroupBox.Header>
+                        <WrapPanel>
+                            <TextBlock Text="请选择检查"></TextBlock>
+                            <TextBlock Text="项 "  MouseDown="CheckItemInverse_OnMouseDown"></TextBlock>
+                        </WrapPanel>
+                    </GroupBox.Header>
                     <ListBox  x:Name="myListbox" >
                         <!--ItemsSource="{Binding Path=CheckList}"-->
                         <ListBox.ItemTemplate>
                             <DataTemplate>
                                 <WrapPanel  >
-                                    <CheckBox IsChecked="{Binding Path=RIsChecked,UpdateSourceTrigger=PropertyChanged}" 
+                                    <CheckBox IsChecked="{Binding Path=RIsChecked,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" 
                                       IsEnabled="{Binding Path=RIsReadOnly,Converter={StaticResource BoolInverseConverter}}"
                                       VerticalContentAlignment="Center"></CheckBox>
                                     <Label Content="{Binding Path=Name}"></Label>

+ 15 - 0
MBI/SAGA.MBI/ToolsData/DataCheck/WinDataCheckSetting.xaml.cs

@@ -6,6 +6,7 @@ using System.Globalization;
 using System.Linq;
 using System.Windows;
 using System.Windows.Data;
+using System.Windows.Input;
 using SAGA.DotNetUtils.Extend;
 using SAGA.MBI.Common;
 using SAGA.MBI.DataArrange;
@@ -135,6 +136,20 @@ namespace SAGA.MBI.ToolsData.DataCheck
             return context;
         }
 
+        private void CheckItemInverse_OnMouseDown(object sender, MouseButtonEventArgs e)
+        {
+            var items = myListbox.ItemsSource as List<ICheckBase>;
+            if (items != null)
+            {
+                foreach (ICheckBase checkBase in items)
+                {
+                    if (!checkBase.RIsReadOnly)
+                    {
+                        checkBase.RIsChecked = !checkBase.RIsChecked;
+                    }
+                }
+            }
+        }
     }
     public class FloorRadioButtonVisibleConverter : IMultiValueConverter
     {

+ 15 - 2
MBI/SAGA.MBI/ToolsData/ModeCheck/ModeCheckBase.cs

@@ -6,6 +6,7 @@
 
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.Linq;
 using NPOI.SS.UserModel;
 using SAGA.DotNetUtils.Others;
@@ -16,7 +17,7 @@ namespace SAGA.MBI.ToolsData.ModeCheck
     /// <summary>
     /// CheckBase
     /// </summary>
-    public class ModeCheckBase:ICheckBase
+    public class ModeCheckBase:ICheckBase,INotifyPropertyChanged
     {
 
         public CheckContext Context { get; set; }
@@ -113,12 +114,24 @@ namespace SAGA.MBI.ToolsData.ModeCheck
         /// 是否强制勾选
         /// </summary>
         public bool RIsReadOnly { get; set; }
+
+        private bool m_RIsChecked;
         /// <summary>
         /// 是否选中
         /// </summary>
-        public bool RIsChecked { get; set; }
+        public bool RIsChecked
+        {
+            get { return m_RIsChecked;}
+            set
+            {
+                m_RIsChecked = value;
+                PropertyChanged?.Invoke(this,new PropertyChangedEventArgs(nameof(RIsChecked)));
+            } }
 
         private List<string> m_SpecificationSheet=new List<string>();
+
+        public event PropertyChangedEventHandler PropertyChanged;
+
         /// <summary>
         /// 关联规范项
         /// </summary>

+ 8 - 2
MBI/SAGA.MBI/ToolsData/ModeCheck/WinModeCheckSetting.xaml

@@ -58,8 +58,14 @@
                 </GroupBox>
             </Grid>
             <Grid Grid.Column="1">
-                <GroupBox Header="请选择检查项">
-                    <ListBox  x:Name="myListbox" >
+                <GroupBox >
+                    <GroupBox.Header>
+                        <WrapPanel>
+                            <TextBlock Text="请选择检查"></TextBlock>
+                            <TextBlock Text="项 "  MouseDown="CheckItemInverse_OnMouseDown"></TextBlock>
+                        </WrapPanel>
+                    </GroupBox.Header>
+                        <ListBox  x:Name="myListbox" >
                         <!--ItemsSource="{Binding Path=CheckList}"-->
                         <ListBox.ItemTemplate>
                             <DataTemplate>

+ 17 - 0
MBI/SAGA.MBI/ToolsData/ModeCheck/WinModeCheckSetting.xaml.cs

@@ -7,6 +7,7 @@ using System.Linq;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Data;
+using System.Windows.Input;
 using SAGA.DotNetUtils.Extend;
 using SAGA.MBI.Common;
 using SAGA.MBI.DataArrange;
@@ -225,6 +226,22 @@ namespace SAGA.MBI.ToolsData.ModeCheck
                 }
             }
         }
+
+
+        private void CheckItemInverse_OnMouseDown(object sender, MouseButtonEventArgs e)
+        {
+            var items = myListbox.ItemsSource as List<ICheckBase>;
+            if (items != null)
+            {
+                foreach (ICheckBase checkBase in items)
+                {
+                    if (!checkBase.RIsReadOnly)
+                    {
+                        checkBase.RIsChecked = !checkBase.RIsChecked;
+                    }
+                }
+            }
+        }
     }
 }