Пример #1
0
        public ResourceWindow(Resource res_)
            : base(Gtk.WindowType.Toplevel)
        {
            this.Build ();

            if (res_ != null )
            {
                _res = res_;
                _update = true;
                FillDetails();
            }
            else
            {
                _res = new Resource();
            }
        }
Пример #2
0
 public ResourceTreeNode(Resource r)
 {
     res = r;
 }
Пример #3
0
        private void LoadResources()
        {
            view.NodeStore = Store;
            view.AppendColumn("Név", new CellRendererText(), "text", 0);

            MySqlConnection conn = new MySqlConnection(Globals.ConnectionString);

            MySqlCommand cmd = new MySqlCommand("select * from resources", conn);

            conn.Open();

            MySqlDataReader rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                Resource res = new Resource();
                res.Id = rdr.GetInt32(rdr.GetOrdinal("r_id"));
                res.Name = rdr.GetString(rdr.GetOrdinal("r_name"));
                res.Active = rdr.GetBoolean(rdr.GetOrdinal("r_active"));

                Store.AddNode( new ResourceTreeNode(res) );
            }

            conn.Close();
        }