Ejemplo n.º 1
0
        public string jun_to_string(JunctionType jun)
        {
            if (jun == JunctionType.INVALID)
            {
                return("Invalid");
            }
            else if (jun == JunctionType.DEADEND)
            {
                return("Deadend");
            }
            else if (jun == JunctionType.T)
            {
                return("T-Junction");
            }
            else if (jun == JunctionType.LL)
            {
                return("Left L");
            }
            else if (jun == JunctionType.RL)
            {
                return("Right L");
            }
            else if (jun == JunctionType.CROSS)
            {
                return("Cross");
            }

            return("opps an error");
        }
Ejemplo n.º 2
0
 protected virtual AdvancedPartJunction CreateJunction(JunctionType type)
 {
     return(new AdvancedPartJunction(type)
     {
         Builder = _builderFactory
     });
 }
Ejemplo n.º 3
0
        private static IValidatorRule Parse(JunctionType junctionType, Dictionary <String, Object> objectStorage)
        // throws CertificateValidationException
        {
            var filteredRules = junctionType.ExtensibleTypeData[0].ExtensibleType_Type_Group.ToList();

            return(Parse(filteredRules, objectStorage, junctionType.JunctionTypeData.Type));
        }
Ejemplo n.º 4
0
        public string jun_to_string(JunctionType jun)
        {
            if (jun == JunctionType.INVALID)
            {
                return("Invalid");
            }
            else if (jun == JunctionType.DEADEND)
            {
                return("D");                 //deadend
            }
            else if (jun == JunctionType.T)
            {
                return("T");                 //T
            }
            else if (jun == JunctionType.LL)
            {
                return("EL");                //elbow left
            }
            else if (jun == JunctionType.RL)
            {
                return("ER");                //elbow right
            }
            else if (jun == JunctionType.CROSS)
            {
                return("Cross");
            }

            return("oops an error");
        }
Ejemplo n.º 5
0
 protected override AdvancedPartJunction CreateJunction(JunctionType type)
 {
     return(new WpfAdvancedPartJunction(type)
     {
         Builder = _builderFactory
     });
 }
Ejemplo n.º 6
0
        public void CopyFrom(IPartView other)
        {
            var junc = other as IPartViewJunction;

            if (junc != null)
            {
                _parts.Clear();
                Type = junc.Type;
                foreach (var p in junc)
                {
                    Add(p);
                }
            }
        }
Ejemplo n.º 7
0
        public decimal GetStat(JunctionType type)
        {
            switch (type)
            {
            case JunctionType.HP: return(HP);

            case JunctionType.STR: return(Strength);

            case JunctionType.VIT: return(Vitality);

            case JunctionType.MAG: return(Magic);

            case JunctionType.SPR: return(Spirit);

            case JunctionType.SPD: return(Speed);

            case JunctionType.LCK: return(Luck);

            default: throw new NotImplementedException();
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Construct a new AdvancedPartJunction that represents an IPartViewJunction.
 /// </summary>
 /// <param name="type">The type of junction.</param>
 public AdvancedPartJunction(JunctionType type)
 {
     Type               = type;
     Parts              = new BindingList <AdvancedPart>();
     Parts.ListChanged += Parts_ListChanged;
 }
Ejemplo n.º 9
0
 public PartViewJunction(JunctionType type)
     : this()
 {
     Type = type;
 }
Ejemplo n.º 10
0
 public JunctionBuilder(JunctionType type)
 {
     Type = type;
 }
Ejemplo n.º 11
0
        private async Task Junction_LocationDefaults()
        {
            using (var odw = new OracleDatabaseWorker(tbOracleConnectionStringText))
            {
                List <string> boundaries = odw.GetDistinctDataColumn(junkTable, "CITY");
                List <string> types      = odw.GetListForDataColumn(@"select distinct FINALTYPE from junctions");

                List <string> statuses = odw.GetDistinctDataColumn(junkTable, "STATUS");
                statuses.Add(UNK);
                List <string> routes = odw.GetDistinctDataColumn(junkTable, "ROUTE");

                //unknjown junction
                using (var uow = new UnitOfWork(Tsdl))
                {
                    var gss  = GlobalSystemSettings.GetInstanceFromDatabase(uow);
                    var junc = new Junction(uow)
                    {
                        LocationName = UNK,
                        Status       = gss.DefaultLocationStatusActive
                    };
                    uow.CommitChanges();
                }
                //routes
                var del = new MyDelegate((lst) =>
                {
                    using (var uow = new UnitOfWork(Tsdl))
                    {
                        foreach (var str in lst
                                 .Where(s => s != ""))
                        {
                            if (!uow.Query <Route>().Any(x => x.Name == str))

                            {
                                Route cs = new Route(uow)
                                {
                                    Name = str
                                };
                                uow.CommitChanges();
                            }
                        }
                    }
                    return(true);
                });
                IAsyncResult routeres = del.BeginInvoke(routes, null, null);

                await Task.FromResult(routes);

                //boundaries
                del = new MyDelegate((lst) =>
                {
                    using (var uow = new UnitOfWork(Tsdl))
                    {
                        foreach (var str in lst
                                 .Where(s => s != ""))
                        {
                            if (!string.IsNullOrWhiteSpace(str) && !uow.Query <Boundary>().Any(x => x.Name == str))

                            {
                                Boundary cs = new Boundary(uow)
                                {
                                    Name = str
                                };
                                uow.CommitChanges();
                            }
                        }
                    }
                    return(true);
                });
                IAsyncResult boundres = del.BeginInvoke(boundaries, null, null);
                await Task.FromResult(boundres);

                //type
                del = new MyDelegate((lst) =>
                {
                    using (var uow = new UnitOfWork(Tsdl))
                    {
                        foreach (var str in lst
                                 .Where(s => s != ""))
                        {
                            if (!uow.Query <JunctionType>().Any(x => x.TypeName == str))

                            {
                                JunctionType cs = new JunctionType(uow)
                                {
                                    TypeName = str, TypeDescription = str
                                };
                                uow.CommitChanges();
                            }
                        }
                    }
                    return(true);
                });
                IAsyncResult typeres = del.BeginInvoke(types, null, null);
                await Task.FromResult(typeres);

                // status
                del = new MyDelegate((lst) =>
                {
                    using (var uow = new UnitOfWork(Tsdl))
                    {
                        foreach (var str in lst
                                 .Where(s => s != ""))
                        {
                            if (!uow.Query <LocationStatus>().Any(x => x.StatusName == str))

                            {
                                LocationStatus cs = new LocationStatus(uow)
                                {
                                    StatusName = str, StatusDescription = str
                                };
                                uow.CommitChanges();
                            }
                        }
                    }
                    return(true);
                });
                IAsyncResult statusres = del.BeginInvoke(statuses, null, null);
                await Task.FromResult(statusres);
            }//using odw
        }
Ejemplo n.º 12
0
 public PartViewJunction()
 {
     Type   = JunctionType.Conjunction;
     _parts = new List <IPartView>();
 }
Ejemplo n.º 13
0
 protected virtual AdvancedPartJunction CreateJunction(JunctionType type)
 {
     return(new AdvancedPartJunction(type));
 }
Ejemplo n.º 14
0
 public JunctionBuilder(JunctionType type, ParameterBuilder other)
     : this(type)
 {
     Other = other;
 }
 public WinFormsAdvancedPartJunction(JunctionType type)
     : base(type)
 {
 }
Ejemplo n.º 16
0
 public WpfAdvancedPartJunction(JunctionType type)
     : base(type)
 {
 }
Ejemplo n.º 17
0
 public WpfAdvancedPartJunction(JunctionType type)
     : base(type)
 {
 }
Ejemplo n.º 18
0
 public JunctionBuilder(JunctionType type, ParameterBuilder other)
     : this(type)
 {
     Other = other;
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Construct a new AdvancedPartJunction that represents an IPartViewJunction.
 /// </summary>
 /// <param name="type">The type of junction.</param>
 public AdvancedPartJunction(JunctionType type)
 {
     Type = type;
     Parts = new BindingList<AdvancedPart>();
     Parts.ListChanged += Parts_ListChanged;
 }
Ejemplo n.º 20
0
 private IndividualStatModel(JunctionType type)
 {
     Type = type;
 }
Ejemplo n.º 21
0
    public void SetJunctionType(int index, JunctionType junction)
    {
        Point2 selectedPoint = _points[index];

        if (selectedPoint.GetJunction () != junction)
        {
            if (junction == JunctionType.Curved)
            {
                ArchedPoint2 ap = new ArchedPoint2 (selectedPoint);
                _points[index] = ap;
            }
            else if (junction == JunctionType.Broken)
            {
                Point2 newPoint = new Point2 (selectedPoint);
                newPoint.SetPrevEdge (selectedPoint.GetPrevEdge ());
                newPoint.SetNextEdge (selectedPoint.GetNextEdge ());

                Edge2 prevEdge = newPoint.GetPrevEdge ();
                if (prevEdge != null)
                {
                    prevEdge.SetNextPoint2 (newPoint);
                }

                Edge2 nextEdge = newPoint.GetNextEdge ();
                if (nextEdge != null)
                {
                    nextEdge.SetPrevPoint2 (newPoint);
                }

                _points[index] = newPoint;
            }
        }
    }
Ejemplo n.º 22
0
 public PartViewJunction(JunctionType type)
     : this()
 {
     Type = type;
 }
Ejemplo n.º 23
0
 public JunctionBuilder(JunctionType type)
 {
     Type = type;
 }
Ejemplo n.º 24
0
 public void CopyFrom(IPartView other)
 {
     var junc = other as IPartViewJunction;
     if (junc != null)
     {
         _parts.Clear();
         Type = junc.Type;
         foreach (var p in junc)
             Add(p);
     }
 }
Ejemplo n.º 25
0
        /// <summary>
        /// Add a new part to the adapter.
        /// </summary>
        /// <param name="type"></param>
        public virtual void Add(JunctionType type)
        {
            var toAdd = CreateNode(null);

            if (toAdd == null)
            {
                return;
            }

            AddHandlers(toAdd);

            // if Parts null, just add node
            if (Part == null)
            {
                Part = toAdd;
            }
            else
            {
                // if we have a selected part, add as a sibling to this, otherwise add it as a sibling to the last item
                var sibling = SelectedPart;
                if (sibling == null)
                {
                    sibling = Part;
                }

                // if the sibling has a container and it's the same type of junction, add it to the same container
                AdvancedPartJunction container = null;
                if (sibling.Container != null && sibling.Container.Type == type)
                {
                    container = sibling.Container;
                }
                else if (sibling == Part && sibling is AdvancedPartJunction && ((AdvancedPartJunction)sibling).Type == type)
                {
                    container = (AdvancedPartJunction)sibling;
                }

                // no parent? (either no container, or the sibling's container is a different junction type)
                if (container == null)
                {
                    container = CreateJunction(type);
                    if (Part == sibling) // root case
                    {
                        Part = container;
                    }
                    else if (sibling.Container != null) // otherwise, replace index in original container
                    {
                        // it seems replacing the index directly messes with UI data templating
                        // so if we remove it and insert the container at the old items location, it works
                        var c     = sibling.Container;
                        var index = c.IndexOf(sibling);
                        c.Remove(sibling);
                        c.Insert(index, container);
                    }
                    container.Add(sibling);
                    AddHandlers(container);
                }

                // and finally, add the new node to the junction
                container.Parts.Add(toAdd);
            }

            toAdd.IsSelected = true;
        }
Ejemplo n.º 26
0
 protected override AdvancedPartJunction CreateJunction(JunctionType type)
 {
     return(new WinFormsAdvancedPartJunction(type));
 }
 public WinFormsAdvancedPartJunction(JunctionType type)
     : base(type)
 {
 }