using System;
using System.ComponentModel;
using System.Workflow.Activities;
using System.Workflow.ComponentModel;
namespace SendPlurkMessageActivity
{
public partial class SendPlurkMessageActivity: SequenceActivity
{
public SendPlurkMessageActivity()
{
InitializeComponent();
}
#region Public workflow members
public static DependencyProperty PlurkUserNameProperty = DependencyProperty.Register("PlurkUserName", typeof(string), typeof(SendPlurkMessageActivity));
[DescriptionAttribute("PlurkUserName")]
[CategoryAttribute("PlurkUserName Category")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string PlurkUserName
{
get
{
return ((string)(base.GetValue(SendPlurkMessageActivity.PlurkUserNameProperty)));
}
set
{
base.SetValue(SendPlurkMessageActivity.PlurkUserNameProperty, value);
}
}
public static DependencyProperty PlurkPasswordProperty = DependencyProperty.Register("PlurkPassword", typeof(string), typeof(SendPlurkMessageActivity));
[DescriptionAttribute("PlurkPassword")]
[CategoryAttribute("PlurkPassword Category")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string PlurkPassword
{
get
{
return ((string)(base.GetValue(SendPlurkMessageActivity.PlurkPasswordProperty)));
}
set
{
base.SetValue(SendPlurkMessageActivity.PlurkPasswordProperty, value);
}
}
public static DependencyProperty PlurkMessageBodyProperty = DependencyProperty.Register("PlurkMessageBody", typeof(string), typeof(SendPlurkMessageActivity));
[DescriptionAttribute("PlurkMessageBody")]
[CategoryAttribute("PlurkMessageBody Category")]
[BrowsableAttribute(true)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
public string PlurkMessageBody
{
get
{
return ((string)(base.GetValue(SendPlurkMessageActivity.PlurkMessageBodyProperty)));
}
set
{
base.SetValue(SendPlurkMessageActivity.PlurkMessageBodyProperty, value);
}
}
#endregion
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
try
{
PlurkApi.PlurkApi api = new PlurkApi.PlurkApi();
if (api.Login(PlurkUserName, PlurkPassword))
{
api.addMessage("tr_ch", string.Empty, PlurkMessageBody, true, string.Empty);
//api.
//api.addMessage("tr_ch", string.Empty, "Plurking from WWF C# CustomizedAction. Current Taiwan time is " + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(), true, string.Empty);
}
}
catch (Exception ex)
{
}
return ActivityExecutionStatus.Closed;
}
}
}