Example #1
0
        public void Set(string ID, ThreeState value)
        {
            ID = ThreadedThreeStates.CheckID(ID);

            lock (Lock)
            {
                this.Get(ID);
                States[Data[ID]] = value;
            }
        }
Example #2
0
        public ThreeState Get(string ID, ThreeState value)
        {
            ID = ThreadedThreeStates.CheckID(ID);

            lock (Lock)
            {
                if (!Data.ContainsKey(ID))
                {
                    if (indexer >= _MaxStates)
                    {
                        throw new Exception("ThreadedThreeStates.Get exception, states limit exhausted, maximum of " + _MaxStates + "states");
                    }

                    Data.Add(ID, indexer, true);
                    States[indexer] = value;
                    ++indexer;
                }

                return(States[Data[ID]]);
            }
        }