Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » General » Downloads
 
Add your own
alternative version

C# 5.0 vNext - New Asynchronous Pattern

, 20 Nov 2010
C# 5.0 CTP was introduced recently, this article is specally dealing with my own understanding with this realease with few sample applications
SampleCode-Async.zip
WpfApplication1
SimplestAsync
bin
Debug
AsyncCtpLibrary.dll
SimplestAsync.dll
SimplestAsync.pdb
obj
Debug
Decl
SimplestAsync.dll
SimplestAsync.pdb
DesignTimeResolveAssemblyReferencesInput.cache
SimplestAsync.dll
SimplestAsync.pdb
TempPE
Properties
WpfApplication1
bin
Debug
AsyncCtpLibrary.dll
WpfApplication1.exe
WpfApplication1.pdb
WpfApplication1.vshost.exe
WpfApplication1.vshost.exe.manifest
codeproject100x30.gif
obj
x86
Debug
Decl
WpfApplication1.exe
WpfApplication1.pdb
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
GenerateResource.read.1.tlog
GenerateResource.write.1.tlog
MainWindow.baml
ResolveAssemblyReference.cache
TempPE
Properties.Resources.Designer.cs.dll
WpfApplication1.exe
WpfApplication1.g.resources
WpfApplication1.pdb
WpfApplication1.Properties.Resources.resources
WpfApplication1_MarkupCompile.cache
WpfApplication1_MarkupCompile.i.cache
Properties
Settings.settings
WpfApplication1.csproj.user
WpfApplication1.suo
WpfAsynchrony
bin
Debug
AsyncCtpLibrary.dll
WpfAsynchrony.exe
WpfAsynchrony.pdb
WpfAsynchrony.vshost.exe
WpfAsynchrony.vshost.exe.manifest
obj
x86
Debug
Decl
WpfAsynchrony.exe
WpfAsynchrony.pdb
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
GenerateResource.read.1.tlog
GenerateResource.write.1.tlog
MainWindow.baml
TempPE
Properties.Resources.Designer.cs.dll
WpfAsynchrony.exe
WpfAsynchrony.g.resources
WpfAsynchrony.pdb
WpfAsynchrony.Properties.Resources.resources
WpfAsynchrony_MarkupCompile.cache
WpfAsynchrony_MarkupCompile.i.cache
Properties
Settings.settings
<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow"
        WindowState="Maximized">
    <DockPanel>
        <DockPanel.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="Orange" Offset="0" />
                <GradientStop Color="#FFE54343" Offset="1" />
            </LinearGradientBrush>
        </DockPanel.Background>
        <DockPanel Height="80" DockPanel.Dock="Top">
            <TextBlock DockPanel.Dock="Left" 
                       Text="Latest Articles" 
                       VerticalAlignment="Center" 
                       Margin="30,0,0,0" />
            <Button x:Name="btnSearch" 
                    Content="Invoke Request" 
                    DockPanel.Dock="Left"
                    VerticalAlignment="Center" 
                    Width="120" 
                    Margin="10,0,0,0" 
                    Click="btnSearch_Click" 
                    IsDefault="True" />
            <Button Name="btnCancel" 
                    Content="Cancel" 
                    DockPanel.Dock="Left" 
                    VerticalAlignment="Center" 
                    Width="120"
                    Margin="10,0,0,0" 
                    Click="btnCancel_Click" 
                    IsCancel="True" />
            <StackPanel Orientation="Vertical" DockPanel.Dock="Right" VerticalAlignment="Center">
                <Image Source="codeproject100x30.gif"
                       Stretch="None"
                       HorizontalAlignment="Right" 
                       VerticalAlignment="Top" />
                 <TextBlock Name="tbstatus" 
                            VerticalAlignment="Bottom"
                            TextAlignment="Right" />
            </StackPanel>
           
        </DockPanel>
        <ListBox x:Name="lstArticles" ItemsSource="{Binding}">
            <ListBox.GroupStyle>
                <GroupStyle>
                    <GroupStyle.ContainerStyle>
                        <Style TargetType="{x:Type GroupItem}">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type GroupItem}">
                                        <Expander Header="{Binding Name}">
                                            <ItemsPresenter />
                                        </Expander>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </GroupStyle.ContainerStyle>
                </GroupStyle>
            </ListBox.GroupStyle>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="{Binding Title}" FontSize="20" Grid.ColumnSpan="2" />
                        <TextBlock Text="{Binding Description}" FontSize="12"  Grid.ColumnSpan="2" Grid.Row="1" TextWrapping="Wrap"/>
                        <TextBlock Text="Published On" Grid.Row="2" Grid.Column="0" />
                        <TextBlock Text="{Binding }" Grid.Row="2" Grid.Column="1" />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </DockPanel>
</Window>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Abhishek Sur
Architect
India India
Did you like his post?
 
Oh, lets go a bit further to know him better.
Visit his Website : www.abhisheksur.com to know more about Abhishek.
 
Abhishek also authored a book on .NET 4.5 Features and recommends you to read it, you will learn a lot from it.
http://bit.ly/EXPERTCookBook
 
Basically he is from India, who loves to explore the .NET world. He loves to code and in his leisure you always find him talking about technical stuffs.
 
Presently he is working in WPF, a new foundation to UI development, but mostly he likes to work on architecture and business classes. ASP.NET is one of his strength as well.
Have any problem? Write to him in his Forum.
 
You can also mail him directly to abhi2434@yahoo.com
 
Want a Coder like him for your project?
Drop him a mail to contact@abhisheksur.com
 
Visit His Blog

Dotnet Tricks and Tips



Dont forget to vote or share your comments about his Writing
Follow on   Twitter   Google+

| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 20 Nov 2010
Article Copyright 2010 by Abhishek Sur
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid