Пример #1
0
        private void buttonGetLatency_Click(object sender, EventArgs e)
        {
            ServerMonitor        monitor     = DemoLib.GetServerMonitor();
            ReplicaConfiguration config      = DemoLib.GetCurrentConfiguration();
            List <string>        allServers  = config.GetServers();
            List <string>        siteNames   = new List <string>();
            List <string>        siteLatency = new List <string>();

            foreach (string server in allServers)
            {
                ServerState ss = monitor.GetServerState(server);
                siteNames.Add(DemoLib.SiteName(server));
                siteLatency.Add(ss.RTTs.FindAverage().ToString("F0").PadLeft(5));
            }

            listBoxLatencySites.DataSource = null;
            listBoxLatencySites.DataSource = siteNames;
            listBoxLatencySites.ClearSelected();
            listBoxLatencyTimes.DataSource = null;
            listBoxLatencyTimes.DataSource = siteLatency;
            listBoxLatencyTimes.ClearSelected();
        }
Пример #2
0
        private void setReplicasButton_Click(object sender, EventArgs e)
        {
            ReplicaConfiguration config = DemoLib.GetCurrentConfiguration();

            config.PrimaryServers.Clear();
            config.SecondaryServers.Clear();
            config.NonReplicaServers.Clear();
            string server = DemoLib.ServerName("West US");

            if (radioButtonWestUSPrimary.Checked)
            {
                config.PrimaryServers.Add(server);
            }
            else if (radioButtonWestUSSecondary.Checked)
            {
                config.SecondaryServers.Add(server);
            }
            else
            {
                config.NonReplicaServers.Add(server);
            }
            server = DemoLib.ServerName("East US");
            if (radioButtonEastUSPrimary.Checked)
            {
                config.PrimaryServers.Add(server);
            }
            else if (radioButtonEastUSSecondary.Checked)
            {
                config.SecondaryServers.Add(server);
            }
            else
            {
                config.NonReplicaServers.Add(server);
            }
            server = DemoLib.ServerName("South US");
            if (radioButtonSouthUSPrimary.Checked)
            {
                config.PrimaryServers.Add(server);
            }
            else if (radioButtonSouthUSSecondary.Checked)
            {
                config.SecondaryServers.Add(server);
            }
            else
            {
                config.NonReplicaServers.Add(server);
            }
            server = DemoLib.ServerName("North US");
            if (radioButtonNorthUSPrimary.Checked)
            {
                config.PrimaryServers.Add(server);
            }
            else if (radioButtonNorthUSSecondary.Checked)
            {
                config.SecondaryServers.Add(server);
            }
            else
            {
                config.NonReplicaServers.Add(server);
            }
            server = DemoLib.ServerName("West Europe");
            if (radioButtonWestEuropePrimary.Checked)
            {
                config.PrimaryServers.Add(server);
            }
            else if (radioButtonWestEuropeSecondary.Checked)
            {
                config.SecondaryServers.Add(server);
            }
            else
            {
                config.NonReplicaServers.Add(server);
            }
            server = DemoLib.ServerName("North Europe");
            if (radioButtonNorthEuropePrimary.Checked)
            {
                config.PrimaryServers.Add(server);
            }
            else if (radioButtonNorthEuropeSecondary.Checked)
            {
                config.SecondaryServers.Add(server);
            }
            else
            {
                config.NonReplicaServers.Add(server);
            }
            server = DemoLib.ServerName("East Asia");
            if (radioButtonAsiaPrimary.Checked)
            {
                config.PrimaryServers.Add(server);
            }
            else if (radioButtonAsiaSecondary.Checked)
            {
                config.SecondaryServers.Add(server);
            }
            else
            {
                config.NonReplicaServers.Add(server);
            }
            server = DemoLib.ServerName("Brazil");
            if (radioButtonBrazilPrimary.Checked)
            {
                config.PrimaryServers.Add(server);
            }
            else if (radioButtonBrazilSecondary.Checked)
            {
                config.SecondaryServers.Add(server);
            }
            else
            {
                config.NonReplicaServers.Add(server);
            }
            initialConfig   = false;
            reconfigSampler = DemoLib.NewSampler();
            DemoLib.SetCurrentConfiguration(config);
        }
Пример #3
0
        private void getReplicasButton_Click(object sender, EventArgs e)
        {
            ReplicaConfiguration config = DemoLib.GetCurrentConfiguration();
            string server = DemoLib.ServerName("West US");

            if (config.PrimaryServers.Contains(server))
            {
                radioButtonWestUSPrimary.Checked = true;
            }
            else if (config.SecondaryServers.Contains(server))
            {
                radioButtonWestUSSecondary.Checked = true;
            }
            else
            {
                radioButtonWestUSUnused.Checked = true;
            }
            if (config.ReadOnlySecondaryServers.Contains(server))
            {
                radioButtonWestUSPrimary.Enabled = false;
            }
            server = DemoLib.ServerName("East US");
            if (config.PrimaryServers.Contains(server))
            {
                radioButtonEastUSPrimary.Checked = true;
            }
            else if (config.SecondaryServers.Contains(server))
            {
                radioButtonEastUSSecondary.Checked = true;
            }
            else
            {
                radioButtonEastUSUnused.Checked = true;
            }
            if (config.ReadOnlySecondaryServers.Contains(server))
            {
                radioButtonEastUSPrimary.Enabled = false;
            }
            server = DemoLib.ServerName("South US");
            if (config.PrimaryServers.Contains(server))
            {
                radioButtonSouthUSPrimary.Checked = true;
            }
            else if (config.SecondaryServers.Contains(server))
            {
                radioButtonSouthUSSecondary.Checked = true;
            }
            else
            {
                radioButtonSouthUSUnused.Checked = true;
            }
            if (config.ReadOnlySecondaryServers.Contains(server))
            {
                radioButtonSouthUSPrimary.Enabled = false;
            }
            server = DemoLib.ServerName("North US");
            if (config.PrimaryServers.Contains(server))
            {
                radioButtonNorthUSPrimary.Checked = true;
            }
            else if (config.SecondaryServers.Contains(server))
            {
                radioButtonNorthUSSecondary.Checked = true;
            }
            else
            {
                radioButtonNorthUSUnused.Checked = true;
            }
            if (config.ReadOnlySecondaryServers.Contains(server))
            {
                radioButtonNorthUSPrimary.Enabled = false;
            }
            server = DemoLib.ServerName("West Europe");
            if (config.PrimaryServers.Contains(server))
            {
                radioButtonWestEuropePrimary.Checked = true;
            }
            else if (config.SecondaryServers.Contains(server))
            {
                radioButtonWestEuropeSecondary.Checked = true;
            }
            else
            {
                radioButtonWestEuropeUnused.Checked = true;
            }
            if (config.ReadOnlySecondaryServers.Contains(server))
            {
                radioButtonWestEuropePrimary.Enabled = false;
            }
            server = DemoLib.ServerName("North Europe");
            if (config.PrimaryServers.Contains(server))
            {
                radioButtonNorthEuropePrimary.Checked = true;
            }
            else if (config.SecondaryServers.Contains(server))
            {
                radioButtonNorthEuropeSecondary.Checked = true;
            }
            else
            {
                radioButtonNorthEuropeUnused.Checked = true;
            }
            if (config.ReadOnlySecondaryServers.Contains(server))
            {
                radioButtonNorthEuropePrimary.Enabled = false;
            }
            server = DemoLib.ServerName("East Asia");
            if (config.PrimaryServers.Contains(server))
            {
                radioButtonAsiaPrimary.Checked = true;
            }
            else if (config.SecondaryServers.Contains(server))
            {
                radioButtonAsiaSecondary.Checked = true;
            }
            else
            {
                radioButtonAsiaUnused.Checked = true;
            }
            if (config.ReadOnlySecondaryServers.Contains(server))
            {
                radioButtonAsiaPrimary.Enabled = false;
            }
            server = DemoLib.ServerName("Brazil");
            if (config.PrimaryServers.Contains(server))
            {
                radioButtonBrazilPrimary.Checked = true;
            }
            else if (config.SecondaryServers.Contains(server))
            {
                radioButtonBrazilSecondary.Checked = true;
            }
            else
            {
                radioButtonBrazilUnused.Checked = true;
            }
            if (config.ReadOnlySecondaryServers.Contains(server))
            {
                radioButtonBrazilPrimary.Enabled = false;
            }
        }