Esempio n. 1
0
        /// <summary>
        /// Stop a playing pattern
        /// </summary>
        /// <param name="pname"></param>
        /// <returns></returns>
        public Boolean stopPattern(string pname)
        {
            if (pname == null)
            {
                return(false);
            }
            Blink1Pattern patt = null;

            if (patterns.TryGetValue(pname, out patt))
            {
                patt.stop();
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        //    /blink1/pattern/stop -- Stop a pattern playback for a given pattern
        static string Ublink1PatternStop(HttpRequest request, Blink1Server blink1Server)
        {
            string pname     = request.Query.Get("pname");
            string statusstr = "no pattern by that name";

            if (pname != null)
            {
                Blink1Pattern patt = null;
                if (blink1Server.patterns.TryGetValue(pname, out patt))
                {
                    patt.stop();
                    statusstr = "pattern '" + pname + "' stopped";
                }
            }
            Dictionary <string, object> result = new Dictionary <string, object>();

            result.Add("status", statusstr);
            return(JsonConvert.SerializeObject(result, Formatting.Indented, jsonSerializerSettings));
        }
Esempio n. 3
0
        //    /blink1/pattern/del -- Remove color pattern from color pattern list
        static string Ublink1PatternDel(HttpRequest request, Blink1Server blink1Server)
        {
            string        pname     = request.Query.Get("pname");
            string        statusstr = "no pattern by that name";
            Blink1Pattern patt      = null;

            if (pname != null)
            {
                patt = blink1Server.patterns[pname];
                patt.stop();
                blink1Server.patterns.Remove(pname);
                statusstr = "pattern '" + pname + "' removed";
            }
            blink1Server.saveSettings();

            Dictionary <string, object> result = new Dictionary <string, object>();

            result.Add("status", statusstr);
            return(JsonConvert.SerializeObject(result, Formatting.Indented, jsonSerializerSettings));
        }