|
Well said that man. Maintaining an MDI App of any size is excruciating.
|
|
|
|
|
Thanks, not a bad suggestion. I think I'll do that, and also check whether any of the form's data in the data source has changed and if so, display a big red warning on the form that the data has changed and this form cannot be saved anymore - or something like that.
I'm surprised to hear you saying that MDI is not a popular format. What would be a popular format then for something like say a CRM applications? Say for instance, you're looking at the details of a customer and then, without having to close that customer and later opening it again, you want to see a list of orders that customer has placed. And then, without having to close that list of orders and later opening it again, you want to see the shipping details for a particular order.
MDI just seemed to me like the perfect format for this kind of application (and of course it brings with it all sorts of extra challenges). But I'd be interested to know what a more appropriate format would be.
|
|
|
|
|
It's not that MDI does not do the job, it is excellent for what you describe, however the management of MDI can be extremely challenging. In 20+ years of windows development I have only worked on 1 MDI app and have resisted the temptation ever since.
I think MS had a number of MDI apps in the late 90s and moved back to SDI, this also strongly influenced the SDI trend.
I am more restrictive and only allow modal dialogs, I often get the complaint that the user wants additional dialogs open at the same time, this I will sometimes do but they are only allowed to work 1 dialog/window at a time.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks, I'll keep that in mind for future projects. Who knows, maybe this is is that one MDI app that I will have developed after which I will resist the temptation Come to think of it, I have actually developed a MDI app before and it was bad.
I'd have to be honest though that I don't really agree with the argument that "you stay away from MDI because it's hard to implement", I'd be much more susceptible to the argument "you stay away from MDI because the user finds it confusing or difficult" and I'm not really sure if that is the case. Especially if you say that you often get the complaint that users want additional dialogs open at the same time.
Isn't that a bit like a car manufacturer saying "we don't have cruise control on our vehicles because it is difficult to implement"? If that is what the user want then that is what the developer needs to do, whether it's easy or not.
Imagine Microsoft Excel telling you, no sorry you can only work on one workbook at a time So, while Excel these days provide you with an option to view all open work books as separate instances of Excel or as different SDI children of a larger MDI application, I consider both to be some type of MDI - viz. multiple documents are open at the same time, all of which can be edited at the same time and any of which may or may not affect data on any of the other.
|
|
|
|
|
I don't stay away from MDI just b/c they are difficult to manage, and I don't dissallow my users from seeing multiple windows of information. I don't use MDI b/c I think SDI is a better solution, that solution is made up of many aspects, among them usability, time to deliver and ease of support.
Support is the biggest cost of any applcation, MDI complicates support - dramtically, especially if the IP for the app is lost when the developer moves on (I'm a contractor to corporates)
You also cannot let users run riot with requirements, as a senior architect part of my job is to reign in some of the more fanciful requests from the users. I still have an outstanding requirement for a Minority Report UI (based on Kinect maybe).
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
LOL. Minority Report UI based on Kinect, that is too funny! I've had some outlandish requests from users but this one takes the biscuit.
|
|
|
|
|
I have four Lantronix X-Port devices connected to my LAN. All of these devices communicates by port 30718, I want to retrive the devices IP-addresses. I used the UdpClient to send a broadcast on that port to find what ever responded. But I didn't receive any usefull information.
Here is my code:
using System.Net;
using System.Net.Sockets;
IPEndPoint broadCastIp = new IPEndPoint(IPAddress.Parse("255.255.255.255"), 30718);
string dataStr = "\0\0\0" + ((char)246).ToString();
private void BroadCast()
{
UdpClient udp = new UdpClient();
byte[] data = new UTF8Encoding().GetBytes(dataStr);
List<byte[]> bytes = new List<byte[]>();
udp.Send(data, data.Length, broadCastIp);
System.Threading.Thread.Sleep(481);
while (udp.Available > 0)
bytes.Add(udp.Receive(ref broadCastIp));
udp.Close();
}
This receives the MAC address from one of the devices and some other unknown data.
Actually I have no idéa how to receive each device's IP-address. Just for fun I installed WireShark to see what happened when I run the BroadCast method. In wireshark I got this information:
Source Destination Info
192.168.10.182 255.255.255.255 Source port: 55316 Destination port: 30718
192.168.10.165 192.168.10.182 Source port: 30718 Destination port: 55316
192.168.10.91 192.168.10.182 Source port: 30718 Destination port: 55316
192.168.10.61 192.168.10.182 Source port: 30718 Destination port: 55316
192.168.10.62 192.168.10.182 Source port: 30718 Destination port: 55316
This is what I'm looking for. It's the correct for IP-addresses for each devices.
So... is it possible to get those four IP-addresses in C#?
modified on Tuesday, February 22, 2011 5:28 AM
|
|
|
|
|
Interesting problem.
So, you broadcast 0,0,0,246 to the network, and this causes the devices to respond with MAC address and other info.
I *think* that this holds the answer:
while (udp.Available > 0)
bytes.Add(udp.Receive(ref broadCastIp));
The endpoint is passed by reference as it gets set to the remote endpoint:
while (udp.Available > 0)
{
IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 0);
udp.Receive(ref remoteEndPoint);
}
Regards,
Rob Philpott.
|
|
|
|
|
Kick ass! Solved problem!
|
|
|
|
|
Good stuff!
Regards,
Rob Philpott.
|
|
|
|
|
Yes:
DirectoryEntry computers = new DirectoryEntry();
computers.Path = "WinNT://MSHOME";
foreach (DirectoryEntry computer in computers.Children)
{
Console.WriteLine(computer.SchemaClassName + ":" + computer.Name);
if (computer.SchemaClassName == "Computer")
{
IPAddress[] localIPs = Dns.GetHostAddresses(computer.Name);
foreach (IPAddress ip in localIPs)
{
Console.WriteLine(" " + ip.ToString());
}
}
}
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
Hi All
I need your advice what is the best solution to handle data
I’m developing online logger application at windows that will be connected to hardware.
The application should handle heavy traffic data( could be up to hundreds of events per second)
The datagridview is active as viewer only (readonly).
I need to develop mechanism of insert the events to DB and display them in the datagridview.
I need your advice if this is correct approach?
I’m thinking of using the flow below
Init()
{
SqlConnection connection = new SqlConnection(connectionstring);
connection.open()
SqlDataAdapter adapter = new SqlDataAdapter("select * from TableName", connection);
DataSet ds = new DataSet();
dataGridView1.DataSource = ds;
);
}
AddRow(data)
{
//Add to database
string insertString = "insert into TableName (Field1, Field2) values (‘Value1’,’Value2’)";
// 1. Instantiate a new command with a query and connection
SqlCommand cmd = new SqlCommand(insertString, connection);
// 2. Call ExecuteNonQuery to send command
cmd.ExecuteNonQuery();
}
//each second the timer event occurs
Timer ()
{
adapter.Fill(ds,idxLastUpdatedRow,100/* update 100 records each time*/ ,tableName);
dataGridView1.refresh()
}
Thanks
Ronen
|
|
|
|
|
If you are talking about "hundreds of events per second" then do not even try to display them in real time: it will very quickly become a bottle neck. Display the last twenty: use a different thread to load the database and update the DataGridView from the UI thread on a timer. Who the heck do you expect to read hundreds of messages a second? I'm a reasonably fast reader (average novel in under two hours) but I wouldn't cope with that volume of data, and would go bonkers if I had to try from more than 30 seconds.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
OriginalGriff wrote: average novel in under two hours
Man your reading habit must be bloody expensive.
100s of rows a second, I don't think you could even focus comfortably on the data!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
It was, in space alone!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Digital man: "You are, in short, an idiot with the IQ of an ant and the intellectual capacity of a hose pipe."
|
|
|
|
|
I'm develop a online logger monitor,
i know the user could be able to read the db in the grid
The grid will be update each second with amount of data that I will define (such as 200 events)
i'm asking about the Implementation
ronen
|
|
|
|
|
I hope you're not expecting to have one app that does both the gathering and the displaying.
I recommend a Web Service to gather the data. The display app can also use the Web Service or query the database directly.
I (and several others here) dislike DataAdapters, DataSets, and DataGridViews. I recommend using a DataReader directly and a TreeView.
Don't put data access code directly in your GUI code; write a Data Access Layer.
Don't use concatenation to form your SQL statements; use parameters.
|
|
|
|
|
thanks for the tips
the apps should be run localy, can i stll run web service, the service should collect the data and insert to db?
i'm think of using several threads in te App (one handling the data recieving, one for processing and store in DB, and one for displaying
thanks
ronen
|
|
|
|
|
Ronenb wrote: can i stll run web service
Yes.
Ronenb wrote: the service should collect the data and insert to db?
Yes.
Ronenb wrote: several threads
Yes.
Ronenb wrote: one handling the data recieving
Querying from DB or Service
Ronenb wrote: one for processing and store in DB
No. That's done by the Service.
Ronenb wrote: one for displaying
That's the app's main thread.
By having a separate process for collecting and storing the data, you can have multiple clients displaying the data.
|
|
|
|
|
thank you very much for your input
|
|
|
|
|
How to check For duplicate Record Before inserting in Xml File Using C# .
Regards & Thanks,
Kuldeep Verma
Ass.IT Developer
|
|
|
|
|
|
hello
i have an educational software that should be installed on different PCs across the enterprise.
my program is using a 5000 text, xml, html files as source of it's content. i don't want my source to be tampered with, copied or used illegally. what i intend to do is to encrypt my source seperately and then put the encrypted files in a folder inside of my app so later my app can read and decrypt each file that is requested by user. the app will be installed and used anywhere.
but the problem is that to secure and store the encryption key inside my application i have to use a key container while as far as i remember(correct me if i'm wrong) they're machine based and can't be used on different machines while i need my key to be fixed for all the installed copies on any PC. i know a lot of softwares using such a architecture but i don't know how do they do that.
any idea?
|
|
|
|
|
When creating a Silverlight dependency property of type decimal (on my control) I got the following errors when setting a value in XAML:
Failed to create a 'System.Decimal' from the text '200.0'.
Failed to create a 'System.Decimal' from the text '200'.
SERIOUSLY? Is it THAT hard?
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
No. It sounds like your DP and/or XAML is wrong. You might want to post them .
|
|
|
|