Moving my blog to MSDN
January 1st, 2007, I started working for Microsoft and will be moving to http://blogs.msdn.com/martijnh/. Hope to see you there!
// To use this namespace you must set a
// reference to the Microsoft Outlook 11.0
// COM server.
using Microsoft.Office.Interop.Outlook;
using OutLookApp = Microsoft.Office.Interop.Outlook.Application;
using System.IO;
using rd = Redemption;
ApplicationClass outLookApp = new ApplicationClass();
NameSpace outlookNS = outlookApp.GetNamespace("MAPI");
MailItem attachmentsItem = (MailItem)outlookNS.GetItemFromID(messageId, null);
// left out for clarity: find the Personal Folders->Inbox folder
rd.MAPIUtils utils = new rd.MAPIUtils();
utils.MAPIOBJECT = outlookNS.MAPIOBJECT;
foreach (Attachment a in attachmentsItem.Attachments)
{
string attachmentFile = Path.GetTempFileName();
a.SaveAsFile(attachmentFile);
MailItem underlyingItem =
(MailItem)personalFolder.Items.Add(OlItemType.olMailItem);
rd.MessageItem neww =
utils.GetItemFromMsgFile(attachmentFile, false);
underlyingItem.Save();
MailItem placedItem =
(MailItem)underlyingItem.Move(personalFolder);
neww.CopyTo(placedItem);
}
<TextBlock>
<TextBlock.Text>
<MultiBinding
Converter="{StaticResource StringFormatterConverter}"
ConverterParameter="{}{0}, {1}">
<Binding Path="Customer.Lastname" />
<Binding Path="Customer.Firstname" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
bool argumentsAreNullOrEmpty = true;
// Check whether all values are null or unset.
foreach (object value in values)
{
if (value != null && value != DependencyProperty.UnsetValue)
{
argumentsAreNullOrEmpty = false;
break;
}
}
// If we have all empty or null arguments, we do nothing.
if (argumentsAreNullOrEmpty)
{
return Binding.DoNothing;
}
<configSections>
<section
name="SolutionProfile"
type="BankTellerModule.Services.ModulesSection, BankTellerModule" />
<section
name="CompositeUI"
type="Microsoft.Practices.CompositeUI.Configuration.SettingsSection, Microsoft.Practices.CompositeUI" />
</configSections>
<CompositeUI>
<services>
<add
serviceType="Microsoft.Practices.CompositeUI.Services.IModuleEnumerator, Microsoft.Practices.CompositeUI" instanceType="BankTellerModule.Services.ConfigurationModuleEnumerator, BankTellerModule" />
</services>
</CompositeUI>
<SolutionProfile>
<Modules>
<add assemblyFile="BankTellerModule.dll" />
</Modules>
</SolutionProfile>
public void Run()
{
RegisterUnhandledExceptionHandler();
Builder builder = CreateBuilder();
AddBuilderStrategies(builder);
CreateRootWorkItem(builder);
...
rootWorkItem.FinishInitialization();
rootWorkItem.Run();
Start();
// Whoops for non-blocking Start()s
rootWorkItem.Dispose();
if (visualizer != null)
visualizer.Dispose();
}
<XmlDataProvider x:Key="MyData" XPath="/Info">
<x:XData>
<Info xmlns="">
<Item ID="12345" Name="Book 1" Price="$10.00" />
<Item ID="24678" Name="Book 3" Price="$9.00" />
</Info>
</x:XData>
</XmlDataProvider>
<CollectionViewSource x:Key='a' Source="{Binding Source={StaticResource MyData}, XPath=Item/@Price}" />
<CollectionViewSource x:Key='b' Source="{Binding Source={StaticResource MyData}, XPath=Item/@Name}" />
<ListBox>
<ListBox.ItemsSource>
<Binding>
<Binding.Source>
<CompositeCollection>
<ListBoxItem>My Constant Item</ListBoxItem>
<CollectionContainer Collection="{Binding Source={StaticResource a}}" />
<CollectionContainer Collection="{Binding Source={StaticResource b}}" />
</CompositeCollection>
</Binding.Source>
</Binding>
</ListBox.ItemsSource>
</ListBox>