diff --git a/Database.cs b/Database.cs
index 954761c..47722dc 100644
--- a/Database.cs
+++ b/Database.cs
@@ -22,6 +22,7 @@ namespace FAtoPA
CreateFSMTable();
CreateModbusTable();
CreateVXTable();
+ CreateConditionTable();
}
private bool CreateFSMTable()
@@ -169,7 +170,7 @@ namespace FAtoPA
}
}
- private bool CreateModbusTable()
+ private bool CreateModbusTable()
{
//Debug.WriteLine("About to execute CreateModbusTable");
using (var connection = new SQLiteConnection(connectionString))
@@ -312,6 +313,27 @@ namespace FAtoPA
}
}
+ private bool CreateConditionTable()
+ {
+ using (var connection = new SQLiteConnection(connectionString))
+ {
+ try
+ {
+ connection.Open();
+ var conFMSCmd = connection.CreateCommand();
+ conFMSCmd.CommandText = "CREATE TABLE IF NOT EXISTS ConditionTable (No INTEGER AUTO INCREMENT, Condition TEXT, PASStatus TEXT)";
+ conFMSCmd.ExecuteNonQuery();
+ Debug.WriteLine("CreateConditionTable success");
+ return true;
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Error CreateConditionTable, Exception : " + ex.Message);
+ return false;
+ }
+ }
+ }
+
private bool CreateVXTable()
{
//Debug.WriteLine("About to execute CreateVXTable");
diff --git a/MainWindow.xaml b/MainWindow.xaml
index 48d0948..141636b 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -61,11 +61,11 @@
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1 1 1 0"
- CornerRadius="10,10,0,0"
-
+ CornerRadius="10,10,0,0"
Padding="8"
Margin="2 2 0 0">
@@ -187,7 +187,7 @@
-
+
@@ -221,9 +221,9 @@
-
+
-
+
@@ -248,14 +248,14 @@
-
+
-
+
@@ -293,11 +293,11 @@
-
+
-
+
-
+
@@ -310,83 +310,109 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index a23c5e0..830ce9d 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -112,7 +112,7 @@ namespace FAtoPA.Net
siType.ItemsSource = Enum.GetValues(typeof(SIType)).Cast().ToList();
Load_ModbusTranslationTable();
-
+
DataContext = this;
}
@@ -299,6 +299,12 @@ namespace FAtoPA.Net
List ConditionON = new List();
List ConditionOFF = new List();
+ //add for example. delete if database condition done.
+ ConditionON.Add(SILogicalState.FIRE.ToString());
+ ConditionON.Add(SILogicalState.SMOKE.ToString());
+ ConditionOFF.Add(SILogicalState.NORMAL.ToString());
+
+
fsm.AddListener(new FSMTableUpdater(FsmTableMember, DetectedSIID, DetectedSIIDCount));
fsm.AddListener(new ModbusTriggerFromFSM(FsmTableMember, ModbusTableMember, modbusSlave, ModbusTranslationTable));
@@ -1085,7 +1091,6 @@ namespace FAtoPA.Net
break;
case "LastUpdate":
e.Column.Width = DataGridLength.Auto;
-
break;
}
}
@@ -1113,6 +1118,8 @@ namespace FAtoPA.Net
}
}
+
+
private void VXTable_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
Debug.WriteLine("VXTable_AutoGeneratingColumn : " + e.PropertyName);
@@ -1243,6 +1250,28 @@ namespace FAtoPA.Net
}
}
+
+ private void ConditionTable_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
+ {
+ Debug.WriteLine("ConditionTable_AutoGeneratingColumn : " + e.PropertyName);
+ switch (e.PropertyName)
+ {
+ case "No":
+ e.Column.Width = DataGridLength.Auto;
+ break;
+ case "Condition":
+ e.Column.Width = DataGridLength.Auto;
+ break;
+ case "PAS Status":
+ e.Column.Width = DataGridLength.Auto;
+ break;
+ }
+ }
+
+ private void VXTable_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+
+ }
}
///