public AzLog() { m_azlm = new AzLogModel(); InitializeComponent(); PopulateAccounts(); m_ste = new Settings(_rgsteeApp, "Software\\Thetasoft\\AzLog", "App"); m_ste.Load(); m_sDefaultView = m_ste.SValue("DefaultView"); }
/* L O A D */ /*---------------------------------------------------------------------------- %%Function: Load %%Qualified: AzLog.AzLogViewSettings.Load %%Contact: rlittle ----------------------------------------------------------------------------*/ public void Load() { RegistryKey rk = Registry.CurrentUser.OpenSubKey(KeySettings()); if (rk == null) { SetDefault(); return; } string[] rgs = rk.GetSubKeyNames(); Settings ste; SortedList<int, Settings> mpnste = new SortedList<int, Settings>(); foreach (string sColumn in rgs) { string sKey = String.Format("{0}\\{1}", KeySettings(), sColumn); ste = new Settings(_rgsteeColumn, sKey, sColumn); ste.Load(); int nTabOrder = ste.NValue("TabOrder"); mpnste.Add(nTabOrder, ste); } foreach (int nKey in mpnste.Keys) { ste = mpnste[nKey]; int nWidth = ste.NValue("Width"); AzLogEntry.LogColumn azlc = (AzLogEntry.LogColumn) ste.NValue("DataLogColumn"); bool fVisible = ste.FValue("Visible"); string sTitle = ste.SValue("Title"); if (sTitle == "") sTitle = (string) ste.Tag; AddLogViewColumn((string) ste.Tag, sTitle, nWidth, azlc, fVisible); } rk.Close(); m_fDirty = false; }
public void TestValueFromKey() { Settings ste = new Settings(new SettingsElt[] { new SettingsElt("TestString1", Settings.Type.Str, "1", ""), new SettingsElt("TestString2", Settings.Type.Str, "2", ""), new SettingsElt("TestInt161", Settings.Type.Int, (Int16) 1, ""), new SettingsElt("TestInt321", Settings.Type.Int, (Int32) 2, ""), new SettingsElt("TestDttm1", Settings.Type.Dttm, DateTime.Parse("1/1/1901"), ""), }, "__UnitTestTest_TcoreSettings__", "tag"); Assert.AreEqual("1", ste.SValue("TestString1")); Assert.AreEqual(1, ste.WValue("TestInt161")); Assert.AreEqual(2, ste.NValue("TestInt321")); Assert.AreEqual(DateTime.Parse("1/1/1901"), ste.DttmValue("TestDttm1")); }
private void m_pbOpen_Click(object sender, EventArgs e) { Settings ste = new Settings(_rgsteeAccount, KeyName, "main"); ste.Load(); m_azlm.OpenAccount((string) m_cbAccounts.SelectedItem, ste.SValue("AccountKey")); foreach (string s in m_azlm.Tables) m_lbTables.Items.Add(s); }