Пример #1
0
        public bool addTag(Tag tag)
        {
            if (tags.ContainsKey(tag.id))
            {
                return(false);
            }

            lock (tags)
            {
                tags.Add(tag.id, tag);
            }

            //Thread thread = new Thread(new ParameterizedThreadStart(TagProcessing.Read));
            Thread thread = new Thread(() => TagProcessing.Read(tag));

            lock (threads)
            {
                threads.Add(tag.id, thread);
                thread.Start();
            }


            XMLConfig.WriteData();
            return(true);
        }
Пример #2
0
        public bool changeScan(string id)
        {
            if (!tags.ContainsKey(id))
            {
                return(false);
            }

            lock (tags)
            {
                tags[id].on = !tags[id].on;
            }

            XMLConfig.WriteData();
            return(true);
        }
Пример #3
0
        public bool removeTag(string id)
        {
            if (!tags.ContainsKey(id))
            {
                return(false);
            }

            lock (tags)
            {
                tags.Remove(id);
            }

            lock (threads)
            {
                threads[id].Abort();
                threads.Remove(id);
            }

            XMLConfig.WriteData();
            return(true);
        }