473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

When and how to set a boolean variable to true?


I have following code:

void DownloadLists ()
{

if (!mIsListsDownloaded)
{

// Loop -- Downloading entries for each list
foreach (ITritonList list in
TritonListManager.GetLists(true))
{
list.OpenEntries(new
ListDataReadyDelegate(OnEntriesDownloaded));
}

// Wrong in here, because the entries are not
downloaded at this time!!!
mIsListsDownloaded = true;
}

}
void OnEntriesDownloaded(IGridList list)
{

foreach (IGridEntry entry in list.Entries)
{

mEntries.Add(entry);
}

loggerCash.LogMessageBarMessage(ESeverity.Detail,
"Finished downloading entries on list " + list.Name.ToString());

}

The task is to download entries on each list for multiple lists and
then set "mIsListsDownloaded" to true. It's important that the action
"OnEntriesDownloaded" be completed for all of the lists before
"mIsListsDownloaded" is set to true.

I've found this a technical challenge -

The delegate method "OnEntriesDownloaded" takes time to complete.
Also, since "OnEntriesDownloaded" is called for each list and there
are multiple lists, it is called multiple times and it takes
significant amount of time (about 6 seconds, could take even longer
depending on how busy the system is) to complete.

Now the question is that when shall I set "mIsEntriesDownloaded" to
true? I want to wait for 8 seconds because by that time, all of the
entries should have been downloaded. However, there is no guarantee
because sometimes the system takes much longer.

I also don't know the C# syntax of waiting for 8 seconds and then set
"mIsListsDownloaded" to true. Could anyone help?
Aug 3 '08 #1
1 1236
>Now the question is that when shall I set "mIsEntriesDownloaded" to
>true? I want to wait for 8 seconds because by that time, all of the
entries should have been downloaded. However, there is no guarantee
because sometimes the system takes much longer.

I also don't know the C# syntax of waiting for 8 seconds and then set
"mIsListsDownloaded" to true. Could anyone help?

Can't you count the number of lists returned by
TritonListManager.GetLists(true) and then keep track of when
OnEntriesDownloaded has been called that number of times?
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Aug 5 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: asim | last post by:
Hi if a declare a variale say Dim Flag and assing it to true a boolean value Flag = True and if i try to concatinate it with another string like mystr="<my-str>" & Flag & "</my-str>" and if...
5
by: Matt | last post by:
I have a simple JS function that I want to return a true or false value based on the parameter passed in. At this point of time I receive the error "'True' is undefined". Here is my code below. ...
7
by: KathyK | last post by:
Hi and thanks in advance! I have an Access 2000 front end and a SQL Server 2000 back end. When the Access main form opens I run code that logs the user on to the SQL server using the generic read...
8
by: FrancisC | last post by:
how to define Boolean in C ? boolean abc; ??? is it default as True or False??
6
by: Tim::.. | last post by:
Can someone tell me why the value of my Boolean is always false! Even after I have declared that my variable iNews should equal TRUE it seems to remain false... Can some please explain why... ...
4
by: Rich | last post by:
Dim bNcd, bNcm, bNqa, bNcur, bN0, bN1, bN2, bN3, bN4 As Boolean Dim arrBool As Boolean() = {bNcd, bNcm, bNqa, bNcur, bN0, bN1, bN2, bN3, bN4} Dim i As Integer bNcd = True bNcm = True bNqa =...
0
by: marc joanisse | last post by:
Hi Folks, I am writing a c# app that interacts with some scientific hardware (a "bird", which is just a magnetic tracker) through a C++ DLL. The actual data from the "bird" is read by the...
0
by: Alex | last post by:
my app was working fine in VB.NET 2003 (and framework 1.1). Now with VB.NET 2005 (framework 2.0) the uploading to an http server (ie. www.sharebigfile.com) stops with the error "The request was...
1
by: shiniskumar | last post by:
how to check if the value of a boolean variable is true of false in ftl? ive got a boolean variable whose value is false i have to perform some action based on its value in front end how do i...
3
by: cj2 | last post by:
In the code below I want when this web service is first published for the boolean Running.running to be True. It seems to default to false. How can I make this default to True? Once the web...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.