Пример #1
0
    /// <summary>
    /// Initializes a new instance of the <see cref="Share"/> class.
    /// </summary>
    /// <param name="comment">The comment of the share.</param>
    /// <param name="title">The title of the share.</param>
    /// <param name="description">The description of the share.</param>
    /// <param name="visibilityCode">The visibility of the share.</param>
    public Share(string comment, string title, string description, VisibilityCode visibilityCode)
    {
      this.Comment = comment;
      if (string.IsNullOrEmpty(title) == false || string.IsNullOrEmpty(description) == false)
      {
        this.Content = new ShareContent 
        {
          Title = title,
          Description = description
        };
      }

      this.Visibility = new Visibility { Code = visibilityCode };
    }
Пример #2
0
        /// <summary>
        /// Generates an object from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="XmlReader" /> stream from which the object is deserialized.</param>
        public void ReadXml(System.Xml.XmlReader reader)
        {
            // Read the opening tag of the encapsulating element
              reader.ReadStartElement();

              reader.ReadStartElement(CodeElementName);
              string codeString = reader.ReadString();
              switch (codeString)
              {
            case "anyone":
              this.Code = VisibilityCode.Anyone;
              break;
            case "connections-only":
              this.Code = VisibilityCode.ConnectionsOnly;
              break;
              }

              reader.ReadEndElement();

              // Read the end tag of the encapsulating element
              reader.ReadEndElement();
        }
Пример #3
0
        /// <summary>
        /// Generates an object from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="XmlReader" /> stream from which the object is deserialized.</param>
        public void ReadXml(System.Xml.XmlReader reader)
        {
            // Read the opening tag of the encapsulating element
            reader.ReadStartElement();

            reader.ReadStartElement(CodeElementName);
            string codeString = reader.ReadString();

            switch (codeString)
            {
            case "anyone":
                this.Code = VisibilityCode.Anyone;
                break;

            case "connections-only":
                this.Code = VisibilityCode.ConnectionsOnly;
                break;
            }

            reader.ReadEndElement();

            // Read the end tag of the encapsulating element
            reader.ReadEndElement();
        }