当前位置: 首页>>代码示例>>C#>>正文


C# OSAEMethod类代码示例

本文整理汇总了C#中OSAEMethod的典型用法代码示例。如果您正苦于以下问题:C# OSAEMethod类的具体用法?C# OSAEMethod怎么用?C# OSAEMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OSAEMethod类属于命名空间,在下文中一共展示了OSAEMethod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessCommand

        public void ProcessCommand(OSAEMethod method)
        {
            osae.AddToLog("Received command: " + method.MethodName, false);
            if (method.MethodName == "TWEET")
            {
                SendTweet(osae.PatternParse(method.Parameter1));
            }
            else if (method.MethodName == "AUTHENTICATE")
            {
                string pin = osae.GetObjectPropertyValue(_pname, "Pin").Value;

                if (pin != "")
                {
                    osae.AddToLog("Found pin: " + pin + ". Attempting to authorize", true);
                    try
                    {
                        // Now that the application's been authenticated, let's get the (permanent)
                        // token and secret token that we'll use to authenticate from now on.
                        _oAuth.AccessTokenGet(_oAuth.OAuthToken, pin.Trim());
                        osae.ObjectPropertySet(_pname, "Token", _oAuth.Token);
                        osae.ObjectPropertySet(_pname, "Token Secret", _oAuth.TokenSecret);
                        osae.ObjectPropertySet(_pname, "Auth Token", _oAuth.OAuthToken);
                        osae.AddToLog("Success! You're ready to start tweeting!", true);
                    }
                    catch (Exception ex)
                    {
                        osae.AddToLog("An error occurred during authorization:\n\n" + ex.Message, true);
                    }
                }
                else
                {
                    osae.AddToLog("No pin found.  Please enter the pin from twitter into the Twitter object property.", true);
                }
            }
        }
开发者ID:nacker90,项目名称:Open-Source-Automation,代码行数:35,代码来源:Twitter.cs

示例2: ProcessCommand

        public override void ProcessCommand(OSAEMethod method)
        {
            Log.Debug("Received command: " + method.MethodName);
            if (method.MethodName == "TWEET")
                SendTweet(Common.PatternParse(method.Parameter1));
            else if (method.MethodName == "AUTHENTICATE")
            {
                string pin = OSAEObjectPropertyManager.GetObjectPropertyValue(pName, "Pin").Value;

                if (pin != "")
                {
                    Log.Info("Found pin: " + pin + ". Attempting to authorize");
                    try
                    {
                        // Now that the application's been authenticated, let's get the (permanent)
                        // token and secret token that we'll use to authenticate from now on.
                        _oAuth.AccessTokenGet(_oAuth.OAuthToken, pin.Trim());
                        OSAEObjectPropertyManager.ObjectPropertySet(pName, "Token", _oAuth.Token, pName);
                        OSAEObjectPropertyManager.ObjectPropertySet(pName, "Token Secret", _oAuth.TokenSecret, pName);
                        OSAEObjectPropertyManager.ObjectPropertySet(pName, "Auth Token", _oAuth.OAuthToken, pName);
                        this.Log.Info("Success! You're ready to start tweeting!");
                    }
                    catch (Exception ex)
                    { Log.Error("An error occurred during authorization", ex); }
                }
                else
                    Log.Info("No pin found.  Please enter the pin from twitter into the Twitter object property.");
            }
        }
开发者ID:opensourceautomation,项目名称:Open-Source-Automation,代码行数:29,代码来源:Twitter.cs

示例3: ProcessCommand

        //private System.Timers.Timer Clock;




        public override void ProcessCommand(OSAEMethod method)
        {
            //System.Data.DataRow row = table.Rows[0];
            //logging.AddToLog("Found Command: " + row["method_name"].ToString() + " | param1: " + row["parameter_1"].ToString() + " | param2: " + row["parameter_1"].ToString(), false);

            //XBMCSystem s = getXBMCSystem(row["object_name"].ToString());
            //if (s != null)
            //{
            //    switch (row["method_name"].ToString())
            //    {
            //        case "VPLAYPAUSE":
            //            s.Connection.Player.PlayPause();
            //            break;
            //        case "VSTOP":
            //            s.Connection.Player.Stop();
            //            break;
            //        case "VBIGSKIPFORWARD":
            //            s.Connection.Player.BigSkipForward();
            //            break;
            //        case "VBIGSKIPBACK":
            //            s.Connection.Player.BigSkipBackward();
            //            break;
            //    }
            //}

        }
开发者ID:jesszgc,项目名称:Open-Source-Automation,代码行数:31,代码来源:XBMC.cs

示例4: ProcessCommand

        public override void ProcessCommand(OSAEMethod method)
        {
            logging.AddToLog("Process command: " + method.MethodName, false);

            switch (method.MethodName)
            {
                case "SET TEMPORARY COOL":
                    ThermostatLib.ThermostatInfo.SetTemporaryCool(method.Address, Double.Parse(method.Parameter1));
                    break;

                case "SET TEMPORARY HEAT":
                    ThermostatLib.ThermostatInfo.SetTemporaryHeat(method.Address, Double.Parse(method.Parameter1));
                    break;

                case "SET HOLD":
                    ThermostatLib.ThermostatInfo.SetHold(method.Address, true);
                    break;

                case "REMOVE HOLD":
                    ThermostatLib.ThermostatInfo.SetHold(method.Address, false);
                    break;

                case "REBOOT":
                    ThermostatLib.SystemInfo.Reboot(method.Address);
                    break;

                case "SET LED":
                    ThermostatLib.SystemInfo.SetLED(method.Address, method.Parameter1);
                    break;
            }
        }
开发者ID:just8,项目名称:Open-Source-Automation,代码行数:31,代码来源:RadioThermostat.cs

示例5: ProcessCommand

        /// <summary>
        /// A Command to be processed bu the plugin
        /// </summary>
        /// <param name="method"></param>
        public override void ProcessCommand(OSAEMethod method)
        {
            try
            {
                string script = "";

                int scriptId;
                if (int.TryParse(method.Parameter1, out scriptId))
                {
                    script = OSAEScriptManager.GetScript(method.Parameter1);
                }
                else
                {
                    script = OSAEScriptManager.GetScriptByName(method.Parameter1);
                }

                logging.AddToLog("running script: " + script, false);

                if(!string.IsNullOrEmpty(script))
                {
                    RunScript(script, method);
                }
            }
            catch (Exception exc)
            {
                logging.AddToLog("Error Processing Command: " + exc.Message, true);
            }
        }
开发者ID:jesszgc,项目名称:Open-Source-Automation,代码行数:32,代码来源:PowerShellPlugin.cs

示例6: ProcessCommand

        /// <summary>
        /// A Command to be processed bu the plugin
        /// </summary>
        /// <param name="method"></param>
        public override void ProcessCommand(OSAEMethod method)
        {
            try
            {
                string script = "";

                int scriptId;
                if (int.TryParse(method.Parameter1, out scriptId))
                {
                    script = OSAEScriptManager.GetScript(method.Parameter1);
                }
                else
                {
                    script = OSAEScriptManager.GetScriptByName(method.Parameter1);
                }

                this.Log.Debug("running script: " + script);

                if(!string.IsNullOrEmpty(script))
                {
                    RunScript(script, method);
                }
            }
            catch (Exception exc)
            {
                this.Log.Error("Error Processing Command ", exc);
            }
        }
开发者ID:rajeshwarn,项目名称:Open-Source-Automation,代码行数:32,代码来源:PowerShellPlugin.cs

示例7: ProcessCommand

        public override void ProcessCommand(OSAEMethod method)
        {
            this.Log.Debug("Found Command: " + method.MethodName + " | param1: " + method.Parameter1 + " | param2: " + method.Parameter2);

            XBMCSystem s = getXBMCSystem(method.ObjectName);
            if (s != null)
            {
                switch (method.MethodName)
                {
                    case "VPLAYPAUSE":
                        s.xbmcSystem.Player.PlayPause();
                        break;
                    case "VSTOP":
                        s.xbmcSystem.Player.Stop();
                        break;
                    case "VBIGSKIPFORWARD":
                        s.xbmcSystem.Player.Seek2(0,Player.Seekvalue.bigforward);
                        break;
                    case "VBIGSKIPBACK":
                        s.xbmcSystem.Player.Seek2(0, Player.Seekvalue.bigbackward);
                        break;
                }
            }

        }
开发者ID:matthewste,项目名称:Open-Source-Automation,代码行数:25,代码来源:XBMC.cs

示例8: ProcessCommand

        public override void ProcessCommand(OSAEMethod method)
        {
            // COSMUPDATER.Run Method.RELOADITEMS

            switch (method.MethodName.ToUpper())
            {
                case "OFF":
                    logging.AddToLog("COSMUpdater Stopped", true);
                    enabled = false;
                    break;
                case "ON":
                    logging.AddToLog("COSMUpdater Started", true);
                    enabled = true;
                    break;
                case "WRITEDATA":
                    logging.AddToLog("COSMUpdater DataWrite Forced", true);
                    WriteData();
                    break;
                case "RELOADITEMS":
                    logging.AddToLog("COSMUpdater ReloadItems", true);
                    GetCurrentList();
                    break;
                default:
                    logging.AddToLog(string.Format("COSMUpdater got method of {0} but it is not implemented", method.MethodName), true);
                    break;
            }
        }
开发者ID:just8,项目名称:Open-Source-Automation,代码行数:27,代码来源:COSMUpdater.cs

示例9: ProcessCommand

        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);
            }
        }
开发者ID:opensourceautomation,项目名称:Open-Source-Automation,代码行数:59,代码来源:Android.cs

示例10: LogMethodInformation

 /// <summary>
 /// Logs information about a method found in the Queue
 /// </summary>
 /// <param name="method">The method to log</param>
 private void LogMethodInformation(OSAEMethod method)
 {
     this.Log.Debug("Found method in queue: " + method.MethodName);
     this.Log.Debug("-- object name: " + method.ObjectName);
     this.Log.Debug("-- param 1: " + method.Parameter1);
     this.Log.Debug("-- param 2: " + method.Parameter2);
     this.Log.Debug("-- object owner: " + method.Owner);
 }
开发者ID:joejoewill,项目名称:Open-Source-Automation,代码行数:12,代码来源:OSAEService.HelperCode.cs

示例11: LogMethodInformation

 /// <summary>
 /// Logs information about a method found in the Queue
 /// </summary>
 /// <param name="method">The method to log</param>
 private void LogMethodInformation(OSAEMethod method)
 {
     logging.AddToLog("Found method in queue: " + method.MethodName, false);
     logging.AddToLog("-- object name: " + method.ObjectName, false);
     logging.AddToLog("-- param 1: " + method.Parameter1, false);
     logging.AddToLog("-- param 2: " + method.Parameter2, false);
     logging.AddToLog("-- object owner: " + method.Owner, false);
 }
开发者ID:jberry,项目名称:Open-Source-Automation,代码行数:12,代码来源:OSAEService.HelperCode.cs

示例12: ProcessCommand

        public override void ProcessCommand(OSAEMethod method)
        {
            //Process incomming command
            Log.Debug("Process command: " + method.MethodName);
            Log.Debug("Process parameter1: " + method.Parameter1);
            Log.Debug("Process parameter2: " + method.Parameter2);
            Log.Debug("Address: " + method.Address);

            switch (method.MethodName)
            {
                case "PLAY":
                    if (method.Parameter1.Trim() == string.Empty)
                        sbs.Play(method.Address);
                    else
                        sbs.PlaylistPlay(method.Address, method.Parameter1);
                    OSAEObjectStateManager.ObjectStateSet(OSAEObjectManager.GetObjectByAddress(method.Address).Name, "PLAYING", pName);
                    break;
                case "STOP":
                    sbs.StopPlayer(method.Address);
                    OSAEObjectStateManager.ObjectStateSet(OSAEObjectManager.GetObjectByAddress(method.Address).Name, "STOPPED", pName);
                    break;
                case "NEXT":
                    sbs.Next(method.Address);
                    break;
                case "PREV":
                    sbs.Previous(method.Address);
                    break;
                case "SHOW":
                    sbs.ShowMessage(method.Address, method.Parameter1, Int32.Parse(method.Parameter2));
                    break;
                case "PAUSE":
                    sbs.PausePlayer(method.Address);
                    OSAEObjectStateManager.ObjectStateSet(OSAEObjectManager.GetObjectByAddress(method.Address).Name, "PAUSED", pName);
                    break;
                case "TTS":
                    TextToSpeech(method.Parameter1);
                    sbs.PlaylistPlay(method.Address, ttsPlay);
                    break;
                case "TTSLIST":
                    DataSet list = OSAEObjectPropertyManager.ObjectPropertyArrayGetAll(method.Parameter1, method.Parameter2);
                    string tts = "";
                    int count = 1;
                    foreach(DataRow item in list.Tables[0].Rows)
                    {
                        tts += "  RSS item number " + count.ToString() + ".  " + item["item_name"].ToString();
                        count++;
                    }
                    TextToSpeech(tts);
                    sbs.PlaylistPlay(method.Address, ttsPlay);
                    break;
                case "TTSLISTRAND":
                    string listItem = OSAEObjectPropertyManager.ObjectPropertyArrayGetRandom(method.Parameter1, method.Parameter2);
                    TextToSpeech(listItem);
                    sbs.PlaylistPlay(method.Address, ttsPlay);
                    break;
            }
        }
开发者ID:opensourceautomation,项目名称:Open-Source-Automation,代码行数:57,代码来源:Class1.cs

示例13: ProcessCommand

        /// <summary>
        /// A Command to be processed bu the plugin
        /// </summary>
        /// <param name="method"></param>
        public override void ProcessCommand(OSAEMethod method)
        {
            try
            {
                string script = OSAEScriptManager.GetScript(method.Parameter1);

                logging.AddToLog("running script: " + script, false);

                RunScript(script, method);
            }
            catch (Exception exc)
            {
                logging.AddToLog("Error Processing Command: " + exc.Message, true);
            }
        }
开发者ID:JohnneyBoy,项目名称:Open-Source-Automation,代码行数:19,代码来源:PowerShellPlugin.cs

示例14: ProcessCommand

        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;

                }
            }
            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);
                }

            }
        }
开发者ID:jesszgc,项目名称:Open-Source-Automation,代码行数:48,代码来源:Android.cs

示例15: ProcessCommand

        public override void ProcessCommand(OSAEMethod method)
        {
            string sMethod = method.MethodName;
            string sParam1 = method.Parameter1;
            string sParam2 = method.Parameter2;

            if (gDebug) Log.Debug("Received Command to: " + sMethod + " (" + sParam1 + ", " + sParam2 + ")");

            if (sMethod == "SENDMESSAGE")
            {
                string sText = Common.PatternParse(sParam1);
                OSAEObjectPropertyManager.ObjectPropertySet(gAppName, "Speaking", "TRUE", gAppName);
                Thread.Sleep(500);
                OSAEObjectPropertyManager.ObjectPropertySet(gAppName, "Speaking", "FALSE", gAppName);
            }
        }
开发者ID:opensourceautomation,项目名称:Open-Source-Automation,代码行数:16,代码来源:OSAPubNub.cs


注:本文中的OSAEMethod类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。