diff --git a/InputBox.xaml b/InputBox.xaml
index 73d3045..6bf916b 100644
--- a/InputBox.xaml
+++ b/InputBox.xaml
@@ -14,21 +14,21 @@
-
+
-
-
-
+
+
+
-
+
-
+
diff --git a/InputBox.xaml.cs b/InputBox.xaml.cs
index 5c69155..26e7005 100644
--- a/InputBox.xaml.cs
+++ b/InputBox.xaml.cs
@@ -38,7 +38,7 @@ namespace FAtoPA.Net
InitializeComponent();
cbModbusRegister.ItemsSource = ModbusRegisters;
- txtLogicalState.Text = key;
+ txtLogicalState.Content = key;
cbModbusRegister.SelectedIndex = ModbusRegisters.IndexOf(value);
diff --git a/MainWindow.xaml b/MainWindow.xaml
index 5db0960..67a20cd 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -9,10 +9,14 @@
Closing="Window_Closing"
Title="MainWindow"
MinWidth="800"
+ MaxWidth="1024"
MinHeight="480"
- WindowState="Maximized" >
+ MaxHeight="600"
+ WindowState="Maximized"
+ IsManipulationEnabled="True">
+
-
-
-
+
@@ -106,7 +111,6 @@
-
@@ -117,16 +121,16 @@
-
-
+
+
-
+
-
+
-
+
@@ -180,14 +184,13 @@
-
-
-
+
+
@@ -196,20 +199,21 @@
-
-
+
-
-
+
+
+
+
-
+
-
+
-
-
+
+
@@ -226,21 +230,25 @@
+
+
+
+
-
-
-
+
+
+
-
+
-
+
@@ -248,38 +256,39 @@
-
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
+
+
-
-
+
-
+
-
-
+
+
@@ -311,111 +320,108 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
-
-
+
+
-
-
+
-
-
-
-
+
+
+
+
-
+
-
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
-
+
+
+
@@ -423,7 +429,6 @@
-
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 9b2c9aa..c934eda 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -213,6 +213,7 @@ namespace FAtoPA.Net
String json = JsonSerializer.Serialize(ModbusTranslationTable);
File.WriteAllText("ModbusTranslationTable.json", json);
Debug.WriteLine("ModbusTranslationTable saved");
+ FSMtoModbusTranslationTable.ItemsSource = ModbusTranslationTable;
} catch (Exception e)
{
Debug.WriteLine("Error saving ModbusTranslationTable : " + e.Message);
@@ -302,6 +303,7 @@ namespace FAtoPA.Net
String json = JsonSerializer.Serialize(FSMConditionTable);
File.WriteAllText("FSMConditionTable.json", json);
Debug.WriteLine("FSMConditionTable saved");
+ ConditionTable.ItemsSource = FSMConditionTable;
}
catch (Exception e)
{
@@ -403,7 +405,7 @@ namespace FAtoPA.Net
fsm.AddListener(new FSMTableUpdater(FsmTableMember, DetectedSIID, DetectedSIIDCount));
fsm.AddListener(new ModbusTriggerFromFSM(FsmTableMember, ModbusTableMember, modbusSlave, ModbusTranslationTable));
fsm.AddListener(new VXTriggerFromFSM(FsmTableMember, VXTableMember, vx3k, ConditionON, ConditionOFF));
- VerifyDataGridBinding(ConditionTable);
+
}
private void Timer1s_Tick(object sender, EventArgs e)
@@ -1329,6 +1331,8 @@ namespace FAtoPA.Net
var result = MessageBox.Show($"Reset FSM to Modbus Translation Table ?", "Reset FSM to Modbus Translation Table", MessageBoxButton.YesNo);
if (result == MessageBoxResult.Yes)
{
+ if (ModbusTranslationTable != null) ModbusTranslationTable.Clear();
+
Create_Default_ModbusTranslationTable();
}
@@ -1363,6 +1367,7 @@ namespace FAtoPA.Net
var result = MessageBox.Show($"Reset FSM Condition Table ?", "Reset FSM Condition Table", MessageBoxButton.YesNo);
if (result == MessageBoxResult.Yes)
{
+ if (FSMConditionTable != null) FSMConditionTable.Clear();
Create_Default_ConditionTable();
}
}
@@ -1375,31 +1380,30 @@ namespace FAtoPA.Net
Save_ConditionTable();
}
}
- // Method to verify if the DataGrid is correctly bound to the data source
- private void VerifyDataGridBinding(DataGrid dataGrid)
+
+ private void btnStartStopFSM_TouchEnter(object sender, TouchEventArgs e)
{
- if (dataGrid.ItemsSource == null)
- {
- Debug.WriteLine("DataGrid is not bound to any data source.");
- return;
- }
+ btnStartStopFSM_Click(sender, e);
+ }
- var dataSourceType = dataGrid.ItemsSource.GetType();
- Debug.WriteLine($"DataGrid is bound to data source of type: {dataSourceType.Name}");
- // Check if the data source is an ObservableCollection
- if (dataSourceType.IsGenericType && dataSourceType.GetGenericTypeDefinition() == typeof(ObservableCollection<>))
+ private void TabItem_TouchDown(object sender, TouchEventArgs e)
+ {
+ if (sender is TabItem touchedTabItem)
{
- Debug.WriteLine("DataGrid is bound to an ObservableCollection.");
- }
- else
- {
- Debug.WriteLine("DataGrid is bound to a different type of collection.");
+ // Set the touched TabItem as the selected one
+ mainTab.SelectedItem = touchedTabItem;
+ e.Handled = true; // Mark the event as handled
}
}
+
+ private void mainTab_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+
+ }
}
- ///
+ /// e
/// Event Handler for VX3K
///
class VX3KEvent : EventInterface