示例#1
0
        protected override void Render(HtmlTextWriter writer)
        {
            base.AddAttributesToRender(writer);
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.WriteEncodedText(Title);
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.WriteEncodedText(Author.ToString());
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.WriteEncodedText(BookType.ToString());
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(CurrencySymbol);
            writer.Write(" ");
            writer.Write(String.Format("{0:F2}", Price));
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderEndTag();
        }
示例#2
0
        public override void OnDoubleClick(Mobile from)
        {
            Player pm = from as Player;

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }

            else if (pm.LevelofUnderstanding[(int)BookType] >= 100)
            {
                pm.SendMessage("You have already learned all you can about this language.");
            }
            else
            {
                pm.LevelofUnderstanding[(int)BookType] += Utility.RandomMinMax(1, 2);
                pm.SendMessage("Your knowledge of the {0} language has increased.", BookType.ToString());

                if (pm.LevelofUnderstanding[(int)BookType] > 100)
                {
                    pm.LevelofUnderstanding[(int)BookType] = 100;
                }

                Delete();
            }
        }
示例#3
0
文件: TBook.cs 项目: bollylu/eLibMan
        public XElement ToXml(bool full)
        {
            XElement RetVal = new XElement(TAG_THIS_ELEMENT);

            RetVal.SetAttributeValue(TAG_ATTRIBUTE_NAME, Name);
            RetVal.SetElementValue(TAG_ELEMENT_PATHNAME, Pathname);
            RetVal.SetElementValue(TAG_ELEMENT_GROUPNAME, Category);
            RetVal.SetAttributeValue(TAG_ATTRIBUTE_AUTHOR, Author);
            RetVal.SetAttributeValue("IsExcluded", IsExcluded);
            RetVal.SetAttributeValue(TAG_ATTRIBUTE_BOOKTYPE, BookType.ToString());
            if (full)
            {
                if (Pages != null && Pages.Count > 0)
                {
                    RetVal.Add(Pages.ToXml());
                }
            }
            else
            {
                if (Pages != null && Pages.Count > 0)
                {
                    XElement PagesXml = new XElement("Pages");
                    PagesXml.SetAttributeValue("Count", Pages.Count);
                    RetVal.Add(PagesXml);
                }
            }
            return(RetVal);
        }
        protected internal override void RenderContents(HtmlTextWriter writer)
        {
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.WriteEncodedText(Title);
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.WriteEncodedText(Author.ToString());
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.WriteEncodedText(BookType.ToString());
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(CurrencySymbol);
            writer.Write(" ");
            writer.Write(String.Format("{0:F2}", Price));
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderEndTag();
        }
示例#5
0
 internal override void UpdateViews()
 {
     NameViewBlock.Text      = Name;
     AuthorViewBlock.Text    = Author;
     BookTypeViewBlock.Text  = BookType.ToString();
     IsBestViewBox.IsChecked = IsBest;
 }
示例#6
0
        public XElement ToXml()
        {
            XElement RetVal = new XElement(XML_THIS_ELEMENT);

            RetVal.SetAttributeValue(XML_ATTRIBUTE_NAME, Name);
            RetVal.SetAttributeValue(XML_ATTRIBUTE_NUMBER, Number);
            RetVal.SetAttributeValue(XML_ATTRIBUTE_BOOK_TYPE, BookType.ToString());
            RetVal.SetAttributeValue(XML_ATTRIBUTE_COLLECTION_NAME, CollectionName);
            return(RetVal);
        }
示例#7
0
        public override string ToString()
        {
            StringBuilder RetVal = new StringBuilder();

            RetVal.Append($"{BookType.ToString().PadRight(8, '.') } | ");
            RetVal.Append($"{CollectionName.PadRight(80, '.')} | ");
            if (!string.IsNullOrWhiteSpace(Number))
            {
                RetVal.Append($"{Number.PadRight(6, '.')} | ");
            }
            if (!string.IsNullOrWhiteSpace(Name))
            {
                RetVal.Append($"{Name.PadRight(80, '.')} | ");
            }
            RetVal.Append($"{RelativePath}");
            return(RetVal.ToString());
        }