Wpf - Multi-threaded ObservableCollection In VB

Jul 14, 2010

This is my attempt to create a ObservableCollection in VB that is WPF thread-safe. Can you think of any problems it may have?

[Code]...

View 2 Replies


ADVERTISEMENT

Run A Multi-threaded Console App

Jul 21, 2011

I'm trying to run a multi-threaded console app in VB and am having thread cross-over. Basically I want to run 5 threads, have them continually access a queue, process, and repeat until there's nothing left. When all threads have processed I want them to do something else.I'm attempting to use SyncLock to prevent multiple threads from accessing but it does not seem to be working.[code]

View 3 Replies

Multi-threaded Code Examples?

Aug 10, 2011

I'm trying to teach myself how to create multi-threaded applications in Visual Basic Express 2008. I found a page headed "Creating Threads and Passing Data at Start Time" in the Library here -

[url]

However, I can't get any of the examples on that page to run. I pasted the code from an example into a new Project in my IDE but pressing F5 just gives me build errors which I have no idea how to resolve. It's probably something trivial but I can't progress with these examples. Please can somebody tell me what I need to add to get them to run

View 1 Replies

Multi-Threaded Drawing Images In A Row

Apr 5, 2011

I am drawing five images in a row. The five are the same thing at five different zoom levels. Therefore, only one of the five will be displayed at any one time, but the others have to be there because there can be over 100 images being displayed on the screen at any one time, and each drawing is quite complicated. If I were to draw them all on the fly, then zooming would require that all 115 images be recreated and redrawn with each zoom. That's painful. To avoid that, I draw all five zoom levels of each image. When the user iteracts with the form, they will be interacting with, at most, two of the images, so when they interact with the form, only two of the 115 have to be redrawn, though those two have to have all five zoom levels drawn, for a total of 10 images.

[Code].....

View 14 Replies

Multi-threaded Task Under Windows

Nov 11, 2010

I've just completed my first multi-threaded task under windows. Historically I am a VMS Engineer. You could multithread in drivers in VMS but VMS never had formalized threads. Which means it never had applications threads. Threads will become increasing important in the future. I thought this maybe a good time to discuss them. Not having access to sources hurts in terms of the amount of depth one can achieve in Windows. Some of the topics for this thread might be...compute resource regulation, how to do multi-threading and of course things to watch out for.

View 1 Replies

Oracle Database - Multi Threaded Implementation?

Mar 12, 2011

I have written a rather complex dll for processing a large volume of data (~4,000,000 records) from an Oracle database. It works well, but takes about 23 hours to run.Since I wrote the code fairly compartmentalized I realized that there are 6 routines that should be able to run concurrently, and I have a multi core processor,I decided to try my first multi-threaded implementation.

In the routine I am working on I am doing no I/O everything is in memory in variables. My data is already in dataTables and hashTables. Most of the data is defined as private in the class scope, but no conflicting updates should happen because the code segments works very distinct portions of the dataTables.The concept is simple, I have 2 routines that need to complete before launching my threads, and one routine that needs to run after all of the threads have completed. Here is what I am trying;

ProcessDXDate()
ProcessHistology()
aryThreads(0) = New Threading.Thread(AddressOf ProcessLaterality)[code].....

View 7 Replies

.NET - Multi-threaded Iteration Over A Single List (Of T)?

Oct 22, 2009

I'm using VB.NET. I want to build a large List (Of MyClassOrStructure) that becomes static after its initial population.I'm going to have multiple threads that need to iterate through this list to read data (no writing, inserting, or deleting)

Are there any very bad things that I need to keep an eye out for?

View 3 Replies

Create A Multi-threaded Proxy Checker

Feb 1, 2011

I am trying to create a proxy checker. This is my first attempt at multithreading and it's not going so well, the threads seem to be waiting for one to complete before initializing the next.

[Code]...

View 2 Replies

Raising Events In Multi-threaded Classes?

Aug 27, 2009

Raising events in multithreaded classes?

I am running a class(gamepad handler) that uses many child threads to check for key input and the like then it raises events to my form to sort out the needed reaction, Is there a way to make the event raises on the same thread as the class itself.

View 3 Replies

VS 2008 Multi-threaded TCP Server / Client?

Nov 14, 2009

I'm having some trouble creating a multi-client server / client thingy.So far, I've used Atheist's example and allowed the clients to successfully transmit information.However, whenever I send more than 1 message to the server at the same time, the server bugs up and does not receive the message at all. I suspect it has something to do with the DoRead method reading from both clients and stuffing it up or something.

View 13 Replies

Re-write Application To Be Multi-threaded Using The Background Worker?

Jul 23, 2009

how to re-write my application (http:[url]....) to be multi-threaded using the background worker. The use case is something like:

1. User opens a binary file, it can be several Gbytes in size so reading it into memory isn't practical.

2. User can then navigate through the file in 188byte chunks, data is read from disk, decoded, and displayed for each chunk in turn.

3. User may want to search for some data or build a report. This will involve repeating the read, decode, display, function multiple times. During this looping the GUI stops responding and there is no option to cancel so I want to make it multi-threaded. So, is it safe to open the file in the GUI thread and then read from the file in the background thread? I currently use something like this to open the file once:

Dim fi As New FileInfo(filepath)
fs = fi.OpenRead()
and then in a separate sub multiple calls to:[code]..........

View 4 Replies

VS 2010 Multi-threaded But Using A Global COLLECTION Of Objects?

Mar 19, 2012

I've got a multi-threaded app - that is using a global COLLECTION of objects.I'm starting to think that objects - when copied to objects - are really just reference pointers to the "single object" in memory - as they would be in JAVASCRIPT (too many languages At any rate - this code - when taking the object from the collection to work with is it making a new object to play with or is it working the single object that actually resides in the collection?

[Code]...

View 16 Replies

.NET Multi-threaded Variable Access - (GUI, Controller, Producer, Consumer)

Jul 25, 2009

I have an application with 4 threads. (GUI, Controller, Producer, Consumer) The GUI is self-explanatory. The controller starts the producer and consumer threads after some intial setup. The producer creates items and places them in a free slot in a "ring buffer". The consumer takes items from the "ring buffer" and writes them to disk. The producer creates items at a much higher rate than the consumer. The consumer is IO heavy and IO bound. Currently I am checking a variable in each ring buffer slot to determine if it can be written to.

if Slot.Free then
Write Slot.Data To Disk
end if

I am not using lock/synclock instead I'm just reading / writing the value of the slot's "free" variable. I don't believe that is correct even though it is a volatile read/write. Is there a better method to read/write this variable? The variable is of type "integer" and is either 0 or 1.

View 5 Replies

Coding - Threads Vs. Tasks - Writing Multi-threaded Applications

Oct 1, 2011

I've been writing multi-threaded applications for a couple of years and have started reading about the Task class. It looks like it handles mutex and synchronous/asynchronous threading in an easier to follow fashion. I was just wondering if you the community likes writing threads the old way or the 4.0 tasking applications. Lastly, I thought multi-threading was parallel computing. But I was reading that there are special task etc. parallel functions.

View 2 Replies

C# - Catch Events In Multi-threaded Application That Can Be Watched By Main Thread?

Dec 4, 2009

I have a console application (VB.NET). When it is started, it spawns worker threads to find work in the database and do the task, then look for the next task (A workflow basically).

The problem that I have is that I have my Event Handler in the main thread that spawns the worker threads. Those workers, if they error, raise an event to a public delegate. However my main thread is not detecting these events, and I cannot figure out how to make it. My intention is to do all logging (text/database), email alerts, and restarting the worker to find another task that is not errored. (This will be expanded in the LogErrorMessage routine and such, for now I am just keeping it a simple Console.Writeline so that I can see if the method is being fired or not)

Here is the code around what I am trying to do:

Logger Class:

Public Delegate Sub LogDelegateError(ByVal Ex As Exception)
Public Class EventLogger
Public Event EventError As LogDelegateError

[Code].....

View 2 Replies

Make Label Visible On Main Form From A Multi Threaded Process

May 17, 2011

I am usng a multi threaded process to fire off a task, but when it is completed I want to make a label visible on the main form (form 1), eg "process completed", however the code I have in place comes up with the following error message;

Cross-thread operation not valid: Control 'lblCompleted' accessed from a thread other than the thread it was created on.

View 4 Replies

System.DirectoryServices Pegs Processor When Multi-threaded - Can I Lower The Burden?

Feb 23, 2009

My application takes the currently logged-in user and uses an a DirectoryServices.DirectorySearcher to pull a few additional detail about them (some properties we have stored in a few custom AD fields, as well as their email address). This works great, though I've always though it was a little slow - my single-threaded code could only make about 2-3 requests/second to AD.

The real problem came when I moved this code to a web server. With multiple simultaneous users, the number of requests/second jumps greatly, and the LSASS.EXE process pegs on my server. I've checked the domain controllers, and they're just fine - the bottleneck is clearly on the application side. I suspect that what's slowing my down is the NTLM/Kerberos challenge/response, and the number of simultaneous requests pegs even the multi-core processor.

Our network policy doesn't allow anonymous reads from AD, so that choice is out. Also, I've tried every member of "AuthenticationTypes" (in the example, I'm using .FastBind), but they all seem to have about the same throughput rate with the same load on the processor.how I might work around this restriction and lower my demands on the processor? Here is the code I'm using - pretty straightforward:

Dim sPath As String = "LDAP://" & stringUserDN
Dim entry As New DirectoryEntry(sPath)
entry.AuthenticationType = AuthenticationTypes.FastBind[code]......

View 1 Replies

Office Automation :: Multi-threaded Real-time Data Handling In Excel With COM

Jun 22, 2010

I have an Excel based algo-trading app that needs to take in lots of real-time data, and make trading decisions based on the calculations driven by the data. It is not one of those "read-only" stock ticker kinda spreadsheets.I created a COM object with VB.NET that runs in its own thread space which collects data from a socket, and when the data is read it raises an Event with data attached. In Excel VBA, the event handler parses the data, puts them to the right places on the spreadsheet to feed calculations (so far it sounds like a stock ticker app), and then, based on the results of the various calculations it does something.The problem is that when the user starts to click around the spreadsheet while there is large amount of data coming, the event handler's cell updating breaks apart. If the app is left alone without user action, it stands well. My frustration comes from not understanding what happens to the main thread when a user clicks around. Either the event handler blocks the user action, or the user action blocks the event handler (under which case I will put in some queuing facility). But I just don't see how user action can break the code (like causing VBA to stop executing)

View 9 Replies

Sending Multi-threaded SendEmail Request Returns General Mapi Failure

Mar 5, 2009

I'm using the MAPI code by Dave Brooks.I am attempting to programatically send out a Crystal Report that is generated.When I run through the code without threading everything runs fine. The problem is when I use threading I get the return error "General MAPI failure [2]".I have never used threading before and understand that there are dangers involved. Can anyone provide any insight into this issue? NOTE: I've removed exception handling to make the code clearer.[code]

View 1 Replies

What Exactly Is The "Multi-threaded Debug DLL" Runtime Library Option Doing In VS 2008

Mar 29, 2010

I have a solution in VS 2008 that creates a DLL. I then use that DLL in another application. If I go in to the DLL projects property pages and change the following configuration for a DEBUG build then the built dll no long provides the desired functionality. If I change it back and rebuild the DLL, then the DLL does provide the correct functionality:

[Code]...

View 3 Replies

.net - Missing ObservableCollection(of T)?

Oct 8, 2009

I'm doing an experiment on WPF and MVVM, and while coding the ViewModel on Vb.net I noticed this red wavy lines under my ObservableCollection(of T)s T_T

Anyway, the application is in WPF & VB.Net, under the .Net Framework 3.5 (I checked) and I have an 'Imports System.Collections.ObjectModel' on top of my class. Intellisense shows the other classes on System.Collections.ObjectModel except ObservableCollection.

Here's a screenshot.

So, why is ObservableCollection(of T) missing and how do I make it appear?

View 1 Replies

How To Sort An ObservableCollection

Jul 8, 2009

I have a WPF app which binds a System.Collections.ObjectModel.ObservableCollection to a listbox. This ObservableCollection contains instances of my own class (named DataContractsUserObject) and at runtime when I add an object to this collection it automatically appears in the listbox because of the binding. The problem is that it always appears at the bottom of the list and I would like it to appear alphabetically sorted as the existing items in the listbox are.So I tried to sort the collection by doing this after I add an item to it:[code]but of course that is not actually sorting the original collection is it, its just sorting a new instance that is in a Generic.List format. Whilst I probably could just do that and then set that new list instance back as the source of the listbox binding, that will cause all of the items to be reloaded (and when each item in the listbox is loaded it animates in, so it would look stupid having all items animate in again just because one has been added).

The ObservableCollection class itself does not have a Sort method and although I know how to implement my own comparison class (using IComparer) I dont know how to make this work on an ObservableCollection without doign ToList or ToArray etc.[code]Just found this that looks like it might be of some use url...

View 1 Replies

Serializing An ObservableCollection(of T) In .Net?

Oct 9, 2009

I'm trying out MVVM in VB.Net for a while now and started out with some of my entities using List(of T)s, which I xml serialized to disk. Now, I updated the classes used by the Lists to implement INotifyPropertyChanged so I also changed the List(of T)s to ObservableCollection(of T)s.After which, the XML serializer stopped working :'( A colleague told me that ObservableCollections, unlike generic Lists, are not serializable.If so then how can I make them Serializable?

View 2 Replies

.net - How To Sort A Observablecollection(of String)

May 21, 2012

All I need is a simple way to sort the strings in the collection. I can't find anything online. Everybody is using lamda expressions which I don't think works for just a string collection?

Public Property FilterCollection As New ObservableCollection(Of String)

From d In FilterCollection Order By (Function(d) d)()

View 1 Replies

.net - LINQ And Static ObservableCollection?

Nov 7, 2011

This will probably be a basic questions for the LINQ & architecture experts however I am failing to understand a problem i've encounted when trying to update a 'Static ObservableCollection.

Me.Grid1.ItemsSource = ContactList Me.Grid2.ItemsSource = From s In ContactList Where s.ContactTypes.Any(Function(t) t.ContactTypeName = "Christmas List")

If I add a new Contact with the ContactType "Christmas List" to the ContactList ObservableCollection, Grid1 reflects the additional Contact however Grid2 does not reflect the change unless I rebind.

Anyway to Reflect the change in Grid2 to show the new Contact with the queried ContactType

View 2 Replies

Bind Textbox To ObservableCollection?

Jun 15, 2011

I'm trying to get bind a textbox text property to an observable collection, and report changes back to the collection. The ContactLog property gets set from the calling page.[code]....

View 1 Replies

Wpf - .NET Using LINQ To Transpose An ObservableCollection?

Aug 11, 2010

I have a custom item class (basically two string values with associated properties), as below:

Public Class itmDataDetails
Private _strDataName As String
Private _strDataValue As String
Public Property strDataName() As String

[Code]...

Naturally, this doesn't work as x cannot be added to the ObservableCollection(Of itmDataDetails). Any suggestions on how to accomplish this? I don't know LINQ that well, so I wouldn't be surprised to discover I'm doing it wrong.

View 1 Replies

Wpf - Bind An ObservableCollection To A ComboBox?

May 10, 2012

How do I get even basic binding to work between a ComboBox and an ObservableCollection? I can't get anything but error messages.

VB:

Class MainWindow
Dim Units As New ObservableCollection(Of String)
Private Sub Window_Loaded(sender As System.Object, e As

[Code]....

View 1 Replies

Wpf - Bind More Than One ObservableCollection In XAML

Feb 4, 2012

How can I implement both of these ObservableCollections in my xaml? I want to have a listview with all my students, and another listview with all my teachers.For now I just made an example student and teacher object. Am I going about this the wrong way. Eventually I will pulling from a datatable, not sure how I would implement it to the ObservableCollection though.

Public Class PersonalViewModel
Public Sub New()
Dim obcollection1 As New ObservableCollection(Of Student)

[Code].....

View 1 Replies

Wpf - ListBox ObservableCollection Duplicating?

Aug 18, 2011

I have a WPF application which has a listbox bound to an ObservableCollection which retrieves it's data from a Database. I am attempting to have the ListBox data refreshed every minute through the use of a DispatcherTimer.

Dim dispatcherTimer As DispatcherTimer = New System.Windows.Threading.DispatcherTimer
AddHandler dispatcherTimer.Tick, AddressOf getRoomMeetingDetails
dispatcherTimer.Interval = New TimeSpan(0, 2, 0)
dispatcherTimer.Start()

[Code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved