determine businessobject on FormNavigated


Author
Message
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
thanks for the advice Trent, I will see it, sound interesting. Thanks BigGrin
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
One thing that you may want to download is the most recent 1.6.6 beta as there is now a new Custom Business Binding Source and template that makes it VERY easy to create reporting objects.  We will post more information and samples about this over the next few weeks, but that would be a good place to start. Smile
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
thanks Paul and Greg for the great tips, about the wrapper I see that the post http://forum.strataframe.net/FindPost12487.aspx have and awesome example of how to do reports with datasets and BBS's and have the handler stuff on the code that Paul and Trent post Smile I see what I do about the formnavigate / navigate / handlers stuff.



thanks Paul and Trent for the examples on that post about reporting, appears to be very usefull and soon I have to do something of that Smile

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
All good stuff!  Thanks, guys!
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I really need to read the posts...FormNavigated...Blush Paul's idea is a good one!
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I guess I'm confused. When you setup an event handler on a BO, it is BO specific normally, unless you are sharing the event handler. I.e. if you have two BOs on the form, PrimaryBO and NotSoPrimaryBO, then when you setup event handlers, it is specific to the BO:

// C#. primaryBO_Navigated and notSoPrimaryBO_Navigated are methods in the form class.

PrimaryBO.Navigated += primaryBO_Navigated;

NotSoPrimaryBO.Navigated += notSoPrimaryBO_Navigated;



' VB. Two choices:

AddHandler PrimaryBO.Navigated, AddressOf primaryBO_Navigated

AddHandler NotSoPrimaryBO.Navigated, AddressOf notSoPrimaryBO_Navigated



' Or directly at the method:

Private Sub primaryBO_Navigated(e As NavigatedEventArgs) Handles PrimaryBO.Navigated

' handle primary BO stuff

End Sub

Private Sub notSoPrimaryBO_Navigated(e As NavigatedEventArgs) Handles NoSoPrimaryBO.Navigated

' handle not so primary bo stuff

End Sub




So, you'd always know the BO, because the code will only react to the navigation on the BO that it is subscribing to.



Now if you are sharing the event handler for both, then, you'd have a problem...but one that is easily fixed. Put the shared code in a private method, with an argument that is the BO being used. Then just use two event handlers to call the common method:

' Common method that does work, based on BO

Private Sub NavigatedHandler(bo As BusinessLayer)

' Test on BO type to figure out what to do

If bo.GetType() Is Me.PrimaryBO.GetType() Then

End If

End Sub

' Use two event handlers that call the common method

Private Sub primaryBO_Navigated(e As NavigatedEventArgs) Handles PrimaryBO.Navigated

Me.NavigatedHandler(Me.PrimaryBO)

End Sub

Private Sub notSoPrimaryBO_Navigated(e As NavigatedEventArgs) Handles NoSoPrimaryBO.Navigated

Me.NavigatedHandler(Me.NotSoPrimaryBO)

End Sub




Hope that helps! BigGrin
Paul Chase
Paul Chase
Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)Advanced StrataFrame User (580 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Fabian,

I "wrapped" the strataframe events that did not pass a sender into custom events that pass the sender though so I could tell where it came from. I'm not sure why they didnt pass the sender through

#Region " Events"

'---> Add events that mirror StrataFrame Events as they do not pass a sender so I can't tell which BO intitiated the event

Public Event AL_Navigated(ByVal sender As Object, ByVal e As MicroFour.StrataFrame.Business.NavigatedEventArgs)

Public Event AL_AfterAddNew(ByVal sender As Object, ByVal e As System.EventArgs)

Public Event AL_AfterDeleted(ByVal sender As Object, ByVal e As MicroFour.StrataFrame.Business.AfterDeleteEventArgs)

Public Event AL_BeforeDeleted(ByVal sender As Object, ByVal e As MicroFour.StrataFrame.Business.BeforeDeleteEventArgs)

#End Region

#Region " Wrapped Events"

''' <summary>

''' Wraps the After Add New event

''' </summary>

''' <param name="e"></param>

''' <remarks></remarks>

Private Sub BaseBiz_AfterAddNew(ByVal e As System.EventArgs) Handles Me.AfterAddNew

'Bubble up th SF event

RaiseEvent AL_AfterAddNew(Me, e)

End Sub

''' <summary>

''' Wraps the After Delete event

''' </summary>

''' <param name="e"></param>

''' <remarks></remarks>

Private Sub BaseBiz_AfterDelete(ByVal e As MicroFour.StrataFrame.Business.AfterDeleteEventArgs) Handles Me.AfterDelete

'Bubble up th SF event

RaiseEvent AL_AfterDeleted(Me, e)

End Sub

''' <summary>

''' Wraps the Befoew Delete event

''' </summary>

''' <param name="e"></param>

''' <remarks></remarks>

Private Sub BaseBiz_BeforeDelete(ByVal e As MicroFour.StrataFrame.Business.BeforeDeleteEventArgs) Handles Me.BeforeDelete

'Bubble up th SF event

RaiseEvent AL_BeforeDeleted(Me, e)

End Sub

Private Sub AL_BusinessObjectBase_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed

End Sub

''' <summary>

''' Handle The is Dirty Changed Event to Enable Disable Buttons

''' </summary>

''' <param name="sender"></param>

''' <param name="e"></param>

''' <remarks></remarks>

Private Sub AL_BusinessObjectBase_IsDirtyChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.IsDirtyChanged

'Nothing here for now this will enable us to trap for changes and then flip buttons

' Base.Common.MainForm.HandleEditingStateChanged()

End Sub

''' <summary>

''' Wraps the Navigated event

''' </summary>

''' <param name="e"></param>

''' <remarks></remarks>

Private Sub BaseBiz_Navigated(ByVal e As MicroFour.StrataFrame.Business.NavigatedEventArgs) Handles Me.Navigated

'Bubble up th SF event

RaiseEvent AL_Navigated(Me, e)

End Sub

#End Region


Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)StrataFrame User (271 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
I have two BOs (a primary and a "not primary", I have to put a handler of primarybusinessobject.navigated to a method on a form to refresh the "not primary" child BO fill manually...



the question is if I have a property or something else that determine if the navigate object is the primary (the eventarg MicroFour.StrataFrame.Business.NavigatedEventArgs in the formnavigate event doesn't have a reference to the business object that raise the navigate)



pd: I not use the BO's property "parentrelationship" and "parentbusinessobject" because I inherited from a intermediate BO and this give me problems with the property (parentrelationship)... then I cut the parent - child features and handle the navigate / transaction stuff manually...



thanks for any idea on this.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search