예제 #1
0
        private void NgbSelect(object sender, System.EventArgs e)
        {
            //button1.Enabled = (lv.SelectedItems.Count>0);
            button2.Enabled = (lv.SelectedItems.Count > 0);
            button3.Enabled = button2.Enabled;

            cbtypes.Items.Clear();
            if (lv.SelectedItems.Count > 0)
            {
                string   path  = System.IO.Path.GetDirectoryName(lv.SelectedItems[0].SubItems[1].Text);
                string[] files = System.IO.Directory.GetFiles(path, "*.package");

                foreach (string file in files)
                {
                    SimPe.Packages.File pk = SimPe.Packages.File.LoadFromFile(file);
                    NeighborhoodType    type;
                    string   name = LoadLabel(pk, out type);
                    NgbhType nt   = new NgbhType(file, name, type);

                    cbtypes.Items.Add(nt);
                    if (Helper.EqualFileName(file, lv.SelectedItems[0].SubItems[1].Text))
                    {
                        cbtypes.SelectedIndex = cbtypes.Items.Count - 1;
                    }
                }
                if (cbtypes.SelectedIndex < 0 && cbtypes.Items.Count > 0)
                {
                    cbtypes.SelectedIndex = 0;
                }
            }
        }
예제 #2
0
        private void NgbOpen(object sender, System.EventArgs e)
        {
            if (lv.SelectedItems.Count <= 0)
            {
                return;
            }

            ngbh = cbtypes.SelectedItem as NgbhType;
            if (ngbh != null)
            {
                if (loadNgbh)
                {
                    package = SimPe.Packages.GeneratableFile.LoadFromFile(ngbh.FileName);
                }
                this.DialogResult = DialogResult.OK;
                Close();
            }
        }