Exemple #1
0
        private void pcb_Click(object sender, EventArgs e)
        {
            if (_resource == null)
            {
                ResourceManager rm = ResourceManager.Instance;
                _resource = rm.GetResource(_res_image.id);
            }

            _is_selected = !_is_selected;
            if (_is_selected)
            {
                this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                this.BackColor = Color.LightYellow;
                SelectedCount = 1;
                SelectedSize = Convert.ToInt32(_resource.size);
            }
            else
            {
                this.BorderStyle = System.Windows.Forms.BorderStyle.None;
                this.BackColor = Color.Transparent;
                SelectedCount = -1;
                SelectedSize = 0 - Convert.ToInt32(_resource.size);
            }
            base.OnSelectChanged(this, null);
        }
 /// <summary>
 /// 创建新的 Resource 对象。
 /// </summary>
 /// <param name="taxonomy_id">taxonomy_id 属性的初始值。</param>
 /// <param name="id">id 属性的初始值。</param>
 public static Resource CreateResource(global::System.String taxonomy_id, global::System.String id)
 {
     Resource resource = new Resource();
     resource.taxonomy_id = taxonomy_id;
     resource.id = id;
     return resource;
 }
 /// <summary>
 /// 用于向 Resources EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToResources(Resource resource)
 {
     base.AddObject("Resources", resource);
 }
Exemple #4
0
        public void AddResource(FileInfo f)
        {
            string rest = FileResourceType(f);
            if (rest != null)
            {
                Resource res = new Resource();
                res.name = f.Name;
                res.id = Guid.NewGuid().ToString();
                res.taxon_id = "0";
                res.taxonomy_id = rest;
                res.path = f.FullName;
                res.size = f.Length;
                res.created_at = DateTime.Now;
                ent.AddToResources(res);

                switch(rest)
                {
                    case "MUSIC":
                        ent.AddToResMusics(GetMusicDetail(res.id,f));
                        break;
                    case "IMG":
                        ent.AddToResImages(GetImageDetail(res.id, f));
                        break;
                }
                ent.SaveChanges();
            }
        }