Esempio n. 1
0
 private void Grid_OnBusinessObjectSelected(object sender, BOEventArgs e)
 {
     if (this.BusinessObjectSelected != null)
     {
         this.BusinessObjectSelected(this, e);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// If the businessObject's IDUpdated Event has been fired then the business object is removed with the
 ///   old ID and added with the new ID. This is only required in cases with mutable primary keys.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected virtual void ObjectID_Updated_Handler(object sender, BOEventArgs e)
 {
     lock (_lock)
     {
         this.Remove(e.BusinessObject);
         this.Add(e.BusinessObject);
     }
 }
 private void Grid_OnBusinessObjectSelected(object sender, BOEventArgs e)
 {
     if (this.BusinessObjectSelected != null)
     {
         this.BusinessObjectSelected(this, new BOEventArgs(this.SelectedBusinessObject));
     }
     this.SetButtonStatesForSelectedObject();
 }
Esempio n. 4
0
        /// <summary>
        /// This handler is called when a business object has been removed from
        /// the collection - it subsequently removes the item from the ListBox
        /// list as well.
        /// </summary>
        /// <param name="sender">The object that notified of the change</param>
        /// <param name="e">Attached arguments regarding the event</param>
        private void BusinessObjectRemovedHandler(object sender, BOEventArgs e)
        {
            ITabPage page = GetTabPage(e.BusinessObject);

            TabControl.Controls.Remove(page);
            IBusinessObjectControl boControl = this.GetBusinessObjectControl(page);

            FireTabPageRemoved(page, boControl);
        }
        private void OnBusinessObjectSelected(object sender, BOEventArgs boEventArgs)
        {
            var selectedBO = boEventArgs.BusinessObject as TBo;

            SetBusinessObjectOnControlBinders(selectedBO);
            if (this.BusinessObjectSelected != null)
            {
                this.BusinessObjectSelected(this, new BOEventArgs <TBo>(selectedBO));
            }
        }
Esempio n. 6
0
        /// <summary>
        /// This handler is called when a business object has been added to
        /// the collection - it subsequently adds the item to the ListBox
        /// list as well.
        /// </summary>
        /// <param name="sender">The object that notified of the change</param>
        /// <param name="e">Attached arguments regarding the event</param>
        private void BusinessObjectAddedHandler(object sender, BOEventArgs e)
        {
            IBusinessObject busObject = e.BusinessObject;

            if (HasTabPage(busObject))
            {
                return;
            }
            AddTabPage(busObject);
        }
Esempio n. 7
0
        /// <summary>
        /// Handles the event of a business object being added. Adds a new
        /// data row containing the object.
        /// </summary>
        /// <param name="sender">The object that notified of the event</param>
        /// <param name="e">Attached arguments regarding the event</param>
        protected virtual void BOAddedHandler(object sender, BOEventArgs e)
        {
            BusinessObject businessObject = (BusinessObject)e.BusinessObject;
            int            rowNum         = this.FindRow(e.BusinessObject);

            if (rowNum >= 0)
            {
                return;              //If row already exists in the datatable then do not add it.
            }
            LoadBusinessObject(businessObject);
        }
 /// <summary>
 /// Event handler when a Business Object is updated in any way.
 /// </summary>
 protected virtual void BusinessObject_Updated(object sender, BOEventArgs e)
 {
     try
     {
         UpdateBusinessObject(e.BusinessObject);
     }
     catch (Exception ex)
     {
         GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error ");
     }
 }
Esempio n. 9
0
        /// <summary>
        /// A handler that updates the display when a business object has been
        /// removed from the collection
        /// </summary>
        /// <param name="sender">The object that notified of the event</param>
        /// <param name="e">Attached arguments regarding the event</param>
        private void BusinessObjectRemovedHandler(object sender, BOEventArgs e)
        {
            var businessObject  = e.BusinessObject;
            var itemToBeRemoved = _listItemsHash[businessObject] as ListViewItem;

            if (itemToBeRemoved == null)
            {
                return;
            }
            ListView.Items.Remove(itemToBeRemoved);
        }
Esempio n. 10
0
 /// <summary>
 /// Event handler when a Business Object is deleted
 /// </summary>
 protected virtual void BusinessObject_Deleted(object sender, BOEventArgs e)
 {
     try
     {
         IBusinessObject businessObject = sender as IBusinessObject;
         RemoveBusinessObjectNode(businessObject);
     }
     catch (Exception ex)
     {
         GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error ");
     }
 }
        /// <summary>
        /// This handler is called when a business object has been removed from
        /// the collection - it subsequently removes the item from the ListBox
        /// list as well.
        /// </summary>
        /// <param name="sender">The object that notified of the change</param>
        /// <param name="e">Attached arguments regarding the event</param>
        protected void BusinessObjectRemovedHandler(object sender, BOEventArgs e)
        {
            var businessObject = e.BusinessObject;
            var isSelectedItem = this.Control.SelectedItem == businessObject;

            this.Control.Items.Remove(businessObject);
            if (isSelectedItem)
            {
                //Fires the event with business object selected null since the selected bo has been removed
                FireBusinessObjectSelected();
            }
        }
Esempio n. 12
0
        private void BusinessObjectUpdatedHandler(object sender, BOEventArgs e)
        {
            var businessObject = e.BusinessObject;

            /*            var boToBeUpdated = this.ListView.Items.Cast<ListViewItem>().FirstOrDefault(item => item.Tag == businessObject);
             */
            var listItemToBeUpdated = _listItemsHash[businessObject] as ListViewItem;

            if (listItemToBeUpdated == null)
            {
                return;
            }
            listItemToBeUpdated.Text = businessObject.ToString();
        }
Esempio n. 13
0
 /// <summary>
 /// Event handler when a Business Object is removed to the business object collection
 /// </summary>
 protected virtual void BusinessObjectCollection_ChildRemoved(object sender, BOEventArgs e)
 {
     try
     {
         IBusinessObjectCollection businessObjectCollection = sender as IBusinessObjectCollection;
         IBusinessObject           businessObject           = e.BusinessObject;
         TreeView.SelectedNode = null;
         RemoveBusinessObjectFromCollectionNode(businessObjectCollection, businessObject);
     }
     catch (Exception ex)
     {
         GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error ");
     }
 }
Esempio n. 14
0
        /// <summary>
        /// Event handler when a Business Object is added to the business object collection
        /// </summary>
        protected virtual void BusinessObjectCollection_ChildAdded(object sender, BOEventArgs e)
        {
            try
            {
                IBusinessObjectCollection businessObjectCollection = sender as IBusinessObjectCollection;
                IBusinessObject           businessObject           = e.BusinessObject;

                AddBusinessObjectToCollectionNode(businessObjectCollection, businessObject);
            }
            catch (Exception ex)
            {
                GlobalRegistry.UIExceptionNotifier.Notify(ex, "", "Error ");
            }
        }
Esempio n. 15
0
        /// <summary>
        /// Handles the event of the Business object becoming invalid.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void SavedEventHandler(object sender, BOEventArgs e)
        {
            TBusinessObject bo = (TBusinessObject)e.BusinessObject;
            bool            removedListContains = this.RemovedBusinessObjects.Contains(bo);

            base.SavedEventHandler(sender, e);
            if (removedListContains)
            {
                RemoveFromPersistedCollection(bo);
            }
            if (this.AddedBusinessObjects.Contains(bo))
            {
                this.AddedBusinessObjects.Remove(bo);
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Handles the event of a Business object being restored.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void RestoredEventHandler(object sender, BOEventArgs e)
        {
            TBusinessObject bo = (TBusinessObject)e.BusinessObject;
            bool            removedListContains = this.RemovedBusinessObjects.Contains(bo);
            bool            addedListContains   = this.AddedBusinessObjects.Contains(bo);

            base.RestoredEventHandler(sender, e);
            if (removedListContains)
            {
                this.Add(bo);
            }
//            if (addedListContains)
//            {
//                DereferenceBO(bo);
//            }
        }
Esempio n. 17
0
        private void OnBusinessObjectAdded(object sender, BOEventArgs <T> args)
        {
            var boToBeAdded = args.BusinessObject;

            if (boToBeAdded == null)
            {
                return;
            }
            var currentCriteria = this.ViewOfBusinessObjectCollection.SelectQuery.Criteria;

            if (currentCriteria == null || currentCriteria.IsMatch(boToBeAdded))
            {
                this.ViewOfBusinessObjectCollection.Add(boToBeAdded);
                var newIndex = this.ViewOfBusinessObjectCollection.Count - 1;
                FireListChanged(ListChangedType.ItemAdded, newIndex);
            }
        }
Esempio n. 18
0
        private void OnBusinessObjectRemoved(object sender, BOEventArgs <T> args)
        {
            var boToBeRemoved = args.BusinessObject;

            if (boToBeRemoved == null)
            {
                return;
            }
            var removedIndex = this.ViewOfBusinessObjectCollection.IndexOf(boToBeRemoved);

            this.ViewOfBusinessObjectCollection.Remove(boToBeRemoved);
            if (removedIndex >= 0)
            {
                FireListChanged(ListChangedType.ItemDeleted, removedIndex);
            }
            else
            {
                FireListChanged(ListChangedType.Reset);
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Handles the event of a business object being removed. Removes the
        /// data row that contains the object.
        /// </summary>
        /// <param name="sender">The object that notified of the event</param>
        /// <param name="e">Attached arguments regarding the event</param>
        protected virtual void RemovedHandler(object sender, BOEventArgs e)
        {
            lock (_table.Rows)
            {
                int rowNum = this.FindRow(e.BusinessObject);
                if (rowNum == -1)
                {
                    return;
                }

                try
                {
                    this._table.Rows.RemoveAt(rowNum);
                }
                catch (Exception)
                {
                    //IF you hit delete many times in succession then you get an issue with the events interfering and you get a wierd error
                    //This suppresses the error.
                    Console.Write(Xsds.There_was_an_error_in_DataSetProvider_MultipleDelesHit);
                }
            }
        }
        /// <summary>
        /// This handler is called when a business object has been added to
        /// the collection - it subsequently adds the item to the ListBox
        /// list as well.
        /// </summary>
        /// <param name="sender">The object that notified of the change</param>
        /// <param name="e">Attached arguments regarding the event</param>
        protected void BusinessObjectAddedHandler(object sender, BOEventArgs e)
        {
            var businessObject = e.BusinessObject;

            if (businessObject == null)
            {
                return;
            }
            var items = Control.Items;

            if (items.Contains(businessObject))
            {
                return;
            }
            if (string.IsNullOrEmpty(businessObject.ToString()))
            {
                string message =
                    string.Format(
                        "Cannot add a business object of type '{0}' to the '{1}' if its ToString is null or zero length",
                        businessObject.ClassDef.ClassName, this.GetType().Name);
                throw new HabaneroDeveloperException(message, message);
            }
            this.Control.Items.Add(e.BusinessObject);
        }
 /// <summary>
 /// This handler is called when a business object has been removed from
 /// the collection - it subsequently removes the item from the ListBox
 /// list as well.
 /// </summary>
 /// <param name="sender">The object that notified of the change</param>
 /// <param name="e">Attached arguments regarding the event</param>
 private void BusinessObjectRemovedHandler(object sender, BOEventArgs e)
 {
     RemoveBOPanel(e.BusinessObject);
 }
Esempio n. 22
0
 /// <summary>
 /// A handler that updates the display when a business object has been
 /// added to the collection
 /// </summary>
 /// <param name="sender">The object that notified of the event</param>
 /// <param name="e">Attached arguments regarding the event</param>
 private void BusinessObjectAddedHandler(object sender, BOEventArgs e)
 {
     ListView.Items.Add(CreateListViewItem(e.BusinessObject));
 }
 private void BusinessObject_OnSaved(object sender, BOEventArgs e)
 {
     UpdateIsEditable();
 }
 /// <summary>
 /// This handler is called when a business object has been added to
 /// the collection - it subsequently adds the item to the ComboBox
 /// list as well.
 /// </summary>
 /// <param name="sender">The object that notified of the change</param>
 /// <param name="e">Attached arguments regarding the event</param>
 private void BusinessObjectAddedHandler(object sender, BOEventArgs e)
 {
     _comboBox.Items.Add(e.BusinessObject);
 }
        //TODO _Port:
        //private void SetupComboBoxRightClickController()
        //{
        //    _comboBoxRightClickController = new ComboBoxRightClickController(_comboBox, _collection.ClassDef);
        //    _comboBoxRightClickController.NewObjectCreated += NewComboBoxObjectCreatedHandler;
        //}

        //private void NewComboBoxObjectCreatedHandler(IBusinessObject businessObject)
        //{
        //    _collection.Add(businessObject);
        //    _comboBox.SelectedItem = businessObject;
        //}

        //TODO _Port:
        /////<summary>
        ///// The controller used to handle the right-click pop-up form behaviour
        /////</summary>
        //public ComboBoxRightClickController ComboBoxRightClickController
        //{
        //    get { return _comboBoxRightClickController; }
        //    set { _comboBoxRightClickController = value; }
        //}

        /// <summary>
        /// This handler is called when a business object has been removed from
        /// the collection - it subsequently removes the item from the ComboBox
        /// list as well.
        /// </summary>
        /// <param name="sender">The object that notified of the change</param>
        /// <param name="e">Attached arguments regarding the event</param>
        private void BusinessObjectRemovedHandler(object sender, BOEventArgs e)
        {
            _comboBox.Items.Remove(e.BusinessObject);
        }
Esempio n. 26
0
        /// <summary>
        /// Updates the grid ID column when the Business's ID is changed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void IDUpdatedHandler(object sender, BOEventArgs e)
        {
            BusinessObject businessObject = (BusinessObject)e.BusinessObject;

            UpdateBusinessObjectRowValues(businessObject);
        }
Esempio n. 27
0
        private void BusinessObjectUpdatedHandler(object sender, BOEventArgs boEventArgs)
        {
            var businessObject = boEventArgs.BusinessObject;

            UpdateBusinessObject(businessObject);
        }
 /// <summary>
 /// This handler is called when a business object has been added to
 /// the collection - it subsequently adds the item to the ListBox
 /// list as well.
 /// </summary>
 /// <param name="sender">The object that notified of the change</param>
 /// <param name="e">Attached arguments regarding the event</param>
 private void BusinessObjectAddedHandler(object sender, BOEventArgs e)
 {
     AddBOPanel(e.BusinessObject);
 }