|
Depends on the body. It might be HTML, or it might be plain text. It would be an odd email if it were just a set of fields separated by colons.
If that were the case, then yes, you're close.
string[] fields = value.Split(':');
string s1 = field[0];
string s2 = field[1];
etc. etc.
Regards,
Rob Philpott.
|
|
|
|
|
Hey Rob thanks for your answer.
ok so i'm using the right methode.
with :
System.Console.WriteLine(string.Format("Html Body:{0}", items.HTMLBody));
System.Console.WriteLine(string.Format("Text Body:{0}", items.Body));
i can even get .txt or html body, i chose txt body to avoid using Regular-Expressions !
my body look like:
---------
txtetxtet xt etxte txte txtetx tetxte txte txt etxtetx tetxtetxte
txtetxtetxtet xtetxtetxtetx tetxtetxtetxt etxtetx tetxtetxte
txtetxte : ............
txtetx tetxtetx tetxtet xtetxt etxtetxtet xtetxtet xtet xtetxte
txtetxte:....................
txtet xtetxtetx tetxtetxtet xtetxtetx tetxtetx tetxtet xtetxte
txtetxtetxtetxtetxtetxtetxtetxtetxtetxtetxtetxtetxtetxte
txte txtetxt etxtetxtetxtetx tetxte txtetxtet tetxt etxtetxte
txtetxtextetxte:....................
---------
i can use ?
....
string[] fields = value.Split(':');
...
thanks,
Thim
|
|
|
|
|
Need to explain the content a bit more. What are the field delimiters?
A colon appears to be one, is a new line (CRLF) another?
Regards,
Rob Philpott.
|
|
|
|
|
Hi Rob ,
The field delimiters are ' : ' (colon)
so i'm working on
string mybody =item.body and use Methode
Split() To look over my custom Fiels(Text Qualifier), but unfortunately i have some issues.
my text body look like:
Titel : MYPROJECT
Subject: NEWPROJECT
---------------
---------------
Manager:MYMANGER1
-------------------
---------------
with :
string title=bodyContent.split(':')[1]
I can already read 'title'. but when looking at the content of 'string title', it contain the next texte value!.
I get : title=MYPROJECT Subject:
instead of just:
title=MYPROJECT
and the same for the others fields.
How can i stop reading when found and read the value of the first colon ':' , I thought about using Readline(), but i know, i'll miss some line to read.
an others suggestion ?!
thanks a lot.
thim
Thim.
modified 22-Jul-14 9:02am.
|
|
|
|
|
Hello I have a problem with update of binding of a label.
I have this simple class:
public partial class frTest : INotifyPropertyChanged
{
private string _message;
public string Message
{
private set
{
_message = value;
OnPropertyChanged("Message");
}
get
{
return _message;
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName = null)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
public frTest()
{
InitializeComponent();
DataContext = this;
}
private void WindowLoaded(object sender, RoutedEventArgs e)
{
Message = "test";
txtDevQty.Text = "1000";
txtDevQty.TextAlignment = TextAlignment.Center;
txtDevQty.IsEnabled = false;
}
private void BtnNextClick(object sender, RoutedEventArgs e)
{
for (int i = 0; i < 1000; i++)
{
Message = string.Format("Tested {0} of {1}", i, 1000);
Thread.Sleep(10);
}
}
}
I have in the xaml code a label with content binded to Message value
<Label Name="lblHint" Content="{Binding Message}" HorizontalAlignment="Center" FontFamily="verdana" FontSize="11" FontWeight="Bold" Foreground="Black" Grid.ColumnSpan="2"></Label>
The problem is that when i launch the BtnNextClick function,i see the label updated only at the end of procedure,and what i would like is to see updated in every cycle the content of the label....
How can I do?
I think it's a problem between my form and the ui thread?
Thanks in advance
Best regards
|
|
|
|
|
The reason you're not seeing anything is because your Thread.Sleeps are locking the UI thread. If you want to see the labels, simply wrap the loop up like this:
Task.Factory.StartNew(() =>
{
for (int i = 0; i < 1000; i++)
{
Message = string.Format("Tested {0} of {1}", i, 1000);
Thread.Sleep(10);
}
});
|
|
|
|
|
|
Only if you want to pause your thread long enough to actually see the update. If you remove it, you'll flood the UI with notifications.
|
|
|
|
|
I have tried but unfortunately using task don't solve my problem...
Because my code is a little bit different of what i wrote...
With this code the update of the label start only when all the iterations of the for (for (int j = 0; j < 10; j++)) are completed
public partial class frTest : INotifyPropertyChanged
{
private string _message;
public string Message
{
private set
{
_message = value;
OnPropertyChanged("Message");
}
get
{
return _message;
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName = null)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
public frTest()
{
InitializeComponent();
DataContext = this;
}
private void WindowLoaded(object sender, RoutedEventArgs e)
{
Message = "test";
txtDevQty.Text = "1000";
txtDevQty.TextAlignment = TextAlignment.Center;
txtDevQty.IsEnabled = false;
}
public void DoSomething()
{
var a = 0;
for (int i = 0; i < 2000000; i++)
{
a++;
}
}
private void BtnNextClick(object sender, RoutedEventArgs e)
{
for (int j = 0; j < 10; j++)
{
DoSomething();
Task.Factory.StartNew(() =>
{
try
{
for (int i = 0; i < 1000; i++)
{
Message = string.Format("Tested {0} of {1}", i, 1000);
Thread.Sleep(10);
}
}
catch (Exception ex)
{
}
});
}
}
}
|
|
|
|
|
And what else would you expect it to do? You aren't actually starting to update Message until you have completed the other loop. Just drop your outer loop into the task factory.
|
|
|
|
|
I cannot do it because in reality my DoSomething function do some work and start a thread that do some long operations.
For this reason i need to update the label for have a feedback of where is my routine arrived
|
|
|
|
|
Look, I cannot read your mind about what you are trying to do. You cannot keep drip feeding things through. It's simple enough, you need to update your label text from a none UI thread, so you can simply spawn that off in its own TaskFactory. In your example, you aren't starting off the update of the label until you have completed DoSomething. Step away from the keyboard right now, and actually design the interactions you need rather than throwing things on here that don't actually match what you're trying to do.
|
|
|
|
|
Hello there,
I have a C# application and with in a thread am popping open another form using the ShowDialog() function. For some reason the form is not displayed as MODAL. I tried passing "this" and obviously that causes a problem as it cannot be used within a thread.
The main C# application is a MDI and has multiple forms embedded in it.
How can i make this form MODAL?
Thanks!
|
|
|
|
|
Don Guy wrote: I tried passing "this" and obviously that causes a problem as it cannot be used within a thread. The dialog should be created (and would then be owned) by the main-thread. You could pass the entire mainform to the thread as an argument, and when the dialog needs be shown, use the mainform to invoke[^] the code on the mainthread.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi. I`m starting programmer in C #. I have a task to automate OpenOffice. I need to create reports OO Calc on fly. Anyone can help me?
Win 7 x32, VS2010 C#
|
|
|
|
|
You haven't given much to go on really. So I would suggest that you have a read of this TblProc: OpenOffice Calc and Excel[^]
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
You need to include some component (COM, LibOpeOffice).
From my expirience I can't advise you COM for OpenOpeffice automation. I'm using LibOpenOffice. Look here http://4k.com.ua/products/others/libopenoffice
|
|
|
|
|
Hi,
I would like to ask about the magnetic strips on the cards?
How can I read the data?
is it just a raw data just like the bard code and I have to split it? or it's encrypted and needs special way to read?
Technology News @ www.JassimRahma.com
|
|
|
|
|
Depends on the card, depends on the reader.
What are you trying to do?
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
I am trying to do a loyalty card. I don't have anything yet
I will purchase zebra printer with its encoder but I want to develop the application which will read the magnetic stripe and do the required task accordingly.
Technology News @ www.JassimRahma.com
|
|
|
|
|
Then talk to the manufacturers and see what they can provide!
They may do several versions...
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
you mean there is no standard way of storing the data on magnetic stripes?!
Technology News @ www.JassimRahma.com
|
|
|
|
|
It's not the data side you need to worry about, it's the API for the reader. You aren't actually be reading the card, the reader does - what you need to do is interpret the output from the reader.
|
|
|
|
|
One interfaces with the "card reader"; which could be a USB device; which is opened and read (when armed) as a file stream.
The card's strip would contain some fields and "tracks" of data at particular offsets in the card reader "file".
You need to extract the required fields (using offsets and lengths), wrap them as strings in a "transaction", and typically send them to a "payment processor" (or whatever) via a web service.
The data is encrypted; the client does not decrypt it; it is sent "as is" (with say a $ amount) to the credit card data processor who decrypts the credit data; verifies it; approves the transaction; or declines it; by sending a web service response back to the client.
|
|
|
|
|
HI,
I am facing an issue , from my client side (HTTPS browser) I am trying to connect a HttpTaskAsyncHandler in the project
Eg:
var webSockets = new WebSocket("wss://xxx.com//Racer.HTML5/WSHandlerCall));
if (webSockets != null) {
webSockets.onopen = function () {
alert('Connection open');
}
webconfig:
<system.webServer>
<handlers>
<add name="WebSocketHandler" verb="*" path="WSHandlerCall" type="Racer.HTML5.WebSocketHandler,Racer.HTML5" resourceType="Unspecified" />
</handlers>
</system.webServer>
<appSettings>
<add key ="wsURL" value="/Racer.HTML5/WSHandlerCall"/>
1.The sockets send a request.
2. OnOpen Listener is triggered but not called the handler.
Plz Help !!
modified 15-Jul-14 14:42pm.
|
|
|
|