public static void BindListeners(System.Windows.Forms.Control control, BaseLogic logic)
 {
     if (logic != null &&
       !Registry.Contains(control)) {
     Registry.Add(control, "");
     logic.StateChanged += new StateChangedDelegate(((IStateChangedListener)control).StateChanged);
       }
       foreach (object listener in control.Controls) {
     if (listener is BaseControl)
       BindListeners((System.Windows.Forms.Control)listener);
     else
       BindListeners((System.Windows.Forms.Control)listener, logic);
       }
 }
 public void StateChanged(BaseLogic sender, StateChangedEventArgs args)
 {
     if (args.State == eState.RETRIEVED) {
     this._DataSourceList = sender.Containers;
     this.RebindData();
       }
 }
 public void StateChanged(BaseLogic sender, StateChangedEventArgs args)
 {
     if (args.State == eState.RETRIEVED) {
     this.DataSource = sender.Container;
       }
 }
        public void StateChanged(BaseLogic sender, StateChangedEventArgs args)
        {
            if (args.State == eState.DELETING) {
            this.JustDeleted = true;

              }

              if (args.State == eState.ADDED) {
            JustAdded = true;

              }

              if (args.State == eState.RETRIEVED) {
            int NextID = -1;
            if (this.SelectedItem != null)
              NextID = ((BaseContainer)this.SelectedItem).ID;
            if (this.JustDeleted)
              NextID = this.GetPreviousIndex(NextID);

            this.EnableSelectedIndexChanged = false;
            this._DataSourceList = sender.Containers;
            this.RebindData();
            this.EnableSelectedIndexChanged = true;

            if (this.JustAdded) {
              this.SelectedIndex = this.GetMaxIndex();
              this.JustAdded = false;
              return;
            }
            if (this.JustDeleted) {
              this.SelectedIndex = NextID;
              this.JustDeleted = false;
              return;
            }

            if (this.Items != null &&
              this.Items.Count > 0) {

              if (NextID < 0) {
            this.SelectedIndex = 0;
              }
              else {
            int index = this.GetIndex(NextID);
            if (index < 0)
              this.SelectedIndex = 0;
            else
              this.SelectedIndex = index;
              }
            }
              }
        }
 public override void StateChanged(BaseLogic sender, StateChangedEventArgs args)
 {
 }