示例#1
0
文件: VvVTraps.cs 项目: pallop/Servuo
        public void OnRevealed(Mobile m)
        {
            ItemID = VisibleID;

            if (Links != null)
            {
                Links.ForEach(l =>
                {
                    if (!l.Deleted && l.ItemID == HiddenID)
                    {
                        l.ItemID = VisibleID;
                    }
                });
            }

            if (ParentTrap != null)
            {
                if (ParentTrap.ItemID == HiddenID)
                {
                    ParentTrap.ItemID = VisibleID;
                }

                ParentTrap.OnRevealed(m);
            }
        }
示例#2
0
        public void WriteXml(XmlWriter writer)
        {
            if (string.IsNullOrEmpty(Title))
                ThrowHelper.ThrowSpecificationViolation("atom:feed elements MUST contain exactly one atom:title element.");
            if (string.IsNullOrEmpty(Id))
                ThrowHelper.ThrowSpecificationViolation("atom:feed elements MUST contain exactly one atom:id element.");
            if (string.IsNullOrEmpty(Updated))
                ThrowHelper.ThrowSpecificationViolation("atom:feed elements MUST contain exactly one atom:updated element.");
            if (Author == null)
                ThrowHelper.ThrowSpecificationViolation("atom:feed elements MUST contain one or more atom:author elements");
            if (Links.Count == 0)
                ThrowHelper.ThrowSpecificationViolation("atom:feed elements SHOULD contain one atom:link element with a " 
                                                        + "rel attribute value of 'self'. This is the preferred URI for retrieving Atom Feed Documents representing this Atom feed.");

            writer.WriteStartElement("feed", AtomSpecs.AtomV1Namespace);

            writer.WriteElementString("title", AtomSpecs.AtomV1Namespace, Title);
            writer.WriteElementString("id", AtomSpecs.AtomV1Namespace, Id);
            writer.WriteElementString("updated", AtomSpecs.AtomV1Namespace, Updated);
            Author.WriteXml(writer);

            Links.ForEach(link => link.WriteXml(writer));
            Entries.ForEach(entry => entry.WriteXml(writer, usePrefix: false));

            writer.WriteEndElement();
        }
示例#3
0
        public void RemoveNode(NodeType type, int index)
        {
            Debug.Assert(Enum.IsDefined(typeof(NodeType), type));
            Debug.Assert(index >= 0);

            switch (type)
            {
            case NodeType.GuideNode:
            {
                GuideNodes.RemoveAt(index);
                break;
            }

            case NodeType.WallNode:
            {
                WallNodes.RemoveAt(index);
                break;
            }
            }
            Links.ForEach(link =>
            {
                if (link.Type == type && link.StartIndex > index)
                {
                    link.StartIndex--;
                }
                if (link.Type == type && link.EndIndex > index)
                {
                    link.EndIndex--;
                }
            });
        }
示例#4
0
文件: VvVTraps.cs 项目: pallop/Servuo
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write(0);

            writer.Write(Owner);
            writer.Write((int)DeploymentType);

            writer.Write(Links != null ? Links.Count : 0);

            if (Links != null)
            {
                Links.ForEach(l => writer.Write(l));
            }

            writer.Write(ParentTrap);
        }
示例#5
0
        private string GenerateSelectSql()
        {
            ThrowExceptionIfMappingConfigIsNotComplete();

            var sb = new StringBuilder();

            sb.Append("SELECT ");

            var allProperties = new List <PropertyConfig>();

            allProperties.AddRange(Properties);

            foreach (var link in Links)
            {
                var derivedProperties = link.GetDerivedPropertyConfigs();

                foreach (var derived in derivedProperties)
                {
                    var found = allProperties.Find(p => p.PropertyName == derived.PropertyName);
                    if (found == null)
                    {
                        allProperties.Add(derived);
                    }
                }
            }

            var selectList = from p in allProperties
                             select p.SelectPart;


            sb.AppendLine(string.Join(",\n ", selectList));

            sb.AppendLine(String.Format(" FROM [Schema].{0}", TableName));


            Links.ForEach(l =>
            {
                var join = l.JoinPart;
                sb.AppendLine(" " + join + " ");
            });


            return(sb.ToString());
        }
示例#6
0
文件: VvVTraps.cs 项目: pallop/Servuo
        public override void Delete()
        {
            base.Delete();

            if (Links != null)
            {
                Links.ForEach(l =>
                {
                    if (!l.Deleted)
                    {
                        l.Delete();
                    }
                });
            }

            if (ParentTrap != null && !ParentTrap.Deleted)
            {
                ParentTrap.Delete();
            }
        }
示例#7
0
        /// <summary>
        /// Пишет скрипт инициализаии элемента управления.
        /// </summary>
        /// <param name="writer">Экземпляр класса <see cref="TextWriter"/></param>
        public override void WriteInitializationScript(TextWriter writer)
        {
            base.WriteInitializationScript(writer);
            //return;
            List <object> links = new List <object>();

            string onCommandHandler    = String.IsNullOrEmpty(ClientEvents.OnCommand) ? "null" : ClientEvents.OnCommand;
            string onFocusItemHandler  = String.IsNullOrEmpty(ClientEvents.OnFocusItem) ? "null" : ClientEvents.OnFocusItem;
            string onSelectItemHandler = String.IsNullOrEmpty(ClientEvents.OnSelectItem) ? "null" : ClientEvents.OnSelectItem;
            string onFormatItemHandler = String.IsNullOrEmpty(ClientEvents.OnFormatItem) ? "null" : ClientEvents.OnFormatItem;
            string onRequestHandler    = String.IsNullOrEmpty(ClientEvents.OnRequest) ? "null" : ClientEvents.OnRequest;

            var options = new {
                required     = Required,
                value        = Value,
                displayValue = DisplayValue,
                source       = AutocompleteUri,
                limit        = AutocompleteMaxItems,
                keyField     = KeyField,
                displayField = DisplayField,
                context      = ClientSideControlContext,
                buttons      = new {
                    search = (Buttons & KescoSelectButtons.SearchButton) == KescoSelectButtons.SearchButton,
                    view   = (Buttons & KescoSelectButtons.ViewButton) == KescoSelectButtons.ViewButton
                },
                //searchButtonImage = SearchButtonImage,
                //refreshUri = RefreshUri,
                //refreshUriKeyField = RefreshUriKeyField,
                //refreshUriLabelField = RefreshUriLabelField,
                focus        = "$$$OnFocusItem$$$",
                select       = "$$$OnSelectItem$$$",
                formatItem   = "$$$OnFormatItem$$$",
                command      = "$$$OnCommand$$$",
                request      = "$$$OnRequest$$$",
                links        = new List <dynamic>(),
                localization = new {
                    found    = Kesco.Web.Mvc.UI.Controls.Localization.Resources.KescoLookUpControl_Found,
                    notFound = Kesco.Web.Mvc.UI.Controls.Localization.Resources.KescoLookUpControl_NotFound,
                    search   = Kesco.Web.Mvc.UI.Controls.Localization.Resources.KescoLookUpControl_Search,
                    view     = Kesco.Web.Mvc.UI.Controls.Localization.Resources.KescoLookUpControl_View
                }
            };


            Links.ForEach((item) =>
            {
                options.links.Add(new { command = item.Command, text = item.Text, icon = item.Icon, show = (int)item.ShowCondition });
            });


            string jsonizedOptions = new JavaScriptSerializer().Serialize(options);

            jsonizedOptions = jsonizedOptions
                              .Replace("\"$$$OnRequest$$$\"", onRequestHandler)
                              .Replace("\"$$$OnCommand$$$\"", onCommandHandler)
                              .Replace("\"$$$OnFocusItem$$$\"", onFocusItemHandler)
                              .Replace("\"$$$OnSelectItem$$$\"", onSelectItemHandler)
                              .Replace("\"$$$OnFormatItem$$$\"", onFormatItemHandler);
            if (IsSelfInitialized)
            {
                writer.WriteLine(@"
					$(document).ready(function() {{
					"                    );
            }
            writer.WriteLine(@"
                        $('#{0}').selectBox({1});
					    "
                             , ID, jsonizedOptions);
            if (IsSelfInitialized)
            {
                writer.WriteLine(@"
					}});
					"                    );
            }
        }