示例#1
0
        public AppOrder GetAppOrder(string packageName)
        {
            lock (orderingLockObj) {
                var order = Ordering.FirstOrDefault(ao => ao.PackageName.Equals(packageName));

                // Make sure the current ordering actually exists
                if (order == null)
                {
                    var index = 1;
                    // If it doesn't exist, let's assume last in line
                    var after = Ordering.LastOrDefault();
                    if (after != null)
                    {
                        index = after.Order + 1;
                    }

                    // Make our order
                    order = new AppOrder {
                        PackageName = packageName,
                        Order       = index
                    };

                    // Order didn't exist so let's add it
                    Ordering.Add(order);
                }

                return(order);
            }
        }
示例#2
0
        public AppOrder GetAppOrder(string packageName)
        {
            lock (orderingLockObj) {
                var order = Ordering.FirstOrDefault (ao => ao.PackageName.Equals (packageName));

                // Make sure the current ordering actually exists
                if (order == null) {
                    var index = 1;
                    // If it doesn't exist, let's assume last in line
                    var after = Ordering.LastOrDefault ();
                    if (after != null)
                        index = after.Order + 1;

                    // Make our order
                    order = new AppOrder {
                        PackageName = packageName,
                        Order = index
                    };

                    // Order didn't exist so let's add it
                    Ordering.Add (order);
                }

                return order;
            }
        }