Exemple #1
0
 public NodeDialog(MouseEventArgs e, Panel panel, GPSContext db)
 {
     this.db = db;
     this.panel = panel;
     InitializeComponent();
     this.textBoxCoordinateX.Text = e.X.ToString();
     this.textBoxCoordinateY.Text = e.Y.ToString();
 }
Exemple #2
0
        public ArcDialog(MouseEventArgs e, Panel panel, Node startNode, Node endNode, GPSContext db)
        {
            InitializeComponent();
            this.db = db;
            this.panel = panel;
            this.startNode = startNode;
            this.endNode = endNode;

            labelStartNodeValue.Text = startNode.Name;
            labelEndNodeValue.Text = endNode.Name;
        }
Exemple #3
0
        private GPSContext createContext()
        {
            var connection = DbConnectionFactory.CreateTransient();
            var db = new GPSContext(connection);
            db.Database.CreateIfNotExists();

            nodes = new Node[]
            {
                new Node("Left Up",    100, 100),
                new Node("Right Up",   200, 100),
                new Node("Left Down",  100, 200),
                new Node("Right Down", 200, 200),
                new Node("Center",     150, 150),
                new Node("Around we go", 300, 150),
            };

            arcs = new Arc[]
            {
                new Arc("LU-RU", nodes[0], nodes[1]),
                new Arc("LU-LD", nodes[0], nodes[2]),
                new Arc("LU-C", nodes[0], nodes[4], false),
                new Arc("RD-C", nodes[3], nodes[4]),
                new Arc("RD-RU", nodes[3], nodes[1]),
                new Arc("LD-RD", nodes[2], nodes[3]),
                new Arc("RG1", nodes[1], nodes[5]),
                new Arc("RG2", nodes[5], nodes[3])
            };

            ftypes = new FeatureType[]
            {
                new FeatureType("Store"),
                new FeatureType("Diner")
            };

            features = new Feature[]
            {
                new Feature("Wallmart", nodes[4], ftypes[0]),
                new Feature("Mo's", nodes[5], ftypes[1])
            };

            db.Nodes.AddOrUpdate(nodes);
            db.Arcs.AddOrUpdate(arcs);
            db.FeatureTypes.AddOrUpdate(ftypes);
            db.Features.AddOrUpdate(features);

            db.SaveChanges();

            return db;
        }