예제 #1
0
        void IStateManager.LoadViewState(object savedState)
        {
            Pair pair = savedState as Pair;

            if (pair == null)
            {
                return;
            }

            bool newCollection = (bool)pair.First;

            object [] itemsArray = (object [])pair.Second;
            int       count      = itemsArray == null ? 0 : itemsArray.Length;

            if (newCollection)
            {
                if (count > 0)
                {
                    items = new ArrayList(count);
                }
                else
                {
                    items = new ArrayList();
                }
            }

            for (int i = 0; i < count; i++)
            {
                ListItem item = new ListItem();

                if (newCollection)
                {
                    item.LoadViewState(itemsArray [i]);
                    item.SetDirty();
                    Add(item);
                }
                else
                {
                    if (itemsArray [i] != null)
                    {
                        item.LoadViewState(itemsArray [i]);
                        item.SetDirty();
                        items [i] = item;
                    }
                }
            }
        }
        internal void LoadViewState(object state)
        {
            if (state != null)
            {
                if (state is Pair)
                {
                    // only changed items were saved
                    Pair      p       = (Pair)state;
                    ArrayList indices = (ArrayList)p.First;
                    ArrayList items   = (ArrayList)p.Second;

                    for (int i = 0; i < indices.Count; i++)
                    {
                        int index = (int)indices[i];

                        if (index < Count)
                        {
                            this[index].LoadViewState(items[i]);
                        }
                        else
                        {
                            ListItem li = new ListItem();
                            li.LoadViewState(items[i]);
                            Add(li);
                        }
                    }
                }
                else
                {
                    // all items were saved
                    Triplet t = (Triplet)state;

                    listItems = new ArrayList();
                    saveAll   = true;

                    string[] texts   = (string[])t.First;
                    string[] values  = (string[])t.Second;
                    bool[]   enabled = (bool[])t.Third;

                    for (int i = 0; i < texts.Length; i++)
                    {
                        Add(new ListItem(texts[i], values[i], enabled[i]));
                    }
                }
            }
        }
 internal void LoadViewState(object state)
 {
     if (state != null)
     {
         if (state is Pair)
         {
             Pair      pair   = (Pair)state;
             ArrayList first  = (ArrayList)pair.First;
             ArrayList second = (ArrayList)pair.Second;
             for (int i = 0; i < first.Count; i++)
             {
                 int num2 = (int)first[i];
                 if (num2 < this.Count)
                 {
                     this[num2].LoadViewState(second[i]);
                 }
                 else
                 {
                     ListItem item = new ListItem();
                     item.LoadViewState(second[i]);
                     this.Add(item);
                 }
             }
         }
         else
         {
             Triplet triplet = (Triplet)state;
             this.listItems = new ArrayList();
             this.saveAll   = true;
             string[] strArray  = (string[])triplet.First;
             string[] strArray2 = (string[])triplet.Second;
             bool[]   third     = (bool[])triplet.Third;
             for (int j = 0; j < strArray.Length; j++)
             {
                 this.Add(new ListItem(strArray[j], strArray2[j], third[j]));
             }
         }
     }
 }
예제 #4
0
		void IStateManager.LoadViewState (object savedState)
		{
			Pair pair = savedState as Pair;
			if (pair == null)
				return;

			bool newCollection = (bool) pair.First;
			object [] itemsArray = (object []) pair.Second;
			int count = itemsArray==null ? 0 : itemsArray.Length;

			if (newCollection)
				if (count > 0)
					items = new ArrayList(count);
				else
					items = new ArrayList();

			for (int i = 0; i < count; i++) {
				ListItem item = new ListItem ();
				
				if (newCollection) {
					item.LoadViewState (itemsArray [i]);
					item.SetDirty ();
					Add (item);
				}
				else{
					if (itemsArray [i] != null){
						item.LoadViewState (itemsArray [i]);
						item.SetDirty ();
						items [i] = item;
					}
				}
			}
		}
        internal void LoadViewState(object state) {
            if (state != null) {
                if (state is Pair) {
                    // only changed items were saved
                    Pair p = (Pair) state;
                    ArrayList indices = (ArrayList) p.First;
                    ArrayList items = (ArrayList) p.Second;

                    for (int i=0; i<indices.Count; i++) {
                        int index = (int) indices[i];

                        if (index < Count)
                            this[index].LoadViewState(items[i]);
                        else {
                            ListItem li = new ListItem();
                            li.LoadViewState(items[i]);
                            Add(li);
                        }
                    }
                }
                else {
                    // all items were saved
                    Triplet t = (Triplet) state;

                    listItems = new ArrayList();
                    saveAll = true;

                    string[] texts  = (string[]) t.First;
                    string[] values = (string[]) t.Second;
                    bool[] enabled  = (bool[]) t.Third;

                    for (int i=0; i < texts.Length; i++) {
                        Add(new ListItem(texts[i], values[i], enabled[i]));
                    }
                }
            }
        }
 internal void LoadViewState(object state)
 {
     if (state != null)
     {
         if (state is Pair)
         {
             Pair pair = (Pair) state;
             ArrayList first = (ArrayList) pair.First;
             ArrayList second = (ArrayList) pair.Second;
             for (int i = 0; i < first.Count; i++)
             {
                 int num2 = (int) first[i];
                 if (num2 < this.Count)
                 {
                     this[num2].LoadViewState(second[i]);
                 }
                 else
                 {
                     ListItem item = new ListItem();
                     item.LoadViewState(second[i]);
                     this.Add(item);
                 }
             }
         }
         else
         {
             Triplet triplet = (Triplet) state;
             this.listItems = new ArrayList();
             this.saveAll = true;
             string[] strArray = (string[]) triplet.First;
             string[] strArray2 = (string[]) triplet.Second;
             bool[] third = (bool[]) triplet.Third;
             for (int j = 0; j < strArray.Length; j++)
             {
                 this.Add(new ListItem(strArray[j], strArray2[j], third[j]));
             }
         }
     }
 }
		internal void LoadViewState (object savedState)
		{
			if (savedState == null)
				return;

			int i, end;
			if (savedState is Pair) {
				Pair pair = (Pair) savedState;
				ArrayList indices = (ArrayList) pair.First;
				ArrayList states  = (ArrayList) pair.Second;

				end = indices.Count;
				for (i = 0; i < end; i++) {
					if ((int) indices [i] < Count ) {
						this [(int) indices [i]].LoadViewState (states [i]);
					} else {
						ListItem temp = new ListItem ();
						temp.LoadViewState (states [i]);
						Add (temp);
					}
				}
			} else if (savedState is Triplet) {
				Triplet t = (Triplet) savedState;
				items = new ArrayList ((int) t.First);
				saveAll = true;
				object [] text = (object []) t.Second;
				object [] vals = (object []) t.Third;
				end = text.Length;
				for(i = 0; i < end; i++)
					items.Add (new ListItem (text[i].ToString (), vals[i].ToString ()));
			}
		}