|
What are your thoughts on updating the ui like that would it be better to load all of the data into a class and update the ui from that
Humble Programmer
|
|
|
|
|
I think that goes without saying. But using MVC or MVVM doesn't preclude performing the data fetch asynchronously.
/ravi
|
|
|
|
|
I am not familiar with MVS MVVM...
I am referring to winforms I don't know if that makes a difference or not...
Humble Programmer
|
|
|
|
|
MVVM = Model View View-Model
Model = "class" (what holds the data)
View = "ui" (what presents the data)
View-Model = "ui class" (adds properties and such to a model so it plays well with the view)
Of those, the view-model is probably the most difficult to understand. For example, if you had a TreeView (a "view" component) that presented Animals (the model/class), you'd use an AnimalNode that both holds a reference to an Animal (exposing all it's properties) and has properties such as "IsSelected" (a view-centric property that needs to be stored somewhere, in this case on the view-model).
That's the high level... but to answer your question, yes it's a good idea to store data in instances of a class and then present that using a ui. I recommend loading all the data into an intermediate collection on a different thread, then call back to the main thread to present all that data in the view. Depending on the scenario, you may want to present the items in a streaming manner rather than after it's completely loaded (streaming = slower, but user gets first results faster).
|
|
|
|
|
Pretty much any lengthy processing should be performed on a separate thread.
|
|
|
|
|
I am using this code when for activated to get the URL address but the Messagebox keeps poping up when user clicked Yes or No.. why it's not returning? where is my mistake?
private void frmLinksEntry_Activated(object sender, EventArgs e)
{
string url_address = Clipboard.GetText();
if (url_address != string.Empty)
{
try
{
System.Uri xx = new Uri(url_address);
}
catch (FormatException exp)
{
return;
}
if (MessageBox.Show("Do you want to use the selected URL?", "Link", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
txtURL.Text = url_address;
}
}
}
|
|
|
|
|
You have shown a handler for the Activated event which will be called whenever the frmLinksEntry control receives focus. It's a bad idea to pop up a messagebox from the handler as this causes the control to lose and then regain focus. The Activated event fires again and the messagebox reopens etc etc etc.
Alan.
|
|
|
|
|
but that's what i want, i mean when the user go to copy the URL from the browser then comes back to my application with the URL in clipboard and the frmLinksEntry active it should ask if he wants to use the copied URL?!
|
|
|
|
|
If the URL you get from the clipboard is the same as the URL in the textbox, then do not show the dialog again.
|
|
|
|
|
but it's not the same! the textbox is empty already!
|
|
|
|
|
I didn't say anything about the textbox being empty.
|
|
|
|
|
How can I apply bullets or numbering for the selected text in Rich Text Control using C#? and how to make the selected numbering 2 if there is a previous numbered 1?
|
|
|
|
|
I am trying to create Microsoft Word Document in C# using [this article] and other articles but it's not working! the Word.Application is not recognized! do I have to add a using declaration as well?
|
|
|
|
|
How do you expect anyone to give you a solution if your only symptom is "It's not working"?
Alan.
|
|
|
|
|
Read the article again; point 3 explains how to add the reference.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
thanks it's working now but one question... where can i get a a step-by-step or reference on how to create full document including tables and pictures and font formatting using C#?
|
|
|
|
|
jrahma wrote: where can i get a a step-by-step or reference
You will have to read the documentation on MSDN, and also try searching Google. There is no universal index of this sort of thing and people tend to publish articles on lots of sites. I doubt that you will find a full step by step guide to what you want though.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
so you mean there is no reference guide for it?!!
|
|
|
|
|
As I said before you can go through the MSDN Documentation[^]. If you want to get familiar with Microsoft technology you need to use MSDN as your prime source of information.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Does anybody know how to do this with the information entered in
this format? ##.####
I thought it might be in the Math class but isn't.
Thanks for any help.
|
|
|
|
|
Darrall wrote: I thought it might be in the Math class but isn't.
Wikipedia does http://en.wikipedia.org/wiki/Geographic_coordinate_conversion[^].
Tarakeshwar Reddy
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|
|
It's not a built-in function, but it's certainly not hard to do the arithmetic.
Subtract the int part of ##.#### from the original. The remainder will be .####. Multiply that by 60 and again take the int part of the result - that's the minutes. Subtract the minutes from the result of the first multiplication, then multiply the result by 60 again. The result is the seconds, though there may be a decimal part in the result if the original datum wasn't an integral number of seconds. You can remove that if you don't want it by again taking only the int part of the result.
I don't yet have enough experience with the language to suggest the syntax - for all I know, Convert.ToInt() might round, rather than truncate real values. If so you'll have to try another dodge. But it shouldn't be too difficult to manage. It's such a frequent problem, though, that I'm rather surprised that MS didn't include it as a stock function.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Thanks Roger. I know the conversion itself is simple if you're sitting there doing it on a calculator. It becomes fairly complicated using C# code though which is why I was surprised there wasn't already a Math function for it. They have sin, cos and tan which all work in angles and in the real world - surveying, mapping, navigation, etc. - angles come in degrees, minutes and seconds.
I will pass my method along once I have finished it in case anybody else wants it.
Thanks for your feedback.
|
|
|
|
|
Hi,
I'm looking for some help implementing an issue i have.
main purpose is aggregating information from DB
I get data from a DB, and that table has 2 primary keys.
for each pair (primary key) i create an object that holds all the information, and after all the DB is read, i take each object and put its information in a different DB table.
I need to clarify that performance is very important, dealing with about 1milion rows every time.
The issue im having is how to hold that info. I tried using a Dictionary, the key being Pair<T,U> (simple object i created).
however, when using Dictionary.contains() didnt recognize 2 similar Pairs, and created a new 'similar' object instead of returning the one already existing.
I am not sure if I should implement Icomparable,
or maybe there is a different way altogether that might be better.
Thanks for your help
|
|
|
|
|
If the fields are primary keys in the DB, shouldn't they be guaranteed unique?
But anyway, IComparable isn't what you're looking for... That's to determine magnitudes, not equality. You want to implement IEquatable<T> ... Just try to make the implementation of that as efficient as possible.
|
|
|
|