/// <summary> /// Handles the Load event of the RunAsForm control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void RunAsForm_Load(object sender, EventArgs e) { if (Program.IsInRunTime == true) { DataAccessConfig config = new DataAccessConfig(); config = (DataAccessConfig)ConfigurationManager.GetConfiguration((AppConfigBase)config); if ((config != null) && (config.ApplicationsList != null)) { m_sEncEntity = config.Entity; foreach (ApplicationUnit appUnit in config.ApplicationsList) { AddItemToListView(appUnit); } if (string.IsNullOrEmpty(m_sEncEntity) == true) { button_RunAs.Enabled = false; button_Add.Enabled = false; } } } }
private void FromString(string _sEntity) { try { DataAccessConfig config = new DataAccessConfig(); config = (DataAccessConfig)ConfigurationManager.GetConfiguration((AppConfigBase)config); if (string.IsNullOrEmpty(_sEntity) == false) { string sEntity = EncDec.Decrypt(_sEntity, C_INT.ToString()); if (string.IsNullOrEmpty(sEntity) == false) { string[] saEntityArray = sEntity.Split(';'); if ((saEntityArray != null) && (saEntityArray.Length == 3)) { m_sUserName = saEntityArray[0]; m_sDomain = saEntityArray[1]; m_sPWD = saEntityArray[2]; } } } } catch (Exception exp) { Logger.ThrowException(exp, "c479aeaa-f54e-4d5b-8d35-412dd92eecc7"); } }
private void FromConfig() { try { DataAccessConfig config = new DataAccessConfig(); config = (DataAccessConfig)ConfigurationManager.GetConfiguration((AppConfigBase)config); if ((config != null) || (string.IsNullOrEmpty(config.Entity) == false)) { FromString(config.Entity); } } catch (Exception exp) { Logger.ThrowException(exp, "e86583ac-77d3-42b1-a0ba-490c5e52affb"); } }
/// <summary> /// Saves the config. /// </summary> private void SaveConfig() { try { DataAccessConfig config = new DataAccessConfig(); config.Entity = m_sEncEntity; config.CloseWhenRun = checkBox_CloseWhenRun.Checked; foreach (ListViewItem item in listView.Items) { if ((item.Tag != null) && (item.Tag is ApplicationUnit)) { config.ApplicationsList.Add((ApplicationUnit)item.Tag); } } ConfigurationManager.WriteConfiguration(config); } catch (Exception exp) { Logger.WriteError(exp, "b885193d-9bcc-444a-bcff-859ac00a0103"); } }