Josh-CO Dev

Solving the worlds problems one line of code at a time.


Leave a comment

Sending Emails from Silverlight

One of the requirements of my application I am writing is to send emails upon the creation of a new comment. This turned out to be quite simple. I am using RIA services and a Domain Service. In my domain service, I simply added the following code. I have noticed that this does not seem to work through GoDaddy, but it does test fine from my machine.

[Invoke]
public string SendEmail(string to, string body, string subject)
{
try
{
MailMessage msg = new MailMessage();
msg.To.Add(new MailAddress(to));
msg.From = new MailAddress(“noreply@josh-co.com”);
msg.Body = body;
msg.Subject = subject;
SmtpClient smtp = new SmtpClient();
smtp.Host = “smtp.gmail.com”;
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Credentials = new System.Net.NetworkCredential(“gmailaccount”, “gmailpassword”);
smtp.Port = 587;
smtp.Send(msg);
return “Success”;
}
catch (Exception ex)
{
return ex.ToString();
}
}

 


Leave a comment

Silverlight Image Source Binding

I figured out something that just happened to be a life saver yesterday. I have been working on a more social tool for my workout tracking program. One thing I wanted was a comment system that would show the user’s profile picture. I spend forever trying to think of a way to loop through the list box. What I ended up with was much more simple:

 Here is the XAML:

<StackPanel Orientation=”Horizontal”>

<Image Grid.Row=”1″ Height=”64″ Source=”{Binding ImagePath}” HorizontalAlignment=”Left” Margin=”5,5,0,0″ x:Name=”imgProfileImage” Stretch=”Fill” VerticalAlignment=”Top” Width=”64″ />

</StackPanel>

The backend code simply sets the ImagePath binding to a path that is stored in the database.

 


Leave a comment

So……

So, I have installed several other products, and unfortunately WordPress seems to be the best out there. I guess I will either have to learn to love it, or write my own software. In the mean time, I will try to be more active.


Updates

So, it’s been a while since I have updated the site. I have been hard at work on my silverlight app and am really not impressed with WordPress. I think I’m actually going to re-do the site with another program. If I don’t find one that I like, then I’m going to have to write my own. We’ll see where this goes, see you in the future!