private void LoadConfig()
        {
            ChildControls ccChildren = new ChildControls();

            tbsHostName = new List <TextBox>();
            tbsNickName = new List <TextBox>();

            int i;

            foreach (object o in ccChildren.GetChildren(Parent, 5))
            {
                if (o.GetType() == typeof(TextBox))
                {
                    switch (((TextBox)o).Uid)
                    {
                    case "HOSTNAME":
                        tbsHostName.Add((TextBox)o);
                        break;

                    case "NICKNAME":
                        tbsNickName.Add((TextBox)o);
                        break;

                    default:
                        break;
                    }
                }
            }

            List.Content = config.GetFileName();

            i = 0;
            foreach (var text in tbsHostName)
            {
                if (config.GetHostName(i) != null)
                {
                    text.Text = config.GetHostName(i);
                }
                else
                {
                    text.Text = "";
                }
                i++;
            }

            i = 0;
            foreach (var text in tbsNickName)
            {
                if (config.GetNickName(i) != null)
                {
                    text.Text = config.GetNickName(i);
                }
                else
                {
                    text.Text = "";
                }
                i++;
            }
        }
Exemplo n.º 2
0
        private void LoadConfig()
        {
            ChildControls ccChildren = new ChildControls();

            labelsHostName = new List <Label>();
            labelsNickName = new List <Label>();
            labelsData     = new List <Label>();
            rectsStatus    = new List <Rectangle>();

            int i;

            foreach (object o in ccChildren.GetChildren(Parent, 5))
            {
                if (o.GetType() == typeof(Label))
                {
                    switch (((Label)o).Uid)
                    {
                    case "HOSTNAME":
                        labelsHostName.Add((Label)o);
                        break;

                    case "NICKNAME":
                        labelsNickName.Add((Label)o);
                        break;

                    case "DATA":
                        labelsData.Add((Label)o);
                        break;

                    default:
                        break;
                    }
                }
                else if (o.GetType() == typeof(Rectangle))
                {
                    rectsStatus.Add((Rectangle)o);
                }
            }


            config = new Config();

            Selection.Items.Clear();

            foreach (var name in config.GetConfigs())
            {
                Selection.Items.Add(name);
            }

            Selection.SelectedItem = config.GetFileName();

            i = 0;
            foreach (var name in config.GetHostName())
            {
                if (name != "")
                {
                    PingAsync(name, i);
                    i++;
                }
            }

            if (i != 19)
            {
                while (i < 20)
                {
                    labelsData[i].Content = "";
                    rectsStatus[i].Fill   = (Brush)converter.ConvertFromString("#FFF");
                    i++;
                }
            }

            i = 0;
            foreach (var label in labelsHostName)
            {
                if (config.GetHostName(i) != null)
                {
                    label.Content = config.GetHostName(i);
                }
                else
                {
                    label.Content = "";
                }
                i++;
            }

            i = 0;
            foreach (var label in labelsNickName)
            {
                if (config.GetNickName(i) != null)
                {
                    label.Content = config.GetNickName(i);
                }
                else
                {
                    label.Content = "";
                }
                i++;
            }

            Time.Content  = DateTime.Now.ToString("HH:mm:ss:ff");
            Interval.Text = interval.ToString();
            Timeout.Text  = timeout.ToString();
        }