Click here to Skip to main content
15,922,894 members
Home / Discussions / C#
   

C#

 
AnswerRe: Auto refresh and timeout Pin
leppie6-Aug-08 10:07
leppie6-Aug-08 10:07 
AnswerRe: Auto refresh and timeout Pin
Guffa6-Aug-08 12:26
Guffa6-Aug-08 12:26 
QuestionMessage Removed Pin
6-Aug-08 9:32
tkrn6-Aug-08 9:32 
GeneralRe: SQL Datatype WinForm Textbox Validation? Pin
nelsonpaixao6-Aug-08 14:05
nelsonpaixao6-Aug-08 14:05 
GeneralRe: SQL Datatype WinForm Textbox Validation? Pin
tkrn7-Aug-08 2:09
tkrn7-Aug-08 2:09 
QuestionMulticast Delegates Event Driven Architecture is there a way? Pin
danielgmx6-Aug-08 6:55
danielgmx6-Aug-08 6:55 
QuestionRe: Multicast Delegates Event Driven Architecture is there a way? Pin
led mike6-Aug-08 7:21
led mike6-Aug-08 7:21 
AnswerRe: Multicast Delegates Event Driven Architecture is there a way? Pin
danielgmx6-Aug-08 8:23
danielgmx6-Aug-08 8:23 
The form count is unknown, the forms are dynamically created from the base form via webservice response data. Here is an example of my code.


<pre>//the base form..
public delegate void SummaryDataChanged(object sender, SummaryDataChangedEventArgs e);</pre>
<pre>public virtual event SummaryDataChanged SummaryDataChangedEvent;</pre>
<pre>[STAThread()]
public ClassSpf.DataManager.ActivityReturn AnalyzeWebRequest(ClassSpf.DataManager.ActivityReturn.ActivityFlag flagType, ClassSpf.WebTargets.ProcessActivityDelegate webRequest, ClassSpf.DataManager.SpfGenericParameter genericParameter)
{
IAsyncResult iAsyncResult = webRequest.BeginInvoke(genericParameter, AnalyzeWebRequestCallBack, null);

ClassSpf.ActivityReturn activityReturn = webRequest.EndInvoke(iAsyncResult);

if (activityReturn.OutPut.Reqstatustx != string.Empty)
{
IssueMessage(activityReturn.Output);
}

if (activityReturn.ActivityException != null)
{
ClassAppTrace.HandleSystemException(activityReturn.ActivityException);
}

if (flagType == ActivityReturn.ActivityFlag.IssueUpdate)
{
if (ClassSpf.GlobalMemorySlots.Order != null &amp;&amp; ClassSpf.GlobalMemorySlots.Operation != null)
{
this.QueueLoadSummary();
}
}

return activityReturn;
}
</pre>

<pre>
internal void QueueLoadSummary()
{
System.Threading.WaitCallback waitCallBack = new WaitCallback(LoadSummaryInformation);

System.Threading.ThreadPool.QueueUserWorkItem(waitCallBack);
}
</pre>

<pre>protected void LoadSummaryInformation(object stateInfo)
{
try
{
if (ClassSpf.GlobalMemorySlots.Input == null)
{
//well we can not load the summary data with out input now can we.
return;
}
else
{
ActivityReturn activityReturn =
WebServiceCall(ClassSpf.GlobalMemorySlots.Input, ref dataManager);

if (activityReturn.ActivityException == null)
{
if (dataManager.CurrentOrder != null &amp; dataManager.CurrentOperation != null)
{
if (SummaryDataChangedEvent != null)
{
SummaryDataChangedEvent(this, new SummaryDataChangedEventArgs(dataManager));
}

SummaryDataChangedEventArgs summDataChanged = new SummaryDataChangedEventArgs(dataManager);
SummaryDataChangedEvent += new SummaryDataChanged(FormBase_SummaryDataChangedEvent);
SummaryDataChangedEvent(this, summDataChanged);
}
}
}
}
catch (InvalidOperationException iOx)
{
ClassAppTrace.HandleSystemException(iOx);
}


}</pre>


<pre>
FormBase_Load()
{
this.UpdateOccurredEvent += new SummaryDataChanged(FormBase_UpdateOccurredEvent);
}</pre>

//the mdiparent (inherited from base form)
<pre>private void MdiParent_SummaryDataChanged(object sender, SummaryDataChangedEventArgs e)
{
try
{
this.Invoke((MethodInvoker)delegate
{
//Some grid code goes here unimportant to the question
});
}
catch (Exception eX)
{
ClassAppTrace.HandleSystemException(eX);
}
finally
{
try
{
//Hook the event in to each child window that needs to accept it
foreach (FormBase child in this.MdiChildren)
{
(child as FormBase).OnUpdateOccurred(sender, e);
}
}
catch (Exception eX)
{
ClassAppTrace.HandleSystemException(eX);
}
}
}
</pre>



I am trying to change the foreach (FormBase child) loop to something more robust, I just don't know what Wink | ;) now I imagine the issue is when the update is fired it is triggered by a child form thus only triggering the event for that form. I would like something like this.

Delegate UpdateType(Data Arguments);
Event UpdateType UpdateEvent;

FormBase_Load()
{
this.UpdateEvent += new UpdateEvent();
}

FormBase_TriggerChildUpdate(DataArgs e)
{
//this is where I would like to see all of the instantiated forms events fired.
//I am just not familiar enough with delegates to find a way to do so without the loop
if(UpdateEvent != null)
UpdateEvent(e);
}
QuestionRe: Multicast Delegates Event Driven Architecture is there a way? Pin
led mike6-Aug-08 8:53
led mike6-Aug-08 8:53 
AnswerRe: Multicast Delegates Event Driven Architecture is there a way? Pin
danielgmx6-Aug-08 9:05
danielgmx6-Aug-08 9:05 
GeneralRe: Multicast Delegates Event Driven Architecture is there a way? Pin
led mike7-Aug-08 5:31
led mike7-Aug-08 5:31 
AnswerRe: Multicast Delegates Event Driven Architecture is there a way? Pin
Joe Woodbury6-Aug-08 10:36
professionalJoe Woodbury6-Aug-08 10:36 
GeneralRe: Multicast Delegates Event Driven Architecture is there a way? Pin
danielgmx6-Aug-08 11:50
danielgmx6-Aug-08 11:50 
QuestionC# & webservice on Multiple servers Pin
balu123456-Aug-08 6:26
balu123456-Aug-08 6:26 
AnswerRe: CP Member Ignore - Repost Pin
Abhijit Jana6-Aug-08 17:59
professionalAbhijit Jana6-Aug-08 17:59 
QuestionProblem with Date Validation Pin
Verghese6-Aug-08 6:16
Verghese6-Aug-08 6:16 
AnswerRe: Problem with Date Validation Pin
Guffa6-Aug-08 10:04
Guffa6-Aug-08 10:04 
GeneralRe: Problem with Date Validation Pin
Verghese6-Aug-08 10:54
Verghese6-Aug-08 10:54 
GeneralRe: Problem with Date Validation Pin
Kjetil Svendsen6-Aug-08 23:18
Kjetil Svendsen6-Aug-08 23:18 
Question.NET DLL fails when called from Excel by restricted user Pin
Vikram A Punathambekar6-Aug-08 5:43
Vikram A Punathambekar6-Aug-08 5:43 
AnswerRe: .NET DLL fails when called from Excel by restricted user Pin
vikas amin6-Aug-08 10:55
vikas amin6-Aug-08 10:55 
QuestionGetting bitmap data from System.Windows.Shapes object Pin
AmitDey6-Aug-08 5:43
AmitDey6-Aug-08 5:43 
AnswerRe: Getting bitmap data from System.Windows.Shapes object Pin
Mark Salsbery6-Aug-08 6:10
Mark Salsbery6-Aug-08 6:10 
GeneralRe: Getting bitmap data from System.Windows.Shapes object Pin
AmitDey6-Aug-08 6:30
AmitDey6-Aug-08 6:30 
GeneralRe: Getting bitmap data from System.Windows.Shapes object Pin
Mark Salsbery6-Aug-08 6:40
Mark Salsbery6-Aug-08 6:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.