Пример #1
0
        internal SchemaPropertyDescriptor(SchemaAdapter adapter, string name, JValue jValue)
            : base(name, null)
        {
            m_value = jValue.Value;
            if (m_value == null)
            {
                m_type = typeof(void);
            }
            m_type = m_value.GetType();

            string descr = "";

            switch (name)
            {
            case "result":
                descr = "Request result, should be 'ok' if request succeeded";
                break;

            case "type":
                descr = "Type of schema, should be 'SimpleJMP/schema'";
                break;

            case "version":
                descr = "Version of schema, should be '1.0'";
                break;

            case "name":
                descr = "Identifying name of the SJMP service";
                break;

            case "description":
                descr = "Comprehensive description of the SJMP service";
                break;

            case "group":
                descr = "Used to group services when there are many of them";
                break;

            case "port":
                descr = "SJMP service port. Used when 'schema push' method is used";
                break;

            case "schema_version":
                descr = "String used to determine if schema has changed since last time";
                break;
            }

            this.AttributeArray = new Attribute[] {
                new CategoryAttribute(" Schema"),
                new DescriptionAttribute(descr)
            };
        }
Пример #2
0
 private void connectButton_Click(object sender, EventArgs e)
 {
     m_adapter = new SchemaAdapter(m_properites.connectionUrl, new ClientAuth(m_properites.user, m_properites.password));
     m_adapter.JsonReceivedEvent += (jObj) => { richTextBox1.Text = jObj.ToString(); };
     m_adapter.ActionResultEvent += (objectName, actionName, resultToken) => MessageBox.Show(resultToken != null? resultToken.ToString() : "null", objectName + "." + actionName + "()");
     //http://stackoverflow.com/a/10130126/376066 - need to do this manually (
     m_adapter.PropertyChanged   += (pcSender, pcE) => propertyGrid1.Refresh();
     propertyGrid1.SelectedObject = m_adapter;
     m_adapter.RefreshSchema();
     m_adapter.RefreshPropertyValues();
     schemaTimer.Enabled     = true;
     propertiesTimer.Enabled = true;
 }
Пример #3
0
        internal ObjectAdapter(SchemaAdapter adapter, string name, JObject jObject)
        {
            m_schemaAdapter = adapter;
            m_name          = name;

            List <PropertyDescriptor> properties = new List <PropertyDescriptor>();

            foreach (KeyValuePair <string, JToken> pair in jObject)
            {
                if (pair.Value is JObject)
                {
                    JObject jContainer = (JObject)pair.Value;
                    switch (pair.Key)
                    {
                    case "properties":
                        properties.Add(
                            new AdapterPropertyDescriptor <PropertiesListAdapter>(
                                new PropertiesListAdapter(this, jContainer, m_propertiesByName),
                                pair.Key,
                                null
                                )
                            );
                        break;

                    case "actions":
                        properties.Add(
                            new AdapterPropertyDescriptor <ActionsListAdapter>(
                                new ActionsListAdapter(this, jContainer),
                                pair.Key,
                                null
                                )
                            );
                        break;
                    }
                }
            }

            PropertyDescriptor[] props = (PropertyDescriptor[])properties.ToArray <PropertyDescriptor>();
            m_properties    = new PropertyDescriptorCollection(props);
            m_propertyOwner = this;
        }