|
You might want to look at this[^].
|
|
|
|
|
Hello all!
I have a couple of questions, half C# related, the other half, less C# related, but more related to embedding URL in C#, thank you for your attention.
I'm writing a console app (in C#) that is supposed to pop up the default mail software, fill in the recipients, subject and body.
this data is acquired from a txt file the app processed.
To do that I start a process (IEXPLORE)
and give it the @"mailto:...", A regex I created from the processed data.
problem is, the body of the text does not take \n seriously and well, basically I have one long line where five should be.
one of my questions is, how do I get a URL to produce a line break?
A second issue is that the app is also supposed to attach the attachments, whose full local path has been processed from the latter mentioned txt file.
i used the &attachments="c:\..." and well, no attachments..
Now for the more C# related part...
the app has two bi-products :
It opens a console windows which needs to be manually closed
IT opens an explorer window that needs to be manually closed
I am a novice programmer and still do not know much about threads.. I understand that I will have to use them somehow, could someone point me in the right direction?
Thank you in advance
modified 19-Mar-13 4:32am.
|
|
|
|
|
annex45 wrote: how do I get a URL to produce a line break
You don't. A URL is a continuous sequence of characters, and should remain so - plus, if you could break the line, where would you break it? Just because it fills a line of text on your monitor doesn't mean that it won't wrap when viewed on a tiny screen smartphone.
Now, as for threading, a simple way to spawn off your work is to use the Tasks Parallel Library (TPL). This[^] is a great place to get started.
|
|
|
|
|
To add a line break, you need to encode it using %0A :
mailto:test@test.org?subject=Hello&body=Line 1%0ALine 2%0ALine 3
Example
The simplest way to encode the data is to use the Uri.EscapeDataString method[^]:
string url = "mailto:test@test.org?subject=" + Uri.EscapeDataString(subject) + "&body=" + Uri.EscapeDataString(body);
You don't need to launch Internet Explorer to open the URL. Just use Process.Start("mailto:...") to open the registered handler for the mailto: protocol.
There is no option to specify attachments in a mailto: link.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
annex45 wrote: I'm writing a console app (in C#) that is supposed to pop up the default mail software,
I find that requirement a bit odd.
|
|
|
|
|
I have a query:
private IQueryable<MaterialModel> getMaterialQuery()
{
var query = (from mh in DataContext.MaterialHeaders
join md in DataContext.MaterialDetails on mh.MaterialHeaderId equals md.MaterialId
select new MaterialModel
{
Id = md.MaterialDetailId,
MaterialHeaderId = mh.MaterialHeaderId,
MaterialDetailId = md.MaterialDetailId,
SafetyLabelTextId = mh.SafetyLabelTextId.Value,
MaterialTypeId = mh.MaterialTypeId,
IncludeInSolventProgram = mh.IncludeInSolventProgram.Value,
IsDamagedByFreezing = mh.IsDamagedByFreezing.Value,
IsEquipment = mh.IsEquipment.Value,
IsMSDS = mh.IsMSDS.Value,
IsPPE = mh.IsPPE.Value,
IsTDG = mh.IsTDG.Value,
IsMiscellanousCost = mh.IsMiscellanousCost.Value,
IsSolvent = mh.IsSolvent.Value,
ItemName = mh.ItemName,
ItemNumber = mh.ItemNumber,
ProductTypeId = mh.ProductTypeId,
ProductUsage1Id = mh.ProductUsage1Id.Value,
ProductUsage2Id = mh.ProductUsage2Id.Value,
ProductUsage3Id = mh.ProductUsage3Id.Value,
ProductUsage4Id = mh.ProductUsage4Id.Value,
SafetyLabelRequired = mh.SafetyLabelRequired.Value,
WarehouseLocationId = md.WarehouseLocationId.Value,
Color = md.Color,
DiamondGritId = md.DiamondGritId.Value,
IsActive = md.IsActive,
IsDiscontinued = md.IsDiscontinued.Value,
IsNormallyStocked = md.IsNormallyStocked.Value,
FittingId = md.FittingId,
ShowOnJobLists = md.ShowOnJobLists.Value,
MinimumOnHandQuantity = md.MinimumOnHandQuantity.Value,
MSDSDescription = md.MSDSDescription,
PhysicalCount = md.PhysicalCount.Value,
PhysicalCountDate = md.PhysicalCountDate.Value,
RackingLocation = md.RackingLocation,
RackingNumber = md.RackingNumber,
SizeId = md.SizeId
});
return query;
}
I then call it like this:
public MaterialModel GetDuplicateMaterial(NewMaterialInfoModel NewMaterialInfoEntity)
{
var query = getMaterialQuery();
MaterialModel entity = query.Where(e => e.ItemName == NewMaterialInfoEntity.ItemName &&
e.MaterialTypeId == (int)NewMaterialInfoEntity.MaterialType &&
e.SizeId == NewMaterialInfoEntity.SizeId &&
e.Color == NewMaterialInfoEntity.Color).FirstOrDefault();
return entity;
}
On the NewMaterialInfoEntity the Color property is empty, and there is a null in the Color column of the table. Yet this fails to return the entity.
What am I doing wrong here?
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
My first thought is, that Color has a value 0 that is different from null. The next thought is, if Color is a reference type, == compares the references (as opposed to the content). You may have to call .Equals()
You could leave out the last condition for a test and check the Color value of the returned entity.
|
|
|
|
|
Color is a string property. I have tried leaving it out, and when I do, it works fine.
If it's not broken, fix it until it is
|
|
|
|
|
Caveat - I don't use Linq!
Presumably Colour is a string and it is choking on a null value, try comparing string.IsNullOrEmpty(Colour)
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
So to be on the safe side the last comparison shouldbe something like
(String.IsNullOrEmpty(e.Color) && String.IsNullOrEmpty(NewMaterialInfoEntity.Color))
|| e.Color == NewMaterialInfoEntity.Color
And don't forget to wrap the whole thing in parentheses to not trip over operator precedence when connecting to the other conditions.
|
|
|
|
|
I create a WCF web service that contains this method in service.svc:
public int positionGPS (_latitude string, string _longitude)
{
/ / Send the ordinate DB
DAL.GPSEntities bd = new DAL.GPSEntities ();
/ / Table of the database table position
Pos = new TablePosition TablePosition ();
pos.latitude = _latitude;
pos.longitude = _longitude;
bd.AddToTablePosition (pos);
bd.SaveChanges ();
/ / Add the code for the socket
/ /??????????
}
this method will be called back for a pda, gps coordinates
then they saved in the database.
my problem:
I want to know how to send these coordinates to another application winforms for tracing in real time in maps.
I know there is a method to use the socket, but I do not know how to apply in wcf, wcf then my service will be housed in the IIS server.
and in our case winforms application (the client socket that many) also PDAs.
and thank you in advance.
|
|
|
|
|
Try the WCF forum.
Use the best guess
|
|
|
|
|
Where is the WCF Forum here?
|
|
|
|
|
Do you see the menu on the left of this page?
Use the best guess
|
|
|
|
|
I am using the FTDI TTL 223 USB Cable.
(Specs here)[^]
It sends data properly at 115200 bps
I want it to do 921600
Anybody know the magic ? I haven't figured it out.
|
|
|
|
|
No TTL 223 just lots of 232s.
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
|
|
|
|
|
Maybe crimp the cable a little.
|
|
|
|
|
Amazing.
The drivers for UARTS SOMETIMES tell the truth, and SOMETIMES tell lies.
A bluetooth adapter plugged into a USB port will tell the system that the max speed is 115200
If you set the baud rate to 1200 (just to make sure, that's "twelve hundred", I didn't leave out a zero) the real speed will still be 921600.
In fact, C# and windows will not allow you to set a rate above 115200. No matter what port speed you set, you will still get data at 921600.
The drivers for this FTDI USB UART produce different observed behavior. Don't understand it, but for whatever reason, I AM able to place the number 921600 as the speed when accessing the wired UART using FTDI's cables, but NOT able to do this with a bluetooth adapter.
All the while, they will both have, evidently, the same speed.
Anyone who does not understand this is just not Hi-Tech
|
|
|
|
|
|
I ain't gonna download anything from mediafire.
|
|
|
|
|
The best wayy of getting an answer is to ask the author of the article directly by posting a message at the bottom of the article.
|
|
|
|
|
The problem that he didn't answered any Since 2011
Anyway could i do to help me with it ?!
than mediafire ?!
|
|
|
|
|
Post a question in the Q & A section, including the code where the error occurs and a brief description of what you have tried yet.
|
|
|
|
|
how can i make a double click event in listview??
i want when i make a double click event in a row in listview i want to appear another form with a listview that displays the row that i make doubleclick with more details about this row.
how can i make this ???
|
|
|
|