FINALLY!!!! Got it working---I called Prog.Dispatcher.BeginInvoke(Sub() LoopPercent(byval x as integer, byval MyVM as ProgressBarDialogViewmodel) inside the player generation loop...don't have it bound via UI, but its working by directly updating the progress.Value inside the Loop...now I need...
I did, but I must have changed it in the program after pasting it once it threw an error and then forgot to change it here.
Anyways, I have somewhat figured out what is going wrong.
I have a third moving part involved.
I have a GeneratePlayers Page, the ViewModel and then the...
Created a new ViewModel and have it exactly as you do, bound using <Window.DataContext>. Previously had it set in the code behind which I didn't show in my example, sorry for the confusion. Still not working. I did get the Progress Bar Window to be responsive by Calling the Button Click Event...
Its no problem, I am always wanting to learn everything I can, so I will keep this for use in a Winforms or non-WPF environment...
I'm still confused as to why the UI thread is unresponsive even as I have a separate Task running for it...
Well, its still not working. Both UI and the new ProgressBar Window are unresponsive.
The ProgressBar task is running, the PlayerCount and PercentDone is updating properly, its just not displaying the updated values on the ProgressBar.
Here is the code in the GeneratePlayers Class---moving...
This was designed to be more of a quick and dirty type project to give the testers something to work with so they could test out the results from the player generation process and give me feedback, so I suppose I am trying to reverse engineer it to work in a way that I shouldn't be...I use MVVM...
Awesome! Thanks so much...
Now my question is going to be how do I get the value out of the secondary thread, because I need the value from there to know what percent the progress bar should display... Here is the Secondary thread where I need to take the value of x and NumPlayers to calculate...
Yes, I realize that, I actually created a separate window for the Progress Bar, but the issue occurs because I'm still getting the result from inside the secondary thread which blocks it from being able to use it...
It's the first foray into multithreading so I know I am asking a lot of dumb...
OK gotcha...using a background worker per your example...
One last issue I am having is that I need to get the current value of "x" in the player generation sub to be able to know the value that should be updated, so I would need to call the worker from inside the secondary thread...however...
Isn't Creating another task for the ProgressBar giving it its own thread? Or is it simply adding another task to the same thread?
Is it possible to do this via a Task instead of a background worker?
Is it not possible to simply do this via a UI Binding to a INotififyPropertyChanged Property...
Not sure what I am doing wrong, but I can't get it to work. I am doing a CPU intensive task where I am creating a large number of players for a football game I am making, and I am using the Task.Factory.StartNew method to run it on. I then create a separate task for the Progress updater but I...
The vertical and horizontal scrollbars are showing on my DataGrid, but they don't actually do anything when you click on them. They appear grayed out and do nothing. I have seen some code where I have to encapsulate the DataGrid in a Scrollbar viewer and/or ScrollBar but as of right now I...
You are exactly right...
I went and clicked on view all references and it showed two. I clicked on the second one and it pulled up the XAML I had written where I had Click = "OpenDB_Click" in addition to having a handler written. Once I removed this, it worked as it should, only opening...
Not sure what the issue is, I am working on a project in WPF, and have the following code for a OpenDB Button.click event handler:
Private Sub OpenDB_Click(sender As Object, e As RoutedEventArgs) Handles OpenDB.Click 'Allows user to choose which DB to open
Dim MyOFD As New...
Thanks, I used the wrong terminology because its exactly as you have it with the inheritance...
I ended up figuring it out and getting to work exactly the way I needed it to...
Basically I did this:
Football Namespace
Public Class Form1
Public XCoach as new Generation.Coach
Sub Main()
for i...
Working on a football game and I have the following classes for Generation of players, coaches, etc.
Person which contains child classes Personnel and Players, and then Coaches and scouts which are child classes of personnel. Here is the issue I have. Inheritence is set up properly
I would...
I have tried every method you can to do it, it still is always returning the time along with it.
I have tried Date.toshortdatestring()
I have tried Date.tostring("d")
Nothing works...still getting the time afterwards...I know I can just remove it but I am just curious as to why the method is...
Bad choice of words, but you got what I meant. Actually found this right before you posted by I like the ({0}) you had better...I always forget about that and just concatenate strings with the & symbols...
Had to stick VALUES directly after Tablename or else it thought they were columns, but it...
Ok, I have a very specific situation that this would be useful for.
I have a DataTable with a large number of columns(200+) that I am doing a bulk insert for in SQLite, since it does not support Update Table like SQL Server does.
I want to know if there is a way after I iterate over all the...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.