/* Clear the current legacy component controls*/ public void Clear(FormCleaner i_cleaner) { Type t = this.control.GetType(); /* get the Type of the proxy'ed Control. */ /* Reflaction ! */ if (t.IsInstanceOfType(new PictureBox())) { (this.control as PictureBox).Image = null; } else if (t.IsInstanceOfType(new ListBox())) { (this.control as ListBox).Items.Clear(); } else if (t.IsInstanceOfType(new FlowLayoutPanel())) { this.control.Controls.Clear(); } else if (t.IsInstanceOfType(new TextBox())) { this.control.ResetText(); } else { throw new ArgumentException(); } Loaded = false; }
} /* -Actual Control*/ public ControlObserver(Control i_Control, FormCleaner i_FormCleaner) { control = i_Control; Loaded = true; Cleaner = i_FormCleaner; }