Ejemplo n.º 1
0
        public void Init(TriggerParameterControl parent, TriggerVariable var, TriggerValue val, HighLevelProperty HLProp)
        {
            this.Text = var.Name + " : " + val.Type;

            mVariable = var;
            mValue    = val;
            mParent   = parent;
            mHLProp   = HLProp;

            UpdateControl();

            //save teh mouseclicks.
            if (mValue.Name.Contains((mVariable.Name + TriggerNamespace.GetDefaultVarSuffix())))
            {
                if (TriggerSystemMain.mTriggerDefinitions.IsListType(mValue.Type))
                {
                    mValue.IsNull = false;
                    ////mParent.ParameterMode = TriggerParameterControl.eParameterMode.
                    UpdateControl();
                    InitVarMode();
                }
                else if (parent.ParentTriggerNamespace.IsSharedValueVar(mValue.ID))
                {
                    //SetValueMode();
                }
                else
                {
                    //InitValueMode();
                    SetValueMode();
                }
            }
        }
Ejemplo n.º 2
0
 void p_AnyChanged(HighLevelProperty sender)
 {
     if (AnyPropertyChanged != null)
     {
         AnyPropertyChanged.Invoke(this, SelectedObject, sender);
     }
 }
Ejemplo n.º 3
0
        void CellEditorManager_ActivatingControl(object sender, Xceed.Grid.Editors.CellEditorEventArgs e)
        {
            //throw new Exception("The method or operation is not implemented.");
            //gridControl1.get

            int id = (int)(e.Cell.ParentRow.Cells["ID"].Value);
            //e.Control.Tag = o;

            TriggerValue      val    = mParentTriggerNamespace.GetValues()[id];
            VarValueBinder    binder = new VarValueBinder(val, val);
            HighLevelProperty HLProp = TriggerSystemMain.mTriggerDefinitions.GetHLProperty(binder, mParentTriggerNamespace);
            string            bindName;
            Control           c = HLProp.GetEditor(out bindName);

            Form f = new Form();

            f.Controls.Add(c);
            c.Dock     = DockStyle.Fill;
            f.Location = (new Point(0, 0));
            f.Text     = binder.GetName();
            f.Show();

            //e.Cell. = c;
            //e.Control = c;
        }
Ejemplo n.º 4
0
        void hybridGrid1_mCellClicked(object sourceObject, string field, int row, int column)
        {
            if (mCurrentSchema == null)
            {
                return;
            }
            UserClassFieldDefinition d    = mCurrentSchema.Fields[column];
            ArrayCellBinder          bind = new ArrayCellBinder(mCurrentTable.mData[row], column, d.Name, d.Type);
            //hybridGrid1.mObjectEditor.ApplyMetaDataToType(
            HighLevelProperty pr = TriggerSystemMain.mTriggerDefinitions.GetHLProperty(bind, mCurrentTriggerNamespace);

            string      bindName;
            Control     c  = pr.GetEditor(out bindName);//mObjectEditor.GetSingleControl(sourceObject, field);
            PopupEditor pe = new PopupEditor();
            Form        f  = pe.ShowPopup(this, c, FormBorderStyle.Sizable, true);
            Point       p2 = Cursor.Position;//this.PointToScreen(p);

            //f.Deactivate += new EventHandler(f_Deactivate);
            //f.Tag = cell;
            f.Width   = 300;
            f.Top     = p2.Y - 25;
            f.Left    = p2.X;
            f.TopMost = true;
            f.Show();
        }
Ejemplo n.º 5
0
 public void InitHLProp()
 {
     mBinder = new VarValueBinder(mVariable, mValue);
     mHLProp = TriggerSystemMain.mTriggerDefinitions.GetHLProperty(mBinder, mParentTriggerNamespace);
     //string temp;
     //Control editor = prop.GetEditor(out temp);
     //editor.Margin = new Padding(0);
     //this.Controls.Add(editor);
 }
Ejemplo n.º 6
0
        void p_Changed(HighLevelProperty sender)
        {
            if (SelectedObjectPropertyChanged != null)
            {
                SelectedObjectPropertyChanged.Invoke(this, SelectedObject, sender);
            }

            ////??? does this refresh belong here?
            //object temp = SelectedObject;
            //this.SelectedObject = null;
            //this.SelectedObject = temp;
        }
Ejemplo n.º 7
0
        void cell_Click(object sender, EventArgs e)
        {
            Xceed.Grid.DataCell cell = sender as Xceed.Grid.DataCell;

            int id = (int)(cell.ParentRow.Cells["ID"].Value);

            if (mEditorforms.ContainsKey(id))
            {
                mEditorforms[id].BringToFront();
            }
            else
            {
                TriggerValue      val    = mParentTriggerNamespace.GetValues()[id];
                VarValueBinder    binder = new VarValueBinder(val, val);
                HighLevelProperty HLProp = TriggerSystemMain.mTriggerDefinitions.GetHLProperty(binder, mParentTriggerNamespace);
                string            bindName;
                Control           c = HLProp.GetEditor(out bindName);
                //this.TemplateControl = c;
                //this.TemplateControl

                Form f = new Form();


                f.Tag = id;


                f.Controls.Add(c);
                c.Dock = DockStyle.Fill;
                f.Text = binder.GetName();
                //f.TopLevelControl = true;
                f.Size = new Size(200, 55);

                Point p1 = new Point(0, 0);
                Point p2 = cell.PointToScreen(p1);
                f.StartPosition = FormStartPosition.Manual;
                p2.Y           -= 30;
                p2.X           -= 60;
                f.Location      = p2;
                //f.Init(this, mVariable, mValue, mHLProp);
                //f.FormClosed += new FormClosedEventHandler(f_FormClosed);
                //f.Show();
                f.FormClosed += new FormClosedEventHandler(f_FormClosed);

                f.TopMost = true;
                f.Show();

                mEditorforms[id] = f;
            }
        }
Ejemplo n.º 8
0
        public Control GetSingleControl(INamedTypedProperty b, string typeName)
        {
            ApplyMetadata(b, typeName);
            HighLevelProperty p = GetHighLevelProperty(b, typeName);

            if (b.MetaData.ContainsKey("UpdateEvent"))
            {
                p.Changed += new HighLevelProperty.HighLevelPropertyEvent(p_Changed);
            }

            p.Changed += new HighLevelProperty.HighLevelPropertyEvent(p_AnyChanged);

            if (b.MetaData.ContainsKey("Ignore") && (bool)(b.MetaData["Ignore"]) == true)
            {
                return(null);// continue;
            }
            //mProps.Add(p);
            string  bindName;
            Control c = p.GetEditor(out bindName);

            if (b.MetaData.ContainsKey("Alias"))
            {
                c.Name = b.MetaData["Alias"].ToString();
            }
            else
            {
                c.Name = b.GetName();
            }

            //Set editor properties:
            Type edtiorType = c.GetType();

            foreach (string s in b.MetaData.Keys)
            {
                if (s.Contains("EditorProperty."))
                {
                    string       editorProp         = s.Replace("EditorProperty.", "");
                    PropertyInfo editorPropertyInfo = edtiorType.GetProperty(editorProp);
                    object       convertedValue     = b.MetaData[s];
                    convertedValue = Convert.ChangeType(convertedValue, editorPropertyInfo.PropertyType);
                    editorPropertyInfo.SetValue(c, convertedValue, null);
                }
            }
            return(c);
        }
Ejemplo n.º 9
0
        private bool mbAllowPromoteFromMetadata = false; //add this to hl?


        private HighLevelProperty GetHighLevelProperty(INamedTypedProperty b, string parentTypeName)
        {
            HighLevelProperty p = null;

            if (false)
            {
            }
            else if (b.MetaData.ContainsKey("ComplexType") == true)
            {
                p = new ComplexTypeProperty(b);
            }
            else if (mbAllowPromoteFromMetadata == true /* && has promotable metadata??? */)
            {
            }
            else if (mSpecificTypeEditor.ContainsKey(parentTypeName) && mSpecificTypeEditor[parentTypeName].ContainsKey(b.GetName()))
            {
                p = (HighLevelProperty)(mSpecificTypeEditor[parentTypeName][b.GetName()].GetConstructor(new Type[] { typeof(INamedTypedProperty) }).Invoke(new object[] { b }));
            }
            else if (mInternalTypeEditors.ContainsKey(b.GetTypeName()) == true)
            {
                p = (HighLevelProperty)(mInternalTypeEditors[b.GetTypeName()].GetConstructor(new Type[] { typeof(INamedTypedProperty) }).Invoke(new object[] { b }));
            }
            else if (b.MetaData.ContainsKey("BaseType") && mBaseTypeEditors.ContainsKey(b.MetaData["BaseType"].ToString()))
            {
                string baseTypeName = b.MetaData["BaseType"] as string;
                p = (HighLevelProperty)(mBaseTypeEditors[baseTypeName].GetConstructor(new Type[] { typeof(INamedTypedProperty) }).Invoke(new object[] { b }));
            }
            //   //is this good???
            //else if (b.MetaData.ContainsKey("BaseType") && mInternalTypeEditors.ContainsKey(b.MetaData["BaseType"].ToString()))
            //{
            //   string baseTypeName = b.MetaData["BaseType"] as string;
            //   p = (HighLevelProperty)(mInternalTypeEditors[baseTypeName].GetConstructor(new Type[] { typeof(INamedTypedProperty) }).Invoke(new object[] { b }));
            //}
            else //default
            {
                p = new HighLevelProperty(b);
            }
            return(p);
        }
Ejemplo n.º 10
0
        void InVariblesList_SelectedObjectPropertyChanged(ObjectEditorControl sender, object selectedObject, HighLevelProperty prop)
        {
            InParameterDefintion def = selectedObject as InParameterDefintion;

            if (prop.Name == "Type" && def != null)
            {
                def.Name = prop.PresentationValue.ToString();
                sender.UpdateData();
            }
        }
Ejemplo n.º 11
0
        private void LoadSettings(object obj)
        {
            List <ReflectedPropertyBinder> mBinders = new List <ReflectedPropertyBinder>();

            if (obj == null)
            {
                this.Visible = false;
                this.SuspendLayout();

                //ClearUI();
                ClearUI();

                mControls.Clear();
                this.ResumeLayout();
                return;
            }

            if (obj is LambdaObject)
            {
                LoadSettings((LambdaObject)obj);
                return;
            }
            if (obj is LamdaObjectProperty)
            {
                LamdaObjectProperty lambdaprop = (LamdaObjectProperty)obj;
                this.ApplyMetaDataToType(lambdaprop.GetName(), lambdaprop.GetName(), lambdaprop.MetaData);
                LoadSettings((LambdaObject)lambdaprop.GetValue());
                return;
            }

            this.Visible = true;


            List <Control> temp = new List <Control>();

            Type t = obj.GetType();

            if (mTypeDescriptions.ContainsKey(t) == false)
            {
                mTypeDescriptions[t] = new TypeDescription(t);
            }

            mBinders = new List <ReflectedPropertyBinder>();
            foreach (PropertyInfo p in mTypeDescriptions[t].mPropertyInfoList)
            {
                ReflectedPropertyBinder b = new ReflectedPropertyBinder(obj, p);
                mBinders.Add(b);
            }
            mProps = new List <HighLevelProperty>();
            foreach (ReflectedPropertyBinder b in mBinders)
            {
                ApplyMetadata(b, t.Name);
                HighLevelProperty p = GetHighLevelProperty(b, t.Name);

                if (b.MetaData.ContainsKey("UpdateEvent"))
                {
                    p.Changed += new HighLevelProperty.HighLevelPropertyEvent(p_Changed);
                }

                p.Changed += new HighLevelProperty.HighLevelPropertyEvent(p_AnyChanged);

                if (b.MetaData.ContainsKey("Ignore") && (bool)(b.MetaData["Ignore"]) == true)
                {
                    continue;
                }

                mProps.Add(p);
                string  bindName;
                Control c = p.GetEditor(out bindName);

                if (b.MetaData.ContainsKey("Alias"))
                {
                    c.Name = b.MetaData["Alias"].ToString();
                }
                else
                {
                    c.Name = b.GetName();
                }

                //Set editor properties:
                Type edtiorType = c.GetType();
                foreach (string s in b.MetaData.Keys)
                {
                    if (s.Contains("EditorProperty."))
                    {
                        string       editorProp         = s.Replace("EditorProperty.", "");
                        PropertyInfo editorPropertyInfo = edtiorType.GetProperty(editorProp);
                        object       convertedValue     = b.MetaData[s];
                        convertedValue = Convert.ChangeType(convertedValue, editorPropertyInfo.PropertyType);
                        editorPropertyInfo.SetValue(c, convertedValue, null);
                    }
                }


                temp.Add(c);
            }

            //saving the ui changes for the end.  why is this so slow?
            this.SuspendLayout();
            mControls.Clear();

            this.AddControls(temp);

            this.ResumeLayout();
        }
Ejemplo n.º 12
0
 void PopSettingsList_AnyObjectPropertyChanged(ObjectEditorControl sender, object selectedObject, HighLevelProperty prop)
 {
     PlayerSettingsChanged();
 }
Ejemplo n.º 13
0
 void mConceptEditor_AnyPropertyChanged(ObjectEditorControl sender, object selectedObject, HighLevelProperty prop)
 {
     if (prop.Name == "Name")
     {
         LoadUI();
     }
 }
Ejemplo n.º 14
0
        private void LoadSettings(LambdaObject lambdaObject)
        {
            string parentName = "";
            string parentType = "";

            INamedTypedProperty[] properties = null;

            if (lambdaObject != null)
            {
                parentName = lambdaObject.mParentName;
                parentType = lambdaObject.mParentType;
                properties = lambdaObject.mProperties;
            }

            if (properties == null || properties.Length == 0)
            {
                this.Visible = false;
                this.SuspendLayout();
                mControls.Clear();
                this.ClearUI();
                this.ResumeLayout();
                return;
            }

            this.Visible = true;

            List <Control> temp = new List <Control>();

            //could we refactor this section:....

            mProps = new List <HighLevelProperty>();
            foreach (INamedTypedProperty ip in properties)
            {
                ApplyMetadata(ip, parentType);
                if (ip.MetaData.ContainsKey("Ignore") && (bool)(ip.MetaData["Ignore"]) == true)
                {
                    continue;
                }

                //This code is for supporting arrays:
                IPropertyArray ar2 = ip as IPropertyArray;
                if (ar2 != null)
                {
                    foreach (INamedTypedProperty inner in ar2.GetProperties())
                    {
                        if (inner.GetValue() == null)
                        {
                            continue;
                        }
                        IPropertyArray propertyArray = inner.GetValue() as IPropertyArray;
                        if (propertyArray != null)
                        {
                            foreach (INamedTypedProperty inner2 in ((IPropertyArray)inner.GetValue()).GetProperties())
                            {
                                Dictionary <string, object> innerData;
                                if (mSpecificPropertyMetadata[ip.MetaData["ArrayType"].ToString()].TryGetValue(inner2.GetName(), out innerData))
                                {
                                    inner2.MetaData = innerData;
                                }
                            }
                        }
                    }
                }
                //Nested logic:  This pushes complext type metadata inwards
                else if (ip.MetaData.ContainsKey("ComplexType") == true)
                {
                    IPropertyArray ar = ip.GetValue() as IPropertyArray;
                    if (ar != null)
                    {
                        foreach (INamedTypedProperty inner in ar.GetProperties())
                        {
                            Dictionary <string, object> innerData;
                            if (mSpecificPropertyMetadata[ip.MetaData["ComplexType"].ToString()].TryGetValue(inner.GetName(), out innerData))
                            {
                                inner.MetaData = innerData;
                            }
                        }
                    }
                }


                HighLevelProperty p = GetHighLevelProperty(ip, parentType);


                //////events
                //if (ip.MetaData.ContainsKey("UpdateEvent"))
                //   p.Changed += new HighLevelProperty.HighLevelPropertyEvent(p_Changed);

                p.Changed += new HighLevelProperty.HighLevelPropertyEvent(p_AnyChanged);
                /////events

                if (ip.MetaData.ContainsKey("Ignore") && (bool)(ip.MetaData["Ignore"]) == true)
                {
                    continue;
                }


                mProps.Add(p);
                string  bindName;
                Control c = p.GetEditor(out bindName);

                if (ip.MetaData.ContainsKey("Alias"))
                {
                    c.Name = ip.MetaData["Alias"].ToString();
                }
                else
                {
                    c.Name = ip.GetName();
                }

                //Set editor properties:
                Type edtiorType = c.GetType();
                foreach (string s in ip.MetaData.Keys)
                {
                    if (s.Contains("EditorProperty."))
                    {
                        string       editorProp         = s.Replace("EditorProperty.", "");
                        PropertyInfo editorPropertyInfo = edtiorType.GetProperty(editorProp);
                        object       convertedValue     = ip.MetaData[s];
                        convertedValue = Convert.ChangeType(convertedValue, editorPropertyInfo.PropertyType);
                        editorPropertyInfo.SetValue(c, convertedValue, null);
                    }
                }

                temp.Add(c);
            }

            mControls.Clear();
            this.SuspendLayout();
            this.AddControls(temp);
            this.ResumeLayout();
        }
Ejemplo n.º 15
0
 void onAnyPropertyChanged(ObjectEditorControl sender, object selectedObject, HighLevelProperty prop)
 {
     RenderTemplate();
 }
Ejemplo n.º 16
0
        void On_AnyPropertyChanged(ObjectEditorControl sender, object selectedObject, HighLevelProperty prop)
        {
            SaveToSelectedButton.Enabled = true;

            if (GetCurrentDefinition().Version == mTopVersion[GetCurrentDefinition().Type])
            {
                SaveToNewVersionButton.Enabled = true;
            }
        }
Ejemplo n.º 17
0
        void basicTypedSuperList1_SelectedObjectPropertyChanged(ObjectEditorControl sender, object selectedObject, HighLevelProperty prop)
        {
            TriggersTemplateVariableBinder varBinder = selectedObject as TriggersTemplateVariableBinder;

            if (varBinder != null)
            {
                TriggerValue value;
                if (mMainTriggerSystem.MainNamespace.GetValues().TryGetValue(varBinder.BindID, out value))
                {
                    varBinder.Type = value.Type;
                    varBinder.Name = value.Name;

                    sender.UpdateData();
                }
            }
        }
Ejemplo n.º 18
0
 void InputTriggersBasicTypedSuperList_SelectedObjectPropertyChanged(ObjectEditorControl sender, object selectedObject, HighLevelProperty prop)
 {
 }
Ejemplo n.º 19
0
        private void LoadSettings(object[] objects)
        {
            if (objects == null || objects.Length == 0)
            {
                this.Visible = false;
                this.SuspendLayout();
                mControls.Clear();
                this.ClearUI();
                this.ResumeLayout();
                return;
            }
            if (objects.Length == 1)
            {
                LoadSettings(objects[0]);
                return;
            }

            this.Visible = true;
            string parentType = "";

            List <Control> temp = new List <Control>();
            Dictionary <Type, TypeDescription> representedTypes = new Dictionary <Type, TypeDescription>();

            foreach (object obj in objects)
            {
                Type t = obj.GetType();
                if (mTypeDescriptions.ContainsKey(t) == false)
                {
                    mTypeDescriptions[t] = new TypeDescription(t);
                }
                representedTypes[t] = mTypeDescriptions[t];
            }

            Dictionary <KeyValuePair <string, Type>, int> mergedPropertyList = new Dictionary <KeyValuePair <string, Type>, int>();

            Dictionary <Type, TypeDescription> .Enumerator it = representedTypes.GetEnumerator();
            while (it.MoveNext())
            {
                if (representedTypes.Count == 1)
                {
                    parentType = it.Current.Key.Name;
                }

                foreach (PropertyInfo p in it.Current.Value.mPropertyInfoList)
                {
                    KeyValuePair <string, Type> info = new KeyValuePair <string, Type>(p.Name, p.PropertyType);
                    if (!mergedPropertyList.ContainsKey(info))
                    {
                        mergedPropertyList[info] = 0;
                    }
                    mergedPropertyList[info]++;
                }
                //it.Current.
            }

            List <ReflectedPropertyMultiBinder> mMultiBinders = new List <ReflectedPropertyMultiBinder>();

            Dictionary <KeyValuePair <string, Type>, int> .Enumerator itProps = mergedPropertyList.GetEnumerator();
            while (itProps.MoveNext())
            {
                if (itProps.Current.Value == representedTypes.Count)
                {
                    //mPropsByName
                    ReflectedPropertyMultiBinder b = new ReflectedPropertyMultiBinder(objects, itProps.Current.Key.Key, itProps.Current.Key.Value, representedTypes);
                    mMultiBinders.Add(b);
                }
            }


            mProps = new List <HighLevelProperty>();
            foreach (ReflectedPropertyMultiBinder b in mMultiBinders)
            {
                Dictionary <Type, TypeDescription> .Enumerator repTypes = representedTypes.GetEnumerator();
                while (repTypes.MoveNext())
                {
                    ApplyMetadata(b, repTypes.Current.Key.Name);
                }

                if (b.MetaData.ContainsKey("Ignore") && (bool)(b.MetaData["Ignore"]) == true)
                {
                    continue;
                }



                HighLevelProperty p = GetHighLevelProperty(b, parentType);//, t.Name);
                mProps.Add(p);
                string  bindName;
                Control c = p.GetEditor(out bindName);

                if (b.MetaData.ContainsKey("Alias"))
                {
                    c.Name = b.MetaData["Alias"].ToString();
                }
                else
                {
                    c.Name = b.GetName();
                }

                //Set editor properties:
                Type edtiorType = c.GetType();
                foreach (string s in b.MetaData.Keys)
                {
                    if (s.Contains("EditorProperty."))
                    {
                        string       editorProp         = s.Replace("EditorProperty.", "");
                        PropertyInfo editorPropertyInfo = edtiorType.GetProperty(editorProp);
                        object       convertedValue     = b.MetaData[s];
                        convertedValue = Convert.ChangeType(convertedValue, editorPropertyInfo.PropertyType);
                        editorPropertyInfo.SetValue(c, convertedValue, null);
                    }
                }

                //c.Name = b.GetName();
                temp.Add(c);
            }

            mControls.Clear();
            this.SuspendLayout();
            this.AddControls(temp);
            this.ResumeLayout();
        }
Ejemplo n.º 20
0
 void basicList_AnyObjectPropertyChanged(ObjectEditorControl sender, object selectedObject, HighLevelProperty prop)
 {
     CoreGlobals.getEditorMain().mOneFrame = true;
 }
Ejemplo n.º 21
0
 void betterPropertyGrid1_AnyPropertyChanged(ObjectEditorControl sender, object selectedObject, HighLevelProperty prop)
 {
     this.mbPropertiesChanged = true;
     //throw new Exception("The method or operation is not implemented.");
 }
Ejemplo n.º 22
0
 void flow_AnyObjectPropertyChanged(ObjectEditorControl sender, object selectedObject, HighLevelProperty prop)
 {
     if (AnyObjectPropertyChanged != null)
     {
         AnyObjectPropertyChanged.Invoke(sender, selectedObject, prop);
     }
 }