コード例 #1
0
        void OnChecked(object sender, RoutedEventArgs e)
        {
            try
            {
                if (dgLocalPlugins.SelectedItem != null)
                {
                    PluginDescription pd = (PluginDescription)dgLocalPlugins.SelectedItem;

                    this.Log.Info("checked: " + pd.Name);

                    NetworkComms.SendObject("Plugin", "127.0.0.1", 10000, pd.Name + "|True");

                    this.Log.Info("Sending message: " + "ENABLEPLUGIN|" + pd.Name + "|True");
                    if (myService.Status == ServiceControllerStatus.Running)
                    {
                        foreach (PluginDescription plugin in pluginList)
                        {
                            if (plugin.Name == pd.Name && plugin.Name != null)
                            {
                                plugin.Status = "Starting...";
                            }
                        }
                    }

                    OSAEObject obj = OSAEObjectManager.GetObjectByName(pd.Name);
                    OSAEObjectManager.ObjectUpdate(obj.Name, obj.Name, obj.Description, obj.Type, obj.Address, obj.Container, 1);
                }
            }
            catch (Exception ex)
            {
                this.Log.Error("Error enabling plugin ", ex);
            }
        }
コード例 #2
0
        public bool CheckObjByName(string Objname)
        {
            bool Objexist = false;

            try
            {
                OSAEObject checkObj = OSAEObjectManager.GetObjectByName(Objname);
                if (checkObj.Name == Objname)
                {
                    if (debug)
                    {
                        this.Log.Debug("The object " + checkObj.Name + " Was found.");
                    }
                    Objexist = true;
                }
            }
            catch
            {
                Objexist = false;
                if (debug)
                {
                    this.Log.Debug("The object " + Objname + " Was not found.");
                }
            }
            return(Objexist);
        }
コード例 #3
0
 private void btnUpdate_Click(object sender, RoutedEventArgs e)
 {
     if (ValidateForm("Update"))
     {
         sWorkingName = cntrlName.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);
         string sName = cntrlName.Text;
         OSAEObjectManager.ObjectUpdate(sOriginalName, sName, "", sName, osaeControlType + " " + _pluginName, "", currentScreen, 30, true);
         OSAEObjectPropertyManager.ObjectPropertySet(sName, "Control Type", osaeControlType + " " + _pluginName, currentUser);
         OSAEObjectPropertyManager.ObjectPropertySet(sName, "Object Name", objectsComboBox.Text, currentUser);
         OSAEObjectPropertyManager.ObjectPropertySet(sName, "X", cntrlX.Text, currentUser);
         OSAEObjectPropertyManager.ObjectPropertySet(sName, "Y", cntrlY.Text, currentUser);
         OSAEObjectPropertyManager.ObjectPropertySet(sName, "ZOrder", cntrlZOrder.Text, currentUser);
         if (hasParams == true)
         {
             foreach (objParams op in oParams)
             {
                 OSAEObjectPropertyManager.ObjectPropertySet(sName, op.Name, op.Value, currentUser);
             }
         }
         OSAEScreenControlManager.ScreenObjectUpdate(currentScreen, objectsComboBox.Text, sName);
         NotifyParentFinished();
     }
     // else
     // {
     // Do not save until feilds are correct
     //  }
 }
コード例 #4
0
        protected override void ProcessRecord()
        {
            logging.AddToLog("Get-OSA - ProcessRecord - Started", false);
            OSAEObject obj = OSAEObjectManager.GetObjectByName(Name);

            WriteObject(obj);
        }
コード例 #5
0
    protected void imgSubmit_Click(object sender, EventArgs e)
    {
        OSAEObject obj = OSAEObjectManager.GetObjectByName(txtUserName.Text);

        if (obj != null)
        {
            string pass = obj.Property("Password").Value;
            if (pass == txtPassword.Text)
            {
                if (pass != "")
                {
                    // Success, create non-persistent authentication cookie.
                    FormsAuthentication.SetAuthCookie(txtUserName.Text.Trim(), false);
                    Int32 cto = Convert.ToInt32(OSAEObjectPropertyManager.GetObjectPropertyValue("Web Server", "Timeout").Value);
                    FormsAuthenticationTicket ticket1 = new FormsAuthenticationTicket(txtUserName.Text.Trim(), true, cto);
                    HttpCookie cookie1 = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket1));
                    Response.Cookies.Add(cookie1);
                    Session["UserName"]      = OSAEObjectManager.GetObjectByName(this.txtUserName.Text.Trim()).Name;
                    Session["TrustLevel"]    = OSAEObjectPropertyManager.GetObjectPropertyValue(this.txtUserName.Text.Trim(), "Trust Level").Value;
                    Session["SecurityLevel"] = OSAEObjectPropertyManager.GetObjectPropertyValue(this.txtUserName.Text.Trim(), "Security Level").Value;
                }
                else
                {
                    FormsAuthentication.SetAuthCookie(txtUserName.Text.Trim(), false);
                    Int32 cto = Convert.ToInt32(OSAEObjectPropertyManager.GetObjectPropertyValue("Web Server", "Timeout").Value);
                    FormsAuthenticationTicket ticket1 = new FormsAuthenticationTicket(txtUserName.Text.Trim(), true, cto);
                    HttpCookie cookie1 = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(ticket1));
                    Response.Cookies.Add(cookie1);
                    Session["UserName"]      = OSAEObjectManager.GetObjectByName(this.txtUserName.Text.Trim()).Name;
                    Session["TrustLevel"]    = OSAEObjectPropertyManager.GetObjectPropertyValue(this.txtUserName.Text.Trim(), "Trust Level").Value;
                    Session["SecurityLevel"] = OSAEObjectPropertyManager.GetObjectPropertyValue(this.txtUserName.Text.Trim(), "Security Level").Value;
                }
                // 4. Do the redirect.
                string    returnUrl1;
                OSAEAdmin adSet  = OSAEAdminManager.GetAdminSettings();
                int       tLevel = Convert.ToInt32(Session["TrustLevel"].ToString());
                if (Session["SecurityLevel"].ToString() != "Admin" & tLevel < adSet.ObjectsTrust)
                {
                    returnUrl1 = "screens.aspx?id=" + adSet.defaultScreen;
                }
                else
                {
                    if (Request.QueryString["ReturnUrl"] == null)
                    {
                        returnUrl1 = "objects.aspx";                                            // the login is successful
                    }
                    else
                    {
                        returnUrl1 = Request.QueryString["ReturnUrl"];   //login not unsuccessful
                    }
                }
                Response.Redirect(returnUrl1);
            }
            else
            {
                lblError.Visible = true;
            }
        }
        lblError.Visible = true;
    }
コード例 #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     pressObjectName = screenObject.Property("Press Object Name").Value;
     releaseObjectName = screenObject.Property("Press Object Name").Value;
     OSAEObject pObj = OSAEObjectManager.GetObjectByName(pressObjectName);
     OSAEObject rObj = OSAEObjectManager.GetObjectByName(releaseObjectName);
     string pressObjTrust = pObj.MinTrustLevel.ToString();
     string releaseObjTrust = rObj.MinTrustLevel.ToString();
     pressMethodName = screenObject.Property("Press Method Name").Value;
     releaseMethodName = screenObject.Property("Release Method Name").Value;
     pMp1 = screenObject.Property("Press Method Param 1").Value;
     pMp2 = screenObject.Property("Press Method Param 2").Value;
     rMp1 = screenObject.Property("Release Method Param 1").Value;
     rMp2 = screenObject.Property("Release Method Param 2").Value;
     string normalImgName = screenObject.Property("Normal Image").Value;
     string pressImgName = screenObject.Property("Pressed Image").Value;
     OSAEImage img = imgMgr.GetImage(normalImgName);
     OSAEImage img2 = imgMgr.GetImage(pressImgName);
     string normalImgURL = "ImgHandler.aspx?ImageID=" + img.ID;
     string pressImgURL = "ImgHandler.aspx?ImageID=" + img2.ID;
     imgClickImage.ImageUrl = "~/imgHandler.aspx?ImageID=" + img.ID;
     imgClickImage.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() + ";");
     imgClickImage.ToolTip = pressObjectName + " - " + pressMethodName;
     imgClickImage.Attributes.Add("onmousedown", "methFunc('" + pressObjectName + "','" + pressMethodName + "','" + pMp1 + "','" + pMp2 + "','" + pressObjTrust + "','" + pressImgURL + "', this.id);");
     imgClickImage.Attributes.Add("onmouseup", "methFunc('" + releaseObjectName + "','" + releaseMethodName + "','" + rMp1 + "','" + rMp2 + "','" + releaseObjTrust + "','" + normalImgURL + "', this.id);");
 }
コード例 #7
0
        public override void ProcessCommand(OSAEMethod method)
        {
            try {
                string object_name = method.ObjectName;
                string method_name = method.MethodName;
                string parameter_1 = method.Parameter1;
                string parameter_2 = method.Parameter2;

                Log.Debug("Found Command: " + method_name + " | param1: " + parameter_1 + " | param2: " + parameter_2);

                if (object_name == pName)
                {
                    switch (method_name)
                    {
                    case "NOTIFYALL":
                        Log.Debug("NOTIFYALL event triggered");
                        Log.Debug("NOTIFYALL devices to loop:" + mdevices.Count);

                        foreach (AndroidDevice d in mdevices)
                        {
                            Log.Debug("NOTIFYALL loop for device:" + d.Name);
                            d.ProcessCommand("NOTIFY", parameter_1, parameter_2);
                        }

                        break;

                    case "EXECUTEALL":
                        Log.Debug("EXECUTEALL event triggered");
                        Log.Debug("EXECUTEALL devices to loop:" + mdevices.Count);

                        foreach (AndroidDevice d in mdevices)
                        {
                            Log.Debug("EXECUTEALL loop for device:" + d.Name);
                            d.ProcessCommand("EXECUTE", parameter_1, parameter_2);
                        }
                        break;
                    }
                }
                else
                {
                    AndroidDevice d = getAndroidDevice(object_name);

                    if (d == null)
                    {
                        OSAEObject obj = OSAEObjectManager.GetObjectByName(object_name);
                        createdevice(obj);
                        d = getAndroidDevice(object_name);
                    }

                    if (d != null)
                    {
                        d.ProcessCommand(method_name, parameter_1, parameter_2);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error processing command!", ex);
            }
        }
コード例 #8
0
        void OnUnchecked(object sender, RoutedEventArgs e)
        {
            try
            {
                PluginDescription pd = (PluginDescription)dgLocalPlugins.SelectedItem;

                this.Log.Info("Updating Object: " + pd.Name + ", Setting Enabled=False");
                OSAEObject obj = OSAEObjectManager.GetObjectByName(pd.Name);
                OSAEObjectManager.ObjectUpdate(obj.Name, obj.Name, obj.Alias, obj.Description, obj.Type, obj.Address, obj.Container, 0);

                //   NetworkComms.SendObject("Plugin", "127.0.0.1", 10051, pd.Name + "|False");
                //   this.Log.Info("Sending message: " + "ENABLEPLUGIN|" + pd.Name + "|False");


                //    if (myService.Status == ServiceControllerStatus.Running)
                //    {
                //       foreach (PluginDescription plugin in pluginList)
                //       {
                //           if (plugin.Name == pd.Name && plugin.Name != null)
                //           {
                //              plugin.Status = "Stopping...";
                //           }
                //       }
                //   }
            }
            catch (Exception ex)
            {
                this.Log.Error("Error disabling plugin", ex);
            }
        }
コード例 #9
0
        /// <summary>
        /// Public Constructor for WindowsService.
        /// - Put all of your Initialization code here.
        /// </summary>
        public OSAEService()
        {
            serviceObject = CheckServiceObject();
            if (serviceObject == null)
            {
                Log = new General.OSAELog("Faulted Service");
                Log.Fatal("Failed to retrieve Service's Object!");
            }
            //else
            //   OSAE.OSAEObjectStateManager.ObjectStateSet(serviceObject, "ON", serviceObject);

            Log = new General.OSAELog(serviceObject);
            Log.Info("Service Starting");

            Common.CheckComputerObject(serviceObject);
            OSAEObject obj = OSAEObjectManager.GetObjectByName(serviceObject);

            OSAEObjectManager.ObjectUpdate(serviceObject, serviceObject, obj.Address, obj.Description, obj.Type, obj.Address, Common.ComputerName, obj.MinTrustLevel, obj.Enabled);

            InitialiseOSAInEventLog();

            // These Flags set whether or not to handle that specific type of event. Set to true if you need it, false otherwise.

            CanStop     = true;
            CanShutdown = true;
        }
コード例 #10
0
        public void updateonline()
        {
            OSAEObjectCollection sonydevices = OSAEObjectManager.GetObjectsByOwner("Sony");

            if (refresh > 0)
            {
                foreach (OSAEObject device in sonydevices)
                {
                    string objName = device.Name;
                    if (objName != "Sony")
                    {
                        if (device.Property("Registered").Value == "TRUE")
                        {
                            if (debug)
                            {
                                this.Log.Debug("Updating Online Status for: " + objName);
                            }
                            sonyobj = OSAEObjectManager.GetObjectByName(objName);
                            if (debug)
                            {
                                this.Log.Debug("Initializing: " + sonyobj.Name);
                            }
                            mySonyDevice.Name        = sonyobj.Name;
                            mySonyDevice.DocumentUrl = sonyobj.Property("DocumentURL").Value;
                            mySonyDevice.ServerName  = "OSAE.Sony";
                            mySonyDevice.BuildFromDocument(new Uri(mySonyDevice.DocumentUrl));
                            OSAEMethod updatereg = new OSAEMethod();
                            updatereg.ObjectName = mySonyDevice.Name;
                            checkStatus(updatereg);
                        }
                    }
                }
            }
        }
コード例 #11
0
    private void loadDetails()
    {
        OSAEObject obj = OSAEObjectManager.GetObjectByName(gvObjects.DataKeys[Int32.Parse(hdnSelectedRow.Text)]["object_name"].ToString());

        txtName.Text               = obj.Name;
        txtDescr.Text              = obj.Description;
        txtAddress.Text            = obj.Address;
        ddlContainer.SelectedValue = obj.Container;
        if (obj.State.Value != "")
        {
            ddlState.SelectedValue = obj.State.Value;
        }
        ddlType.SelectedValue = obj.Type;
        if (obj.Enabled == 1)
        {
            chkEnabled.Checked = true;
        }
        else
        {
            chkEnabled.Checked = false;
        }

        OSAEObjectType objtype = OSAEObjectTypeManager.ObjectTypeLoad(obj.Type);

        txtOwned.Text = objtype.OwnedBy;
    }
コード例 #12
0
        //private string serviceName;
        public void startPlugin(string serviceName, Plugin plugin)
        {
            Log = new General.OSAELog(serviceName);
            Log.Info(plugin.PluginName + ":  Starting Plugin...");

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

            //Enabe and start seemed to be mixed, changed to start, enabe is handled at the Webui for now, maybe a method in the future
            //OSAEObjectManager.ObjectUpdate(plugin.PluginName, plugin.PluginName, obj.Alias, obj.Description, obj.Type, obj.Address, obj.Container, obj.MinTrustLevel, true);
            try
            {
                if (plugin.ActivatePlugin())
                {
                    // plugin.Enabled = true;
                    plugin.RunInterface(serviceObject);
                    OSAEObjectStateManager.ObjectStateSet(plugin.PluginName, "ON", "SYSTEM");
                    Log.Debug(plugin.PluginName + ":  Plugin started.");
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error activating plugin (" + plugin.PluginName + "): " + ex.Message, ex);
                OSAEObjectStateManager.ObjectStateSet(plugin.PluginName, "OFF", "SYSTEM");
            }
        }
コード例 #13
0
        protected override void ProcessRecord()
        {
            this.Log.Debug("Get-OSA - ProcessRecord - Started");
            OSAEObject obj = OSAEObjectManager.GetObjectByName(Name);

            WriteObject(obj);
        }
コード例 #14
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(txtScreenName.Text))
            {
                MessageBox.Show("Please specify a name for the screen");
                return;
            }

            if (img == null)
            {
                MessageBox.Show("Please specify an image for the screen");
                return;
            }


            string tempName = "Screen - " + txtScreenName.Text.Replace("Screen - ", "");

            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, tempName, obj.Alias, obj.Description, obj.Type, obj.Address, obj.Container, obj.Enabled);
            OSAEObjectPropertyManager.ObjectPropertySet(tempName, "Background Image", img.Name, "GUI");

            //OnLoadScreen();

            NotifyParentFinished();
        }
コード例 #15
0
        private bool validateForm(string mthd)
        {
            bool validate = true;

            // Does this object already exist
            if (mthd == "Add" || sOriginalName != txtScreenName.Text)
            {
                try
                {
                    OSAEObject oExist = OSAEObjectManager.GetObjectByName(txtScreenName.Text);
                    if (oExist != null)
                    {
                        MessageBox.Show("Control name already exist. Please Change!");
                        validate = false;
                    }
                }
                catch { }
            }
            if (string.IsNullOrEmpty(txtScreenName.Text))
            {
                MessageBox.Show("You must enter a Name for this Control!");
                validate = false;
            }
            if (img == null)
            {
                MessageBox.Show("Please specify an image for the screen");
                validate = false;
            }

            return(validate);
        }
コード例 #16
0
        void OnUnchecked(object sender, RoutedEventArgs e)
        {
            try
            {
                PluginDescription pd = (PluginDescription)dgLocalPlugins.SelectedItem;
                logging.AddToLog("unchecked: " + pd.Name, true);

                Thread thread = new Thread(() => messageHost(OSAEWCFMessageType.PLUGIN, "ENABLEPLUGIN|" + pd.Name + "|False"));
                thread.Start();
                logging.AddToLog("Sending message: " + "ENABLEPLUGIN|" + pd.Name + "|False", true);

                if (myService.Status == ServiceControllerStatus.Running)
                {
                    foreach (PluginDescription plugin in pluginList)
                    {
                        if (plugin.Name == pd.Name && plugin.Name != null)
                        {
                            plugin.Status = "Stopping...";
                        }
                    }
                }

                OSAEObject obj = OSAEObjectManager.GetObjectByName(pd.Name);
                OSAEObjectManager.ObjectUpdate(obj.Name, obj.Name, obj.Description, obj.Type, obj.Address, obj.Container, 0);
            }
            catch (Exception ex)
            {
                logging.AddToLog("Error disabling plugin: " + ex.Message, true);
            }
        }
コード例 #17
0
        protected override void ProcessRecord()
        {
            logging.AddToLog("Show-OSA - ProcessRecord - Started", false);
            OSAEObject obj = OSAEObjectManager.GetObjectByName(Name);

            WriteObject("Name: " + obj.Name);
            WriteObject("State: " + obj.State.Value);
            WriteObject("Description: " + obj.Description);
            WriteObject("Container: " + obj.Container);
            WriteObject("Address: " + obj.Address);

            if (obj.Enabled == 0)
            {
                WriteObject("Enabled: FALSE");
            }
            else
            {
                WriteObject("Enabled: TRUE");
            }

            WriteObject("Base Type: " + obj.BaseType);
            WriteObject("Type: " + obj.Type);

            foreach (OSAEMethod method in obj.Methods)
            {
                WriteObject("Method: " + method.MethodName);
            }

            foreach (OSAEObjectProperty prop in obj.Properties)
            {
                WriteObject("Property (" + prop.DataType + "): " + prop.Name + " Value = " + prop.Value);
            }

            WriteObject("Updated: " + obj.LastUpd);
        }
コード例 #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Username"] == null)
        {
            Response.Redirect("~/Default.aspx");
        }
        int objSet = OSAEAdminManager.GetAdminSettingsByName("Screen Trust");
        int tLevel = Convert.ToInt32(Session["TrustLevel"].ToString());

        if (tLevel < objSet)
        {
            Response.Redirect("~/permissionError.aspx");
        }

        getRestPort();
        hdnUserTrust.Value = Session["TrustLevel"].ToString();
        debuglabel.Text    = Session["TrustLevel"].ToString();
        gScreen            = Request.QueryString["id"];
        try
        {
            OSAEObject screen = OSAEObjectManager.GetObjectByName(gScreen);
            //List<OSAEScreenControl> controls = OSAEScreenControlManager.GetScreenControls(gScreen);
            OSAEObjectCollection screenObjects = OSAEObjectManager.GetObjectsByContainer(gScreen);
            string    sImg = OSAEObjectPropertyManager.GetObjectPropertyValue(gScreen, "Background Image").Value.ToString();
            OSAEImage img  = imgMgr.GetImage(sImg);
            imgBackground.ImageUrl = "~/ImageHandler.ashx?id=" + img.ID;
            foreach (OSAEObject obj in screenObjects)
            {
                LoadControl(obj);
            }
        }
        catch
        { return; }
    }
コード例 #19
0
        public void sendtext(OSAEMethod method)
        {
            bool reg = checkStatus(method);

            if (reg == true)
            {
                try
                {
                    objName                  = method.ObjectName;
                    sonyobj                  = OSAEObjectManager.GetObjectByName(objName);
                    mySonyDevice.Name        = sonyobj.Name;
                    mySonyDevice.DocumentUrl = sonyobj.Property("DocumentURL").Value;
                    mySonyDevice.ServerName  = "OSAE.Sony";
                    mySonyDevice.BuildFromDocument(new Uri(mySonyDevice.DocumentUrl));
                    mySonyDevice.SendText(method.Parameter1);
                }
                catch (Exception ex)
                {
                    this.Log.Info("An error occurred!!!: " + ex.Message);
                    if (debug)
                    {
                        this.Log.Debug("The Send Text method was unsuccessful.");
                    }
                }
            }
        }
コード例 #20
0
        public OSAEObject GetObject(string name)
        {
            // lookup object
            OSAEObject OSAEobj = OSAEObjectManager.GetObjectByName(name);

            OSAEobj.Properties = getProperties(OSAEobj.Name);
            return(OSAEobj);
        }
コード例 #21
0
        public override void RunInterface(string pluginName)
        {
            this.Log.Info("Found Plugin Object: " + pluginName);
            this.Log.Info(pluginName + " is starting...");
            OSAEObject plugin = OSAEObjectManager.GetObjectByName(pluginName);
            string     refsh  = plugin.Property("Refresh").Value;

            debug = Convert.ToBoolean(plugin.Property("Debug").Value);

            // Set API Logging
            mySonyLib.Log.Enable = true;

            // If Plugin Debug is TRUE:
            if (debug)
            {
                // then Log ALL Lines!
                mySonyLib.Log.Level = "All";
            }
            else
            {
                // else only Log BASIC Lines!
                mySonyLib.Log.Level = "Basic";
            }
            // Sets Logging to OSA Plugins folder
            mySonyLib.Log.Path = OSAE.Common.ApiPath + @"\Plugins\Sony\";
            mySonyLib.Log.Name = "SonyPlugin_LOG.txt";

            //Start a new file every time service is restarted
            // Old file is renamed with Time/Date Stamp.
            string saveLogDate = DateTime.Now.ToShortDateString();

            saveLogDate = saveLogDate.Replace("/", "_");
            string saveLogTime = DateTime.Now.ToShortTimeString();

            saveLogTime = saveLogTime.Replace(":", "_");
            saveLogTime.Replace(" ", "");
            string saveLog = saveLogDate + "_" + saveLogTime + "_SonyPlugin_OLD.txt";

            mySonyLib.Log.ClearLog(saveLog);

            // Setup Update Timer
            OnlineUpdateTimer = new System.Timers.Timer();
            refresh           = Convert.ToInt16(refsh);
            if (refresh == 0)
            {
                Onlineupdatetime = Onlineupdatetime * 1;
            }
            else
            {
                Onlineupdatetime = Onlineupdatetime * refresh;
            }
            OnlineUpdateTimer.Interval = Onlineupdatetime;
            OnlineUpdateTimer.Start();
            OnlineUpdateTimer.Elapsed += new ElapsedEventHandler(OnlineUpdateTime);
            this.updateOnlineThread    = new Thread(new ThreadStart(updateonline));
            this.updateOnlineThread.Start();
            Thread.Sleep(5000);
        }
コード例 #22
0
        protected override void ProcessRecord()
        {
            this.Log.Debug("Set-OSA - ProcessRecord - Started");
            OSAEObject obj = OSAEObjectManager.GetObjectByName(Name);

            OSAEObjectPropertyManager.ObjectPropertySet(Name, Property, Value, source);

            WriteObject(true);
        }
コード例 #23
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(cboObject.Text))
            {
                MessageBox.Show("You must choose an associated object!");
                validate = false;
            }
            if (string.IsNullOrEmpty(cboState1.Text))
            {
                MessageBox.Show("You must set the State 1 property!");
                validate = false;
            }

            if (string.IsNullOrEmpty(txtState1X.Text))
            {
                MessageBox.Show("State 1 X Can not be empty");
                validate = false;
            }
            if (string.IsNullOrEmpty(txtState1Y.Text))
            {
                MessageBox.Show("State 1 Y Can not be empty");
                validate = false;
            }
            if (string.IsNullOrEmpty(txtState2X.Text))
            {
                MessageBox.Show("State 2 X Can not be empty");
                validate = false;
            }
            if (string.IsNullOrEmpty(txtState2Y.Text))
            {
                MessageBox.Show("State 2 Y Can not be empty");
                validate = false;
            }
            if (string.IsNullOrEmpty(txtZOrder.Text))
            {
                MessageBox.Show("ZOrder can not be empty");
                validate = false;
            }
            return(validate);
        }
コード例 #24
0
        public OSAEObject GetObject(string name)
        {
            // lookup object
            OSAEObject OSAEobj = OSAEObjectManager.GetObjectByName(name);

            OSAEobj.Properties = getProperties(OSAEobj.Name);
            Log.Debug("Retrieving object:  " + name + ".");
            return(OSAEobj);
        }
コード例 #25
0
        private bool ValidateForm(string mthd)
        {
            bool validate = true;

            // Does this object already exist
            if (mthd == "Add" || sOriginalName != cntrlName.Text)
            {
                try
                {
                    OSAEObject oExist = OSAEObjectManager.GetObjectByName(cntrlName.Text);
                    if (oExist != null)
                    {
                        MessageBox.Show("Control name already exist. Please Change!");
                        validate = false;
                    }
                }
                catch { }
            }
            if (string.IsNullOrEmpty(cntrlName.Text))
            {
                MessageBox.Show("Please specify a name for the control");
                validate = false;
            }
            if (objectsComboBox.SelectedIndex == -1)
            {
                MessageBox.Show("Please Choose a Object to Associate");
                validate = false;
            }
            if (string.IsNullOrEmpty(cntrlX.Text))
            {
                MessageBox.Show("X Can not be empty");
                validate = false;
            }
            if (string.IsNullOrEmpty(cntrlY.Text))
            {
                MessageBox.Show("Y Can not be empty");
                validate = false;
            }
            if (string.IsNullOrEmpty(cntrlZOrder.Text))
            {
                MessageBox.Show("ZOrder can not be empty");
                validate = false;
            }
            if (hasParams == true)
            {
                foreach (objParams op in oParams)
                {
                    if (string.IsNullOrEmpty(op.Value))
                    {
                        MessageBox.Show("An additioanl Parameter is empty");
                        validate = false;
                    }
                }
            }

            return(validate);
        }
コード例 #26
0
        protected override void ProcessRecord()
        {
            logging.AddToLog("Set-OSA - ProcessRecord - Started", false);
            OSAEObject obj = OSAEObjectManager.GetObjectByName(Name);

            OSAEObjectPropertyManager.ObjectPropertySet(Name, Property, Value, source);

            WriteObject(true);
        }
コード例 #27
0
        public override void ProcessCommand(OSAEMethod method)
        {
            String object_name = method.ObjectName;
            String method_name = method.MethodName;
            String parameter_1 = method.Parameter1;
            String parameter_2 = method.Parameter2;

            log("Found Command: " + method_name + " | param1: " + parameter_1 + " | param2: " + parameter_2, true);

            if (object_name == pName)
            {
                switch (method_name)
                {
                case "NOTIFYALL":
                    log("NOTIFYALL event triggered", false);

                    log("NOTIFYALL devices to loop:" + mdevices.Count, false);

                    foreach (AndroidDevice d in mdevices)
                    {
                        log("NOTIFYALL loop for device:" + d.Name, false);
                        d.ProcessCommand("NOTIFY", parameter_1, parameter_2);
                    }

                    break;

                case "EXECUTEALL":
                    log("EXECUTEALL event triggered", false);

                    log("EXECUTEALL devices to loop:" + mdevices.Count, false);

                    foreach (AndroidDevice d in mdevices)
                    {
                        log("EXECUTEALL loop for device:" + d.Name, false);
                        d.ProcessCommand("EXECUTE", parameter_1, parameter_2);
                    }

                    break;
                }
            }
            else
            {
                AndroidDevice d = getAndroidDevice(object_name);

                if (d == null)
                {
                    OSAEObject obj = OSAEObjectManager.GetObjectByName(object_name);
                    createdevice(obj);
                    d = getAndroidDevice(object_name);
                }

                if (d != null)
                {
                    d.ProcessCommand(method_name, parameter_1, parameter_2);
                }
            }
        }
コード例 #28
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 Control Name!");
                validate = false;
            }
            if (string.IsNullOrEmpty(txtNormalX.Text))
            {
                MessageBox.Show("X Can not be empty");
                validate = false;
            }
            if (string.IsNullOrEmpty(txtNormalY.Text))
            {
                MessageBox.Show("Y Can not be empty");
                validate = false;
            }
            if (string.IsNullOrEmpty(txtZOrder.Text))
            {
                MessageBox.Show("ZOrder can not be empty");
                validate = false;
            }
            if (string.IsNullOrEmpty(cboPressObject.Text) && string.IsNullOrEmpty(cboReleaseObject.Text) && string.IsNullOrEmpty(cboPressScript.Text) && string.IsNullOrEmpty(cboReleaseScript.Text))
            {
                MessageBox.Show("You must set an Object or Script");
                validate = false;
            }
            if (!string.IsNullOrEmpty(cboPressObject.Text) && string.IsNullOrEmpty(cboPressMethod.Text))
            {
                MessageBox.Show("You must set the Mouse Down Method!");
                validate = false;
            }
            if (!string.IsNullOrEmpty(cboReleaseObject.Text) && string.IsNullOrEmpty(cboReleaseMethod.Text))
            {
                MessageBox.Show("You must set the Mouse Release Method!");
                validate = false;
            }
            return(validate);
        }
コード例 #29
0
        private void PluginMessageReceived(PacketHeader header, Connection connection, string message)
        {
            Log.Info("<- Plugin Message: " + message);
            string[] arguments = message.Split('|');

            foreach (Plugin p in plugins)
            {
                if (p.PluginName == arguments[0].Trim())
                {
                    Log.Info("Found Plugin: " + arguments[0].Trim() + " on " + serviceObject);
                    OSAEObject obj = OSAEObjectManager.GetObjectByName(p.PluginName);
                    if (obj != null)
                    {
                        Log.Info("Found Plugin Object for: " + arguments[0].Trim() + " on " + serviceObject);
                        bool isSystemPlugin = false;
                        foreach (OSAEObjectProperty p2 in obj.Properties)
                        {
                            if (p2.Name == "System Plugin")
                            {
                                if (p2.Value == "TRUE")
                                {
                                    isSystemPlugin = true;
                                }
                                break;
                            }
                        }
                        Log.Info("Plugin " + arguments[0].Trim() + " SystemPlugin = " + isSystemPlugin);
                        if (arguments[1].Trim() == "ON" && !isSystemPlugin)
                        {
                            //We are only stoppeng and starting, leave enabled alone
                            //OSAEObjectManager.ObjectUpdate(p.PluginName, p.PluginName, obj.Alias, obj.Description, obj.Type, obj.Address, obj.Container, obj.MinTrustLevel, true);
                            try
                            {
                                startPlugin(p);
                                Log.Debug("Started plugin: " + p.PluginName);
                            }
                            catch (Exception ex)
                            { Log.Error("Error Starting plugin (" + p.PluginName + ")", ex); }
                        }
                        else if (arguments[1].Trim() == "OFF" && !isSystemPlugin)
                        {
                            //OSAEObjectManager.ObjectUpdate(p.PluginName, p.PluginName, obj.Alias, obj.Description, obj.Type, obj.Address, obj.Container, obj.MinTrustLevel, false);
                            try
                            {
                                stopPlugin(p);
                                Log.Debug("Stopped plugin: " + p.PluginName);
                            }
                            catch (Exception ex)
                            { Log.Error("Error stopping plugin (" + p.PluginName + ")", ex); }
                        }
                    }
                }
            }
        }
コード例 #30
0
 private void btnUpdate_Click(object sender, RoutedEventArgs e)
 {
     if (validateForm("Update"))
     {
         string          tempName = txtScreenName.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, tempName, obj.Alias, obj.Description, obj.Type, obj.Address, obj.Container, obj.MinTrustLevel, obj.Enabled);
         OSAEObjectPropertyManager.ObjectPropertySet(tempName, "Background Image", img.Name, currentUser);
         NotifyParentFinished();
     }
 }