Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Apress committed Oct 14, 2016
0 parents commit 597454e
Show file tree
Hide file tree
Showing 627 changed files with 67,978 additions and 0 deletions.
Binary file added 4599.pdf
Binary file not shown.
57 changes: 57 additions & 0 deletions BuildExampleCode.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
@echo off
@echo COMMAND-LINE BUILD FOR
@echo Pro WF: Windows Workflow in .NET 4
@echo by Bruce Bukovics * Apress
rem ------------------------------------------------------------
set BUILDUTILITY=msbuild /verbosity:minimal
set BUILDACTION=/t:Rebuild
set BUILDPROFILE=/p:Configuration=Debug /p:Platform="Any CPU"
rem -------------------------------------------------
if not "%1" == "" set BUILDACTION=%1
@echo BUILDACTION = %BUILDACTION%
pause
rem -------------------------------------------------
@echo START OF NEW BUILD > buildlog.txt
rem -------------------------------------------------
@echo .NET 4 / VISUAL STUDIO 2010 BUILDS
@echo BUILDING CHAPTER 1
%BUILDUTILITY% "chapter 01\chapter 01.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
@echo BUILDING CHAPTER 2
%BUILDUTILITY% "chapter 02\chapter 02.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
@echo BUILDING CHAPTER 3
%BUILDUTILITY% "chapter 03\chapter 03.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
@echo BUILDING CHAPTER 4
%BUILDUTILITY% "chapter 04\chapter 04.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
@echo BUILDING CHAPTER 5
%BUILDUTILITY% "chapter 05\chapter 05.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
@echo BUILDING CHAPTER 6
%BUILDUTILITY% "chapter 06\chapter 06.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
@echo BUILDING CHAPTER 7
%BUILDUTILITY% "chapter 07\chapter 07.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
@echo BUILDING CHAPTER 8
%BUILDUTILITY% "chapter 08\chapter 08.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
@echo BUILDING CHAPTER 9
%BUILDUTILITY% "chapter 09\chapter 09.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
@echo BUILDING CHAPTER 11
%BUILDUTILITY% "chapter 11\chapter 11.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
@echo BUILDING CHAPTER 13
%BUILDUTILITY% "chapter 13\chapter 13.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
@echo BUILDING CHAPTER 14
%BUILDUTILITY% "chapter 14\chapter 14.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
@echo BUILDING CHAPTER 15
%BUILDUTILITY% "chapter 15\chapter 15.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
@echo BUILDING CHAPTER 16
%BUILDUTILITY% "chapter 16\chapter 16.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
@echo BUILDING CHAPTER 17
%BUILDUTILITY% "chapter 17\chapter 17.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
@echo BUILDING CHAPTER 18
%BUILDUTILITY% "chapter 18\chapter 18.sln" %BUILDACTION% %BUILDPROFILE% >> buildlog.txt
rem -------------------------------------------------
:exit
@echo ------------------------------------------------ >> buildlog.txt
@echo ------- END OF BUILD - SUMMARY FOLLOWS --------->> buildlog.txt
@echo ------------------------------------------------ >> buildlog.txt
find "error" buildlog.txt >> buildlog.txt
rem -------------------------------------------------
start notepad.exe buildlog.txt
rem -------------------------------------------------
27 changes: 27 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Freeware License, some rights reserved

Copyright (c) 2010 Bruce Bukovics

Permission is hereby granted, free of charge, to anyone obtaining a copy
of this software and associated documentation files (the "Software"),
to work with the Software within the limits of freeware distribution and fair use.
This includes the rights to use, copy, and modify the Software for personal use.
Users are also allowed and encouraged to submit corrections and modifications
to the Software for the benefit of other users.

It is not allowed to reuse, modify, or redistribute the Software for
commercial use in any way, or for a user�s educational materials such as books
or blog articles without prior permission from the copyright holder.

The above copyright notice and this permission notice need to be included
in all copies or substantial portions of the software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#Apress Source Code

This repository accompanies [*Pro WF*](http://www.apress.com/9781430227212) by Bruce Bukovics (Apress, 2010).

![Cover image](9781430227212.jpg)

Download the files as a zip using the green button, or clone the repository to your machine using Git.

##Releases

Release v1.0 corresponds to the code in the published book, without corrections or updates.

##Contributions

See the file Contributing.md for more information on how you can contribute to this repository.
29 changes: 29 additions & 0 deletions ReadMe.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Pro WF: Windows Workflow in .NET 4 - by Bruce Bukovics - Apress

** SAMPLE CODE BUILDING INSTRUCTIONS **

The following build procedure assumes that you have the following
software already installed:

- Visual Studio 2010

Follow these steps to build all sample code for the book:

1) If you haven't already done so, unzip all sample code
to a new work directory. Use the option that preserves
the directory structure contained within the zip file.
The assumed name for the directory is \ProWF4.
Once unzipped, you should see separate folders for
each chapter in the book. Within each chapter, there
are individual folders for each project.

2) Open a Visual Studio 2010 command prompt. This sets all
of the necessary environment variables needed to build
the sample projects.

3) Using the command prompt, change to the \ProWF4 directory
where you unzipped the sample code.

4) Execute the command BuildExampleCode.cmd. This will build all
of the solutions for all chapters of the book.

19 changes: 19 additions & 0 deletions chapter 01/Calculator/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
This file is part of the downloadable code for the Apress book:
Pro WF: Windows Workflow in .NET 4.0
Copyright (c) Bruce Bukovics. All rights reserved.
This code is provided as is without warranty of any kind, either expressed
or implied, including but not limited to fitness for any particular purpose.
You may use the code for any commercial or noncommercial purpose, and combine
it with your own code, but cannot reproduce it in whole or in part for
publication purposes without prior approval.
-->
<configuration>
<startup>

<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />

</startup>
</configuration>
70 changes: 70 additions & 0 deletions chapter 01/Calculator/Calculator.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F97FF29B-26FA-44C0-968C-9F9CC051BA34}</ProjectGuid>
<ProjectTypeGuids>{32f31d43-81cc-4c15-9de6-3fc5453562b6};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Calculator</RootNamespace>
<AssemblyName>Calculator</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Activities" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceModel.Activities" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="ParseCalculatorArgs.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<XamlAppDef Include="Calculator.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</XamlAppDef>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
81 changes: 81 additions & 0 deletions chapter 01/Calculator/Calculator.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<!--
This file is part of the downloadable code for the Apress book:
Pro WF: Windows Workflow in .NET 4.0
Copyright (c) Bruce Bukovics. All rights reserved.
This code is provided as is without warranty of any kind, either expressed
or implied, including but not limited to fitness for any particular purpose.
You may use the code for any commercial or noncommercial purpose, and combine
it with your own code, but cannot reproduce it in whole or in part for
publication purposes without prior approval.
-->
<Activity mc:Ignorable="sap" x:Class="Calculator.Calculator" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:local="clr-namespace:Calculator" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" xmlns:s1="clr-namespace:System;assembly=mscorlib" xmlns:s2="clr-namespace:System;assembly=System" xmlns:s3="clr-namespace:System;assembly=System.Xml" xmlns:s4="clr-namespace:System;assembly=System.Core" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sd1="clr-namespace:System.Data;assembly=System.Data.DataSetExtensions" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<x:Members>
<x:Property Name="ArgExpression" Type="InArgument(x:String)" />
<x:Property Name="Result" Type="OutArgument(x:Double)" />
</x:Members>
<sap:VirtualizedContainerService.HintSize>538,428</sap:VirtualizedContainerService.HintSize>
<mva:VisualBasic.Settings>Assembly references and imported namespaces serialized as XML namespaces</mva:VisualBasic.Settings>
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="ShouldExpandAll">False</x:Boolean>
<x:Boolean x:Key="ShouldCollapseAll">False</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Sequence sad:XamlDebuggerXmlReader.FileName="C:\WF\WindowsWorkflowWork\code\chapter 01\Calculator\Calculator.xaml" sap:VirtualizedContainerService.HintSize="498,388" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">
<Sequence.Variables>
<Variable x:TypeArguments="x:Double" Name="FirstNumber" />
<Variable x:TypeArguments="x:Double" Name="SecondNumber" />
<Variable x:TypeArguments="x:String" Name="Operation" />
</Sequence.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<local:ParseCalculatorArgs Expression="[ArgExpression]" FirstNumber="[FirstNumber]" sap:VirtualizedContainerService.HintSize="476,22" Operation="[Operation]" SecondNumber="[SecondNumber]" />
<Switch x:TypeArguments="x:String" Expression="[Operation]" sap:VirtualizedContainerService.HintSize="476,202">
<Switch.Default>
<Throw Exception="[New InvalidOperationException(&quot;Operation Invalid&quot;)]" sap:VirtualizedContainerService.HintSize="459,100" />
</Switch.Default>
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
<x:Boolean x:Key="IsPinned">False</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<Assign x:Key="+" sap:VirtualizedContainerService.HintSize="457,100">
<Assign.To>
<OutArgument x:TypeArguments="x:Double">[Result]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Double">[FirstNumber + SecondNumber]</InArgument>
</Assign.Value>
</Assign>
<Assign x:Key="-" sap:VirtualizedContainerService.HintSize="457,100">
<Assign.To>
<OutArgument x:TypeArguments="x:Double">[Result]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Double">[FirstNumber - SecondNumber]</InArgument>
</Assign.Value>
</Assign>
<Assign x:Key="*" sap:VirtualizedContainerService.HintSize="457,100">
<Assign.To>
<OutArgument x:TypeArguments="x:Double">[Result]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Double">[FirstNumber * SecondNumber]</InArgument>
</Assign.Value>
</Assign>
<Assign x:Key="/" sap:VirtualizedContainerService.HintSize="457,100">
<Assign.To>
<OutArgument x:TypeArguments="x:Double">[Result]</OutArgument>
</Assign.To>
<Assign.Value>
<InArgument x:TypeArguments="x:Double">[FirstNumber / SecondNumber]</InArgument>
</Assign.Value>
</Assign>
</Switch>
</Sequence>
</Activity>
51 changes: 51 additions & 0 deletions chapter 01/Calculator/ParseCalculatorArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//--------------------------------------------------------------------------------
// This file is part of the downloadable code for the Apress book:
// Pro WF: Windows Workflow in .NET 4.0
// Copyright (c) Bruce Bukovics. All rights reserved.
//
// This code is provided as is without warranty of any kind, either expressed
// or implied, including but not limited to fitness for any particular purpose.
// You may use the code for any commercial or noncommercial purpose, and combine
// it with your own code, but cannot reproduce it in whole or in part for
// publication purposes without prior approval.
//--------------------------------------------------------------------------------
using System;
using System.Activities;

namespace Calculator
{
public sealed class ParseCalculatorArgs : CodeActivity
{
[RequiredArgument]
public InArgument<String> Expression { get; set; }
public OutArgument<Double> FirstNumber { get; set; }
public OutArgument<Double> SecondNumber { get; set; }
public OutArgument<String> Operation { get; set; }

protected override void Execute(CodeActivityContext context)
{
FirstNumber.Set(context, 0);
SecondNumber.Set(context, 0);
Operation.Set(context, "error");

String line = Expression.Get(context);
if (!String.IsNullOrEmpty(line))
{
String[] arguments = line.Split(' ');
if (arguments.Length == 3)
{
Double number = 0;
if (Double.TryParse(arguments[0], out number))
{
FirstNumber.Set(context, number);
}
Operation.Set(context, arguments[1]);
if (Double.TryParse(arguments[2], out number))
{
SecondNumber.Set(context, number);
}
}
}
}
}
}

0 comments on commit 597454e

Please sign in to comment.