コード例 #1
0
        private void disablePlugin(Plugin p)
        {
            OSAEObject obj = OSAEObjectManager.GetObjectByName(p.PluginName);

            OSAEObjectManager.ObjectUpdate(p.PluginName, p.PluginName, obj.Description, obj.Type, obj.Address, obj.Container, 0);
            try
            {
                p.Shutdown();
                p.Enabled = false;
                p.Domain  = Common.CreateSandboxDomain("Sandbox Domain", p.Location, SecurityZone.Internet, typeof(ClientService));
            }
            catch (Exception ex)
            {
                this.Log.Error("Error stopping plugin (" + p.PluginName + ")", ex);
            }
        }
コード例 #2
0
        private void Load_All_Weather()
        {
            weatherObj            = OSAEObjectManager.GetObjectByName("Weather");
            lblCurTemp.Content    = weatherObj.Property("Temp").Value + "°";
            lblConditions.Content = weatherObj.Property("Today Forecast").Value;

            LoadLows();
            LoadHighs();
            LoadDayLabels();
            LoadDaySummaryLabels();
            LoadNightSummaryLabels();
            LoadDates();
            LoadImageControls();

            lblForcast.Text = "";
        }
コード例 #3
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            string sName = txtControlName.Text;

            OSAEObjectManager.ObjectAdd(sName, "", sName, "CONTROL TIMER LABEL", "", currentScreen, 50, true);
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "Font Name", txtFont.Text, currentUser);
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "Font Size", txtSize.Text, currentUser);
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "Fore Color", foreColorComboBox.Text, currentUser);
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "Back Color", backColorComboBox.Text, currentUser);
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "Object Name", objectComboBox.Text, currentUser);
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "X", txtX.Text, currentUser);
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "Y", txtY.Text, currentUser);
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "ZOrder", txtZOrder.Text, currentUser);
            OSAEScreenControlManager.ScreenObjectAdd(currentScreen, objectComboBox.Text, sName);
            NotifyParentFinished();
        }
コード例 #4
0
 private void btnUpdate_Click(object sender, RoutedEventArgs e)
 {
     if (validateForm("Update"))
     {
         string sName = txtName.Text;
         OSAEObjectManager.ObjectUpdate(sOriginalName, sName, sName, sName, "CONTROL BROWSER", "", currentScreen, 30, true);
         OSAEObjectPropertyManager.ObjectPropertySet(sName, "URI", txtURI.Text, currentUser);
         OSAEObjectPropertyManager.ObjectPropertySet(sName, "Width", txtWidth.Text, currentUser);
         OSAEObjectPropertyManager.ObjectPropertySet(sName, "Height", txtHeight.Text, currentUser);
         OSAEObjectPropertyManager.ObjectPropertySet(sName, "X", txtX.Text, currentUser);
         OSAEObjectPropertyManager.ObjectPropertySet(sName, "Y", txtY.Text, currentUser);
         OSAEObjectPropertyManager.ObjectPropertySet(sName, "ZOrder", txtZOrder.Text, currentUser);
         OSAEScreenControlManager.ScreenObjectAdd(currentScreen, "", txtName.Text);
         NotifyParentFinished();
     }
 }
コード例 #5
0
    private void loadPlugins()
    {
        pluginList = new BindingList <PluginDescription>();
        List <string> osapdFiles = new List <string>();

        string[] pluginFile = Directory.GetFiles(Common.ApiPath + "\\Plugins", "*.osapd", SearchOption.AllDirectories);
        osapdFiles.AddRange(pluginFile);

        foreach (string path in osapdFiles)
        {
            if (!string.IsNullOrEmpty(path))
            {
                PluginDescription desc = new PluginDescription();

                desc.Deserialize(path);
                desc.Status  = "Stopped";
                desc.Enabled = false;

                OSAEObjectCollection objs = OSAEObjectManager.GetObjectsByType(desc.Type);
                foreach (OSAEObject o in objs)
                {
                    if (OSAEObjectPropertyManager.GetObjectPropertyValue(o.Name, "Computer Name").Value == Common.ComputerName || desc.Type == o.Name)
                    {
                        desc.Name = o.Name;
                        if (o.Enabled == 1)
                        {
                            desc.Enabled = true;
                        }
                        if (o.State.Value == "ON")
                        {
                            desc.Status = "Running";
                        }
                        else
                        {
                            desc.Status = "Stopped";
                        }
                    }
                }
                pluginList.Add(desc);

                //logging.AddToLog("Plugin found: Name:" + desc.Name + " Desc ID: " + desc.ID, true);
            }
        }
        checkForUpdates();
        gvPlugins.DataSource = pluginList;
        gvPlugins.DataBind();
    }
コード例 #6
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            sWorkingName = txtControlName.Text;
            OSAEObjectManager.ObjectAdd(sWorkingName, sWorkingName, "CONTROL CLICK IMAGE", "", currentScreen, true);
            if (imgNormalRaw != null)
            {
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Normal Image", imgNormalRaw.Name, "GUI");
            }
            else
            {
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Normal Image", "", "GUI");
            }
            if (imgPressedRaw != null)
            {
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Pressed Image", imgPressedRaw.Name, "GUI");
            }
            else
            {
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Pressed Image", "", "GUI");
            }
            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Press Object Name", cboPressObject.Text, "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Press Method Name", cboPressMethod.Text, "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Press Param 1", txtPressParam1.Text, "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Press Param 2", txtPressParam2.Text, "GUI");

            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Press Script Name", cboPressScript.Text, "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Press Script Param 1", txtPressScriptParam1.Text, "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Press Script Param 2", txtPressScriptParam2.Text, "GUI");

            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Release Object Name", cboReleaseObject.Text, "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Release Method Name", cboReleaseMethod.Text, "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Release Param 1", txtReleaseParam1.Text, "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Release Param 2", txtReleaseParam2.Text, "GUI");

            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Release Script Name", cboReleaseScript.Text, "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Release Script Param 1", txtReleaseScriptParam1.Text, "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Release Script Param 2", txtReleaseScriptParam2.Text, "GUI");

            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "X", "100", "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Y", "100", "GUI");

            OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Zorder", "1", "GUI");

            OSAEScreenControlManager.ScreenObjectAdd(currentScreen, "", sWorkingName);

            NotifyParentFinished();
        }
コード例 #7
0
        public override void RunInterface(string pluginName)
        {
            pName = pluginName;
            Log   = new General.OSAELog(pName);
            Log.Info("Starting Android plugin");
            OwnTypes();

            //connect to devices
            OSAEObjectCollection objects = OSAEObjectManager.GetObjectsByType("ANDROID DEVICE");

            foreach (OSAEObject obj in objects)
            {
                createdevice(obj);
            }

            Log.Debug("Run Interface Complete");
        }
コード例 #8
0
        private void StateChange(string serial, Direction dir, uint n, int state)
        {
            string address = serial + ((dir == Direction.Input) ? "_I" : "_O") + n;
            //osae.AddToLog("state: " + address + " = " + state, true);
            OSAEObject obj = OSAEObjectManager.GetObjectByAddress(address);

            if (obj != null)
            {
                bool invert = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Name, "Invert").Value == "TRUE";
                bool on     = (state != 0) ^ invert;
                OSAEObjectStateManager.ObjectStateSet(obj.Name, on ? "ON" : "OFF", pName);
                logging.AddToLog("State change: " + obj.Name
                                 + " (" + address + ")"
                                 + " changed to " + OSAEObjectStateManager.GetObjectStateValue(obj.Name).Value,
                                 true); // false?
            }
        }
コード例 #9
0
        private void Load_App_Name()
        {
            try
            {
                gAppName = "VR CLIENT-" + OSAE.Common.ComputerName;
                bool found = OSAEObjectManager.ObjectExists(gAppName);
                if (!found)
                {
                    OSAEObjectManager.ObjectAdd(gAppName, "", gAppName, "VR CLIENT", "", OSAE.Common.ComputerName, 30, true);
                    AddToLog("Object Name: " + gAppName + " not found, so I created it.");
                }

                OSAEObjectStateManager.ObjectStateSet(gAppName, "ON", gAppName);
            }
            catch (Exception ex)
            { AddToLog("Error messaging host: " + ex.Message); }
        }
コード例 #10
0
        public void stopPlugin(string serviceName, Plugin p)
        {
            Log = new General.OSAELog("SERVICE");
            Log.Info(p.PluginName + ":  Disabling Plugin...");

            OSAEObject obj = OSAEObjectManager.GetObjectByName(p.PluginName);

            //  OSAEObjectManager.ObjectUpdate(p.PluginName, p.PluginName, obj.Alias, obj.Description, obj.Type, obj.Address, obj.Container, obj.MinTrustLevel, false);
            try
            {
                p.Shutdown();
                OSAEObjectStateManager.ObjectStateSet(p.PluginName, "OFF", "SYSTEM");
                p.Domain = Common.CreateSandboxDomain("Sandbox Domain", p.Location, SecurityZone.Internet, typeof(OSAEService));
            }
            catch (Exception ex)
            { Log.Error("Error stopping plugin (" + p.PluginName + "): " + ex.Message, ex); }
        }
コード例 #11
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            if (validateForm("Update"))
            {
                sWorkingName = txtControlName.Text;
                OSAE.OSAEObject obj = OSAEObjectManager.GetObjectByName(sOriginalName);
                //We call an object update here in case the Name was changed, then perform the updates against the New name
                OSAEObjectManager.ObjectUpdate(sOriginalName, sWorkingName, obj.Alias, obj.Description, obj.Type, obj.Address, obj.Container, obj.MinTrustLevel, obj.Enabled);

                if (imgNormalRaw != null)
                {
                    OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Normal Image", imgNormalRaw.Name, currentUser);
                }
                else
                {
                    OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Normal Image", "", currentUser);
                }
                if (imgPressedRaw != null)
                {
                    OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Pressed Image", imgPressedRaw.Name, currentUser);
                }
                else
                {
                    OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Pressed Image", "", currentUser);
                }
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Press Object Name", cboPressObject.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Press Method Name", cboPressMethod.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Press Param 1", txtPressParam1.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Press Param 2", txtPressParam2.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Press Script Name", cboPressScript.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Press Script Param 1", txtPressScriptParam1.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Press Script Param 2", txtPressScriptParam2.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Release Object Name", cboReleaseObject.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Release Method Name", cboReleaseMethod.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Release Param 1", txtReleaseParam1.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Release Param 2", txtReleaseParam2.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Release Script Name", cboReleaseScript.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Release Script Param 1", txtReleaseScriptParam1.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Release Script Param 2", txtReleaseScriptParam2.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "X", txtNormalX.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Y", txtNormalY.Text, currentUser);
                OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Zorder", txtZOrder.Text, currentUser);
                OSAEScreenControlManager.ScreenObjectUpdate(currentScreen, "", sWorkingName);
                NotifyParentFinished();
            }
        }
コード例 #12
0
        private PowerCollection GetPowerCollection(int address)
        {
            foreach (PowerCollection pc in pcList)
            {
                if (pc.Address == address)
                {
                    return(pc);
                }
            }
            pcList.Add(new PowerCollection(address));
            if (OSAEObjectManager.GetObjectByAddress("KAW" + address.ToString()) == null)
            {
                OSAEObjectManager.ObjectAdd("KillAWatt - " + address.ToString(), "", "Kill-A-Watt device", "KILLAWATT MODULE", "KAW" + address.ToString(), "", 50, true);
            }

            return(GetPowerCollection(address));
        }
コード例 #13
0
        public override void RunInterface(string pluginName)
        {
            log("Running interface", true);
            pName = pluginName;

            OSAEObjectTypeManager.ObjectTypeUpdate("Android Device", "Android Device", "Android Device", pluginName, "Android Device", 0, 0, 0, 1);

            //connect to devices
            OSAEObjectCollection objects = OSAEObjectManager.GetObjectsByType("Android Device");

            foreach (OSAEObject obj in objects)
            {
                createdevice(obj);
            }

            log("Run Interface Complete", true);
        }
コード例 #14
0
        public override void RunInterface(string pluginName)
        {
            Log.Info("Starting Android plugin");
            pName = pluginName;

            OSAEObjectTypeManager.ObjectTypeUpdate("Android Device", "Android Device", "Android Device", pluginName, "Android Device", false, false, false, true);

            //connect to devices
            OSAEObjectCollection objects = OSAEObjectManager.GetObjectsByType("Android Device");

            foreach (OSAEObject obj in objects)
            {
                createdevice(obj);
            }

            Log.Debug("Run Interface Complete");
        }
コード例 #15
0
        private bool validateForm(string mthd)
        {
            bool validate = true;

            // Does this object already exist
            if (mthd == "Add" || sOriginalName != txtControlName.Text)
            {
                try
                {
                    OSAEObject oExist = OSAEObjectManager.GetObjectByName(txtControlName.Text);
                    if (oExist != null)
                    {
                        MessageBox.Show("Control name already exist. Please Change!");
                        validate = false;
                    }
                }
                catch { }
            }
            if (string.IsNullOrEmpty(txtControlName.Text))
            {
                MessageBox.Show("You must enter a name for this control!");
                validate = false;
            }
            if (string.IsNullOrEmpty(objectComboBox.Text))
            {
                MessageBox.Show("You must choose an associated object!");
                validate = false;
            }
            if (string.IsNullOrEmpty(txtX.Text))
            {
                MessageBox.Show("X Can not be empty");
                validate = false;
            }
            if (string.IsNullOrEmpty(txtY.Text))
            {
                MessageBox.Show("Y Can not be empty");
                validate = false;
            }
            if (string.IsNullOrEmpty(txtZOrder.Text))
            {
                MessageBox.Show("ZOrder can not be empty");
                validate = false;
            }

            return(validate);
        }
コード例 #16
0
 private void Load_App_Name()
 {
     try
     {
         gAppName = PluginManager.GetPluginName("VR CLIENT", OSAE.Common.ComputerName);
         if (gAppName == "")
         {
             gAppName = "VR CLIENT-" + OSAE.Common.ComputerName;
             OSAEObjectManager.ObjectAdd(gAppName, gAppName, "VR CLIENT", "", "SYSTEM", true);
             OSAEObjectPropertyManager.ObjectPropertySet(gAppName, "Computer Name", OSAE.Common.ComputerName, "VR");
         }
     }
     catch (Exception ex)
     {
         AddToLog("Error messaging host: " + ex.Message);
     }
 }
コード例 #17
0
 /// <summary>
 /// Check if there is an object for the Service running on this machine in OSA, and create one if not.
 /// </summary>
 private void CreateServiceObject()
 {
     try
     {
         logging.AddToLog("Creating Service object", true);
         OSAEObject svcobj = OSAEObjectManager.GetObjectByName("SERVICE-" + Common.ComputerName);
         if (svcobj == null)
         {
             OSAEObjectManager.ObjectAdd("SERVICE-" + Common.ComputerName, "SERVICE-" + Common.ComputerName, "SERVICE", "", "SYSTEM", true);
         }
         OSAEObjectStateManager.ObjectStateSet("SERVICE-" + Common.ComputerName, "ON", "OSAE Service");
     }
     catch (Exception ex)
     {
         logging.AddToLog("Error creating service object - " + ex.Message, true);
     }
 }
コード例 #18
0
        public override void RunInterface(string pluginName)
        {
            logging.AddToLog("Running interface", false);
            pName = pluginName;
            OSAEObjectTypeManager.ObjectTypeUpdate("XBMC SYSTEM", "XBMC SYSTEM", "XBMC System", pluginName, "XBMC SYSTEM", 0, 0, 0, 1);

            OSAEObjectCollection XBMCInstances = OSAEObjectManager.GetObjectsByType("XBMC System");

            foreach (OSAEObject obj in XBMCInstances)
            {
                string ip = "", username = "", password = "";
                int    port = 0;

                foreach (OSAEObjectProperty p in obj.Properties)
                {
                    switch (p.Name)
                    {
                    case "IP":
                        ip = p.Value;
                        break;

                    case "Port":
                        port = Int32.Parse(p.Value);
                        break;

                    case "Username":
                        username = p.Value;
                        break;

                    case "Password":
                        password = p.Value;
                        break;
                    }
                }
                logging.AddToLog("Creating new XBMC System connection: " + obj.Name + " - " + ip, false);
                XBMCSystem system = new XBMCSystem(obj.Name, ip, port, username, password);
                system.Connect();
                Systems.Add(system);
            }

            //Clock = new System.Timers.Timer();
            //Clock.Interval = 5000;
            //Clock.Start();
            //Clock.Elapsed += new ElapsedEventHandler(Timer_Tick);
        }
コード例 #19
0
        protected override void OnStart(string[] args)
        {
            Common.InitialiseLogFolder();

            this.Log.Info("OnStart");

            try
            {
                this.Log.Debug("Starting UDP listener");
                NetworkComms.AppendGlobalIncomingPacketHandler <string>("Plugin", PluginMessageReceived);
                NetworkComms.AppendGlobalIncomingPacketHandler <string>("Commmand", MethodMessageReceived);
                //Start listening for incoming UDP data
                UDPConnection.StartListening(true);
                this.Log.Debug("UPD Listener started");
            }
            catch (Exception ex)
            {
                this.Log.Error("Error starting listener", ex);
            }

            Common.CreateComputerObject(sourceName);

            try
            {
                this.Log.Info("Creating Service object");
                OSAEObject svcobj = OSAEObjectManager.GetObjectByName("SERVICE-" + Common.ComputerName);
                if (svcobj == null)
                {
                    OSAEObjectManager.ObjectAdd("SERVICE-" + Common.ComputerName, "SERVICE-" + Common.ComputerName, "SERVICE", "", "SYSTEM", true);
                }
                OSAEObjectStateManager.ObjectStateSet("SERVICE-" + Common.ComputerName, "ON", sourceName);
            }
            catch (Exception ex)
            {
                this.Log.Error("Error creating service object", ex);
            }

            Thread loadPluginsThread = new Thread(new ThreadStart(LoadPlugins));

            loadPluginsThread.Start();

            //Clock.Interval = 5000;
            //Clock.Start();
            //Clock.Elapsed += new System.Timers.ElapsedEventHandler(checkConnection);
        }
コード例 #20
0
        private void PluginMessageReceived(PacketHeader header, Connection connection, string message)
        {
            Log.Info("A message was recieved from " + connection.ToString() + " which said '" + message + "'.");

            string[] arguments = message.Split('|');
            bool     local     = false;

            if (arguments[1] == "True")
            {
                OSAEObjectStateManager.ObjectStateSet(arguments[0], "ON", "SYSTEM");
            }
            else if (arguments[1] == "False")
            {
                OSAEObjectStateManager.ObjectStateSet(arguments[0], "OFF", "SYSTEM");
            }

            foreach (Plugin p in plugins)
            {
                if (p.PluginName == arguments[0])
                {
                    local = true;

                    OSAEObject obj = OSAEObjectManager.GetObjectByName(p.PluginName);
                    if (obj != null)
                    {
                        if (arguments[1] == "True")
                        {
                            // enablePlugin(p);
                            // maybe this call should be enable/disable, not sure, moving on
                            startPlugin("SYSTEM", p);
                            UDPConnection.SendObject("Plugin", p.PluginName + " | " + p.Enabled.ToString() + " | " + p.PluginVersion + " | Running | " + p.LatestAvailableVersion + " | " + p.PluginType + " | " + Common.ComputerName, new IPEndPoint(IPAddress.Broadcast, 10051));
                        }
                        else if (arguments[1] == "False")
                        {
                            stopPlugin("SYSTEM", p);
                            UDPConnection.SendObject("Plugin", p.PluginName + " | " + p.Enabled.ToString() + " | " + p.PluginVersion + " | Stopped | " + p.LatestAvailableVersion + " | " + p.PluginType + " | " + Common.ComputerName, new IPEndPoint(IPAddress.Broadcast, 10051));
                        }
                    }
                }
            }
            if (!local)
            {
                UDPConnection.SendObject("Plugin", message, new IPEndPoint(IPAddress.Broadcast, 10051));
            }
        }
コード例 #21
0
    protected void chkEnabled_OnCheckedChanged(object sender, EventArgs e)
    {
        try
        {
            CheckBox ckbx       = (CheckBox)sender;
            string   pluginName = "";
            string   enabled;
            if (ckbx.Checked)
            {
                enabled = "True";
            }
            else
            {
                enabled = "False";
            }

            foreach (GridViewRow rw in gvPlugins.Rows)
            {
                CheckBox chkBx = (CheckBox)rw.FindControl("chkEnabled");
                if (chkBx == ckbx)
                {
                    pluginName = ((Label)rw.FindControl("lblObject")).Text;
                }
            }

            NetworkComms.SendObject("Plugin", Common.LocalIPAddress(), 10051, pluginName + "|" + enabled);
            Log.Info("Sending message: " + "ENABLEPLUGIN|" + pluginName + "|" + enabled);

            foreach (PluginDescription plugin in pluginList)
            {
                if (plugin.Name == pluginName && plugin.Name != null)
                {
                    plugin.Status = "Starting...";
                }
            }

            OSAEObject obj = OSAEObjectManager.GetObjectByName(pluginName);
            OSAEObjectManager.ObjectUpdate(obj.Name, obj.Name, obj.Description, obj.Type, obj.Address, obj.Container, 1);
            loadPlugins();
        }
        catch (Exception ex)
        {
            Log.Info("Error enabling plugin: " + ex.Message + " Inner Exception: " + ex.InnerException);
        }
    }
コード例 #22
0
        private OSAEObjectPropertyCollection getProperties(string objName)
        {
            OSAEObject oObj = OSAEObjectManager.GetObjectByName(objName);
            OSAEObjectPropertyCollection props      = oObj.Properties;
            OSAEObjectPropertyCollection properties = new OSAEObjectPropertyCollection();

            foreach (OSAEObjectProperty prop in props)
            {
                OSAEObjectProperty p = new OSAEObjectProperty();
                p.Name        = prop.Name;
                p.Value       = prop.Value;
                p.DataType    = prop.DataType;
                p.LastUpdated = prop.LastUpdated;
                p.Id          = prop.Id;
                properties.Add(p);
            }
            return(properties);
        }
コード例 #23
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     if (hdnSelectedRow.Text != "")
     {
         gvObjects.Rows[Int32.Parse(hdnSelectedRow.Text)].Attributes.Remove("onmouseout");
         gvObjects.Rows[Int32.Parse(hdnSelectedRow.Text)].Style.Add("background", "lightblue");
     }
     if (hdnSelectedPropRow.Text != "")
     {
         gvProperties.Rows[Int32.Parse(hdnSelectedPropRow.Text)].Attributes.Remove("onmouseout");
         gvProperties.Rows[Int32.Parse(hdnSelectedPropRow.Text)].Style.Add("background", "lightblue");
     }
     if (hdnSelectedObjectName.Text != "")
     {
         txtExportScript.Text = OSAEObjectManager.ObjectExport(hdnSelectedObjectName.Text);
     }
     hdnEditingPropList.Value = hdnEditingPropList.Value;
 }
コード例 #24
0
        private void Load_App_Name()
        {
            OSAEObjectCollection screens = OSAEObjectManager.GetObjectsByType("GUI CLIENT");

            foreach (OSAE.OSAEObject obj in screens)
            {
                if (obj.Property("Computer Name").Value == Common.ComputerName)
                {
                    gAppName = obj.Name;
                }
            }
            if (gAppName == "")
            {
                gAppName = "GUI CLIENT-" + Common.ComputerName;
                OSAEObjectManager.ObjectAdd(gAppName, gAppName, "GUI CLIENT", "", "SYSTEM", true);
                OSAEObjectPropertyManager.ObjectPropertySet(gAppName, "Computer Name", Common.ComputerName, "GUI");
            }
        }
コード例 #25
0
        public void disablePlugin(Plugin p)
        {
            logging.AddToLog("Disabling Plugin: " + p.PluginName, true);

            OSAEObject obj = OSAEObjectManager.GetObjectByName(p.PluginName);

            OSAEObjectManager.ObjectUpdate(p.PluginName, p.PluginName, obj.Description, obj.Type, obj.Address, obj.Container, 0);
            try
            {
                p.Shutdown();
                p.Enabled = false;
                p.Domain  = Common.CreateSandboxDomain("Sandbox Domain", p.Location, SecurityZone.Internet, typeof(OSAEService));
            }
            catch (Exception ex)
            {
                logging.AddToLog("Error stopping plugin (" + p.PluginName + "): " + ex.Message + " - " + ex.InnerException, true);
            }
        }
コード例 #26
0
        public override void RunInterface(string pluginName)
        {
            //throw new NotImplementedException();
            this.Log.Info("Found Plugin Object: " + pluginName);
            this.Log.Info(pluginName + " is starting...");
            OSAEObject plugin  = OSAEObjectManager.GetObjectByName(pluginName);
            string     refresh = plugin.Property("Refresh").Value;
            int        refre   = Convert.ToInt16(refresh);

            Onlineupdatetime           = Onlineupdatetime * refre;
            OnlineUpdateTimer          = new System.Timers.Timer();
            OnlineUpdateTimer.Interval = Onlineupdatetime;
            OnlineUpdateTimer.Start();
            OnlineUpdateTimer.Elapsed += new ElapsedEventHandler(OnlineUpdateTime);
            this.updateOnlineThread    = new Thread(new ThreadStart(updateonline));
            this.updateOnlineThread.Start();
            Thread.Sleep(5000);
        }
コード例 #27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        OSAEObject obj = OSAEObjectManager.GetObjectByName(screenObject.Property("Object Name").Value);

        Source = renameingSys(obj.Property("SNAP SHOT").Value);
        double imgWidth  = Convert.ToDouble(obj.Property("Width").Value);
        double imgHeight = Convert.ToDouble(obj.Property("Height").Value);

        ControlWidth  = Convert.ToDouble(screenObject.Property("Width").Value);
        imgRatio      = ControlWidth / imgWidth;
        ControlHeight = Convert.ToInt32(imgHeight * imgRatio);
        width         = ControlWidth.ToString();
        height        = ControlHeight.ToString();
        imgSnapShot.Attributes.Add("Style", "position:absolute;top:" + (Int32.Parse(screenObject.Property("Y").Value) + 50).ToString() + "px;left:" + (Int32.Parse(screenObject.Property("X").Value) + 10).ToString() + "px;z-index:" + (Int32.Parse(screenObject.Property("ZOrder").Value) + 10).ToString() + ";");
        imgSnapShot.ImageUrl = @Source;
        imgSnapShot.Width    = System.Web.UI.WebControls.Unit.Parse(width);
        imgSnapShot.Height   = System.Web.UI.WebControls.Unit.Parse(height);
    }
コード例 #28
0
        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            string sName = currentScreen + " - " + objectComboBox.Text;

            OSAEObjectManager.ObjectAdd(sName, sName, "CONTROL METHOD IMAGE", "", currentScreen, true);
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "Object Name", objectComboBox.Text, "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "Method Name", methodComboBox.Text, "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "Param 1", txtParam1.Text, "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "Param 2", txtParam2.Text, "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "Image", img.Name, "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "X", "100", "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "Y", "100", "GUI");
            OSAEObjectPropertyManager.ObjectPropertySet(sName, "Zorder", "1", "GUI");

            OSAEScreenControlManager.ScreenObjectAdd(currentScreen, objectComboBox.Text, sName);

            NotifyParentFinished();
        }
コード例 #29
0
 private void btnUpdate_Click(object sender, RoutedEventArgs e)
 {
     if (validateForm("Update"))
     {
         sWorkingName = txtName.Text;
         OSAE.OSAEObject obj = OSAEObjectManager.GetObjectByName(sOriginalName);
         //We call an object update here in case the Name was changed, then perform the updates against the New name
         OSAEObjectManager.ObjectUpdate(sOriginalName, sWorkingName, obj.Alias, obj.Description, obj.Type, obj.Address, obj.Container, obj.MinTrustLevel, obj.Enabled);
         //OSAEObjectManager.ObjectAdd(sWorkingName, "", sWorkingName, "CONTROL NAVIGATION IMAGE", "", currentScreen, true);
         OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Image", img.Name, currentUser);
         OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Screen", cboScreens.Text, currentUser);
         OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "X", txtX.Text, currentUser);
         OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Y", txtY.Text, currentUser);
         OSAEObjectPropertyManager.ObjectPropertySet(sWorkingName, "Zorder", txtZOrder.Text, currentUser);
         OSAEScreenControlManager.ScreenObjectUpdate(currentScreen, cboScreens.Text, sWorkingName);
         NotifyParentFinished();
     }
 }
コード例 #30
0
 /// <summary>
 /// Add the new object to the system
 /// </summary>
 /// <param name="sender">Standard sender argument see MSDN</param>
 /// <param name="e">Standard RoutedEventArgs argument see MSDN</param>
 private void addButton_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     if (ValidateForm())
     {
         OSAEObjectManager.ObjectAdd(
             nameTextBox.Text,
             descriptionTextBox.Text,
             objectTypesComboBox.SelectedValue.ToString(),
             addressTextBox.Text,
             (containersComboBox.SelectedIndex == -1) ? "" : containersComboBox.SelectedValue.ToString(),
             true);
     }
     else
     {
         MessageBox.Show("Not all the mandatory fields have been completed", "Fields Incomplete", MessageBoxButton.OK, MessageBoxImage.Error);
         NotifyParentFinished();
     }
 }