예제 #1
0
        private void parseCacheAttribute(ref Geocache cache, XmlReader reader)
        {
            CacheAttribute attr = new CacheAttribute();

            attr.ID = reader.GetAttribute("id");
            string inc = reader.GetAttribute("inc");

            if (inc == "1")
            {
                attr.Include = true;
            }
            else
            {
                attr.Include = false;
            }
            attr.AttrValue = reader.ReadElementContentAsString();
            m_store.AddAttribute(cache.Name, attr);
            return;
        }
예제 #2
0
 public abstract void AddAttribute(string parent, CacheAttribute attribute);
        private void ShowAttrIcons(CacheAttribute[] attrs, StringBuilder bldr)
        {
            Gtk.Table.TableChild props;
            bool isFirst = true;
            uint colCount = 0;
            foreach (CacheAttribute attr in attrs) {
                Pixbuf buf;
                if (attr.Include)
                    buf = IconManager.GetYAttrIcon (attr.AttrValue);
                else
                    buf = IconManager.GetNAttrIcon (attr.AttrValue);
                if (buf != null) {
                    Gtk.Image img = new Gtk.Image ();
                    img.Pixbuf = buf;
                    img.TooltipText = Catalog.GetString (attr.AttrValue);
                    attrTable.Add (img);
                    props = ((Gtk.Table.TableChild)(this.attrTable[img]));
                    props.TopAttach = 0;
                    props.LeftAttach = colCount;
                    props.RightAttach = colCount + 1;
                    props.BottomAttach = 1;
                    props.XOptions = AttachOptions.Shrink;
                    img.Show ();
                    colCount++;
                    continue;
                }

                if (isFirst)
                    isFirst = false;
                else
                    bldr.Append (", ");
                if (!attr.Include) {
                    bldr.Append ("<span fgcolor='red' strikethrough='true'>");
                    bldr.Append (attr.AttrValue);
                    bldr.Append ("</span>");
                } else {
                    bldr.Append (attr.AttrValue);
                }
            }
            Label filler = new Label ("");
            attrTable.Add (filler);
            props = ((Gtk.Table.TableChild)(this.attrTable[filler]));
            props.TopAttach = 0;
            props.LeftAttach = colCount;
            props.RightAttach = colCount + 1;
            props.BottomAttach = 1;
            props.XOptions = AttachOptions.Expand;
            filler.Show ();

            if (bldr.Length > 0) {
                attrTable.Add (attrLabel);
                props = ((Gtk.Table.TableChild)(this.attrTable[attrLabel]));
                props.TopAttach = 1;
                props.LeftAttach = 0;
                props.RightAttach = colCount + 1;
                props.BottomAttach = 2;
                attrLabel.Markup = bldr.ToString ();
                attrLabel.Show ();
            }
        }
예제 #4
0
 public abstract void AddAttribute(string parent, CacheAttribute attribute);
예제 #5
0
 private void parseCacheAttribute(ref Geocache cache, XmlReader reader)
 {
     CacheAttribute attr = new CacheAttribute();
     attr.ID = reader.GetAttribute("id");
     string inc = reader.GetAttribute("inc");
     if (inc == "1")
         attr.Include = true;
     else
         attr.Include = false;
     attr.AttrValue = reader.ReadElementContentAsString();
     m_store.AddAttribute(attr, cache.Name);
     return;
 }
예제 #6
0
 public List<CacheAttribute> GetAttributes(String name)
 {
     List<CacheAttribute> list = new List<CacheAttribute>();
     IDbConnection conn = OpenConnection();
     IDbCommand cmd = conn.CreateCommand();
     cmd.CommandText = String.Format(GET_ATTRIBUTES, name);
     IDataReader rdr = cmd.ExecuteReader();
     while (rdr.Read())
     {
         CacheAttribute attr = new CacheAttribute();
         attr.ID = rdr.GetString(0);
         string val = rdr.GetString(1);
         attr.Include = bool.Parse(val);
         attr.AttrValue = rdr.GetString(2);
         list.Add(attr);
     }
     CloseConnection(ref rdr, ref cmd, ref conn);
     return list;
 }
예제 #7
0
 public void AddAttribute(CacheAttribute attr, String name)
 {
     IDbCommand cmd = m_conn.CreateCommand();
     cmd.CommandText = String.Format(ADD_ATTRIBUTE, name, attr.ID, attr.Include.ToString(), attr.AttrValue);
     cmd.ExecuteNonQuery();
     cmd.Dispose();
     cmd = null;
 }