Example #1
0
        public Window1()  // Instance Constructor
        {
            InitializeComponent();

            IntStorage is1 = new IntStorage(); // Create Targets.
            IntStorage is2 = new IntStorage();

            SetCount(is1, 28);               // Store Values.
            SetCount(is2, 500);

            int i1 = GetCount(is1);          // Retrieve the values.
            int i2 = GetCount(is2);

            txt1.Text = i1.ToString();       // Display the values.
            txt2.Text = i2.ToString();
        }
        public MainWindow()
        {
            InitializeComponent();

            // Create targets programmatically and
            // see how they store/retrieve a value for an attached proprerty
            IntStorage is1 = new IntStorage();
            IntStorage is2 = new IntStorage();
            // Store values
            SetCount(is1, 28);
            SetCount(is2, 500);
            // Retrieve the values
            int i1 = GetCount(is1);
            int i2 = GetCount(is2);
            // Display the values
            txt1.Text = i1.ToString();
            txt2.Text = i2.ToString();
        }
Example #3
0
        public int GetInt(object key, int defaultValue)
        {
            if (items == null)
            {
                return(defaultValue);
            }

            IntStorage value = items[key] as IntStorage;

            if (value == null)
            {
                return(defaultValue);
            }
            else
            {
                return(value.value);
            }
        }
Example #4
0
        public MainWindow()
        {
            InitializeComponent();

            // Create targets programmatically and
            // see how they store/retrieve a value for an attached proprerty
            IntStorage is1 = new IntStorage();
            IntStorage is2 = new IntStorage();

            // Store values
            SetCount(is1, 28);
            SetCount(is2, 500);
            // Retrieve the values
            int i1 = GetCount(is1);
            int i2 = GetCount(is2);

            // Display the values
            txt1.Text = i1.ToString();
            txt2.Text = i2.ToString();
        }
Example #5
0
 public void SetInt(object key, int value, int defaultValue)
 {
     if (value == defaultValue)
     {
         if (items == null)
         {
             return;
         }
         if (items[key] != null)
         {
             items.Remove(key);
         }
     }
     else
     {
         if (items == null)
         {
             items = new Hashtable();
         }
         items[key] = new IntStorage(value);
     }
 }
 public static void SetCount(IntStorage ints, int value)
 {
     ints.SetValue(CountProperty, value);
 }
 public static int GetCount(IntStorage ints)
 {
     return (int) ints.GetValue(CountProperty);
 }
Example #8
0
 public static void SetCount(IntStorage ints, int value)
 {
     ints.SetValue(CountProperty, value);
 }
Example #9
0
 public static int GetCount(IntStorage ints)
 {
     return((int)ints.GetValue(CountProperty));
 }