Lots of good discussion and points have been raised thus far, but there's another consideration.. . WPF is less mature technology.
While it's certainly true that WinForms are "only" 9 years old, it's a natural evolution of the paradigm that defines Windows development from Windows 1.0* to VB6 through even today (non-.NET development). WPF is a fundamental shift from this paradigm.
Mature technologies will offer...
User Profile
Collapse
-
There is no "easy" way to do this in C#.
C# (and other .NET languages) are compiled into MSIL, and the Common Language Runtime (which executes MSIL) has no understanding of C#, VB, or any other .NET language. Interpreted languages (like JavaScript) have runtime engines that can understand and execute code.
That said, there are a few ways to handle this:
Write a parser/compiler for your specific...Leave a comment:
-
Difficult to say why "sensible" data isn't coming back without knowing anything about the devices, etc. However, if it's simply a 2-byte request followed by a 2-byte response, I would write code like this:
Code:mySerialPort.Write(new byte[] { 0x01, 0x05 }, 0, 2); while (mySerialPort.BytesToRead < 2) Thread.Sleep(100); byte[] response = new byte[2]; mySerialPort.Read(response, 0,
Leave a comment:
-
The System.IO.Ports will be able to help you here. The main class in this namespace is SerialPort.
Opening, reading/writing, and closing is pretty easy.
Code:bool continue = true; SerialPort mySerialPort = new SerialPort(); mySerialPort.PortName = "COM1"; mySerialPort.BaudRate = 9800; // ... mySerialPort.Open(); while (continue) {
Leave a comment:
-
Yes, your admin program would simply use the Send method, which you'd obviously code for. Dont' forget about authentication, since you don't want just anyone to tie into this admin hook.Leave a comment:
-
You cannot accomplish this with a switch statement, and you will instead have to use an if/else construct.
Code:if (e.KeyCode == settings.hotkey1) MessageBox.Show("Hot Key 1"); else if (e.KeyCode == settings.hotkey2) MessageBox.Show("Hot Key 2");
...Leave a comment:
-
To clarify on insertAlias' point (great insight, btw)...
There are definitely no memory leaks involved here. Consider that the following two snippets of code are functionally identical.
Code:// With Named Delegates void Initialize() { btnSave.Click += btnSave_Click; } void btnSave_Click(object s, EventArgs e) { DoSave();
Leave a comment:
-
Windows Live Messenger ("Client") connects to publically-accessible Microsoft server. The Client stays constantly connected and, essentially, listens for messages from the Server.
One way to do this would be with a UdpClient:
Code:var client = new UdpClient(12345); // Local Port 12345 client.Connect("yourserver.com", 67890); // Remote Port 67890 var remoteEndpoint = new IPEndPoint(IPAddress.Any,
Leave a comment:
-
Can you elaborate what you're looking for?
A CRC64 algorithm produces a 64-bit number from any amount of data. You can't "reconstruc t" any amount of data from 64 bits.Leave a comment:
-
I didn't look at the source code; the problem, however, appears to be that the directory you're trying to write the file to does not exist.
I understand you have "newobject.newD irectory" being created, but I suspect that the path in newobject.newDi rectory is different than the path being created by the file.
Have you tried debugging or setting breakpoints where the file is (trying to) be created?Leave a comment:
-
From which system are you executing this query from? For example... are you just using like SQL Query Management Studio? Or, do you have a web application connecting to SQL?Leave a comment:
-
Can you be more specific on the requirements?
There are commercial billpay services avaiable: submit an invoice number, mailing address, and dollar amount, and they debit your account and mail a check. Banks contract with these companies and integrate their online banking software so that they can provide customers with the service.
You could customize their accounting system to interface wtih billpay companies... or,...Leave a comment:
-
The biggest problem you will run into is NAT and firewalls. For example, at work, we have a single public IP address that is NAT'ed to 50+ computers. Even without a firewall, there would be no way for your server to talk to one of our computers: the IP belongs to the router.
So, the only way around this is to have a client program (inside of a private network) open up a communication channel with your server (accessible via public...Leave a comment:
-
Based on the exception being thrown (DirectoryNotFo undException), the problem is the same: you are trying to create a file in a directory that does not exist.
Before creating the file, just make sure the directory exists. You could even create a simple helper method to do this.
Code:void CreateFileAndDirectory(string fileName) { if (!Directory.Exists(Path.GetDirectoryName(fileName)) Directory.Create(Path.GetDirectoryName(fileName));
Leave a comment:
-
There is no easy or feasible way to do this.
If you want other programs (explorer, notepad, hex editor, etc) to be able to read and see these as "files", then you will need to create something at the operating-system level. That means a driver (specifically, a storage driver)... which even experienced/expert developers find daunting.
If you want to see what the driver path is like, here's a good start http...Leave a comment:
-
Do you have access to that path?
If so, the file could already exist.Leave a comment:
-
You didn't tell us which line the error was occuring, but I would guess it's here.
Code:// this creates the file (i.e. My Documents\New Project\New File.txt) System.IO.File.Create(@newFile);
Code:using System.IO; ... if (!Directory.Exists( Path.GetDirectoryName(@newFile)))
Leave a comment:
-
There is no easy way to do this.
Based on VARCHAR2 in your code, it looks like you're using Oracle, and their CREATE TABLE statement is a complete beast.
In order for you to get table names, column names, etc., you would first need to write a parser. There are some great tools avaiable for this (GOLD Parsing System comes to mind), but it's still a ton of work.Leave a comment:
-
This happened to me at least once or twice.
I wish I could be more specific as to how or why, but as I recall, the problem was that the project file got munged somehow. Looking at the XML of the .csproj, there were a whole bunch of publishing settings that were added, but that I couldn't change/modify from the UI.
The way that I solved it was reverting to a previons version of the .csproj file and re-adding in whatever...Leave a comment:
-
Good point, NeoPa. To add to my previous reply...
An AFTER UPDATE trigger on table that updates the same table (a "direct recursion") will not, by default, trigger itself. However, if you were to set the database option RECURSIVE_TRIGG ERS (I don't recommended it), then a direct recusion could occur, allowing for the trigger to trigger itself. This would then cause a stack overflow error, or as SQL Server calls it, "exceeding...Leave a comment:
No activity results to display
Show More
Leave a comment: