Ejemplo n.º 1
0
        public void SetResourceOwner(ResourcePointer pointer, CultureInfo culture)
        {
            if (!_loading)
            {
                _loading = true;
                _pointer = pointer;
                _culture = culture;

                this.Image = null;
                if (_pointer != null)
                {
                    try
                    {
                        if (_pointer.UsePictureBox)
                        {
                            object v = _pointer.GetResourceValue(CultureName);
                            this.Image = (Image)v;
                        }
                        else
                        {
                        }
                    }
                    catch (Exception err)
                    {
                        MessageBox.Show(this.FindForm(), err.Message, "Show image", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                _loading = false;
                this.Invalidate();
            }
        }
 public TreeNodeResourceCode(ResourcePointer owner)
     : base(new ResourceCodePointer(owner))
 {
     ImageIndex         = owner.TreeNodeIconIndex;
     SelectedImageIndex = ImageIndex;
     OnShowText();
 }
        private void buttonOK_Click(object sender, EventArgs e)
        {
            Dictionary <IProperty, UInt32> map = new Dictionary <IProperty, uint>();

            for (int i = 0; i < _table.Rows.Count; i++)
            {
                if (_table.Rows[i][0] != null && _table.Rows[i][0] != DBNull.Value && _table.Rows[i][1] != null && _table.Rows[i][1] != DBNull.Value)
                {
                    IProperty       p  = (IProperty)(_table.Rows[i][0]);
                    ResourcePointer rp = (ResourcePointer)(_table.Rows[i][1]);
                    map.Add(p, rp.MemberId);
                }
            }
            _pointer.SetResourceMap(map);
            if (_deletedImages.Count > 0)
            {
                foreach (IProperty p in _deletedImages)
                {
                    try
                    {
                        p.SetValue(null);
                    }
                    catch
                    {
                    }
                }
            }
            this.DialogResult = DialogResult.OK;
        }
Ejemplo n.º 4
0
 public void OnPostSerialize(ObjectIDmap objMap, XmlNode objectNode, bool saved, object serializer)
 {
     if (_resource == null)
     {
         ProjectResources rh = objMap.Project.GetProjectSingleData <ProjectResources>();
         _resource = rh.GetResourcePointerById(_id);
     }
 }
        public virtual object Clone()
        {
            ResourcePointer obj = (ResourcePointer)(Activator.CreateInstance(this.GetType()));

            obj._id      = MemberId;
            obj._name    = _name;
            obj._xmlNode = _xmlNode;
            return(obj);
        }
        public bool IsSameProperty(IPropertyPointer p)
        {
            ResourcePointer rp = p as ResourcePointer;

            if (rp != null)
            {
                return(rp.MemberId == this.MemberId);
            }
            return(false);
        }
        public bool IsSameObjectRef(IObjectIdentity objectIdentity)
        {
            ResourcePointer rp = objectIdentity as ResourcePointer;

            if (rp != null)
            {
                return(rp.MemberId == this.MemberId);
            }
            return(false);
        }
        private void buttonOK_Click(object sender, EventArgs e)
        {
            TreeNodeResourceCode tnr = treeView1.SelectedNode as TreeNodeResourceCode;

            if (tnr != null)
            {
                SelectedResource  = tnr.Pointer.Resource;
                this.DialogResult = DialogResult.OK;
            }
        }
 private void mn_remove(object sender, EventArgs e)
 {
     if (this.TreeView != null)
     {
         if (MessageBox.Show(this.TreeView.FindForm(), "Do not want to remove this resource?", "Remove resource", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             ResourcePointer rp = (ResourcePointer)(this.OwnerPointer);
             rp.Manager.RemoveResource(rp.MemberId);
             Remove();
             rp.IsChanged = true;
         }
     }
 }
Ejemplo n.º 10
0
        public void LoadData(ClassPointer pointer)
        {
            _pointer = pointer;
            ProjectResources rm = _pointer.Project.GetProjectSingleData <ProjectResources>();
            Dictionary <IProperty, UInt32> map = _pointer.ResourceMap;

            _table = new DataTable();
            _table.Columns.Add("Property", typeof(object));
            _table.Columns.Add("Resource name", typeof(object));
            Dictionary <IProperty, UInt32> .Enumerator en = map.GetEnumerator();
            while (en.MoveNext())
            {
                ResourcePointer rp = rm.GetResourcePointerById(en.Current.Value);
                if (rp != null)
                {
                    _table.Rows.Add(en.Current.Key, rp);
                }
            }
            dataGridView1.DataSource = _table;
        }
Ejemplo n.º 11
0
 public void SetResourceOwner(ResourcePointer pointer, CultureInfo culture)
 {
     _pointer = pointer;
     _culture = culture;
     _loading = true;
     if (_pointer == null)
     {
         Text = "";
     }
     else
     {
         if (_culture == null)
         {
             Text = _pointer.GetResourceString(string.Empty);
         }
         else
         {
             Text = _pointer.GetResourceString(_culture.Name);
         }
     }
     _loading = false;
 }
Ejemplo n.º 12
0
 public ResourceCodePointer(ResourcePointer pointer)
 {
     _resource = pointer;
     _id       = pointer.MemberId;
 }
 public TreeNodeResource(ResourcePointer owner)
     : base(owner)
 {
     OnShowText();
     Nodes.Add(new CLoad());
 }