|
I'm trying to put together an enhanced message box that acts as a progress view with a timeout.
Here is the idea:
I call a Dialog box that displays my title and a progress bar. It progresses the bar once a second to show that it is doing something. It also calls my routine, which will do it's thing.
If the progress times out, then kill my routine and say "Operation Timed Out", with an OK button. Clicking on the Ok button returns DialogResult.Cancel (to say the operation failed)
If my routine returns successfully, then return DialogResult.OK and remove the dialog box. (No interaction with the user required).
The main idea is that I can do some network operations in the background, show the user progress in a pop-up box, and have a network timeout - all in one package.
Has anyone written one of these, or have suggestions on where I should start?
Progress thus far:
I have the dialog box nicely written (with delegates so I can update the progress bar and associated messages). I'm not sure on how to move forward with the timeout stuff.
|
|
|
|
|
ahall@mirapoint.com wrote: Has anyone written one of these, or have suggestions on where I should start?
http://www.codeproject.com/cs/miscctrl/progressdialog.asp[^]
ahall@mirapoint.com wrote: I'm not sure on how to move forward with the timeout stuff.
Add a timer to the dialog!
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
EdLast modified: 12 June 2006 14:07:39 --
|
|
|
|
|
The progress dialog mentioned was pretty good code and gave me a lot of what I needed.
Adding a timer, and a background worker finished it off. Generically, it might take a little more work, but not much more.
Thanks for the pointers.
|
|
|
|
|
Thread title doesnt really explain this question to well. Hopefully this will make things a little clearer:
Lets say I have the following classes
class MyBase
{
string str1;
public MyBase(string str1)
{
this.str1 = str1;
}
}
class MyChild : MyBase
{
bool b1;
public MyChild(bool b1, MyBase baseData)
{
this.b1 = b1
???? = baseData
}
}
Without writing reams of code to explicity do it, is there a way of getting the MyChild constructor parameter baseData into the base instance of the MyChild object?
|
|
|
|
|
Maybe you're trying to do this?
class MyChild : MyBase {
bool b1;
public MyChild(bool b1, string str1) : base(str1) {
this.b1 = b1;
}
}
Logifusion[^]
|
|
|
|
|
First of all, The object of the child class contains the portion of data from the base class. You can replace that portion with any object of the base class, but your MyChild code is not working the way you anticipated.
I think you are confused about how to handle class relationship. There are two approaches here:
1) inheritance ("Car is a Vehicle")
2) composition ("Car has an Engine")
MyChild class code looks more like composition relation, namely, it contains an object of MyBase. The code should be something like this:
class MyChild
{
public MyChild(bool bl, MyBase baseData)
{
this.bl = bl;
this.baseData = baseData;
}
private bool bl;
private MyBase baseData;
}
- It's easier to make than to correct a mistake.
|
|
|
|
|
I am using a DataGridView to display a List of objects that change frequently (at a rate of up to 4 times per second.) I am using a BindingSource as the DataSource for the DataGridView and on every datachange event I set the BindingSource's DataSource to the List of objects. This results in a bunch of flicker.
I attempted to fix this using SuspendLayout and ResumeLayout, but haven't seen a difference. Any ideas?
|
|
|
|
|
Andrew Stampor wrote: I am using a BindingSource as the DataSource for the DataGridView and on every datachange event I set the BindingSource's DataSource to the List of objects.
What event do you mean by "datachange event"? Unless you're getting an entirely different list object than you were previously bound to, why are you setting the BindingSource's DataSource multiple times?
--
I've killed again, haven't I?
|
|
|
|
|
Thanks for your reply. I've changed the way I am trying to do this, but am not getting an update like I would like.
What I am now doing is maintaining a List<CSomeObject>. That List is assigned as the datasource for the DataGridView. What I am noticing, though, is that when I update a value in one of the CSomeObjects that is part of the List, the value doesn't change on the grid until I click on the grid. Do you know what I am missing?
|
|
|
|
|
Ahh, the List<t> class implements IList, and not the IBindingList interface. IBindingList fires a ListChanged event that informs the BindingSource to which it is bound, and subsequently the DataGrid to which that BindingSource is bound, that it should update. IList fires no such event, so the BindingSource never knows that it should update itself.
My solution to the same problem was to create a class that derives from System.Collections.CollectionBase and implements IBindingList, and use it in lieu of an IList-based List.
--
I've killed again, haven't I?
|
|
|
|
|
Hmmm... would this refresh only the changed cells in the grid, or does it refresh the whole thing anyway?
|
|
|
|
|
If I'm not mistaken, I believe it refreshes the row containing the element that was changed.
--
I've killed again, haven't I?
|
|
|
|
|
OK... I've changed the List to a BindingList, but when I make changes to the Properties, it doesn't update on the DataGridView. Is there a way I can trigger that event?
|
|
|
|
|
There are probably a few ways to do it. My collection objects trigger the ListChanged event via a call to the collection class that contains them.
--
I've killed again, haven't I?
|
|
|
|
|
Instead of creating my own implementation of the IBindingList interface, I used the BindingList class. When I was updating the properties of the objects in the list, it was not triggering the ListChanged event. When I looked at ListChanged in help, it mentioned that it will only be fired by items in the list that implement the INotifyPropertyChanged interface.
I added INotifyPropertyChanged to my object class and had it trigger the PropertyChanged event when one of the properties I was interested in changed. This resolved both the issue with the grid not updating and the flickering issue I was having before.
Thanks for all of your help. You never mentioned the INotifyPropertyChanged interface, so if you haven't heard about it until now, I'd suggest giving it a look.
|
|
|
|
|
Glad to be of help!
I've never used INotifyPropertyChanged. It looks like that would get me the same effect as the manual way without having to register the collection class to the collected object. Learning is fun! Thanks!
--
I've killed again, haven't I?
|
|
|
|
|
As far as the flickering goes, i think you should just enable double buffering. Here'a an example for a data grid:
public class myDataGridClass : DataGrid
{
public myDataGridClass()
{
this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint , true);
this.UpdateStyles();
}
}
Then, instead of using a DataGrid object you would simply use a myDataGrid object that has the DoubleBuffer flag set to true.
|
|
|
|
|
I have a comboBox with some data from a database (the comboBox is populated from the wizard). let's say I add some more data in the database. How can I refresh the data from the comboBox? Do I have to add the new data manualy?
Thanks!
|
|
|
|
|
If the combobox is databound, it will automatically update from your dataset.
|
|
|
|
|
ok, then how do I refresh the dataset?
|
|
|
|
|
IF the dataset is untyped you fill it in yourself using Datarows.
If you've typed it to a database, you use DA.Fill (dataadapter.fill)
|
|
|
|
|
Hi,
Does anyone know of an open source .NET diagram framework that provides Visio like capabilities?
I used GoDiagram in the past, and it was very good (in a commercial product), but it is a commercial product and I need diagrammatic capabilities for a non commercial project.
Thanks
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
-- modified at 11:17 Monday 12th June, 2006
|
|
|
|
|
|
Hi Senthil,
Very impressing! (You can always count on CodeProject members )
Thank you, I am looking at it right now.
Looks like a good candidate to start with.
Yuval
"The true sign of intelligence is not knowledge but imagination." - Albert Einstein
|
|
|
|
|
hi all,
i want to parse this text:
******************** CASE OPENNING RECORDS OF 80 ENTRIES ********************
***************** (MONTH/DAY-HOUR:MINUTE:SECOND-#AUTHORITY) *****************
------------------------------- CASE NO: 8888 -------------------------------
05/12-17:25:05-#3 05/12-17:24:56-#3 05/12-17:24:44-#0 05/12-17:24:32-#3
05/12-17:24:22-#3
---------------------------------- DATA END ---------------------------------
and get values as:
8888
05/12 17:25:05 #3
05/12 17:24:56 #3
05/12 17:24:44 #0
05/12 17:24:32 #3
05/12 17:24:22 #3
help please ?
|
|
|
|