Ejemplo n.º 1
0
        public void TestUiConfigLoadSave()
        {
            UIConfiguration c = new UIConfiguration();

            c.Treshold               = Level.INFO;
            c.ColumnsWidths.Logger   = 1;
            c.ColumnsWidths.Domain   = 2;
            c.ColumnsWidths.Thread   = 3;
            c.ColumnsWidths.UserName = 4;
            c.ColumnsWidths.Date     = 20;
            c.ColumnsWidths.Time     = 30;
            c.ColumnsWidths.Exc      = 40;
            c.ColumnsWidths.Message  = 50;
            c.Save();

            UIConfiguration c2 = new UIConfiguration();

            c2.Load();

            Assert.AreEqual(c.Treshold, c2.Treshold);
            Assert.AreEqual(c.ColumnsWidths.Logger, c2.ColumnsWidths.Logger);
            Assert.AreEqual(c.ColumnsWidths.Domain, c2.ColumnsWidths.Domain);
            Assert.AreEqual(c.ColumnsWidths.Thread, c2.ColumnsWidths.Thread);
            Assert.AreEqual(c.ColumnsWidths.UserName, c2.ColumnsWidths.UserName);
            Assert.AreEqual(c.ColumnsWidths.Date, c2.ColumnsWidths.Date);
            Assert.AreEqual(c.ColumnsWidths.Time, c2.ColumnsWidths.Time);
            Assert.AreEqual(c.ColumnsWidths.Exc, c2.ColumnsWidths.Exc);
            Assert.AreEqual(c.ColumnsWidths.Message, c2.ColumnsWidths.Message);

            Console.WriteLine("Tests succeeded");
        }
Ejemplo n.º 2
0
 private void SaveUIConfig()
 {
     try
     {
         _uiConfig.ColumnsWidths.Logger   = loggerTypeCol.Width;
         _uiConfig.ColumnsWidths.Date     = dateCol.Width;
         _uiConfig.ColumnsWidths.Time     = timeCol.Width;
         _uiConfig.ColumnsWidths.Exc      = excColumn.Width;
         _uiConfig.ColumnsWidths.Domain   = DomainCol.Width;
         _uiConfig.ColumnsWidths.Thread   = ThreadCol.Width;
         _uiConfig.ColumnsWidths.UserName = UserCol.Width;
         _uiConfig.ColumnsWidths.Message  = msgCol.Width;
         _uiConfig.Treshold = (Level)Enum.Parse(typeof(Level), levelsLB.SelectedItem.ToString());
         _uiConfig.Font     = logGrid.Font;
         _uiConfig.Save();
     }
     catch (Exception ex)
     {
         ShowError("Error when saving settings to ui config", ex);
     }
 }