Ejemplo n.º 1
0
 //- @Set -//
 /// <summary>
 /// Set a value in state.
 /// </summary>
 /// <param name="entryType">Type of entry (either a control or value).</param>
 /// <param name="key">State key to the data.</param>
 /// <param name="data">Value of the entry.</param>
 public static void Set(StateEntryType entryType, String key, String data)
 {
     if (String.IsNullOrEmpty(key))
     {
         return;
     }
     if (entryType == StateEntryType.ControlId)
     {
         lock (_lock)
         {
             if (ControlData.ContainsKey(key))
             {
                 ControlData[key] = data;
             }
             else
             {
                 ControlData.Add(key, data);
             }
         }
     }
     else if (entryType == StateEntryType.Value)
     {
         lock (_lock)
         {
             if (ValueData.ContainsKey(key))
             {
                 ValueData[key] = data;
             }
             else
             {
                 ValueData.Add(key, data);
             }
         }
     }
 }
Ejemplo n.º 2
0
 //- @Get -//
 /// <summary>
 /// Gets a value from state.
 /// </summary>
 /// <param name="entryType">Type of entry (either a control or value).</param>
 /// <param name="key">State key to the data.</param>
 /// <returns>Value of the entry.</returns>
 public static String Get(StateEntryType entryType, String key)
 {
     if (String.IsNullOrEmpty(key))
     {
         return String.Empty;
     }
     if (entryType == StateEntryType.ControlId)
     {
         lock (_lock)
         {
             if (ControlData.ContainsKey(key))
             {
                 return ControlData[key];
             }
         }
     }
     else if (entryType == StateEntryType.Value)
     {
         lock (_lock)
         {
             if (ValueData.ContainsKey(key))
             {
                 return ValueData[key];
             }
         }
     }
     //+
     return String.Empty;
 }