예제 #1
0
        public Request PutExtra(string key, dynamic value)
        {
            lock (this)
            {
                if (key == null)
                {
                    return(this);
                }
                if (Extras == null)
                {
                    Extras = new Dictionary <string, dynamic>();
                }

                if (Extras.ContainsKey(key))
                {
                    Extras[key] = value;
                }
                else
                {
                    Extras.Add(key, value);
                }

                return(this);
            }
        }
예제 #2
0
        /// <summary>
        /// 设置此链接的额外信息
        /// </summary>
        /// <param name="key">键值</param>
        /// <param name="value">额外信息</param>
        public void PutExtra(string key, dynamic value)
        {
            lock (_locker)
            {
                if (key != null)
                {
                    if (Extras == null)
                    {
                        Extras = new Dictionary <string, dynamic>();
                    }

                    if (Extras.ContainsKey(key))
                    {
                        Extras[key] = value;
                    }
                    else
                    {
                        Extras.Add(key, value);
                    }
                }
            }
        }
예제 #3
0
        public Recipe(XmlElement node)
        {
            Name        = node.GetAttribute("Name");
            Description = node.GetAttribute("Description");
            History     = node.GetAttribute("History");

            string imageFileName = node.GetAttribute("Image");

            if (!string.IsNullOrEmpty(imageFileName))
            {
                imageFileName = $"ms-appx:///Assets/{imageFileName}";
            }
            else
            {
                imageFileName = $"ms-appx:///Assets/cocktail-glass.png";
            }

            BitmapImage image = new BitmapImage();

            image.UriSource = new Uri(imageFileName);
            Image           = image;

            foreach (XmlElement n in node.SelectNodes("Ingredient"))
            {
                Ingredients.Add(new Ingredient(n));
            }

            foreach (XmlElement n in node.SelectNodes("Dash"))
            {
                Dashs.Add(new Dash(n));
            }

            foreach (XmlElement n in node.SelectNodes("Extra"))
            {
                Extras.Add(new Extra(n));
            }
        }
예제 #4
0
 public Builder AddExtra(string key, string value)
 {
     Extras.Add(key, value);
     return(this);
 }
예제 #5
0
 public OperateResult(int code, string message, KeyValuePair <string, object> keyValue)
 {
     Code    = code;
     Message = message;
     Extras.Add(keyValue.Key, keyValue.Value);
 }
예제 #6
0
 public void AgregarExtras(Extra extra)
 {
     Extras.Add(extra);
 }