Esempio n. 1
0
 public void ShowCollectorDetails(ICollector collector)
 {
     base.Show();
     DatabaseSizeConfig = null;
     DatabaseSizeConfig = ((DatabaseSize)collector).DatabaseSizeConfig;
     LoadList();
     RefreshList();
     ShowDetails_Resize(null, null);
 }
Esempio n. 2
0
        public override string ConfigureAgent(string config)
        {
            XmlDocument configXml = new XmlDocument();

            if (config.Length > 0)
            {
                configXml.LoadXml(config);
            }
            else
            {
                configXml.LoadXml(GetDefaultOrEmptyConfigString());
            }
            ReadConfiguration(configXml);

            EditConfig editConfig = new EditConfig();

            editConfig.DatabaseSizeConfig = DatabaseSizeConfig;
            //editConfig.SqlServer = DatabaseSizeConfig.SqlServer;
            //editConfig.IntegratedSec = DatabaseSizeConfig.IntegratedSec;
            //editConfig.UserName = DatabaseSizeConfig.UserName;
            //editConfig.Password = DatabaseSizeConfig.Password;
            //editConfig.Databases = DatabaseSizeConfig.Databases;
            //editConfig.CmndTimeOut = DatabaseSizeConfig.CmndTimeOut;
            if (editConfig.ShowConfig() == System.Windows.Forms.DialogResult.OK)
            {
                DatabaseSizeConfig = editConfig.DatabaseSizeConfig;
                //DatabaseSizeConfig.SqlServer = editConfig.SqlServer;
                //DatabaseSizeConfig.IntegratedSec = editConfig.IntegratedSec;
                //DatabaseSizeConfig.UserName = editConfig.UserName;
                //DatabaseSizeConfig.Password = editConfig.Password;
                //DatabaseSizeConfig.Databases = editConfig.Databases;

                XmlElement root           = configXml.DocumentElement;
                XmlNode    connectionNode = root.SelectSingleNode("connection");
                connectionNode.SetAttributeValue("sqlServer", DatabaseSizeConfig.SqlServer);
                connectionNode.SetAttributeValue("integratedSec", DatabaseSizeConfig.IntegratedSec.ToString());
                connectionNode.SetAttributeValue("userName", DatabaseSizeConfig.UserName);
                connectionNode.SetAttributeValue("password", DatabaseSizeConfig.Password);
                connectionNode.SetAttributeValue("cmndTimeOut", DatabaseSizeConfig.CmndTimeOut.ToString());
                connectionNode.InnerXml = "";

                foreach (var database in DatabaseSizeConfig.Databases)
                {
                    XmlElement databaseNode = configXml.CreateElement("database");
                    databaseNode.SetAttributeValue("name", database.Name);
                    databaseNode.SetAttributeValue("warningSizeMB", database.WarningSizeMB.ToString());
                    databaseNode.SetAttributeValue("errorSizeMB", database.ErrorSizeMB.ToString());

                    connectionNode.AppendChild(databaseNode);
                }
                config = configXml.OuterXml;
            }
            return(config);
        }
Esempio n. 3
0
 public void RefreshConfig(ICollector collector)
 {
     DatabaseSizeConfig = null;
     DatabaseSizeConfig = ((DatabaseSize)collector).DatabaseSizeConfig;
     LoadList();
     RefreshList();
     if (this.WindowState == FormWindowState.Minimized)
     {
         this.WindowState = FormWindowState.Normal;
     }
     this.Show();
 }
Esempio n. 4
0
 private void EditConfig_Load(object sender, EventArgs e)
 {
     if (DatabaseSizeConfig == null)
     {
         DatabaseSizeConfig = new QuickMon.DatabaseSizeConfig();
     }
     txtServer.Text                 = DatabaseSizeConfig.SqlServer;
     chkIntegratedSec.Checked       = DatabaseSizeConfig.IntegratedSec;
     txtUserName.Text               = DatabaseSizeConfig.UserName;
     txtPassword.Text               = DatabaseSizeConfig.Password;
     numericUpDownCmndTimeOut.Value = DatabaseSizeConfig.CmndTimeOut;
     LoadDatabases();
 }
Esempio n. 5
0
 private void cmdOK_Click(object sender, EventArgs e)
 {
     DatabaseSizeConfig               = new QuickMon.DatabaseSizeConfig();
     DatabaseSizeConfig.SqlServer     = txtServer.Text;
     DatabaseSizeConfig.IntegratedSec = chkIntegratedSec.Checked;
     DatabaseSizeConfig.UserName      = txtUserName.Text;
     DatabaseSizeConfig.Password      = txtPassword.Text;
     DatabaseSizeConfig.CmndTimeOut   = (int)numericUpDownCmndTimeOut.Value;
     DatabaseSizeConfig.Databases     = new List <DatabaseEntry>();
     foreach (ListViewItem lvi in lvwDatabases.Items)
     {
         DatabaseEntry dbe = (DatabaseEntry)lvi.Tag;
         DatabaseSizeConfig.Databases.Add(dbe);
     }
     DialogResult = System.Windows.Forms.DialogResult.OK;
     Close();
 }
Esempio n. 6
0
        public override void ReadConfiguration(XmlDocument config)
        {
            XmlElement root           = config.DocumentElement;
            XmlNode    connectionNode = root.SelectSingleNode("connection");

            DatabaseSizeConfig               = new DatabaseSizeConfig();
            DatabaseSizeConfig.SqlServer     = connectionNode.ReadXmlElementAttr("sqlServer", "");
            DatabaseSizeConfig.IntegratedSec = bool.Parse(connectionNode.ReadXmlElementAttr("integratedSec", "True"));
            DatabaseSizeConfig.UserName      = connectionNode.ReadXmlElementAttr("userName", "");
            DatabaseSizeConfig.Password      = connectionNode.ReadXmlElementAttr("password", "");
            DatabaseSizeConfig.CmndTimeOut   = int.Parse(connectionNode.ReadXmlElementAttr("cmndTimeOut", "60"));
            DatabaseSizeConfig.Databases     = new List <DatabaseEntry>();
            foreach (XmlElement databaseNode in connectionNode.SelectNodes("database"))
            {
                DatabaseSizeConfig.Databases.Add(new DatabaseEntry()
                {
                    Name          = databaseNode.ReadXmlElementAttr("name", ""),
                    WarningSizeMB = int.Parse(databaseNode.ReadXmlElementAttr("warningSizeMB", "1024")),
                    ErrorSizeMB   = int.Parse(databaseNode.ReadXmlElementAttr("errorSizeMB", "4094"))
                }
                                                 );
            }
        }