예제 #1
0
파일: RouteDetails.cs 프로젝트: uvbs/babbot
        public RouteDetails()
        {
            InitializeComponent();

            pOptA.Tag   = pObjA;
            pObjA.Tag   = pSubObjA;
            cbObjA0.Tag = lblObjA0;
            cbObjA1.Tag = lblObjA1;

            pOptB.Tag   = pObjB;
            pObjB.Tag   = pSubObjB;
            cbObjB0.Tag = lblObjB0;
            cbObjB1.Tag = lblObjB1;

            CbTypes  = new ComboBox[] { cbTypeA, cbTypeB };
            ZoneText = new TextBox[] { tbZoneA, tbZoneB };
            Panel[] obj_p = new Panel[] { pOptA, pOptB };

            List <AbstractListEndpoint>[] obj_list = new List <AbstractListEndpoint>[] {
                new List <AbstractListEndpoint>(), new List <AbstractListEndpoint>()
            };

            foreach (EndpointTypes ept in Enum.GetValues(typeof(EndpointTypes)))
            {
                string class_name = Output.GetLogNameByLfs(
                    Enum.GetName(typeof(EndpointTypes), ept).ToLower(), "") + "ListEndpoint";

                Type reflect_class = Type.GetType("BabBot.Forms.Shared." + class_name);

                AbstractListEndpoint[] ale = new AbstractListEndpoint[2];
                for (int i = 0; i < 2; i++)
                {
                    AbstractListEndpoint epl = Activator.CreateInstance(
                        reflect_class, new object[] { this,
                                                      obj_p[i], (char)(65 + i), ept }) as AbstractListEndpoint;
                    obj_list[i].Add(epl);
                    ale[i] = epl;
                }

                EndpointList.Add(ept, ale);
            }

            for (int i = 0; i < 2; i++)
            {
                CbTypes[i].Tag           = i;
                CbTypes[i].DataSource    = obj_list[i];
                CbTypes[i].DisplayMember = "Name";
                CbTypes[i].SelectedIndex = (int)EndpointTypes.UNDEF;
            }
        }
예제 #2
0
파일: RouteDetails.cs 프로젝트: uvbs/babbot
        public void PopulateControls(Route r)
        {
            for (int i = 0; i < 2; i++)
            {
                Endpoint             ep = r[i];
                AbstractListEndpoint ab = EndpointList[ep.PType][i];

                ZoneText[i].Text = ep.ZoneText;
                CbTypes[i].Text  = ab.Name;

                ab.OnSelection(r[i]);
            }

            tbDescr.Text         = r.Description;
            cbReversible.Checked = r.Reversible;
            lblWaypointFile.Text = "Waypoint : " +
                                   r.WaypointFileName + ".wp";
        }
예제 #3
0
파일: RouteDetails.cs 프로젝트: uvbs/babbot
        public Route GetRoute(Vector3D a, Vector3D b)
        {
            // Check if B is set
            if (!(CheckEndpoints() &&
                  ((AbstractListEndpoint)cbTypeA.SelectedItem).Check &&
                  ((AbstractListEndpoint)cbTypeB.SelectedItem).Check))
            {
                return(null);
            }

            // Make route
            AbstractListEndpoint point_a = cbTypeA.SelectedItem as AbstractListEndpoint;
            AbstractListEndpoint point_b = cbTypeB.SelectedItem as AbstractListEndpoint;

            // Make new route
            Route route = new Route(
                point_a.GetEndpoint(tbZoneA.Text, a),
                point_b.GetEndpoint(tbZoneB.Text, b),
                tbDescr.Text, cbReversible.Checked);

            return(route);
        }
예제 #4
0
        public RouteDetails()
        {
            InitializeComponent();

            pOptA.Tag = pObjA;
            pObjA.Tag = pSubObjA;
            cbObjA0.Tag = lblObjA0;
            cbObjA1.Tag = lblObjA1;

            pOptB.Tag = pObjB;
            pObjB.Tag = pSubObjB;
            cbObjB0.Tag = lblObjB0;
            cbObjB1.Tag = lblObjB1;

            CbTypes = new ComboBox[] { cbTypeA, cbTypeB };
            ZoneText = new TextBox[] { tbZoneA, tbZoneB };
            Panel[] obj_p = new Panel[] { pOptA, pOptB };

            List<AbstractListEndpoint>[] obj_list = new List<AbstractListEndpoint>[] {
                new List<AbstractListEndpoint>(), new List<AbstractListEndpoint>() };

            foreach (EndpointTypes ept in Enum.GetValues(typeof(EndpointTypes)))
            {
                string class_name = Output.GetLogNameByLfs(
                    Enum.GetName(typeof(EndpointTypes), ept).ToLower(), "") + "ListEndpoint";

                Type reflect_class = Type.GetType("BabBot.Forms.Shared." + class_name);

                AbstractListEndpoint[] ale = new AbstractListEndpoint[2];
                for (int i = 0; i < 2; i++)
                {
                    AbstractListEndpoint epl = Activator.CreateInstance(
                        reflect_class, new object[] { this,
                            obj_p[i], (char) (65 + i), ept }) as AbstractListEndpoint;
                    obj_list[i].Add(epl);
                    ale[i] = epl;
                }

                EndpointList.Add(ept, ale);
            }

            for (int i = 0; i < 2; i++)
            {
                CbTypes[i].Tag = i;
                CbTypes[i].DataSource = obj_list[i];
                CbTypes[i].DisplayMember = "Name";
                CbTypes[i].SelectedIndex = (int)EndpointTypes.UNDEF;
            }
        }