Ejemplo n.º 1
0
        protected Plugin(string Plugin_Name, string Plugin_Friendly_Name, string Plugin_Description)
        {
            _name = Plugin_Name;
            Friendly_Name = Plugin_Friendly_Name;
            Description = Plugin_Description;

            using (var context = new zvsEntities2(zvsEntityControl.GetzvsConnectionString))
            {
                plugin pl = context.plugins.FirstOrDefault(p => p.name == this._name);

                if (pl != null)
                {
                    pl.friendly_name = Friendly_Name;
                    pl.description = Description;
                }
                else
                {
                    pl = new plugin { name = _name, friendly_name = Friendly_Name, description = Description };
                    context.plugins.AddObject(pl);
                }
                context.SaveChanges();
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the plugins EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToplugins(plugin plugin)
 {
     base.AddObject("plugins", plugin);
 }
Ejemplo n.º 3
0
#pragma warning restore 649
        //private bool _runCommands;

        public PluginManager()
        {
            DirectoryCatalog catalog = new DirectoryCatalog("plugins");
            CompositionContainer compositionContainer = new CompositionContainer(catalog);
            compositionContainer.ComposeParts(this);

            builtin_commands.InstallBuiltInCommand(new builtin_commands
            {
                name = "REPOLL_ME",
                friendly_name = "Repoll Device",
                arg_data_type = (int)Data_Types.INTEGER,
                show_on_dynamic_obj_list = false,
                description = "This will force a repoll on an object."
            });

            builtin_commands.InstallBuiltInCommand(new builtin_commands
            {
                name = "REPOLL_ALL",
                friendly_name = "Repoll all Devices",
                arg_data_type = (int)Data_Types.NONE,
                show_on_dynamic_obj_list = false,
                description = "This will force a repoll on all objects."
            });

            builtin_commands.InstallBuiltInCommand(new builtin_commands
            {
                name = "GROUP_ON",
                friendly_name = "Turn Group On",
                arg_data_type = (int)Data_Types.STRING,
                show_on_dynamic_obj_list = false,
                description = "Activates a group."
            });

            builtin_commands.InstallBuiltInCommand(new builtin_commands
            {
                name = "GROUP_OFF",
                friendly_name = "Turn Group Off",
                arg_data_type = (int)Data_Types.STRING,
                show_on_dynamic_obj_list = false,
                description = "Deactivates a group."
            });

            builtin_commands.InstallBuiltInCommand(new builtin_commands
            {
                name = "TIMEDELAY",
                friendly_name = "Scene Time Delay (sec)",
                arg_data_type = (int)Data_Types.INTEGER,
                show_on_dynamic_obj_list = false,
                description = "Pauses a scene execution for x seconds."
            });

            device_propertys.DefineOrUpdateDeviceProperty(new device_propertys
            {
                name = "ENABLEPOLLING",
                friendly_name = "Enable polling for this device.",
                default_value = "false",
                value_data_type = (int)Data_Types.BOOL
            });
            
            // Iterate the plugins to make sure none of them are new...
            foreach (Plugin p in _plugins)
            {
                using (zvsEntities2 context = new zvsEntities2(zvsEntityControl.GetzvsConnectionString))
                {
                    plugin ent_p = context.plugins.FirstOrDefault(pl => pl.name == p.Name);
                    if (ent_p == null)
                    {
                        ent_p = new plugin { name = p.Name, friendly_name = p.ToString() };
                        context.plugins.AddObject(ent_p);
                        context.SaveChanges();
                    }
                }

                p.Initialize();
                p.Start();
            }

            builtin_command_que.BuiltinCommandAddedToQueEvent += new builtin_command_que.BuiltinCommandAddedEventHandler(builtin_command_que_BuiltinCommandAddedToQueEvent);
            device_type_command_que.DeviceTypeCommandAddedToQueEvent += new device_type_command_que.DeviceTypeCommandAddedEventHandler(device_type_command_que_DeviceTypeCommandAddedToQueEvent);
            device_command_que.DeviceCommandAddedToQueEvent += new device_command_que.DeviceCommandAddedEventHandler(device_command_que_DeviceCommandAddedToQueEvent);            
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Create a new plugin object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="friendly_name">Initial value of the friendly_name property.</param>
 /// <param name="name">Initial value of the name property.</param>
 /// <param name="enabled">Initial value of the enabled property.</param>
 public static plugin Createplugin(global::System.Int64 id, global::System.String friendly_name, global::System.String name, global::System.Boolean enabled)
 {
     plugin plugin = new plugin();
     plugin.id = id;
     plugin.friendly_name = friendly_name;
     plugin.name = name;
     plugin.enabled = enabled;
     return plugin;
 }