示例#1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Locality l = (Locality)((ListBox)Application.Current.Windows[0].FindName("listBox1")).SelectedItem;

            if (listBox1.SelectedItem != null)
            {
                string p = (listBox1.SelectedItem).ToString();

                string[] str = p.Trim().Split(' ');
                MessageBox.Show(p);
                Window3 f3 = new Window3();

                (f3.comboBox1).Text = str[1];
                (f3.textBox1).Text  = str[3];
                (f3.textBox2).Text  = str[5];
                int      year, month, day, hour, minute, seconds;
                string   time = str[7] + " " + str[8];
                string[] s    = time.Split('.', ':', ' ');
                int      i    = 0;
                foreach (string st in s)
                {
                    if (st[0] == '0')
                    {
                        s[i] = st.Remove(0, 1);
                    }
                    i++;
                }
                year  = Convert.ToInt32(s[2]);
                month = Convert.ToInt32(s[1]);
                day   = Convert.ToInt32(s[0].Replace(" ", ""));


                f3.DatePicker.SelectedDate = new DateTime(year, month, day);
                (f3.textBox4).Text         = str[14];
                (f3.comboBox2).Text        = str[17];


                for (int j = 18; j < str.Length; j++)
                {
                    string[] st = str[j].Split(';');
                    st[0] = st[0].Replace("{X=", "");
                    st[1] = st[1].Replace("Y=", "");
                    st[1] = st[1].Replace("}", "");
                    ((ListBox)f3.listBox1).Items.Add(new Point(Convert.ToInt32(st[0]), Convert.ToInt32(st[1])));
                }
                (f3.textBox5).Text = str[10];

                f3.ShowDialog();
                if (l.plots != null)
                {
                    listBox1.Items.Clear();
                    foreach (var plot in l.plots)
                    {
                        listBox1.Items.Add(plot);
                    }
                }
            }
        }
示例#2
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Locality l  = (Locality)((ListBox)Application.Current.Windows[0].FindName("listBox1")).SelectedItem;
            Window3  f3 = new Window3();

            f3.ShowDialog();
            if (l.plots != null)
            {
                listBox1.Items.Clear();
                foreach (var plot in l.plots)
                {
                    listBox1.Items.Add(plot);
                }
            }
        }