Exemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="settings"></param>
        public ConnectionSettings_UI(ConnectionSettings settings, bool setUiEnable, ApplicationSettings appSettings, Point position)
        {
            // Store the Starting Position to a local Variable
            windowStartPosistion = position;

            // Clone the Settings Object. becouse We are gone to change the Settings withe the interfacing of the users..
            userSettings        = (ConnectionSettings)ObjectCopier.Clone(settings);
            applicationSettings = (ApplicationSettings)ObjectCopier.Clone(appSettings);

            InitializeComponent();

            singleConnectionPage    = new settingsPageSingleConnection(userSettings.connection1, applicationSettings.expertModeIsActive);
            connectyInTheMiddlepage = new settingsPageConnectyInTheMiddle(userSettings, applicationSettings.expertModeIsActive);

            //Check the Current User Settings
            updateUiWithCurrentSettings();

            SettingsModeFrame.Loaded += new RoutedEventHandler(ConnectionSettingsFrameLoaded);


            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 settingsPageSingleConnection(currentConnectionSettings.connection1, expertModeIsEnabled);
            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 settingsPageSingleConnection(currentConnectionSettings.connection2, expertModeIsEnabled);
            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();
        }