Exemplo n.º 1
0
 private void AddToCollectionButton_Click(object sender, EventArgs e)
 {
     if (EditorUI.GetParentVD2DataIsReadOnly(this))
     {
         return;
     }
     if ((_SelectedCollection != null) && (_ElementType != null))
     {
         VD2Data parentfile = null;
         Control c          = this;
         while (c.Parent != null)
         {
             if (c.Parent is VD2DocumentViewer)
             {
                 VD2DocumentViewer docview = (VD2DocumentViewer)c.Parent;
                 if (docview.Document is VD2Data)
                 {
                     parentfile = (VD2Data)docview.Document;
                 }
             }
             c = c.Parent;
         }
         VD2DataStructure ds = (VD2DataStructure)System.Activator.CreateInstance(_ElementType, parentfile, null);
         _SelectedCollection.Add(ds);
         //
         // _SelectedCollection.Add("");
     }
 }
Exemplo n.º 2
0
 public void ResetAllPropertyEdited()
 {
     foreach (KeyValuePair <string, VD2PropertyInfo> info in VD2PropertyInfos)
     {
         info.Value.EditedByUser = false;
         System.Reflection.PropertyInfo prop = GetType().GetProperty(info.Key);
         if (prop.PropertyType == typeof(System.Collections.ObjectModel.ObservableCollection <VD2DataStructure>))
         {
             object o = prop.GetValue(this);
             System.Collections.ObjectModel.ObservableCollection <VD2DataStructure> val = (System.Collections.ObjectModel.ObservableCollection <VD2DataStructure>)o;
             if (val != null)
             {
                 foreach (VD2DataStructure ds in val)
                 {
                     ds.ResetAllPropertyEdited();
                 }
             }
         }
         if ((prop.PropertyType == typeof(VD2DataStructure)) || (prop.PropertyType.IsSubclassOf(typeof(VD2DataStructure))))
         {
             VD2DataStructure ds = (VD2DataStructure)prop.GetValue(this);
             if (ds != null)
             {
                 ds.ResetAllPropertyEdited();
             }
         }
     }
 }
Exemplo n.º 3
0
 private void setValueToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (Item is VD2DataStructure)
     {
         VD2DataStructure dsitem = (VD2DataStructure)Item;
         if (DataStructurePropertiesEditor != null)
         {
             if (DataStructurePropertiesEditor.SelectedGridItem != null)
             {
                 dsitem.SetPropertyEdited(DataStructurePropertiesEditor.SelectedGridItem.Label, true);
                 dsitem.SetPropertyExists(DataStructurePropertiesEditor.SelectedGridItem.Label, false);
                 if (EditorUI.GetParentVD2DataFileSourceShortName(this) == "Base")
                 {
                     dsitem.SetPropertyExistsInBaseData(DataStructurePropertiesEditor.SelectedGridItem.Label, true);
                 }
             }
         }
     }
 }
 private void duplicateToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (EditorUI.GetParentVD2DataIsReadOnly(this))
     {
         return;
     }
     if (Parent != null)
     {
         if (Parent.Parent != null)
         {
             if (Parent.Parent is DataStructureCollectionsEditor)
             {
                 DataStructureCollectionsEditor editorparent = (DataStructureCollectionsEditor)Parent.Parent;
                 if ((_SelectedIndex >= 0) && (_SelectedIndex < editorparent.SelectedCollection.Count))
                 {
                     VD2Data parentfile = null;
                     Control c          = this;
                     while (c.Parent != null)
                     {
                         if (c.Parent is VD2DocumentViewer)
                         {
                             VD2DocumentViewer docview = (VD2DocumentViewer)c.Parent;
                             if (docview.Document is VD2Data)
                             {
                                 parentfile = (VD2Data)docview.Document;
                             }
                         }
                         c = c.Parent;
                     }
                     VD2DataStructure ds = (VD2DataStructure)System.Activator.CreateInstance(editorparent.ElementType, parentfile, editorparent.SelectedCollection[_SelectedIndex].DataNode);
                     ds.CopyFrom(editorparent.SelectedCollection[_SelectedIndex]);
                     editorparent.SelectedCollection.Add(ds);
                 }
             }
         }
     }
 }
Exemplo n.º 5
0
 public virtual void CopyFrom(VD2DataStructure inOriginal)
 {
 }