/// <summary> /// Constructor /// </summary> /// <param name="settings"></param> public ConnectionSettings_UI(ConnectionSettings settings, bool setUiEnable) { // Clone the Settings Object. becouse We are gone to change the Settings withe the interfacing of the users.. userSettings = (ConnectionSettings)ObjectCopier.Clone(settings); InitializeComponent(); //Check the Current User Settings updateUiWithCurrentSettings(); singleConnectionPage = new settingsPageConnection(userSettings.connection1); SingleConnectionContentFrame.Loaded += new RoutedEventHandler(singleConnectionPageLoaded); connectyInTheMiddlepage = new settingsPageConnectyInTheMiddle(userSettings); ConnectyInTheMiddleContentFrame.Loaded += new RoutedEventHandler(multiConnectionPageLoaded); if (!setUiEnable) { DisableEditFunctions(); } }
/// <summary> /// This function sets the Data from the Current Settings /// </summary> public void updateUiWithCurrentSettings() { // Set the Data to the Left Frame for the Connection 1 Connection1_Name.Text = currentConnectionSettings.connection1.connectionName; connection_1 = new settingsPageConnection(currentConnectionSettings.connection1); connection_1.Changed += new SingleConnectionSettingsChangedEventHandler(connectionSettingsChanged); if (settingsContentFrameConnection1.IsLoaded) { settingsContentFrameConnection1.Content = connection_1; } else { settingsContentFrameConnection1.Loaded += new RoutedEventHandler(contentFrame1Loaded); } // Set the Data to the Left Frame for the Connection 2 Connection2_Name.Text = currentConnectionSettings.connection2.connectionName; connection_2 = new settingsPageConnection(currentConnectionSettings.connection2); connection_2.Changed += new SingleConnectionSettingsChangedEventHandler(connectionSettingsChanged); if (settingsContentFrameConnection2.IsLoaded) { settingsContentFrameConnection2.Content = connection_2; } else { settingsContentFrameConnection2.Loaded += new RoutedEventHandler(contentFrame2Loaded); } // Check the Plausability. To Show the User Wrong Inputs checkisPlausible(); }