/// <summary> /// Constructor /// </summary> /// <param name="settings"></param> public settingsPageTcpIp(SingleConnectionSettings settings, bool enableExpertMode) { expertModeIsEnabled = enableExpertMode; userSettings = settings; InitializeComponent(); setUiTcpIpSettings(); }
} // Functionality Selection... /// <summary> /// Constructor /// </summary> public ConnectionSettings() { connection1 = new SingleConnectionSettings(); connection1.connectionName = "Verbindung 1"; connection2 = new SingleConnectionSettings(); connection2.connectionName = "Verbindung 2"; }
/// <summary> /// Funtion to return the User entered Settings. This Function is called when the Accept button was Pressed /// </summary> public SingleConnectionSettings getUserParams() { if (connectionSelection.SelectedItem.ToString() == "TCP") { if (tcpIpPage != null) { currentConnectionSettings.currentConnectionSetting = 1; currentConnectionSettings = tcpIpPage.getUserParams(); } } else if (connectionSelection.SelectedItem.ToString() == "RS232") { if (rs232Page != null) { currentConnectionSettings.currentConnectionSetting = 1; currentConnectionSettings = rs232Page.getUserParams(); } } else { currentConnectionSettings = new SingleConnectionSettings(); } // Return the User Settings return(currentConnectionSettings); }
/// <summary> /// Get the Valid State from the current Page /// </summary> /// <returns></returns> private bool checkisPlausible() { bool yesDataIsValid = false; SingleConnectionSettings con1 = connection_1.getUserParams(); SingleConnectionSettings con2 = connection_2.getUserParams(); if ((connection_1.checkisPlausible() && connection_2.checkisPlausible())) { // Bevor we can compare those Variables we have to figure out wich Interface is used! if (con1.currentConnectionSetting == con2.currentConnectionSetting) { if (con1.currentConnectionSetting == 1) { // It is not Possible that two Servers listen to the Same Port... if (con1.tcpSettings.clientServerSelection == "Server" && con2.tcpSettings.clientServerSelection == "Server" && con1.tcpSettings.port == con2.tcpSettings.port) { yesDataIsValid = false; } else { yesDataIsValid = true; } } else { if (con1.serialSettings.port == con2.serialSettings.port) { yesDataIsValid = false; } else { yesDataIsValid = true; } } } // Color the UI for the User to show wich setting is not ok.. if (!yesDataIsValid) { // Set the Boarder Thicknes. To show the user te wrong Input BoarderSettingsContenFrame2.BorderBrush = Brushes.Red; } else { // Hide the Boarder to let the User know that the input is valid BoarderSettingsContenFrame2.BorderBrush = Brushes.LightGray; } } // Check if both Connections are OK return(yesDataIsValid); }
/// <summary> /// Constructor with now params (This Constructor is setting the default settings) /// </summary> public settingsPageConnection() { // Init the View InitializeComponent(); // Set the Data to local variable currentConnectionSettings = new SingleConnectionSettings(); // Set up the UI to corresponding to the current Settings setUiFromPreviousSettings(); }
/// <summary> /// Constructor with now params (This Constructor is setting the default settings) /// </summary> public settingsPageSingleConnection() { // Init the View InitializeComponent(); // Set the Data to local variable currentConnectionSettings = new SingleConnectionSettings(); connectionSelection.ItemsSource = new string[] { "RS232", "TCP" }; // Set up the UI to corresponding to the current Settings updateUiWithCurrentSettings(); }
/// <summary> /// Constructor /// </summary> /// <param name="settings"></param> public settingsPageRs232(SingleConnectionSettings settings) { userSettings = settings; InitializeComponent(); setUiRs232Settings(); // Check the State of the PortSelection if (!CheckPortSelection()) { cbPort.Background = Brushes.Red; } }
/// <summary> /// Constructor /// </summary> /// <param name="settings"></param> public settingsPageRs232(SingleConnectionSettings settings, bool enableExpertMode) { userSettings = settings; expertModeIsEnabled = enableExpertMode; InitializeComponent(); setUiRs232Settings(); // Check the State of the PortSelection if (!CheckPortSelection()) { cbPort.Background = Brushes.Red; } }
/// <summary> /// Constructor with Settings /// </summary> /// <param name="settings"></param> public settingsPageSingleConnection(SingleConnectionSettings settings, bool enableExpertMode) { // Init the View InitializeComponent(); // Set the Data to local variable currentConnectionSettings = settings; expertModeIsEnabled = enableExpertMode; connectionSelection.ItemsSource = new string[] { "RS232", "TCP" }; // Set up the UI to corresponding to the current Settings updateUiWithCurrentSettings(); }
/// <summary> /// Funtion to return the User entered Settings. This Function is called when the Accept button was Pressed /// </summary> public SingleConnectionSettings getUserParams() { if (currentConnectionSettings.currentConnectionSetting == 1) { if (tcpIpPage != null) { currentConnectionSettings = tcpIpPage.getUserParams(); } } else { if (rs232Page != null) { currentConnectionSettings = rs232Page.getUserParams(); } } // Return the User Settings return(currentConnectionSettings); }
/// <summary> /// Constructor /// </summary> /// <param name="settings"></param> public settingsPageTcpIp(SingleConnectionSettings settings) { userSettings = settings; InitializeComponent(); setUiTcpIpSettings(); }
} // Functionality Selection... /// <summary> /// Constructor /// </summary> public ConnectionSettings() { connection1 = new SingleConnectionSettings(); connection2 = new SingleConnectionSettings(); }