// Initializes the state keys to their default values. private void InitializeState() { object webManagerDir = Registry.GetValue("HKEY_LOCAL_MACHINE\\Software\\PalphaManagerServices", "Installation Path", null) ?? Registry.GetValue("HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\PalphaManagerServices", "Installation Path", null); bool managerOptionsEnabled = m_state["configurationType"].ToString() == "database"; bool webManagerOptionEnabled = managerOptionsEnabled && (webManagerDir != null); bool existing = Convert.ToBoolean(m_state["existing"]); bool initialDataScript = !existing && Convert.ToBoolean(m_state["initialDataScript"]); m_nodeSelectionScreen = new NodeSelectionScreen(); if (m_state != null && m_state.ContainsKey("setupReadyScreen")) { m_setupReadyScreen = (SetupReadyScreen)m_state["setupReadyScreen"]; } else { m_setupReadyScreen = new SetupReadyScreen(); m_state["setupReadyScreen"] = m_setupReadyScreen; } if (m_state != null && m_state.ContainsKey("historianSetupScreen")) { m_historianSetupScreen = (HistorianSetupScreen)m_state["historianSetupScreen"]; } else { m_historianSetupScreen = new HistorianSetupScreen(); m_state["historianSetupScreen"] = m_historianSetupScreen; } // Enable or disable the options based on whether those options are available for the current configuration. m_PalphaManagerLocalCheckBox.IsEnabled = managerOptionsEnabled; m_PalphaManagerWebCheckBox.IsEnabled = webManagerOptionEnabled; // If the options are disabled, they must also be unchecked. if (!managerOptionsEnabled) { m_PalphaManagerLocalCheckBox.IsChecked = false; } if (!webManagerOptionEnabled) { m_PalphaManagerWebCheckBox.IsChecked = false; } m_setupHistorianCheckBox.IsChecked = false; // Set up the state object with the proper initial values. m_state["applyChangesToService"] = m_PalphaServiceCheckBox.IsChecked.GetValueOrDefault(); m_state["applyChangesToLocalManager"] = m_PalphaManagerLocalCheckBox.IsChecked.GetValueOrDefault(); m_state["applyChangesToWebManager"] = m_PalphaManagerWebCheckBox.IsChecked.GetValueOrDefault(); //m_state["setupHistorian"] = initialDataScript; //m_setupHistorianCheckBox.Visibility = (Convert.ToBoolean(m_state["setupHistorian"]) ? Visibility.Visible : Visibility.Collapsed); //Replaced above two lines with two lines below because initialDataScript should only be used for visibility of checkbox. m_state["setupHistorian"] = (bool)m_setupHistorianCheckBox.IsChecked; m_setupHistorianCheckBox.Visibility = initialDataScript ? Visibility.Visible : Visibility.Collapsed; m_horizontalRule.Visibility = m_setupHistorianCheckBox.Visibility; }
// Initializes the state keys to their default values. private void InitializeState() { object webManagerDir = Registry.GetValue("HKEY_LOCAL_MACHINE\\Software\\substationSBGManagerServices", "Installation Path", null) ?? Registry.GetValue("HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\substationSBGManagerServices", "Installation Path", null); bool managerOptionsEnabled = m_state["configurationType"].ToString() == "database"; bool webManagerOptionEnabled = managerOptionsEnabled && (webManagerDir != null); bool existing = Convert.ToBoolean(m_state["existing"]); bool initialDataScript = !existing && Convert.ToBoolean(m_state["initialDataScript"]); m_nodeSelectionScreen = new NodeSelectionScreen(); if (m_state != null && m_state.ContainsKey("setupReadyScreen")) { m_setupReadyScreen = (SetupReadyScreen)m_state["setupReadyScreen"]; } else { m_setupReadyScreen = new SetupReadyScreen(); m_state["setupReadyScreen"] = m_setupReadyScreen; } if (m_state != null && m_state.ContainsKey("historianSetupScreen")) { m_historianSetupScreen = (HistorianSetupScreen)m_state["historianSetupScreen"]; } else { m_historianSetupScreen = new HistorianSetupScreen(); m_state["historianSetupScreen"] = m_historianSetupScreen; } // Enable or disable the options based on whether those options are available for the current configuration. m_substationSBGManagerLocalCheckBox.IsEnabled = managerOptionsEnabled; m_substationSBGManagerWebCheckBox.IsEnabled = webManagerOptionEnabled; // If the options are disabled, they must also be unchecked. if (!managerOptionsEnabled) m_substationSBGManagerLocalCheckBox.IsChecked = false; if (!webManagerOptionEnabled) m_substationSBGManagerWebCheckBox.IsChecked = false; if (initialDataScript) m_setupHistorianCheckBox.IsChecked = true; else m_setupHistorianCheckBox.IsChecked = false; // Set up the state object with the proper initial values. m_state["applyChangesToService"] = m_substationSBGServiceCheckBox.IsChecked.Value; m_state["applyChangesToLocalManager"] = m_substationSBGManagerLocalCheckBox.IsChecked.Value; m_state["applyChangesToWebManager"] = m_substationSBGManagerWebCheckBox.IsChecked.Value; //m_state["setupHistorian"] = initialDataScript; //m_setupHistorianCheckBox.Visibility = (Convert.ToBoolean(m_state["setupHistorian"]) ? Visibility.Visible : Visibility.Collapsed); //Replaced above two lines with two lines below because initialDataScript should only be used for visibility of checkbox. m_state["setupHistorian"] = (bool)m_setupHistorianCheckBox.IsChecked; m_setupHistorianCheckBox.Visibility = initialDataScript ? Visibility.Visible : Visibility.Collapsed; m_horizontalRule.Visibility = m_setupHistorianCheckBox.Visibility; }