├── Sources ├── Nuget │ ├── BuildPackage.bat │ ├── NuGet.exe │ ├── Workflow.png │ ├── Tiny-Workflow.2.1.0.nupkg │ └── Binaries │ │ ├── lib │ │ └── TinyWorkflow.Core.dll │ │ └── Package.nuspec ├── TinyWorkflow │ ├── IWorkflowFactory.cs │ ├── project.json │ ├── WorkflowFactory.cs │ ├── WorkflowStepType.cs │ ├── Actions │ │ ├── WorkflowActionState.cs │ │ ├── GoWorkflowAction.cs │ │ ├── WorkflowAction.cs │ │ ├── MultipleGoWorkflowAction.cs │ │ ├── BlockWorkflowAction.cs │ │ ├── WhileWorkflowAction.cs │ │ ├── ForWorkflowAction.cs │ │ └── IfWorkflowAction.cs │ ├── WorkflowState.cs │ ├── WorkflowStateChangedEventArgs.cs │ ├── IWorkflow.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── TinyWorkflow.csproj │ └── Workflow.cs ├── packages │ ├── MvvmLight.4.1.26.1 │ │ ├── MvvmLight.4.1.26.1.nupkg │ │ ├── lib │ │ │ ├── SL3 │ │ │ │ ├── GalaSoft.MvvmLight.dll │ │ │ │ ├── GalaSoft.MvvmLight.Extras.dll │ │ │ │ ├── System.Windows.Interactivity.dll │ │ │ │ └── Microsoft.Practices.ServiceLocation.dll │ │ │ ├── net35 │ │ │ │ ├── GalaSoft.MvvmLight.dll │ │ │ │ ├── GalaSoft.MvvmLight.Extras.dll │ │ │ │ ├── System.Windows.Interactivity.dll │ │ │ │ └── Microsoft.Practices.ServiceLocation.dll │ │ │ ├── SL4 │ │ │ │ ├── GalaSoft.MvvmLight.SL4.dll │ │ │ │ ├── GalaSoft.MvvmLight.Extras.SL4.dll │ │ │ │ ├── System.Windows.Interactivity.dll │ │ │ │ ├── Microsoft.Practices.ServiceLocation.dll │ │ │ │ └── Microsoft.Practices.ServiceLocation.xml │ │ │ ├── SL5 │ │ │ │ ├── GalaSoft.MvvmLight.SL5.dll │ │ │ │ ├── GalaSoft.MvvmLight.Extras.SL5.dll │ │ │ │ ├── System.Windows.Interactivity.dll │ │ │ │ ├── Microsoft.Practices.ServiceLocation.dll │ │ │ │ └── Microsoft.Practices.ServiceLocation.xml │ │ │ ├── wp8 │ │ │ │ ├── GalaSoft.MvvmLight.WP8.dll │ │ │ │ ├── GalaSoft.MvvmLight.Extras.WP8.dll │ │ │ │ ├── System.Windows.Interactivity.dll │ │ │ │ └── Microsoft.Practices.ServiceLocation.dll │ │ │ ├── net40 │ │ │ │ ├── GalaSoft.MvvmLight.WPF4.dll │ │ │ │ ├── System.Windows.Interactivity.dll │ │ │ │ ├── GalaSoft.MvvmLight.Extras.WPF4.dll │ │ │ │ └── Microsoft.Practices.ServiceLocation.dll │ │ │ ├── sl3-wp │ │ │ │ ├── GalaSoft.MvvmLight.WP7.dll │ │ │ │ ├── GalaSoft.MvvmLight.Extras.WP7.dll │ │ │ │ ├── System.Windows.Interactivity.dll │ │ │ │ └── Microsoft.Practices.ServiceLocation.dll │ │ │ ├── net45 │ │ │ │ ├── GalaSoft.MvvmLight.WPF45.dll │ │ │ │ ├── System.Windows.Interactivity.dll │ │ │ │ ├── GalaSoft.MvvmLight.Extras.WPF45.dll │ │ │ │ └── Microsoft.Practices.ServiceLocation.dll │ │ │ ├── netcore45 │ │ │ │ ├── GalaSoft.MvvmLight.Win8.dll │ │ │ │ ├── GalaSoft.MvvmLight.Win8.pri │ │ │ │ ├── GalaSoft.MvvmLight.Extras.Win8.dll │ │ │ │ ├── GalaSoft.MvvmLight.Extras.Win8.pri │ │ │ │ ├── Microsoft.Practices.ServiceLocation.dll │ │ │ │ ├── Microsoft.Practices.ServiceLocation.pri │ │ │ │ └── Microsoft.Practices.ServiceLocation.xml │ │ │ └── sl4-wp71 │ │ │ │ ├── GalaSoft.MvvmLight.WP71.dll │ │ │ │ ├── GalaSoft.MvvmLight.Extras.WP71.dll │ │ │ │ ├── System.Windows.Interactivity.dll │ │ │ │ ├── Microsoft.Practices.ServiceLocation.dll │ │ │ │ └── Microsoft.Practices.ServiceLocation.xml │ │ ├── Content │ │ │ ├── MVVMLight.Nuget.Readme.txt │ │ │ ├── App.xaml.transform │ │ │ └── ViewModel │ │ │ │ ├── MainViewModel.cs.pp │ │ │ │ └── ViewModelLocator.cs.pp │ │ └── MvvmLight.4.1.26.1.nuspec │ └── repositories.config ├── TinyWorkflow.UITests │ ├── packages.config │ ├── App.config │ ├── Properties │ │ ├── Settings.settings │ │ ├── Settings.Designer.cs │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── ServiceMock │ │ ├── Enums │ │ │ └── Rights.cs │ │ ├── BaseService.cs │ │ ├── RightManagementService.cs │ │ └── SideDataService.cs │ ├── App.xaml.cs │ ├── MVVMLight.Nuget.Readme.txt │ ├── App.xaml │ ├── MainWindow.xaml.cs │ ├── ViewModel │ │ ├── Model │ │ │ └── UserRight.cs │ │ ├── ViewModelLocator.cs │ │ ├── States │ │ │ └── MainState.cs │ │ └── MainViewModel.cs │ ├── MainWindow.xaml │ └── TinyWorkflow.UITests.csproj ├── TinyWorkflow.Tests │ ├── States │ │ ├── ListState.cs │ │ ├── ConditionState.cs │ │ ├── ComplexState.cs │ │ └── SimpleState.cs │ ├── WhileStepTest.cs │ ├── BlockSimpleStepTest.cs │ ├── IfStepTest.cs │ ├── BlockWhileStepTest.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SimpleStepTest.cs │ ├── BlockIfStepTest.cs │ ├── BugFixes │ │ └── ForStepBugFixTest.cs │ ├── ForStepTest.cs │ ├── AsynchStepTest.cs │ ├── ComplexTest.cs │ ├── ParallelStepTest.cs │ ├── TinyWorkflow.Tests.csproj │ └── StartAndResetTest.cs └── TinyWorkflow.sln ├── Releases ├── TinyWorkflow.dll └── TinyWorkflow.XML ├── .gitignore ├── LICENSE └── README.md /Sources/Nuget/BuildPackage.bat: -------------------------------------------------------------------------------- 1 | nuget.exe pack Binaries\Package.nuspec -------------------------------------------------------------------------------- /Sources/Nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/Nuget/NuGet.exe -------------------------------------------------------------------------------- /Releases/TinyWorkflow.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Releases/TinyWorkflow.dll -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.suo 4 | *.vspscc 5 | /Sources/.vs 6 | /Sources/TinyWorkflow/project.lock.json 7 | -------------------------------------------------------------------------------- /Sources/Nuget/Workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/Nuget/Workflow.png -------------------------------------------------------------------------------- /Sources/Nuget/Tiny-Workflow.2.1.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/Nuget/Tiny-Workflow.2.1.0.nupkg -------------------------------------------------------------------------------- /Sources/Nuget/Binaries/lib/TinyWorkflow.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/Nuget/Binaries/lib/TinyWorkflow.Core.dll -------------------------------------------------------------------------------- /Sources/TinyWorkflow/IWorkflowFactory.cs: -------------------------------------------------------------------------------- 1 | namespace TinyWorkflow 2 | { 3 | public interface IWorkflowFactory 4 | { 5 | IWorkflow Create(); 6 | } 7 | } -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/MvvmLight.4.1.26.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/MvvmLight.4.1.26.1.nupkg -------------------------------------------------------------------------------- /Sources/packages/repositories.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/SL3/GalaSoft.MvvmLight.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/SL3/GalaSoft.MvvmLight.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/net35/GalaSoft.MvvmLight.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/net35/GalaSoft.MvvmLight.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/SL4/GalaSoft.MvvmLight.SL4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/SL4/GalaSoft.MvvmLight.SL4.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/SL5/GalaSoft.MvvmLight.SL5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/SL5/GalaSoft.MvvmLight.SL5.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/wp8/GalaSoft.MvvmLight.WP8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/wp8/GalaSoft.MvvmLight.WP8.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/SL3/GalaSoft.MvvmLight.Extras.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/SL3/GalaSoft.MvvmLight.Extras.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/net40/GalaSoft.MvvmLight.WPF4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/net40/GalaSoft.MvvmLight.WPF4.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/sl3-wp/GalaSoft.MvvmLight.WP7.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/sl3-wp/GalaSoft.MvvmLight.WP7.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/net35/GalaSoft.MvvmLight.Extras.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/net35/GalaSoft.MvvmLight.Extras.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/net45/GalaSoft.MvvmLight.WPF45.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/net45/GalaSoft.MvvmLight.WPF45.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/SL3/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/SL3/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/SL4/GalaSoft.MvvmLight.Extras.SL4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/SL4/GalaSoft.MvvmLight.Extras.SL4.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/SL4/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/SL4/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/SL5/GalaSoft.MvvmLight.Extras.SL5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/SL5/GalaSoft.MvvmLight.Extras.SL5.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/SL5/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/SL5/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/net35/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/net35/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/net40/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/net40/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/net45/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/net45/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/netcore45/GalaSoft.MvvmLight.Win8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/netcore45/GalaSoft.MvvmLight.Win8.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/netcore45/GalaSoft.MvvmLight.Win8.pri: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/netcore45/GalaSoft.MvvmLight.Win8.pri -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/sl4-wp71/GalaSoft.MvvmLight.WP71.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/sl4-wp71/GalaSoft.MvvmLight.WP71.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/wp8/GalaSoft.MvvmLight.Extras.WP8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/wp8/GalaSoft.MvvmLight.Extras.WP8.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/wp8/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/wp8/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/net40/GalaSoft.MvvmLight.Extras.WPF4.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/net40/GalaSoft.MvvmLight.Extras.WPF4.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/sl3-wp/GalaSoft.MvvmLight.Extras.WP7.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/sl3-wp/GalaSoft.MvvmLight.Extras.WP7.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/sl3-wp/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/sl3-wp/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/SL3/Microsoft.Practices.ServiceLocation.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/SL3/Microsoft.Practices.ServiceLocation.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/SL4/Microsoft.Practices.ServiceLocation.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/SL4/Microsoft.Practices.ServiceLocation.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/SL5/Microsoft.Practices.ServiceLocation.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/SL5/Microsoft.Practices.ServiceLocation.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/net45/GalaSoft.MvvmLight.Extras.WPF45.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/net45/GalaSoft.MvvmLight.Extras.WPF45.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/sl4-wp71/GalaSoft.MvvmLight.Extras.WP71.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/sl4-wp71/GalaSoft.MvvmLight.Extras.WP71.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/sl4-wp71/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/sl4-wp71/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/wp8/Microsoft.Practices.ServiceLocation.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/wp8/Microsoft.Practices.ServiceLocation.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/net35/Microsoft.Practices.ServiceLocation.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/net35/Microsoft.Practices.ServiceLocation.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/net40/Microsoft.Practices.ServiceLocation.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/net40/Microsoft.Practices.ServiceLocation.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/net45/Microsoft.Practices.ServiceLocation.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/net45/Microsoft.Practices.ServiceLocation.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/netcore45/GalaSoft.MvvmLight.Extras.Win8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/netcore45/GalaSoft.MvvmLight.Extras.Win8.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/netcore45/GalaSoft.MvvmLight.Extras.Win8.pri: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/netcore45/GalaSoft.MvvmLight.Extras.Win8.pri -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/sl3-wp/Microsoft.Practices.ServiceLocation.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/sl3-wp/Microsoft.Practices.ServiceLocation.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/sl4-wp71/Microsoft.Practices.ServiceLocation.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/sl4-wp71/Microsoft.Practices.ServiceLocation.dll -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/netcore45/Microsoft.Practices.ServiceLocation.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/netcore45/Microsoft.Practices.ServiceLocation.dll -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/netcore45/Microsoft.Practices.ServiceLocation.pri: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alphamax/TinyWorkflow/HEAD/Sources/packages/MvvmLight.4.1.26.1/lib/netcore45/Microsoft.Practices.ServiceLocation.pri -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "supports": {}, 3 | "dependencies": { 4 | "Microsoft.NETCore.Portable.Compatibility": "1.0.1", 5 | "NETStandard.Library": "1.6.0", 6 | "System.Threading.Tasks.Parallel": "4.3.0" 7 | }, 8 | "frameworks": { 9 | "netstandard1.1": {} 10 | } 11 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow/WorkflowFactory.cs: -------------------------------------------------------------------------------- 1 | namespace TinyWorkflow 2 | { 3 | public class WorkflowFactory : IWorkflowFactory 4 | { 5 | public IWorkflow Create() 6 | { 7 | return new Workflow(); 8 | } 9 | 10 | public static IWorkflow New() 11 | { 12 | return new Workflow(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow/WorkflowStepType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace TinyWorkflow 8 | { 9 | internal enum WorkflowStepType 10 | { 11 | Go, 12 | For, 13 | While 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/ServiceMock/Enums/Rights.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace TinyWorkflow.UITests.ServiceMock.Enums 8 | { 9 | public enum Rights 10 | { 11 | ReadOnly, 12 | ReadWrite, 13 | SuperUser, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace TinyWorkflow.UITests 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/MVVMLight.Nuget.Readme.txt: -------------------------------------------------------------------------------- 1 | ***Windows 8 Metro style only*** 2 | 3 | Windows 8 has a new way to import CLR namespaces into XAML. 4 | 5 | In order to avoid issues, after installing MVVM Light through Nuget in your Windows 8 Metro style application, follow these steps: 6 | 7 | - open App.xaml 8 | 9 | - Locate the statement 10 | xmlns:vm="clr-namespace:[YouApplication].ViewModel" 11 | 12 | - Replace this statement with: 13 | xmlns:vm="using:[YouApplication].ViewModel" 14 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow/Actions/WorkflowActionState.cs: -------------------------------------------------------------------------------- 1 | namespace TinyWorkflow.Actions 2 | { 3 | /// 4 | /// State of an action. 5 | /// 6 | internal enum WorkflowActionState 7 | { 8 | /// 9 | /// Ready to be run. 10 | /// 11 | Ready, 12 | 13 | /// 14 | /// Blocked. Waiting for an unblock command. 15 | /// 16 | Blocked, 17 | 18 | /// 19 | /// Has been run and is finised. 20 | /// 21 | Ended, 22 | } 23 | } -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/Content/MVVMLight.Nuget.Readme.txt: -------------------------------------------------------------------------------- 1 | ***Windows 8 Metro style only*** 2 | 3 | Windows 8 has a new way to import CLR namespaces into XAML. 4 | 5 | In order to avoid issues, after installing MVVM Light through Nuget in your Windows 8 Metro style application, follow these steps: 6 | 7 | - open App.xaml 8 | 9 | - Locate the statement 10 | xmlns:vm="clr-namespace:[YouApplication].ViewModel" 11 | 12 | - Replace this statement with: 13 | xmlns:vm="using:[YouApplication].ViewModel" 14 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/States/ListState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace TinyWorkflow.Tests.States 8 | { 9 | public class ListState 10 | { 11 | public List List { get; set; } 12 | public int StateFullVariable { get; set; } 13 | 14 | public ListState() 15 | { 16 | List = new List(); 17 | StateFullVariable = 0; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/ServiceMock/BaseService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace TinyWorkflow.UITests.ServiceMock 9 | { 10 | public class BaseService 11 | { 12 | protected Random r = new Random(DateTime.Now.Millisecond); 13 | protected void GenerateSleep(int min, int max) 14 | { 15 | int delay = min + r.Next(max - min); 16 | Thread.Sleep(delay); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow/WorkflowState.cs: -------------------------------------------------------------------------------- 1 | namespace TinyWorkflow 2 | { 3 | /// 4 | /// State of workflow 5 | /// 6 | public enum WorkflowState 7 | { 8 | /// 9 | /// Workflow is running 10 | /// 11 | Running, 12 | 13 | /// 14 | /// Workflow is blocked, wwaiting for being unblocked 15 | /// 16 | Blocked, 17 | 18 | /// 19 | /// Workflow has not been started 20 | /// 21 | NotRunning, 22 | 23 | /// 24 | /// Workflow has ended 25 | /// 26 | End, 27 | } 28 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow/WorkflowStateChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace TinyWorkflow 8 | { 9 | public class WorkflowStateChangedEventArgs : EventArgs 10 | { 11 | /// 12 | /// New workflow state. 13 | /// 14 | public WorkflowState State { get; private set; } 15 | 16 | public WorkflowStateChangedEventArgs(WorkflowState state) 17 | { 18 | State = state; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/States/ConditionState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace TinyWorkflow.Tests.States 8 | { 9 | public class ConditionState 10 | { 11 | public int MaxRun { get; set; } 12 | public int ActualRun { get; set; } 13 | public int StateFullVariable { get; set; } 14 | 15 | public ConditionState() 16 | { 17 | ActualRun = 0; 18 | MaxRun = 0; 19 | StateFullVariable = 0; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/States/ComplexState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace TinyWorkflow.Tests.States 8 | { 9 | public class ComplexState 10 | { 11 | public List ListInitial { get; set; } 12 | public List ListFinal { get; set; } 13 | 14 | public int CacheValue { get; set; } 15 | 16 | public ComplexState() 17 | { 18 | ListInitial = new List(); 19 | ListFinal = new List(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/App.xaml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/States/SimpleState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace TinyWorkflow.Tests.States 8 | { 9 | public class SimpleState 10 | { 11 | public int StateFullVariable { get; set; } 12 | public int StateFullVariableAsynch1 { get; set; } 13 | public int StateFullVariableAsynch2 { get; set; } 14 | public int StateFullVariableAsynch3 { get; set; } 15 | 16 | public SimpleState() 17 | { 18 | StateFullVariable = 0; 19 | StateFullVariableAsynch1 = 0; 20 | StateFullVariableAsynch2 = 0; 21 | StateFullVariableAsynch3 = 0; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/WhileStepTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using TinyWorkflow.Tests.States; 5 | 6 | namespace TinyWorkflow.Tests 7 | { 8 | [TestClass] 9 | public class WhileStepTest 10 | { 11 | [TestMethod] 12 | public void RunWhile() 13 | { 14 | var workflow = new Workflow() 15 | .While(WhileTest, WhileContent); 16 | 17 | workflow.Start(new ConditionState() { MaxRun = 5 }); 18 | Assert.AreEqual(10, workflow.Workload.StateFullVariable); 19 | } 20 | 21 | public void WhileContent(ConditionState state) 22 | { 23 | state.StateFullVariable += state.ActualRun; 24 | state.ActualRun++; 25 | } 26 | 27 | public bool WhileTest(ConditionState state) 28 | { 29 | return state.ActualRun < state.MaxRun; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Sources/Nuget/Binaries/Package.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tiny-Workflow 5 | Tiny Workflow 6 | 2.1.0 7 | Benjamin Laffont 8 | Benjamin Laffont 9 | https://github.com/alphamax/TinyWorkflow/blob/master/LICENSE 10 | https://github.com/alphamax/TinyWorkflow 11 | https://raw.githubusercontent.com/alphamax/TinyWorkflow/master/Sources/Nuget/Workflow.png 12 | false 13 | Little workflow engine with fluent definition 14 | First release. 15 | Copyright 2017 16 | Workflow Stateless Fluent 17 | 18 | -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/Content/App.xaml.transform: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using TinyWorkflow.UITests.ViewModel; 16 | 17 | namespace TinyWorkflow.UITests 18 | { 19 | /// 20 | /// Interaction logic for MainWindow.xaml 21 | /// 22 | public partial class MainWindow : Window 23 | { 24 | public MainWindow() 25 | { 26 | InitializeComponent(); 27 | (this.DataContext as MainViewModel).Dispatcher = Dispatcher; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/BlockSimpleStepTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using TinyWorkflow.Tests.States; 8 | 9 | namespace TinyWorkflow.Tests 10 | { 11 | [TestClass] 12 | public class BlockSimpleStepTest 13 | { 14 | [TestMethod] 15 | public void SimpleStepBlock() 16 | { 17 | var workflow = new Workflow() 18 | .Do(ActionBeforeBlock) 19 | .Block() 20 | .Do(ActionAfterBlock); 21 | 22 | workflow.Start(new SimpleState()); 23 | Assert.AreEqual(5, workflow.Workload.StateFullVariable); 24 | workflow.Unblock(); 25 | Assert.AreEqual(10, workflow.Workload.StateFullVariable); 26 | } 27 | 28 | public void ActionBeforeBlock(SimpleState state) 29 | { 30 | state.StateFullVariable = 5; 31 | } 32 | 33 | public void ActionAfterBlock(SimpleState state) 34 | { 35 | state.StateFullVariable = 10; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/ServiceMock/RightManagementService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using TinyWorkflow.UITests.ServiceMock.Enums; 7 | 8 | namespace TinyWorkflow.UITests.ServiceMock 9 | { 10 | public class RightManagementService : BaseService 11 | { 12 | public void HasPrivilege(Rights privilege, Action callback) 13 | { 14 | Task.Factory.StartNew(() => 15 | { 16 | this.GenerateSleep(500, 1500); 17 | if (privilege == Rights.ReadOnly) 18 | { 19 | callback(true); 20 | } 21 | else if (privilege == Rights.ReadWrite) 22 | { 23 | callback(true); 24 | } 25 | else 26 | { 27 | callback(false); 28 | } 29 | }); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/Content/ViewModel/MainViewModel.cs.pp: -------------------------------------------------------------------------------- 1 | using GalaSoft.MvvmLight; 2 | 3 | namespace $rootnamespace$.ViewModel 4 | { 5 | /// 6 | /// This class contains properties that the main View can data bind to. 7 | /// 8 | /// Use the mvvminpc snippet to add bindable properties to this ViewModel. 9 | /// 10 | /// 11 | /// You can also use Blend to data bind with the tool's support. 12 | /// 13 | /// 14 | /// See http://www.galasoft.ch/mvvm 15 | /// 16 | /// 17 | public class MainViewModel : ViewModelBase 18 | { 19 | /// 20 | /// Initializes a new instance of the MainViewModel class. 21 | /// 22 | public MainViewModel() 23 | { 24 | ////if (IsInDesignMode) 25 | ////{ 26 | //// // Code runs in Blend --> create design time data. 27 | ////} 28 | ////else 29 | ////{ 30 | //// // Code runs "for real" 31 | ////} 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Alphamax 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow/Actions/GoWorkflowAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace TinyWorkflow.Actions 4 | { 5 | internal class GoWorkflowAction : WorkflowAction 6 | { 7 | #region Public properties 8 | 9 | /// 10 | /// Action embeded in the step 11 | /// 12 | public Action Action { get; private set; } 13 | 14 | public override WorkflowActionState State 15 | { 16 | get { return state; } 17 | } 18 | 19 | #endregion Public properties 20 | 21 | #region Private Variables 22 | 23 | private WorkflowActionState state; 24 | 25 | #endregion Private Variables 26 | 27 | #region Ctor 28 | 29 | public GoWorkflowAction(Action action) 30 | { 31 | Action = action; 32 | state = WorkflowActionState.Ready; 33 | } 34 | 35 | #endregion Ctor 36 | 37 | #region Public methods 38 | 39 | public override void Reset() 40 | { 41 | state = WorkflowActionState.Ready; 42 | } 43 | 44 | /// 45 | /// Run the step 46 | /// 47 | /// 48 | public override void Run(T obj) 49 | { 50 | Action(obj); 51 | state = WorkflowActionState.Ended; 52 | } 53 | 54 | #endregion Public methods 55 | } 56 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18033 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace TinyWorkflow.UITests.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/IfStepTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using TinyWorkflow.Tests.States; 4 | 5 | namespace TinyWorkflow.Tests 6 | { 7 | [TestClass] 8 | public class IfStepTest 9 | { 10 | [TestMethod] 11 | public void RunIfTrue() 12 | { 13 | var workflow = new Workflow() 14 | .If(TestToTrue, ActionIfTrue, ActionIfFalse); 15 | workflow.Start(new SimpleState()); 16 | Assert.AreEqual(2, workflow.Workload.StateFullVariable); 17 | } 18 | 19 | [TestMethod] 20 | public void RunIfFalse() 21 | { 22 | var workflow = new Workflow() 23 | .If(TestToFalse, ActionIfTrue, ActionIfFalse); 24 | workflow.Start(new SimpleState()); 25 | Assert.AreEqual(3, workflow.Workload.StateFullVariable); 26 | } 27 | 28 | public bool TestToTrue(SimpleState state) 29 | { 30 | return state.StateFullVariable == 0; 31 | } 32 | 33 | public bool TestToFalse(SimpleState state) 34 | { 35 | return state.StateFullVariable != 0; 36 | } 37 | 38 | public void ActionIfTrue(SimpleState state) 39 | { 40 | state.StateFullVariable = 2; 41 | } 42 | 43 | public void ActionIfFalse(SimpleState state) 44 | { 45 | state.StateFullVariable = 3; 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TinyWorkflow [![GitHub release](https://img.shields.io/github/release/alphamax/TinyWorkflow.svg?maxAge=2592000?style=flat-square)]() [![license](https://img.shields.io/github/license/alphamax/TinyWorkflow.svg?maxAge=2592000?style=flat-square)]() 2 | 3 | ## Definition 4 | 5 | This is a little project for a simple but usefull workflow engine. 6 | This workflow engine support While, Foreach, If, basic actions. 7 | 8 | The project is provided with unit tests. 9 | 10 | A technical blog post is available here : 11 | [Full documentation](https://alphablog.org/a-little-workflow-engine/) 12 | 13 | ##Installation 14 | 15 | Just download the last binaries and add it as reference to your project. 16 | First workflow 17 | 18 | Your first definition TinyWorkflow is like : 19 | ``` 20 | Workflow workflow = new Workflow() 21 | .Do(EasyAction) 22 | workflow.Start(new SimpleState()); 23 | ``` 24 | EasyAction is a method like : 25 | ``` 26 | public void EasyAction(SimpleState state) 27 | { 28 | //Your code here 29 | } 30 | ``` 31 | And SimpleState is a simple class : 32 | ``` 33 | public class SimpleState 34 | { 35 | //Your statefull content here 36 | } 37 | ``` 38 | ## Now available in Nuget Package [Here](https://www.nuget.org/packages/Tiny-Workflow/2.1.0) 39 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/BlockWhileStepTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using TinyWorkflow.Tests.States; 5 | 6 | namespace TinyWorkflow.Tests 7 | { 8 | [TestClass] 9 | public class BlockWhileStepTest 10 | { 11 | [TestMethod] 12 | public void RunWhileWithBlock() 13 | { 14 | var workflow = new Workflow() 15 | .While(WhileTest, 16 | new Workflow() 17 | .Do(WhileContent) 18 | .Block() 19 | ); 20 | 21 | workflow.Start(new ConditionState() { MaxRun = 5 }); 22 | Assert.AreEqual(0, workflow.Workload.StateFullVariable); 23 | workflow.Unblock(); 24 | Assert.AreEqual(1, workflow.Workload.StateFullVariable); 25 | workflow.Unblock(); 26 | Assert.AreEqual(3, workflow.Workload.StateFullVariable); 27 | workflow.Unblock(); 28 | Assert.AreEqual(6, workflow.Workload.StateFullVariable); 29 | workflow.Unblock(); 30 | Assert.AreEqual(10, workflow.Workload.StateFullVariable); 31 | } 32 | 33 | public void WhileContent(ConditionState state) 34 | { 35 | state.StateFullVariable += state.ActualRun; 36 | state.ActualRun++; 37 | } 38 | 39 | public bool WhileTest(ConditionState state) 40 | { 41 | return state.ActualRun < state.MaxRun; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow/Actions/WorkflowAction.cs: -------------------------------------------------------------------------------- 1 | namespace TinyWorkflow.Actions 2 | { 3 | /// 4 | /// Workflow action that is representing a workflow step. 5 | /// 6 | /// Type of the state linked to the workflow. 7 | internal abstract class WorkflowAction 8 | { 9 | #region Public properties 10 | 11 | /// 12 | /// State of the workflow. 13 | /// 14 | public abstract WorkflowActionState State { get; } 15 | 16 | #endregion Public properties 17 | 18 | #region Public methods 19 | 20 | /// 21 | /// Resolve the dynamic part of the step. 22 | /// 23 | /// 24 | public virtual void Resolve(T obj) 25 | { 26 | } 27 | 28 | /// 29 | /// Reset the action to it's initial state. 30 | /// 31 | /// 32 | public virtual void Reset() 33 | { 34 | } 35 | 36 | /// 37 | /// Run the step 38 | /// 39 | /// 40 | public virtual void Run(T obj) 41 | { 42 | } 43 | 44 | /// 45 | /// Unblock the step. 46 | /// 47 | /// 48 | public virtual void Unblock(int unblockLevel) 49 | { 50 | } 51 | 52 | #endregion Public methods 53 | } 54 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow/IWorkflow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace TinyWorkflow 5 | { 6 | public interface IWorkflow 7 | { 8 | T Workload { get; set; } 9 | 10 | WorkflowState State { get; } 11 | 12 | void Start(T workload); 13 | 14 | void StartAndReset(T workload); 15 | 16 | void End(); 17 | 18 | void Reset(); 19 | 20 | void Unblock(); 21 | 22 | void Unblock(int level); 23 | 24 | void UnblockAll(); 25 | 26 | IWorkflow Block(); 27 | 28 | IWorkflow Block(int blockCount); 29 | 30 | IWorkflow Block(Func blockCount); 31 | 32 | IWorkflow Do(Action action); 33 | 34 | IWorkflow DoAsynch(params Action[] actions); 35 | 36 | IWorkflow DoParallel(params Action[] actions); 37 | 38 | IWorkflow Foreach(Func> itemExtractor, Action> action); 39 | 40 | IWorkflow Foreach(Func> itemExtractor, IWorkflow> workflow); 41 | 42 | IWorkflow While(Func condition, Action action); 43 | 44 | IWorkflow While(Func condition, IWorkflow workflow); 45 | 46 | IWorkflow If(Func condition, Action actionIfTrue, Action actionIfFalse); 47 | 48 | IWorkflow If(Func condition, IWorkflow actionsIfTrue, IWorkflow actionsIfFalse); 49 | } 50 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow/Actions/MultipleGoWorkflowAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace TinyWorkflow.Actions 5 | { 6 | internal class MultipleGoWorkflowAction : WorkflowAction 7 | { 8 | private readonly bool m_waitActionsFinish; 9 | 10 | #region Public properties 11 | 12 | /// 13 | /// Action embeded in the step 14 | /// 15 | public Action[] Actions { get; private set; } 16 | 17 | public override WorkflowActionState State 18 | { 19 | get { return state; } 20 | } 21 | 22 | #endregion Public properties 23 | 24 | #region Private Variables 25 | 26 | private WorkflowActionState state; 27 | 28 | #endregion Private Variables 29 | 30 | #region Ctor 31 | 32 | public MultipleGoWorkflowAction(Action[] actions, bool waitActionsFinish) 33 | { 34 | m_waitActionsFinish = waitActionsFinish; 35 | Actions = actions; 36 | state = WorkflowActionState.Ready; 37 | } 38 | 39 | #endregion Ctor 40 | 41 | #region Public methods 42 | 43 | public override void Reset() 44 | { 45 | state = WorkflowActionState.Ready; 46 | } 47 | 48 | public override void Run(T obj) 49 | { 50 | Task task = Task.Run(() => Parallel.ForEach(Actions, (action) => action(obj))); 51 | if (m_waitActionsFinish) 52 | task.Wait(); 53 | state = WorkflowActionState.Ended; 54 | } 55 | 56 | #endregion Public methods 57 | } 58 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("TinyWorkflow")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("TinyWorkflow")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("845067ac-dc96-4012-804f-841be1b5d89a")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("TinyWorkflow.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("TinyWorkflow.Tests")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("c13b5bfe-1630-44dd-b68e-85771b6689e2")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/SimpleStepTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using TinyWorkflow.Tests.States; 4 | 5 | namespace TinyWorkflow.Tests 6 | { 7 | [TestClass] 8 | public class SimpleStepTest 9 | { 10 | [TestMethod] 11 | public void RunOneStep() 12 | { 13 | var workflow = new Workflow() 14 | .Do(EasyAction); 15 | workflow.Start(new SimpleState()); 16 | Assert.AreEqual(1, workflow.Workload.StateFullVariable); 17 | } 18 | 19 | [TestMethod] 20 | public void RunMultipleStepSequence() 21 | { 22 | var workflow = new Workflow() 23 | .Do(EasyAction) 24 | .Do(EasyAction2) 25 | .Do(EasyAction3); 26 | workflow.Start(new SimpleState()); 27 | Assert.AreEqual(3, workflow.Workload.StateFullVariable); 28 | } 29 | 30 | [TestMethod] 31 | public void RunHugeMultipleStep() 32 | { 33 | Workflow workflow = new Workflow(); 34 | for (int i = 0; i < 500; i++) 35 | { 36 | workflow.Do(EasyActionAdd); 37 | } 38 | workflow.Start(new SimpleState()); 39 | Assert.AreEqual(500, workflow.Workload.StateFullVariable); 40 | } 41 | 42 | public void EasyAction(SimpleState state) 43 | { 44 | state.StateFullVariable = 1; 45 | } 46 | 47 | public void EasyAction2(SimpleState state) 48 | { 49 | state.StateFullVariable = 2; 50 | } 51 | 52 | public void EasyAction3(SimpleState state) 53 | { 54 | state.StateFullVariable = 3; 55 | } 56 | 57 | public void EasyActionAdd(SimpleState state) 58 | { 59 | state.StateFullVariable++; 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/BlockIfStepTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using TinyWorkflow.Tests.States; 4 | 5 | namespace TinyWorkflow.Tests 6 | { 7 | [TestClass] 8 | public class BlockIfStepTest 9 | { 10 | [TestMethod] 11 | public void RunIfTrueAndBlock() 12 | { 13 | var workflow = new Workflow() 14 | .If(TestToTrue, ActionIfTrue, ActionIfFalse) 15 | .Block() 16 | .Do(ActionAfter); 17 | workflow.Start(new SimpleState()); 18 | Assert.AreEqual(2, workflow.Workload.StateFullVariable); 19 | workflow.Unblock(); 20 | Assert.AreEqual(3, workflow.Workload.StateFullVariable); 21 | } 22 | 23 | [TestMethod] 24 | public void RunIfFalseAndBlock() 25 | { 26 | var workflow = new Workflow() 27 | .If(TestToFalse, ActionIfTrue, ActionIfFalse) 28 | .Block() 29 | .Do(ActionAfter); 30 | workflow.Start(new SimpleState()); 31 | Assert.AreEqual(3, workflow.Workload.StateFullVariable); 32 | workflow.Unblock(); 33 | Assert.AreEqual(4, workflow.Workload.StateFullVariable); 34 | } 35 | 36 | public bool TestToTrue(SimpleState state) 37 | { 38 | return state.StateFullVariable == 0; 39 | } 40 | 41 | public bool TestToFalse(SimpleState state) 42 | { 43 | return state.StateFullVariable != 0; 44 | } 45 | 46 | public void ActionIfTrue(SimpleState state) 47 | { 48 | state.StateFullVariable = 2; 49 | } 50 | 51 | public void ActionIfFalse(SimpleState state) 52 | { 53 | state.StateFullVariable = 3; 54 | } 55 | 56 | public void ActionAfter(SimpleState state) 57 | { 58 | state.StateFullVariable++; 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/BugFixes/ForStepBugFixTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using TinyWorkflow.Tests.States; 5 | 6 | namespace TinyWorkflow.Tests.BugFixes 7 | { 8 | /// 9 | /// Do not run indefinitely when no items returned (Bug #25775) 10 | /// 11 | [TestClass] 12 | public class ForStepBugFixTest 13 | { 14 | [TestMethod] 15 | public void RunStaticForeach() 16 | { 17 | var workflow = new Workflow() 18 | .Foreach(StaticEnumerateItem, 19 | new Workflow>() 20 | .Do(ActionInForeach) 21 | ); 22 | 23 | workflow.Start(new ListState()); 24 | Assert.AreEqual(0, workflow.Workload.StateFullVariable); 25 | } 26 | 27 | [TestMethod] 28 | public void RunDynamicForeach() 29 | { 30 | var workflow = new Workflow() 31 | .Do(DefineList) 32 | .Foreach(DynamicEnumerateItem, 33 | new Workflow>() 34 | .Do(ActionInForeach) 35 | ); 36 | 37 | workflow.Start(new ListState()); 38 | Assert.AreEqual(0, workflow.Workload.StateFullVariable); 39 | } 40 | 41 | public void DefineList(ListState state) 42 | { 43 | state.List = new List() { }; 44 | } 45 | 46 | public IEnumerable DynamicEnumerateItem(ListState state) 47 | { 48 | return state.List; 49 | } 50 | 51 | public IEnumerable StaticEnumerateItem(ListState state) 52 | { 53 | return new List() { }; 54 | } 55 | 56 | public void ActionInForeach(Tuple state) 57 | { 58 | state.Item2.StateFullVariable += state.Item1; 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/ForStepTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using TinyWorkflow.Tests.States; 5 | 6 | namespace TinyWorkflow.Tests 7 | { 8 | [TestClass] 9 | public class ForStepTest 10 | { 11 | [TestMethod] 12 | public void RunStaticForeach() 13 | { 14 | var workflow = new Workflow() 15 | .Foreach(StaticEnumerateItem, 16 | new Workflow>() 17 | .Do(ActionInForeach) 18 | ); 19 | 20 | //Workflow workflow = new Workflow() 21 | // .Foreach(StaticEnumerateItem,ActionInForeach); 22 | 23 | workflow.Start(new ListState()); 24 | Assert.AreEqual(10, workflow.Workload.StateFullVariable); 25 | } 26 | 27 | [TestMethod] 28 | public void RunDynamicForeach() 29 | { 30 | var workflow = new Workflow() 31 | .Do(DefineList) 32 | .Foreach(DynamicEnumerateItem, 33 | new Workflow>() 34 | .Do(ActionInForeach) 35 | ); 36 | 37 | workflow.Start(new ListState()); 38 | Assert.AreEqual(20, workflow.Workload.StateFullVariable); 39 | } 40 | 41 | public void DefineList(ListState state) 42 | { 43 | state.List = new List() { 5, 6, 9 }; 44 | } 45 | 46 | public IEnumerable DynamicEnumerateItem(ListState state) 47 | { 48 | return state.List; 49 | } 50 | 51 | public IEnumerable StaticEnumerateItem(ListState state) 52 | { 53 | return new List() { 3, 5, 2 }; 54 | } 55 | 56 | public void ActionInForeach(Tuple state) 57 | { 58 | state.Item2.StateFullVariable += state.Item1; 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/ServiceMock/SideDataService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using TinyWorkflow.UITests.ServiceMock.Enums; 7 | 8 | namespace TinyWorkflow.UITests.ServiceMock 9 | { 10 | public class SideDataService : BaseService 11 | { 12 | List users = new List() { "Jean", "Pierre", "Paul", "Jacques", "Yves", "Choubidoumaster", "Fred", "Marcel" }; 13 | List sections = new List() { "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X" }; 14 | 15 | public void GetUsers(Action> callback) 16 | { 17 | Task.Factory.StartNew(() => 18 | { 19 | this.GenerateSleep(500, 1500); 20 | callback(users); 21 | }); 22 | } 23 | 24 | public void GetSections(Action> callback) 25 | { 26 | Task.Factory.StartNew(() => 27 | { 28 | this.GenerateSleep(500, 1500); 29 | callback(sections); 30 | }); 31 | } 32 | 33 | public void GetUserSections(string user, Action> callback) 34 | { 35 | Task.Factory.StartNew(() => 36 | { 37 | this.GenerateSleep(500, 1500); 38 | List tempSection = sections.ToList(); 39 | int loop = r.Next(5); 40 | for (int i = 0; i < loop; i++) 41 | { 42 | tempSection.RemoveAt(r.Next(tempSection.Count)); 43 | } 44 | callback(tempSection); 45 | 46 | }); 47 | } 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow/Actions/BlockWorkflowAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace TinyWorkflow.Actions 4 | { 5 | internal class BlockWorkflowAction : WorkflowAction 6 | { 7 | #region Public properties 8 | 9 | public override WorkflowActionState State 10 | { 11 | get 12 | { 13 | if (!BlockCount.HasValue) 14 | { 15 | return WorkflowActionState.Ready; 16 | } 17 | else if (BlockCount.Value > UnblockedCount) 18 | { 19 | return WorkflowActionState.Blocked; 20 | } 21 | else 22 | { 23 | return WorkflowActionState.Ended; 24 | } 25 | } 26 | } 27 | 28 | /// 29 | /// Function that will return dynamicaly the number of block count. 30 | /// 31 | public Func BlockCountFunc { get; private set; } 32 | 33 | /// 34 | /// Once resolved, keep the value of block count. 35 | /// 36 | public int? BlockCount { get; private set; } 37 | 38 | /// 39 | /// How many times the unblock method has been called. 40 | /// 41 | public int UnblockedCount { get; private set; } 42 | 43 | #endregion Public properties 44 | 45 | #region Ctor 46 | 47 | public BlockWorkflowAction(Func blockCount) 48 | { 49 | BlockCountFunc = blockCount; 50 | } 51 | 52 | #endregion Ctor 53 | 54 | #region Public methods 55 | 56 | public override void Reset() 57 | { 58 | UnblockedCount = 0; 59 | } 60 | 61 | #endregion Public methods 62 | 63 | public override void Resolve(T obj) 64 | { 65 | BlockCount = BlockCountFunc(obj); 66 | } 67 | 68 | public override void Unblock(int unblockLevel) 69 | { 70 | lock (this) 71 | { 72 | if (unblockLevel == Int32.MaxValue) 73 | { 74 | UnblockedCount = Int32.MaxValue; 75 | } 76 | else 77 | { 78 | UnblockedCount += unblockLevel; 79 | } 80 | } 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/ViewModel/Model/UserRight.cs: -------------------------------------------------------------------------------- 1 | using GalaSoft.MvvmLight; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Collections.ObjectModel; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace TinyWorkflow.UITests.ViewModel.Model 10 | { 11 | public class UserRight : ViewModelBase 12 | { 13 | #region User 14 | private string _User = string.Empty; 15 | 16 | /// 17 | /// Sets and gets the User property. 18 | /// Changes to that property's value raise the PropertyChanged event. 19 | /// 20 | public string User 21 | { 22 | get 23 | { 24 | return _User; 25 | } 26 | 27 | set 28 | { 29 | if (_User == value) 30 | { 31 | return; 32 | } 33 | 34 | _User = value; 35 | RaisePropertyChanged("User"); 36 | } 37 | } 38 | #endregion 39 | 40 | #region Rights 41 | private ObservableCollection _Rights = new ObservableCollection(); 42 | 43 | /// 44 | /// Sets and gets the Rights property. 45 | /// Changes to that property's value raise the PropertyChanged event. 46 | /// 47 | public ObservableCollection Rights 48 | { 49 | get 50 | { 51 | return _Rights; 52 | } 53 | 54 | set 55 | { 56 | if (_Rights == value) 57 | { 58 | return; 59 | } 60 | 61 | _Rights = value; 62 | RaisePropertyChanged("Rights"); 63 | } 64 | } 65 | #endregion 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/ViewModel/ViewModelLocator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | In App.xaml: 3 | 4 | 6 | 7 | 8 | In the View: 9 | DataContext="{Binding Source={StaticResource Locator}, Path=ViewModelName}" 10 | 11 | You can also use Blend to do all this with the tool's support. 12 | See http://www.galasoft.ch/mvvm 13 | */ 14 | 15 | using GalaSoft.MvvmLight; 16 | using GalaSoft.MvvmLight.Ioc; 17 | using Microsoft.Practices.ServiceLocation; 18 | 19 | namespace TinyWorkflow.UITests.ViewModel 20 | { 21 | /// 22 | /// This class contains static references to all the view models in the 23 | /// application and provides an entry point for the bindings. 24 | /// 25 | public class ViewModelLocator 26 | { 27 | /// 28 | /// Initializes a new instance of the ViewModelLocator class. 29 | /// 30 | public ViewModelLocator() 31 | { 32 | ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); 33 | 34 | ////if (ViewModelBase.IsInDesignModeStatic) 35 | ////{ 36 | //// // Create design time view services and models 37 | //// SimpleIoc.Default.Register(); 38 | ////} 39 | ////else 40 | ////{ 41 | //// // Create run time view services and models 42 | //// SimpleIoc.Default.Register(); 43 | ////} 44 | 45 | SimpleIoc.Default.Register(); 46 | } 47 | 48 | public MainViewModel Main 49 | { 50 | get 51 | { 52 | return ServiceLocator.Current.GetInstance(); 53 | } 54 | } 55 | 56 | public static void Cleanup() 57 | { 58 | // TODO Clear the ViewModels 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/Content/ViewModel/ViewModelLocator.cs.pp: -------------------------------------------------------------------------------- 1 | /* 2 | In App.xaml: 3 | 4 | 6 | 7 | 8 | In the View: 9 | DataContext="{Binding Source={StaticResource Locator}, Path=ViewModelName}" 10 | 11 | You can also use Blend to do all this with the tool's support. 12 | See http://www.galasoft.ch/mvvm 13 | */ 14 | 15 | using GalaSoft.MvvmLight; 16 | using GalaSoft.MvvmLight.Ioc; 17 | using Microsoft.Practices.ServiceLocation; 18 | 19 | namespace $rootnamespace$.ViewModel 20 | { 21 | /// 22 | /// This class contains static references to all the view models in the 23 | /// application and provides an entry point for the bindings. 24 | /// 25 | public class ViewModelLocator 26 | { 27 | /// 28 | /// Initializes a new instance of the ViewModelLocator class. 29 | /// 30 | public ViewModelLocator() 31 | { 32 | ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); 33 | 34 | ////if (ViewModelBase.IsInDesignModeStatic) 35 | ////{ 36 | //// // Create design time view services and models 37 | //// SimpleIoc.Default.Register(); 38 | ////} 39 | ////else 40 | ////{ 41 | //// // Create run time view services and models 42 | //// SimpleIoc.Default.Register(); 43 | ////} 44 | 45 | SimpleIoc.Default.Register(); 46 | } 47 | 48 | public MainViewModel Main 49 | { 50 | get 51 | { 52 | return ServiceLocator.Current.GetInstance(); 53 | } 54 | } 55 | 56 | public static void Cleanup() 57 | { 58 | // TODO Clear the ViewModels 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TinyWorkflow", "TinyWorkflow\TinyWorkflow.csproj", "{EB78B492-6A7E-439C-9000-32BDE7B8CB53}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TinyWorkflow.Tests", "TinyWorkflow.Tests\TinyWorkflow.Tests.csproj", "{FA775B80-F4D4-4AE0-8E71-1559D6089E13}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TinyWorkflow.UITests", "TinyWorkflow.UITests\TinyWorkflow.UITests.csproj", "{25B9A518-CBD6-4FAD-A124-26C76641AD3C}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {EB78B492-6A7E-439C-9000-32BDE7B8CB53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {EB78B492-6A7E-439C-9000-32BDE7B8CB53}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {EB78B492-6A7E-439C-9000-32BDE7B8CB53}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {EB78B492-6A7E-439C-9000-32BDE7B8CB53}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {FA775B80-F4D4-4AE0-8E71-1559D6089E13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {FA775B80-F4D4-4AE0-8E71-1559D6089E13}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {FA775B80-F4D4-4AE0-8E71-1559D6089E13}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {FA775B80-F4D4-4AE0-8E71-1559D6089E13}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {25B9A518-CBD6-4FAD-A124-26C76641AD3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {25B9A518-CBD6-4FAD-A124-26C76641AD3C}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {25B9A518-CBD6-4FAD-A124-26C76641AD3C}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {25B9A518-CBD6-4FAD-A124-26C76641AD3C}.Release|Any CPU.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/AsynchStepTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using TinyWorkflow.Tests.States; 5 | 6 | namespace TinyWorkflow.Tests 7 | { 8 | [TestClass] 9 | public class AsynchStepTest 10 | { 11 | private IWorkflow temporaryWorkflow; 12 | 13 | [TestMethod] 14 | public void RunOneAsynchStep() 15 | { 16 | temporaryWorkflow = new Workflow() 17 | .DoAsynch(EasyAction) 18 | .Block() 19 | .Do(EasyAsynchronousTestValidation); 20 | temporaryWorkflow.Start(new SimpleState()); 21 | Thread.Sleep(3000); 22 | } 23 | 24 | [TestMethod] 25 | public void RunMultipleAsynchStep() 26 | { 27 | temporaryWorkflow = new Workflow() 28 | .DoAsynch(EasyActionAsynch1, EasyActionAsynch2, EasyActionAsynch3) 29 | .Block(3) 30 | .Do(AsynchronousTestValidation); 31 | temporaryWorkflow.Start(new SimpleState()); 32 | Thread.Sleep(3000); 33 | } 34 | 35 | public void EasyAsynchronousTestValidation(SimpleState state) 36 | { 37 | Assert.AreEqual(1, state.StateFullVariable); 38 | } 39 | 40 | public void AsynchronousTestValidation(SimpleState state) 41 | { 42 | Assert.AreEqual(10, state.StateFullVariableAsynch1); 43 | Assert.AreEqual(20, state.StateFullVariableAsynch2); 44 | Assert.AreEqual(30, state.StateFullVariableAsynch3); 45 | } 46 | 47 | public void EasyAction(SimpleState state) 48 | { 49 | Thread.Sleep(1000); 50 | state.StateFullVariable = 1; 51 | temporaryWorkflow.Unblock(); 52 | } 53 | 54 | public void EasyActionAsynch1(SimpleState state) 55 | { 56 | Thread.Sleep(1200); 57 | state.StateFullVariableAsynch1 = 10; 58 | temporaryWorkflow.Unblock(); 59 | } 60 | 61 | public void EasyActionAsynch2(SimpleState state) 62 | { 63 | Thread.Sleep(700); 64 | state.StateFullVariableAsynch2 = 20; 65 | temporaryWorkflow.Unblock(); 66 | } 67 | 68 | public void EasyActionAsynch3(SimpleState state) 69 | { 70 | Thread.Sleep(1000); 71 | state.StateFullVariableAsynch3 = 30; 72 | temporaryWorkflow.Unblock(); 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/ComplexTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | using TinyWorkflow.Tests.States; 5 | 6 | namespace TinyWorkflow.Tests 7 | { 8 | [TestClass] 9 | public class ComplexTest 10 | { 11 | [TestMethod] 12 | public void FindAllPrimeNumbersAfter() 13 | { 14 | var workflow = new Workflow() 15 | //Define the 16 | .Do(DefineInitialList) 17 | .Foreach(DynamicEnumerateItem, 18 | new Workflow>() 19 | .Do(InitWhile) 20 | .While(TestNumber, InternalWhileContent) 21 | .Do(RegisterResult)); 22 | 23 | workflow.Start(new ComplexState()); 24 | Assert.AreEqual(7, workflow.Workload.ListFinal[0]); 25 | Assert.AreEqual(7, workflow.Workload.ListFinal[1]); 26 | Assert.AreEqual(11, workflow.Workload.ListFinal[2]); 27 | } 28 | 29 | public void DefineInitialList(ComplexState state) 30 | { 31 | state.ListInitial = new List() { 5, 6, 9 }; 32 | } 33 | 34 | public IEnumerable DynamicEnumerateItem(ComplexState state) 35 | { 36 | return state.ListInitial; 37 | } 38 | 39 | public IEnumerable DynamicEnumerateItemResult(ComplexState state) 40 | { 41 | return state.ListFinal; 42 | } 43 | 44 | public void PrintNumber(Tuple state) 45 | { 46 | Console.WriteLine(state.Item1 + " is a prime number"); 47 | } 48 | 49 | public void InitWhile(Tuple state) 50 | { 51 | state.Item2.CacheValue = state.Item1 + 1; 52 | } 53 | 54 | public bool TestNumber(Tuple state) 55 | { 56 | return !IsPrimeNumber(state.Item2.CacheValue); 57 | } 58 | 59 | public void InternalWhileContent(Tuple state) 60 | { 61 | state.Item2.CacheValue++; 62 | } 63 | 64 | public void RegisterResult(Tuple state) 65 | { 66 | state.Item2.ListFinal.Add(state.Item2.CacheValue); 67 | } 68 | 69 | private bool IsPrimeNumber(int number) 70 | { 71 | for (int i = 2; i <= number / 2; i++) 72 | { 73 | if ((number % i == 0)) 74 | { 75 | return false; 76 | } 77 | } 78 | 79 | return true; 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/ParallelStepTest.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using TinyWorkflow.Tests.States; 4 | 5 | namespace TinyWorkflow.Tests 6 | { 7 | [TestClass] 8 | public class ParallelStepTest 9 | { 10 | private IWorkflow temporaryWorkflow; 11 | 12 | [TestMethod] 13 | public void RunOneParallelStep() 14 | { 15 | temporaryWorkflow = new Workflow() 16 | .DoParallel(EasyAction) 17 | .Do(EasyParallelTestValidation); 18 | temporaryWorkflow.Start(new SimpleState()); 19 | } 20 | 21 | [TestMethod] 22 | public void RunMultipleParallelStep() 23 | { 24 | temporaryWorkflow = new Workflow() 25 | .DoParallel(EasyActionParallel1, EasyActionParallel2, EasyActionParallel3) 26 | .Do(ParallelTestValidation); 27 | temporaryWorkflow.Start(new SimpleState()); 28 | } 29 | 30 | public void EasyParallelTestValidation(SimpleState state) 31 | { 32 | Assert.AreEqual(1, state.StateFullVariable); 33 | } 34 | 35 | public void ParallelTestValidation(SimpleState state) 36 | { 37 | Assert.AreEqual(10, state.StateFullVariableAsynch1); 38 | Assert.AreEqual(20, state.StateFullVariableAsynch2); 39 | Assert.AreEqual(30, state.StateFullVariableAsynch3); 40 | } 41 | 42 | public void EasyAction(SimpleState state) 43 | { 44 | Thread.Sleep(1000); 45 | state.StateFullVariable = 1; 46 | } 47 | 48 | public void EasyActionParallel1(SimpleState state) 49 | { 50 | Thread.Sleep(1200); 51 | state.StateFullVariableAsynch1 = 10; 52 | } 53 | 54 | public void EasyActionParallel2(SimpleState state) 55 | { 56 | Thread.Sleep(700); 57 | state.StateFullVariableAsynch2 = 20; 58 | } 59 | 60 | public void EasyActionParallel3(SimpleState state) 61 | { 62 | Thread.Sleep(1000); 63 | state.StateFullVariableAsynch3 = 30; 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("TinyWorkflow.UITests")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("TinyWorkflow.UITests")] 15 | [assembly: AssemblyCopyright("Copyright © 2013")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/MvvmLight.4.1.26.1.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MvvmLight 5 | 4.1.26.1 6 | MVVM Light 7 | Laurent Bugnion (GalaSoft) 8 | Laurent Bugnion (GalaSoft) 9 | http://mvvmlight.codeplex.com/license 10 | http://www.galasoft.ch/mvvm 11 | http://www.galasoft.ch/mvvm/resources/Logo/icon_100x100_transparent.png 12 | true 13 | The MVVM Light Toolkit is a set of components helping people to get started in the Model-View-ViewModel pattern in Silverlight, WPF, Windows Phone 7 and Windows 8. It is a light and pragmatic framework that contains only the essential components needed. This is V4 RTM! 14 | The MVVM Light Toolkit is a set of components helping people to get started in the Model-View-ViewModel pattern in all versions of Silverlight, WPF, Windows Phone 7 and Windows 8. 15 | Copyright 2013 Laurent Bugnion (GalaSoft) 16 | en-US 17 | mvvm mvvmlight silverlight wp7 windows8 winrt win8 wpf windowsphone windowsphone7 windowsphone8 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow/Actions/WhileWorkflowAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace TinyWorkflow.Actions 4 | { 5 | internal class WhileWorkflowAction : WorkflowAction 6 | { 7 | #region Public properties 8 | 9 | /// 10 | /// Action embeded in the step 11 | /// 12 | public IWorkflow Workflow { get; private set; } 13 | 14 | /// 15 | /// Condition for running the step 16 | /// 17 | public Func ConditionToRun { get; private set; } 18 | 19 | /// 20 | /// Condition result, once evaluated. 21 | /// 22 | public bool? CachedConditionToRun { get; private set; } 23 | 24 | public override WorkflowActionState State 25 | { 26 | get 27 | { 28 | if (!CachedConditionToRun.HasValue) 29 | { 30 | return WorkflowActionState.Ready; 31 | } 32 | else if (CachedConditionToRun == true) 33 | { 34 | if (Workflow.State == WorkflowState.End) 35 | { 36 | return WorkflowActionState.Ended; 37 | } 38 | if (Workflow.State == WorkflowState.Blocked) 39 | { 40 | return WorkflowActionState.Blocked; 41 | } 42 | return WorkflowActionState.Ready; 43 | } 44 | else 45 | { 46 | return WorkflowActionState.Ended; 47 | } 48 | } 49 | } 50 | 51 | #endregion Public properties 52 | 53 | #region Private Variables 54 | 55 | private T _State; 56 | 57 | #endregion Private Variables 58 | 59 | #region Ctor 60 | 61 | public WhileWorkflowAction(Func conditionToRun, Action action) 62 | : this(conditionToRun, new Workflow().Do(action)) 63 | { 64 | } 65 | 66 | public WhileWorkflowAction(Func conditionToRun, IWorkflow workflow) 67 | { 68 | Workflow = workflow; 69 | ConditionToRun = conditionToRun; 70 | } 71 | 72 | #endregion Ctor 73 | 74 | #region Public methods 75 | 76 | private bool EvaluateCondition(T obj) 77 | { 78 | CachedConditionToRun = ConditionToRun(obj); 79 | return CachedConditionToRun.Value; 80 | } 81 | 82 | public override void Reset() 83 | { 84 | if (Workflow != null) 85 | { 86 | Workflow.Reset(); 87 | } 88 | CachedConditionToRun = null; 89 | } 90 | 91 | public override void Run(T obj) 92 | { 93 | _State = obj; 94 | if (Workflow != null) 95 | { 96 | if (EvaluateCondition(obj)) 97 | { 98 | Workflow.Start(obj); 99 | 100 | if (Workflow.State == WorkflowState.End && EvaluateCondition(obj)) 101 | { 102 | Workflow.Reset(); 103 | } 104 | } 105 | } 106 | } 107 | 108 | public override void Unblock(int unblockLevel) 109 | { 110 | var wf = Workflow as Workflow; 111 | 112 | if (wf != null) 113 | { 114 | wf.UnblockInternal(unblockLevel); 115 | 116 | //if (Workflow.State == WorkflowState.End && EvaluateCondition(_State)) 117 | //{ 118 | // Workflow.Reset(); 119 | //} 120 | } 121 | } 122 | 123 | #endregion Public methods 124 | } 125 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow/Actions/ForWorkflowAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace TinyWorkflow.Actions 6 | { 7 | internal class ForWorkflowAction : WorkflowAction 8 | { 9 | #region Public properties 10 | 11 | public override WorkflowActionState State 12 | { 13 | get 14 | { 15 | if (Workflow.State == WorkflowState.End) 16 | { 17 | return WorkflowActionState.Ended; 18 | } 19 | if (Workflow.State == WorkflowState.Blocked) 20 | { 21 | return WorkflowActionState.Blocked; 22 | } 23 | return WorkflowActionState.Ready; 24 | } 25 | } 26 | 27 | public Func> Enumarator { get; private set; } 28 | 29 | public IWorkflow> Workflow { get; private set; } 30 | 31 | #endregion Public properties 32 | 33 | #region Private Variables 34 | 35 | private List ResolvedEnumerator; 36 | 37 | private int indexOfRun; 38 | 39 | private T LastState; 40 | 41 | #endregion Private Variables 42 | 43 | #region Ctor 44 | 45 | public ForWorkflowAction(Func> enumerator, IWorkflow> workflow) 46 | { 47 | Workflow = workflow; 48 | Enumarator = enumerator; 49 | indexOfRun = 0; 50 | } 51 | 52 | #endregion Ctor 53 | 54 | #region Public methods 55 | 56 | public override void Reset() 57 | { 58 | indexOfRun = 0; 59 | if (Workflow != null) 60 | { 61 | Workflow.Reset(); 62 | } 63 | } 64 | 65 | /// 66 | /// Resolve the dynamic part of the step. 67 | /// 68 | /// 69 | public override void Resolve(T obj) 70 | { 71 | LastState = obj; 72 | ResolvedEnumerator = Enumarator(obj).ToList(); 73 | } 74 | 75 | /// 76 | /// Run the step 77 | /// 78 | /// 79 | public override void Run(T obj) 80 | { 81 | LastState = obj; 82 | 83 | if (indexOfRun >= ResolvedEnumerator.Count) 84 | { 85 | //Workflow part is done before starting. 86 | //No items to iterate. 87 | Workflow.End(); 88 | } 89 | else 90 | { 91 | do 92 | { 93 | Workflow.Start(new Tuple(ResolvedEnumerator[indexOfRun], obj)); 94 | switch (Workflow.State) 95 | { 96 | case WorkflowState.End: 97 | indexOfRun++; 98 | if (indexOfRun < ResolvedEnumerator.Count) 99 | { 100 | Workflow.Reset(); 101 | } 102 | break; 103 | 104 | case WorkflowState.Blocked: 105 | return; 106 | } 107 | } 108 | while (indexOfRun < ResolvedEnumerator.Count); 109 | } 110 | } 111 | 112 | public override void Unblock(int unblockLevel) 113 | { 114 | var wf = Workflow as Workflow; 115 | wf?.UnblockInternal(unblockLevel); 116 | //Run(LastState); 117 | //if (indexOfRun >= ResolvedEnumerator.Count) 118 | //{ 119 | // Workflow.Reset(); 120 | //} 121 | } 122 | 123 | #endregion Public methods 124 | } 125 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18033 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace TinyWorkflow.UITests.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TinyWorkflow.UITests.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow/TinyWorkflow.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14.0 6 | Debug 7 | AnyCPU 8 | {EB78B492-6A7E-439C-9000-32BDE7B8CB53} 9 | Library 10 | Properties 11 | TinyWorkflow 12 | TinyWorkflow.Core 13 | en-US 14 | 512 15 | {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 16 | 17 | 18 | v5.0 19 | 20 | 21 | true 22 | full 23 | false 24 | bin\Debug\ 25 | DEBUG;TRACE 26 | prompt 27 | 4 28 | 29 | 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 66 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow/Actions/IfWorkflowAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace TinyWorkflow.Actions 5 | { 6 | internal class IfWorkflowAction : WorkflowAction 7 | { 8 | #region Public properties 9 | 10 | public override WorkflowActionState State 11 | { 12 | get 13 | { 14 | var tempWF = EvaluatedConditionOnResolve == true ? WorkflowIfTrue : null; 15 | tempWF = EvaluatedConditionOnResolve == false ? WorkflowIfFalse : tempWF; 16 | 17 | if (tempWF != null) 18 | { 19 | if (tempWF.State == WorkflowState.Blocked) 20 | { 21 | return WorkflowActionState.Blocked; 22 | } 23 | 24 | if (tempWF.State == WorkflowState.End) 25 | { 26 | return WorkflowActionState.Ended; 27 | } 28 | } 29 | 30 | return WorkflowActionState.Ready; 31 | } 32 | } 33 | 34 | /// 35 | /// Action embeded in the step if True 36 | /// 37 | public IWorkflow WorkflowIfTrue { get; private set; } 38 | 39 | /// 40 | /// Action embeded in the step if False 41 | /// 42 | public IWorkflow WorkflowIfFalse { get; private set; } 43 | 44 | /// 45 | /// Condition for steps 46 | /// 47 | public Func Condition { get; private set; } 48 | 49 | /// 50 | /// Dynamic query that is used in cas of 'for'. Must be evaluated just before being run. 51 | /// 52 | public Func>> DynamicQuery { get; private set; } 53 | 54 | #endregion Public properties 55 | 56 | #region Private Variables 57 | 58 | private bool? EvaluatedConditionOnResolve { get; set; } 59 | 60 | #endregion Private Variables 61 | 62 | #region Ctor 63 | 64 | public IfWorkflowAction(Func condition, Action actionIfTrue, Action actionIfFalse) 65 | : this(condition, new Workflow().Do(actionIfTrue), new Workflow().Do(actionIfFalse)) 66 | { 67 | } 68 | 69 | public IfWorkflowAction(Func condition, IWorkflow actionIfTrue, IWorkflow actionIfFalse) 70 | { 71 | Condition = condition; 72 | WorkflowIfTrue = actionIfTrue; 73 | WorkflowIfFalse = actionIfFalse; 74 | } 75 | 76 | #endregion Ctor 77 | 78 | #region Public methods 79 | 80 | public override void Reset() 81 | { 82 | if (WorkflowIfTrue != null) 83 | { 84 | WorkflowIfTrue.Reset(); 85 | } 86 | if (WorkflowIfFalse != null) 87 | { 88 | WorkflowIfFalse.Reset(); 89 | } 90 | } 91 | 92 | public override void Resolve(T obj) 93 | { 94 | EvaluatedConditionOnResolve = Condition(obj); 95 | } 96 | 97 | public override void Run(T obj) 98 | { 99 | if (EvaluatedConditionOnResolve == true) 100 | { 101 | if (WorkflowIfTrue != null) 102 | { 103 | WorkflowIfTrue.Start(obj); 104 | } 105 | } 106 | else if (EvaluatedConditionOnResolve == false) 107 | { 108 | if (WorkflowIfFalse != null) 109 | { 110 | WorkflowIfFalse.Start(obj); 111 | } 112 | } 113 | else 114 | { 115 | throw new Exception("If part is not resolved"); 116 | } 117 | } 118 | 119 | public override void Unblock(int unblockLevel) 120 | { 121 | if (EvaluatedConditionOnResolve == true) 122 | { 123 | var wfTrue = WorkflowIfTrue as Workflow; 124 | if (wfTrue != null) 125 | { 126 | wfTrue.UnblockInternal(unblockLevel); 127 | } 128 | } 129 | else if (EvaluatedConditionOnResolve == false) 130 | { 131 | var wfFalse = WorkflowIfFalse as Workflow; 132 | if (wfFalse != null) 133 | { 134 | wfFalse.UnblockInternal(unblockLevel); 135 | } 136 | } 137 | } 138 | 139 | #endregion Public methods 140 | } 141 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/TinyWorkflow.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | {FA775B80-F4D4-4AE0-8E71-1559D6089E13} 7 | Library 8 | Properties 9 | TinyWorkflow.Tests 10 | TinyWorkflow.Tests 11 | v4.5 12 | 512 13 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 10.0 15 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 16 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 17 | False 18 | UnitTest 19 | SAK 20 | SAK 21 | SAK 22 | SAK 23 | 24 | 25 | true 26 | full 27 | false 28 | bin\Debug\ 29 | DEBUG;TRACE 30 | prompt 31 | 4 32 | 33 | 34 | pdbonly 35 | true 36 | bin\Release\ 37 | TRACE 38 | prompt 39 | 4 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | {eb78b492-6a7e-439c-9000-32bde7b8cb53} 78 | TinyWorkflow 79 | 80 | 81 | 82 | 83 | 84 | 85 | False 86 | 87 | 88 | False 89 | 90 | 91 | False 92 | 93 | 94 | False 95 | 96 | 97 | 98 | 99 | 100 | 101 | 108 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/ViewModel/States/MainState.cs: -------------------------------------------------------------------------------- 1 | using GalaSoft.MvvmLight; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Collections.ObjectModel; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using TinyWorkflow.UITests.ViewModel.Model; 9 | 10 | namespace TinyWorkflow.UITests.ViewModel.States 11 | { 12 | public class MainState : ViewModelBase 13 | { 14 | public MainState() 15 | { 16 | } 17 | 18 | #region IsReadOnlyUser 19 | private bool _IsReadOnlyUser = false; 20 | 21 | public bool IsReadOnlyUser 22 | { 23 | get 24 | { 25 | return _IsReadOnlyUser; 26 | } 27 | 28 | set 29 | { 30 | if (_IsReadOnlyUser == value) 31 | { 32 | return; 33 | } 34 | 35 | _IsReadOnlyUser = value; 36 | RaisePropertyChanged("IsReadOnlyUser"); 37 | } 38 | } 39 | #endregion 40 | 41 | #region IsReadWriteUser 42 | private bool _IsReadWriteUser = false; 43 | 44 | public bool IsReadWriteUser 45 | { 46 | get 47 | { 48 | return _IsReadWriteUser; 49 | } 50 | 51 | set 52 | { 53 | if (_IsReadWriteUser == value) 54 | { 55 | return; 56 | } 57 | 58 | _IsReadWriteUser = value; 59 | RaisePropertyChanged("IsReadWriteUser"); 60 | } 61 | } 62 | #endregion 63 | 64 | #region IsSuperUser 65 | private bool _IsSuperUser = false; 66 | 67 | /// 68 | /// Sets and gets the IsSuperUser property. 69 | /// Changes to that property's value raise the PropertyChanged event. 70 | /// 71 | public bool IsSuperUser 72 | { 73 | get 74 | { 75 | return _IsSuperUser; 76 | } 77 | 78 | set 79 | { 80 | if (_IsSuperUser == value) 81 | { 82 | return; 83 | } 84 | 85 | _IsSuperUser = value; 86 | RaisePropertyChanged("IsSuperUser"); 87 | } 88 | } 89 | #endregion 90 | 91 | #region UserRights 92 | private ObservableCollection _UserRights = new ObservableCollection(); 93 | 94 | /// 95 | /// Sets and gets the UserRights property. 96 | /// Changes to that property's value raise the PropertyChanged event. 97 | /// 98 | public ObservableCollection UserRights 99 | { 100 | get 101 | { 102 | return _UserRights; 103 | } 104 | 105 | set 106 | { 107 | if (_UserRights == value) 108 | { 109 | return; 110 | } 111 | 112 | _UserRights = value; 113 | RaisePropertyChanged("UserRights"); 114 | } 115 | } 116 | #endregion 117 | 118 | // Loading Stuff 119 | 120 | #region MaxLoadingLevel 121 | private int _MaxLoadingLevel = 0; 122 | 123 | /// 124 | /// Sets and gets the MaxLoadingLevel property. 125 | /// Changes to that property's value raise the PropertyChanged event. 126 | /// 127 | public int MaxLoadingLevel 128 | { 129 | get 130 | { 131 | return _MaxLoadingLevel; 132 | } 133 | 134 | set 135 | { 136 | if (_MaxLoadingLevel == value) 137 | { 138 | return; 139 | } 140 | 141 | _MaxLoadingLevel = value; 142 | RaisePropertyChanged("MaxLoadingLevel"); 143 | } 144 | } 145 | #endregion 146 | 147 | #region ActualLoadingLevel 148 | private int _ActualLoadingLevel = 0; 149 | 150 | /// 151 | /// Sets and gets the ActualLoadingLevel property. 152 | /// Changes to that property's value raise the PropertyChanged event. 153 | /// 154 | public int ActualLoadingLevel 155 | { 156 | get 157 | { 158 | return _ActualLoadingLevel; 159 | } 160 | 161 | set 162 | { 163 | if (_ActualLoadingLevel == value) 164 | { 165 | return; 166 | } 167 | 168 | _ActualLoadingLevel = value; 169 | RaisePropertyChanged("ActualLoadingLevel"); 170 | } 171 | } 172 | #endregion 173 | 174 | #region IsLoading 175 | private bool _IsLoading = false; 176 | 177 | /// 178 | /// Sets and gets the IsLoading property. 179 | /// Changes to that property's value raise the PropertyChanged event. 180 | /// 181 | public bool IsLoading 182 | { 183 | get 184 | { 185 | return _IsLoading; 186 | } 187 | 188 | set 189 | { 190 | if (_IsLoading == value) 191 | { 192 | return; 193 | } 194 | 195 | _IsLoading = value; 196 | RaisePropertyChanged("IsLoading"); 197 | } 198 | } 199 | #endregion 200 | 201 | #region LoadingString 202 | private string _LoadingString = string.Empty; 203 | 204 | /// 205 | /// Sets and gets the LoadingString property. 206 | /// Changes to that property's value raise the PropertyChanged event. 207 | /// 208 | public string LoadingString 209 | { 210 | get 211 | { 212 | return _LoadingString; 213 | } 214 | 215 | set 216 | { 217 | if (_LoadingString == value) 218 | { 219 | return; 220 | } 221 | 222 | _LoadingString = value; 223 | RaisePropertyChanged("LoadingString"); 224 | } 225 | } 226 | #endregion 227 | } 228 | } 229 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/TinyWorkflow.UITests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {25B9A518-CBD6-4FAD-A124-26C76641AD3C} 8 | WinExe 9 | Properties 10 | TinyWorkflow.UITests 11 | TinyWorkflow.UITests 12 | v4.5 13 | 512 14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 4 16 | SAK 17 | SAK 18 | SAK 19 | SAK 20 | 5.2.30810.0 21 | 22 | 23 | AnyCPU 24 | true 25 | full 26 | false 27 | bin\Debug\ 28 | DEBUG;TRACE 29 | prompt 30 | 4 31 | 32 | 33 | AnyCPU 34 | pdbonly 35 | true 36 | bin\Release\ 37 | TRACE 38 | prompt 39 | 4 40 | 41 | 42 | 43 | ..\packages\MvvmLight.4.1.26.1\lib\net45\GalaSoft.MvvmLight.Extras.WPF45.dll 44 | 45 | 46 | ..\packages\MvvmLight.4.1.26.1\lib\net45\GalaSoft.MvvmLight.WPF45.dll 47 | 48 | 49 | 50 | ..\packages\MvvmLight.4.1.26.1\lib\net45\Microsoft.Practices.ServiceLocation.dll 51 | 52 | 53 | 54 | 55 | ..\packages\MvvmLight.4.1.26.1\lib\net45\System.Windows.Interactivity.dll 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 4.0 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | MSBuild:Compile 72 | Designer 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | MSBuild:Compile 84 | Designer 85 | 86 | 87 | App.xaml 88 | Code 89 | 90 | 91 | MainWindow.xaml 92 | Code 93 | 94 | 95 | 96 | 97 | Code 98 | 99 | 100 | True 101 | True 102 | Resources.resx 103 | 104 | 105 | True 106 | Settings.settings 107 | True 108 | 109 | 110 | ResXFileCodeGenerator 111 | Resources.Designer.cs 112 | 113 | 114 | 115 | SettingsSingleFileGenerator 116 | Settings.Designer.cs 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | {eb78b492-6a7e-439c-9000-32bde7b8cb53} 126 | TinyWorkflow 127 | 128 | 129 | 130 | 131 | 132 | 133 | 140 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.Tests/StartAndResetTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | 8 | namespace TinyWorkflow.Tests 9 | { 10 | [TestClass] 11 | public class StartAndResetTest 12 | { 13 | [TestMethod] 14 | public void StartAndResetSingleStepWorkflow() 15 | { 16 | var workflow = new Workflow() 17 | .Do(c => c.Data = c.Data.ToUpper()); 18 | 19 | var contextData = "sample"; 20 | 21 | workflow.StartAndReset(new SimpleWorkflowContext(contextData)); 22 | Assert.AreEqual(WorkflowState.NotRunning, workflow.State); 23 | Assert.AreEqual(contextData.ToUpper(), workflow.Workload.Data); 24 | } 25 | 26 | [TestMethod] 27 | public void StartAndResetMultipleTimes() 28 | { 29 | var workflow = new Workflow() 30 | .Do(c => c.Data = c.Data.ToUpper()); 31 | 32 | var contextData = "sample"; 33 | 34 | workflow.StartAndReset(new SimpleWorkflowContext(contextData)); 35 | Assert.AreEqual(WorkflowState.NotRunning, workflow.State); 36 | Assert.AreEqual(contextData.ToUpper(), workflow.Workload.Data); 37 | 38 | workflow.StartAndReset(new SimpleWorkflowContext(contextData)); 39 | Assert.AreEqual(WorkflowState.NotRunning, workflow.State); 40 | Assert.AreEqual(contextData.ToUpper(), workflow.Workload.Data); 41 | 42 | workflow.StartAndReset(new SimpleWorkflowContext(contextData)); 43 | Assert.AreEqual(WorkflowState.NotRunning, workflow.State); 44 | Assert.AreEqual(contextData.ToUpper(), workflow.Workload.Data); 45 | 46 | workflow.StartAndReset(new SimpleWorkflowContext(contextData)); 47 | Assert.AreEqual(WorkflowState.NotRunning, workflow.State); 48 | Assert.AreEqual(contextData.ToUpper(), workflow.Workload.Data); 49 | } 50 | 51 | [TestMethod] 52 | public void StartAndResetWithMultipleSteps() 53 | { 54 | var workflow = new Workflow() 55 | .Do(c => c.Data = c.Data.ToUpper()) 56 | .Do(c => c.Data = c.Data += c.Data) 57 | .Do(c => c.Data = c.Data.ToLower()); 58 | 59 | var contextData = "sample"; 60 | 61 | workflow.StartAndReset(new SimpleWorkflowContext(contextData)); 62 | Assert.AreEqual(WorkflowState.NotRunning, workflow.State); 63 | Assert.AreEqual(contextData + contextData, workflow.Workload.Data); 64 | 65 | workflow.StartAndReset(new SimpleWorkflowContext(contextData)); 66 | Assert.AreEqual(WorkflowState.NotRunning, workflow.State); 67 | Assert.AreEqual(contextData + contextData, workflow.Workload.Data); 68 | } 69 | 70 | [TestMethod] 71 | public void StartAndResetWithBlockingAction() 72 | { 73 | var workflow = new Workflow() 74 | .Do(c => c.Data = c.Data.ToUpper()) 75 | .Block(1) 76 | .Do(c => c.Data += c.Data); 77 | 78 | var contextData = "sample"; 79 | 80 | //start and check state at which workflow should be blocked 81 | workflow.StartAndReset(new SimpleWorkflowContext(contextData)); 82 | Assert.AreEqual(WorkflowState.Blocked, workflow.State); 83 | Assert.AreEqual(contextData.ToUpper(), workflow.Workload.Data); 84 | 85 | //continue workflow and if it has been reset 86 | workflow.Unblock(); 87 | Assert.AreEqual(WorkflowState.NotRunning, workflow.State); 88 | Assert.AreEqual((contextData + contextData).ToUpper(), workflow.Workload.Data); 89 | } 90 | 91 | [TestMethod] 92 | public void StartAndResetWithForeachWorkflow() 93 | { 94 | var workflow = new Workflow() 95 | .Do(c => c.Data += c.Data) 96 | .Foreach(context => context.Data.ToCharArray(), 97 | context => context.Item2.Data += context.Item1.ToString().ToUpper()); 98 | 99 | var contextData = "sample"; 100 | 101 | workflow.StartAndReset(new SimpleWorkflowContext(contextData)); 102 | Assert.AreEqual(WorkflowState.NotRunning, workflow.State); 103 | Assert.AreEqual(contextData + contextData + (contextData + contextData).ToUpper(), workflow.Workload.Data); 104 | } 105 | 106 | [TestMethod] 107 | public void StartAndResetWithWhileLoop() 108 | { 109 | var workflow = new Workflow() 110 | .While(context => context.Data != context.Data.ToUpper(), context => 111 | { 112 | var charArray = context.Data.ToCharArray(); 113 | for (int i = 0; i < charArray.Length; i++) 114 | { 115 | if (char.IsLower(charArray[i])) 116 | { 117 | charArray[i] = char.ToUpper(charArray[i]); 118 | context.Data = new string(charArray); 119 | break; 120 | } 121 | } 122 | }); 123 | 124 | var contextData = "sample"; 125 | 126 | workflow.StartAndReset(new SimpleWorkflowContext(contextData)); 127 | Assert.AreEqual(WorkflowState.NotRunning, workflow.State); 128 | Assert.AreEqual(contextData.ToUpper(), workflow.Workload.Data); 129 | } 130 | 131 | [TestMethod] 132 | public void StartAndResetWithMultipleWorkflows() 133 | { 134 | var workflow = new Workflow() 135 | .Foreach(context => context.Data.ToCharArray(), new Workflow>() 136 | .Do(context => context.Item2.Data += context.Item1) 137 | .Foreach(context => context.Item2.Data.ToCharArray(), new Workflow>>() 138 | .Do(context => context.Item2.Item2.Data = context.Item2.Item2.Data.Substring(0,context.Item2.Item2.Data.Length - 1)) 139 | ) 140 | ); 141 | 142 | var contextData = "sample"; 143 | 144 | workflow.StartAndReset(new SimpleWorkflowContext(contextData)); 145 | Assert.AreEqual(WorkflowState.NotRunning, workflow.State); 146 | Assert.AreEqual(string.Empty, workflow.Workload.Data); 147 | } 148 | 149 | private class SimpleWorkflowContext 150 | { 151 | public string Data { get; set; } 152 | 153 | public SimpleWorkflowContext(string data) 154 | { 155 | Data = data; 156 | } 157 | } 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /Sources/TinyWorkflow.UITests/ViewModel/MainViewModel.cs: -------------------------------------------------------------------------------- 1 | using GalaSoft.MvvmLight; 2 | using GalaSoft.MvvmLight.Command; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Windows.Threading; 7 | using TinyWorkflow.UITests.ServiceMock; 8 | using TinyWorkflow.UITests.ServiceMock.Enums; 9 | using TinyWorkflow.UITests.ViewModel.Model; 10 | using TinyWorkflow.UITests.ViewModel.States; 11 | 12 | namespace TinyWorkflow.UITests.ViewModel 13 | { 14 | /// 15 | /// This class contains properties that the main View can data bind to. 16 | /// 17 | /// Use the mvvminpc snippet to add bindable properties to this ViewModel. 18 | /// 19 | /// 20 | /// You can also use Blend to data bind with the tool's support. 21 | /// 22 | /// 23 | /// See http://www.galasoft.ch/mvvm 24 | /// 25 | /// 26 | public class MainViewModel : ViewModelBase 27 | { 28 | #region Services 29 | 30 | private RightManagementService rmService = new RightManagementService(); 31 | private SideDataService sdService = new SideDataService(); 32 | 33 | #endregion 34 | 35 | public Dispatcher Dispatcher { get; set; } 36 | 37 | #region Private Variables 38 | 39 | private Workflow loadingWorkflow = new Workflow(); 40 | 41 | #endregion 42 | 43 | #region MainState 44 | private MainState _MainState = new MainState(); 45 | 46 | /// 47 | /// Sets and gets the MainState property. 48 | /// Changes to that property's value raise the PropertyChanged event. 49 | /// 50 | public MainState MainState 51 | { 52 | get 53 | { 54 | return _MainState; 55 | } 56 | 57 | set 58 | { 59 | if (_MainState == value) 60 | { 61 | return; 62 | } 63 | 64 | _MainState = value; 65 | RaisePropertyChanged("MainState"); 66 | } 67 | } 68 | #endregion 69 | 70 | 71 | /// 72 | /// Initializes a new instance of the MainViewModel class. 73 | /// 74 | public MainViewModel() 75 | { 76 | ////Gather all rights. 77 | //loadingWorkflow 78 | // .Do(SetupLoading) 79 | // .DoAsynch(IsReadOnlyUser, IsReadWriteUser, IsReadSuperUser) 80 | // .Block(3) 81 | // //Get user list 82 | // .DoAsynch(GetUsers) 83 | // .Block() 84 | // .Foreach(EnumerateUsers, new Workflow>() 85 | // .Do(RegisterAccess) 86 | // .Block()) 87 | // .Do(RemoveLoading); 88 | 89 | //Gather all rights. 90 | loadingWorkflow 91 | .Do(SetupLoading) 92 | .DoAsynch(IsReadOnlyUser, IsReadWriteUser, IsReadSuperUser) 93 | .Block(3) 94 | //Get user list 95 | .DoAsynch(GetUsers) 96 | .Block() 97 | .Foreach(EnumerateUsers, new Workflow>() 98 | .DoAsynch(RegisterAccess)) 99 | .Block((s) => { return s.UserRights.Count(); }) 100 | .Do(RemoveLoading); 101 | 102 | InitializedCommand = new RelayCommand(Initialized); 103 | loadingWorkflow.Start(MainState); 104 | } 105 | 106 | #region WriteManagement 107 | private void IsReadOnlyUser(MainState s) 108 | { 109 | rmService.HasPrivilege(Rights.ReadOnly, (result) => 110 | { 111 | s.IsReadOnlyUser = result; 112 | loadingWorkflow.Unblock(); 113 | } 114 | ); 115 | } 116 | 117 | private void IsReadWriteUser(MainState s) 118 | { 119 | rmService.HasPrivilege(Rights.ReadWrite, (result) => 120 | { 121 | s.IsReadWriteUser = result; 122 | loadingWorkflow.Unblock(); 123 | } 124 | ); 125 | } 126 | 127 | private void IsReadSuperUser(MainState s) 128 | { 129 | rmService.HasPrivilege(Rights.SuperUser, (result) => 130 | { 131 | s.IsSuperUser = result; 132 | loadingWorkflow.Unblock(); 133 | } 134 | ); 135 | } 136 | #endregion 137 | 138 | #region UserManagement 139 | 140 | private void GetUsers(MainState s) 141 | { 142 | s.LoadingString = "Gathering users ..."; 143 | sdService.GetUsers((result) => 144 | { 145 | Dispatcher.BeginInvoke(new Action(() => 146 | { 147 | foreach (var item in result) 148 | { 149 | s.UserRights.Add(new UserRight() { User = item }); 150 | } 151 | s.MaxLoadingLevel = result.Count(); 152 | loadingWorkflow.Unblock(); 153 | })); 154 | } 155 | ); 156 | } 157 | 158 | private IEnumerable EnumerateUsers(MainState s) 159 | { 160 | return s.UserRights.Select(c => c.User).ToList(); 161 | } 162 | 163 | private void RegisterAccess(Tuple t) 164 | { 165 | t.Item2.LoadingString = "Get data for user " + t.Item1 + " ..."; 166 | sdService.GetUserSections(t.Item1, (result) => 167 | { 168 | Dispatcher.BeginInvoke(new Action(() => 169 | { 170 | UserRight found = t.Item2.UserRights.FirstOrDefault(c => c.User == t.Item1); 171 | if (found != null) 172 | { 173 | lock (t.Item2) 174 | { 175 | found.Rights.Clear(); 176 | foreach (var item in result) 177 | { 178 | found.Rights.Add(item); 179 | } 180 | } 181 | } 182 | t.Item2.ActualLoadingLevel++; 183 | loadingWorkflow.Unblock(); 184 | })); 185 | }); 186 | } 187 | 188 | #endregion 189 | 190 | #region Loading 191 | 192 | public void SetupLoading(MainState s) 193 | { 194 | s.IsLoading = true; 195 | s.LoadingString = "Checking user rights..."; 196 | 197 | } 198 | 199 | public void RemoveLoading(MainState s) 200 | { 201 | s.IsLoading = false; 202 | } 203 | 204 | #endregion 205 | 206 | #region Commands 207 | 208 | public RelayCommand InitializedCommand { get; set; } 209 | 210 | public void Initialized() 211 | { 212 | 213 | } 214 | 215 | #endregion 216 | } 217 | } -------------------------------------------------------------------------------- /Sources/TinyWorkflow/Workflow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using TinyWorkflow.Actions; 4 | 5 | namespace TinyWorkflow 6 | { 7 | /// 8 | /// Represent a workflow. 9 | /// Can be configured in fluent mode. 10 | /// 11 | /// Type of the state 12 | public class Workflow : IWorkflow 13 | { 14 | #region Public 15 | 16 | /// 17 | /// State embeded in the actual Workflow 18 | /// 19 | public T Workload { get; set; } 20 | 21 | /// 22 | /// State of the workflow. 23 | /// 24 | public WorkflowState State 25 | { 26 | get 27 | { 28 | return _State; 29 | } 30 | private set 31 | { 32 | if (value != _State) 33 | { 34 | _State = value; 35 | RaiseWorkflowStateChangedEvent(value); 36 | } 37 | } 38 | } 39 | 40 | #endregion Public 41 | 42 | #region Private 43 | 44 | private readonly List> _Actions; 45 | private WorkflowState _State; 46 | private int _WorkflowStep; 47 | 48 | #endregion Private 49 | 50 | public Workflow() 51 | { 52 | _Actions = new List>(); 53 | State = WorkflowState.NotRunning; 54 | _WorkflowStep = 0; 55 | } 56 | 57 | /// 58 | /// Start a workflow with the given workload 59 | /// 60 | /// 61 | public void Start(T workload) 62 | { 63 | Workload = workload; 64 | if (State == WorkflowState.NotRunning) 65 | { 66 | State = WorkflowState.Running; 67 | Run(); 68 | } 69 | else if (State == WorkflowState.Running) 70 | { 71 | Run(); 72 | } 73 | } 74 | 75 | /// 76 | /// Starts a workflow and resets it when it reaches . 77 | /// 78 | /// 79 | public void StartAndReset(T workload) 80 | { 81 | //prevent multiple event subscriptions 82 | WorkflowStateChanged -= OnWorkflowEnded; 83 | WorkflowStateChanged += OnWorkflowEnded; 84 | 85 | Start(workload); 86 | } 87 | void OnWorkflowEnded(object sender, WorkflowStateChangedEventArgs eventArgs) 88 | { 89 | //reset the workflow when it reaches End state 90 | if (eventArgs.State == WorkflowState.End) Reset(); 91 | } 92 | 93 | public void End() 94 | { 95 | //Just in case new states later 96 | if (State == WorkflowState.NotRunning || State == WorkflowState.Running) 97 | { 98 | State = WorkflowState.End; 99 | } 100 | } 101 | 102 | /// 103 | /// Reset the workflow run state. 104 | /// 105 | public void Reset() 106 | { 107 | _WorkflowStep = 0; 108 | State = WorkflowState.NotRunning; 109 | foreach (var item in _Actions) 110 | { 111 | item.Reset(); 112 | } 113 | } 114 | 115 | /// 116 | /// Unblock a blocked workflow. 117 | /// 118 | public void Unblock() 119 | { 120 | Unblock(1); 121 | } 122 | 123 | /// 124 | /// Unblock a blocked workflow. 125 | /// 126 | public void Unblock(int level) 127 | { 128 | UnblockInternal(level); 129 | Run(); 130 | } 131 | 132 | /// 133 | /// Unblock a blocked workflow. 134 | /// 135 | internal void UnblockInternal(int level) 136 | { 137 | if (_Actions[_WorkflowStep] != null) 138 | { 139 | _Actions[_WorkflowStep].Unblock(level); 140 | } 141 | State = WorkflowState.Running; 142 | } 143 | 144 | /// 145 | /// Unblock a blocked workflow. 146 | /// 147 | public void UnblockAll() 148 | { 149 | Unblock(Int32.MaxValue); 150 | } 151 | 152 | /// 153 | /// Configure a 'block' step which block the execution of the workflow. 154 | /// 155 | public IWorkflow Block() 156 | { 157 | Block(1); 158 | return this; 159 | } 160 | 161 | /// 162 | /// Configure a 'block' step which block the execution of the workflow. 163 | /// 164 | /// Number of unblock that must be called before starting the workflow. 165 | public IWorkflow Block(int blockCount) 166 | { 167 | Block((obj) => { return blockCount; }); 168 | return this; 169 | } 170 | 171 | /// 172 | /// Configure a 'block' step which block the execution of the workflow. 173 | /// 174 | /// Function that retuen dynamic block count. Evaluated late after definition. 175 | public IWorkflow Block(Func blockCount) 176 | { 177 | _Actions.Add(new BlockWorkflowAction(blockCount)); 178 | return this; 179 | } 180 | 181 | /// 182 | /// Configure a 'Go' step. 183 | /// 184 | /// Action that need to be run 185 | /// 186 | public IWorkflow Do(Action action) 187 | { 188 | _Actions.Add(new GoWorkflowAction(action)); 189 | return this; 190 | } 191 | 192 | /// 193 | /// Configure a 'Go' step. 194 | /// 195 | /// Actions that need to be run 196 | /// 197 | public IWorkflow DoAsynch(params Action[] actions) 198 | { 199 | _Actions.Add(new MultipleGoWorkflowAction(actions, false)); 200 | return this; 201 | } 202 | 203 | /// 204 | /// Configure a 'Go' step. 205 | /// 206 | /// Actions that need to be run 207 | /// 208 | public IWorkflow DoParallel(params Action[] actions) 209 | { 210 | _Actions.Add(new MultipleGoWorkflowAction(actions, true)); 211 | return this; 212 | } 213 | 214 | /// 215 | /// Configure a 'Foreach' step. 216 | /// 217 | /// Type of parameter you want to loop on. 218 | /// Function that return the list of items. 219 | /// Action that must be done on each loop. 220 | /// 221 | public IWorkflow Foreach(Func> itemExtractor, Action> action) 222 | { 223 | return Foreach(itemExtractor, (new Workflow>()).Do(action)); 224 | } 225 | 226 | /// 227 | /// Configure a 'Foreach' step. 228 | /// 229 | /// 230 | /// Function that will be dynamicaly resolved and list items. 231 | /// Workflow that will be run for each item listed. 232 | /// 233 | public IWorkflow Foreach(Func> itemExtractor, IWorkflow> workflow) 234 | { 235 | _Actions.Add(new ForWorkflowAction(itemExtractor, workflow)); 236 | 237 | return this; 238 | } 239 | 240 | /// 241 | /// Run a step and block while the condition is true. 242 | /// 243 | /// Action that must be run 244 | /// Condition to run the action. 245 | /// 246 | public IWorkflow While(Func condition, Action action) 247 | { 248 | _Actions.Add(new WhileWorkflowAction(condition, action)); 249 | 250 | return this; 251 | } 252 | 253 | /// 254 | /// Run a step and block while the condition is true. 255 | /// 256 | /// Workflow that must be run 257 | /// Condition to run the action. 258 | /// 259 | public IWorkflow While(Func condition, IWorkflow workflow) 260 | { 261 | _Actions.Add(new WhileWorkflowAction(condition, workflow)); 262 | 263 | return this; 264 | } 265 | 266 | /// 267 | /// Run a step depending the condition. 268 | /// 269 | /// Condition to run the action. 270 | /// Action that must be run if contition is true 271 | /// Action that must be run if condition is false 272 | /// 273 | public IWorkflow If(Func condition, Action actionIfTrue, Action actionIfFalse) 274 | { 275 | _Actions.Add(new IfWorkflowAction(condition, actionIfTrue, actionIfFalse)); 276 | 277 | return this; 278 | } 279 | 280 | /// 281 | /// Run a step depending the condition. 282 | /// 283 | /// Condition to run the action. 284 | /// Actions that must be run if condition is true 285 | /// Actions that must be run if condition is false 286 | /// 287 | public IWorkflow If(Func condition, IWorkflow actionsIfTrue, IWorkflow actionsIfFalse) 288 | { 289 | _Actions.Add(new IfWorkflowAction(condition, actionsIfTrue, actionsIfFalse)); 290 | 291 | return this; 292 | } 293 | 294 | /// 295 | /// Run the workflow. 296 | /// 297 | private void Run() 298 | { 299 | while (_WorkflowStep < _Actions.Count) 300 | { 301 | if (State == WorkflowState.Running) 302 | { 303 | switch (_Actions[_WorkflowStep].State) 304 | { 305 | case WorkflowActionState.Blocked: 306 | State = WorkflowState.Blocked; 307 | return; 308 | 309 | case WorkflowActionState.Ended: 310 | _WorkflowStep++; 311 | break; 312 | 313 | case WorkflowActionState.Ready: 314 | _Actions[_WorkflowStep].Resolve(Workload); 315 | _Actions[_WorkflowStep].Run(Workload); 316 | break; 317 | } 318 | } 319 | } 320 | State = WorkflowState.End; 321 | } 322 | 323 | private void RaiseWorkflowStateChangedEvent(WorkflowState state) 324 | { 325 | WorkflowStateChanged?.Invoke(this, new WorkflowStateChangedEventArgs(state)); 326 | } 327 | 328 | /// 329 | /// Occurs when workflow changes its state. 330 | /// 331 | public event EventHandler WorkflowStateChanged; 332 | } 333 | } -------------------------------------------------------------------------------- /Releases/TinyWorkflow.XML: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | TinyWorkflow 5 | 6 | 7 | 8 | 9 | Workflow action that is representing a workflow step. 10 | 11 | Type of the state linked to the workflow. 12 | 13 | 14 | 15 | Resolve the dynamic part of the step. 16 | 17 | 18 | 19 | 20 | 21 | Reset the action to it's initial state. 22 | 23 | 24 | 25 | 26 | 27 | Run the step 28 | 29 | 30 | 31 | 32 | 33 | Unblock the step. 34 | 35 | 36 | 37 | 38 | 39 | State of the workflow. 40 | 41 | 42 | 43 | 44 | Function that will return dynamicaly the number of block count. 45 | 46 | 47 | 48 | 49 | Once resolved, keep the value of block count. 50 | 51 | 52 | 53 | 54 | How many times the unblock method has been called. 55 | 56 | 57 | 58 | 59 | Action embeded in the step 60 | 61 | 62 | 63 | 64 | Action embeded in the step if True 65 | 66 | 67 | 68 | 69 | Action embeded in the step if False 70 | 71 | 72 | 73 | 74 | Condition for steps 75 | 76 | 77 | 78 | 79 | Dynamic query that is used in cas of 'for'. Must be evaluated just before being run. 80 | 81 | 82 | 83 | 84 | Resolve the dynamic part of the step. 85 | 86 | 87 | 88 | 89 | 90 | Run the step 91 | 92 | 93 | 94 | 95 | 96 | Run the step 97 | 98 | 99 | 100 | 101 | 102 | Action embeded in the step 103 | 104 | 105 | 106 | 107 | Action embeded in the step 108 | 109 | 110 | 111 | 112 | Condition for running the step 113 | 114 | 115 | 116 | 117 | Condition result, once evaluated. 118 | 119 | 120 | 121 | 122 | State of an action. 123 | 124 | 125 | 126 | 127 | Ready to be run. 128 | 129 | 130 | 131 | 132 | Blocked. Waiting for an unblock command. 133 | 134 | 135 | 136 | 137 | Has been run and is finised. 138 | 139 | 140 | 141 | 142 | Represent a workflow. 143 | Can be configured in fluent mode. 144 | 145 | Type of the state 146 | 147 | 148 | 149 | Start a workflow with the given workload 150 | 151 | 152 | 153 | 154 | 155 | Reset the workflow run state. 156 | 157 | 158 | 159 | 160 | Unblock a blocked workflow. 161 | 162 | 163 | 164 | 165 | Unblock a blocked workflow. 166 | 167 | 168 | 169 | 170 | Unblock a blocked workflow. 171 | 172 | 173 | 174 | 175 | Unblock a blocked workflow. 176 | 177 | 178 | 179 | 180 | Configure a 'block' step which block the execution of the workflow. 181 | 182 | 183 | 184 | 185 | Configure a 'block' step which block the execution of the workflow. 186 | 187 | Number of unblock that must be called before starting the workflow. 188 | 189 | 190 | 191 | Configure a 'block' step which block the execution of the workflow. 192 | 193 | Function that retuen dynamic block count. Evaluated late after definition. 194 | 195 | 196 | 197 | Configure a 'Go' step. 198 | 199 | Action that need to be run 200 | 201 | 202 | 203 | 204 | Configure a 'Go' step. 205 | 206 | Actions that need to be run 207 | 208 | 209 | 210 | 211 | Configure a 'Foreach' step. 212 | 213 | Type of parameter you want to loop on. 214 | Function that return the list of items. 215 | Action that must be done on each loop. 216 | 217 | 218 | 219 | 220 | Configure a 'Foreach' step. 221 | 222 | 223 | Function that will be dynamicaly resolved and list items. 224 | Workflow that will be run for each item listed. 225 | 226 | 227 | 228 | 229 | Run a step and block while the condition is true. 230 | 231 | Action that must be run 232 | Condition to run the action. 233 | 234 | 235 | 236 | 237 | Run a step and block while the condition is true. 238 | 239 | Workflow that must be run 240 | Condition to run the action. 241 | 242 | 243 | 244 | 245 | Run a step depending the condition. 246 | 247 | Condition to run the action. 248 | Action that must be run if contition is true 249 | Action that must be run if condition is false 250 | 251 | 252 | 253 | 254 | Run a step depending the condition. 255 | 256 | Condition to run the action. 257 | Actions that must be run if contition is true 258 | Actions that must be run if condition is false 259 | 260 | 261 | 262 | 263 | Run the workflow. 264 | 265 | 266 | 267 | 268 | State embeded in the actual Workflow 269 | 270 | 271 | 272 | 273 | State of the workflow. 274 | 275 | 276 | 277 | 278 | State of workflow 279 | 280 | 281 | 282 | 283 | Workflow is running 284 | 285 | 286 | 287 | 288 | Workflow is blocked, wwaiting for being unblocked 289 | 290 | 291 | 292 | 293 | Workflow has not been started 294 | 295 | 296 | 297 | 298 | Workflow has ended 299 | 300 | 301 | 302 | 303 | -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/netcore45/Microsoft.Practices.ServiceLocation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Microsoft.Practices.ServiceLocation 5 | 6 | 7 | 8 | 9 | The standard exception thrown when a ServiceLocator has an error in resolving an object. 10 | 11 | 12 | 13 | 14 | Initializes a new instance of the class. 15 | 16 | 17 | 18 | 19 | Initializes a new instance of the class with a specified error message. 20 | 21 | 22 | The message that describes the error. 23 | 24 | 25 | 26 | 27 | Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. 28 | 29 | 30 | The error message that explains the reason for the exception. 31 | 32 | 33 | The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. 34 | 35 | 36 | 37 | 38 | The generic Service Locator interface. This interface is used 39 | to retrieve services (instances identified by type and optional 40 | name) from a container. 41 | 42 | 43 | 44 | 45 | Get an instance of the given . 46 | 47 | Type of object requested. 48 | if there is an error resolving 49 | the service instance. 50 | The requested service instance. 51 | 52 | 53 | 54 | Get an instance of the given named . 55 | 56 | Type of object requested. 57 | Name the object was registered with. 58 | if there is an error resolving 59 | the service instance. 60 | The requested service instance. 61 | 62 | 63 | 64 | Get all instances of the given currently 65 | registered in the container. 66 | 67 | Type of object requested. 68 | if there is are errors resolving 69 | the service instance. 70 | A sequence of instances of the requested . 71 | 72 | 73 | 74 | Get an instance of the given . 75 | 76 | Type of object requested. 77 | if there is are errors resolving 78 | the service instance. 79 | The requested service instance. 80 | 81 | 82 | 83 | Get an instance of the given named . 84 | 85 | Type of object requested. 86 | Name the object was registered with. 87 | if there is are errors resolving 88 | the service instance. 89 | The requested service instance. 90 | 91 | 92 | 93 | Get all instances of the given currently 94 | registered in the container. 95 | 96 | Type of object requested. 97 | if there is are errors resolving 98 | the service instance. 99 | A sequence of instances of the requested . 100 | 101 | 102 | 103 | This class provides the ambient container for this application. If your 104 | framework defines such an ambient container, use ServiceLocator.Current 105 | to get it. 106 | 107 | 108 | 109 | 110 | Set the delegate that is used to retrieve the current container. 111 | 112 | Delegate that, when called, will return 113 | the current ambient container. 114 | 115 | 116 | 117 | The current ambient container. 118 | 119 | 120 | 121 | 122 | This class is a helper that provides a default implementation 123 | for most of the methods of . 124 | 125 | 126 | 127 | 128 | Get an instance of the given . 129 | 130 | The requested service. 131 | if there is an error in resolving the service instance. 132 | The requested object. 133 | 134 | 135 | 136 | Get an instance of the given . 137 | 138 | Type of object requested. 139 | if there is an error resolving 140 | the service instance. 141 | The requested service instance. 142 | 143 | 144 | 145 | Get an instance of the given named . 146 | 147 | Type of object requested. 148 | Name the object was registered with. 149 | if there is an error resolving 150 | the service instance. 151 | The requested service instance. 152 | 153 | 154 | 155 | Get all instances of the given currently 156 | registered in the container. 157 | 158 | Type of object requested. 159 | if there is are errors resolving 160 | the service instance. 161 | A sequence of instances of the requested . 162 | 163 | 164 | 165 | Get an instance of the given . 166 | 167 | Type of object requested. 168 | if there is are errors resolving 169 | the service instance. 170 | The requested service instance. 171 | 172 | 173 | 174 | Get an instance of the given named . 175 | 176 | Type of object requested. 177 | Name the object was registered with. 178 | if there is are errors resolving 179 | the service instance. 180 | The requested service instance. 181 | 182 | 183 | 184 | Get all instances of the given currently 185 | registered in the container. 186 | 187 | Type of object requested. 188 | if there is are errors resolving 189 | the service instance. 190 | A sequence of instances of the requested . 191 | 192 | 193 | 194 | When implemented by inheriting classes, this method will do the actual work of resolving 195 | the requested service instance. 196 | 197 | Type of instance requested. 198 | Name of registered service you want. May be null. 199 | The requested service instance. 200 | 201 | 202 | 203 | When implemented by inheriting classes, this method will do the actual work of 204 | resolving all the requested service instances. 205 | 206 | Type of service requested. 207 | Sequence of service instance objects. 208 | 209 | 210 | 211 | Format the exception message for use in an 212 | that occurs while resolving a single service. 213 | 214 | The actual exception thrown by the implementation. 215 | Type of service requested. 216 | Name requested. 217 | The formatted exception message string. 218 | 219 | 220 | 221 | Format the exception message for use in an 222 | that occurs while resolving multiple service instances. 223 | 224 | The actual exception thrown by the implementation. 225 | Type of service requested. 226 | The formatted exception message string. 227 | 228 | 229 | 230 | This delegate type is used to provide a method that will 231 | return the current container. Used with the 232 | static accessor class. 233 | 234 | An . 235 | 236 | 237 | 238 | -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/SL4/Microsoft.Practices.ServiceLocation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Microsoft.Practices.ServiceLocation 5 | 6 | 7 | 8 | 9 | The standard exception thrown when a ServiceLocator has an error in resolving an object. 10 | 11 | 12 | 13 | 14 | Initializes a new instance of the class. 15 | 16 | 17 | 18 | 19 | Initializes a new instance of the class with a specified error message. 20 | 21 | 22 | The message that describes the error. 23 | 24 | 25 | 26 | 27 | Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. 28 | 29 | 30 | The error message that explains the reason for the exception. 31 | 32 | 33 | The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. 34 | 35 | 36 | 37 | 38 | The generic Service Locator interface. This interface is used 39 | to retrieve services (instances identified by type and optional 40 | name) from a container. 41 | 42 | 43 | 44 | 45 | Get an instance of the given . 46 | 47 | Type of object requested. 48 | if there is an error resolving 49 | the service instance. 50 | The requested service instance. 51 | 52 | 53 | 54 | Get an instance of the given named . 55 | 56 | Type of object requested. 57 | Name the object was registered with. 58 | if there is an error resolving 59 | the service instance. 60 | The requested service instance. 61 | 62 | 63 | 64 | Get all instances of the given currently 65 | registered in the container. 66 | 67 | Type of object requested. 68 | if there is are errors resolving 69 | the service instance. 70 | A sequence of instances of the requested . 71 | 72 | 73 | 74 | Get an instance of the given . 75 | 76 | Type of object requested. 77 | if there is are errors resolving 78 | the service instance. 79 | The requested service instance. 80 | 81 | 82 | 83 | Get an instance of the given named . 84 | 85 | Type of object requested. 86 | Name the object was registered with. 87 | if there is are errors resolving 88 | the service instance. 89 | The requested service instance. 90 | 91 | 92 | 93 | Get all instances of the given currently 94 | registered in the container. 95 | 96 | Type of object requested. 97 | if there is are errors resolving 98 | the service instance. 99 | A sequence of instances of the requested . 100 | 101 | 102 | 103 | A strongly-typed resource class, for looking up localized strings, etc. 104 | 105 | 106 | 107 | 108 | Returns the cached ResourceManager instance used by this class. 109 | 110 | 111 | 112 | 113 | Overrides the current thread's CurrentUICulture property for all 114 | resource lookups using this strongly typed resource class. 115 | 116 | 117 | 118 | 119 | Looks up a localized string similar to Activation error occured while trying to get all instances of type {0}. 120 | 121 | 122 | 123 | 124 | Looks up a localized string similar to Activation error occured while trying to get instance of type {0}, key "{1}". 125 | 126 | 127 | 128 | 129 | This class provides the ambient container for this application. If your 130 | framework defines such an ambient container, use ServiceLocator.Current 131 | to get it. 132 | 133 | 134 | 135 | 136 | Set the delegate that is used to retrieve the current container. 137 | 138 | Delegate that, when called, will return 139 | the current ambient container. 140 | 141 | 142 | 143 | The current ambient container. 144 | 145 | 146 | 147 | 148 | This class is a helper that provides a default implementation 149 | for most of the methods of . 150 | 151 | 152 | 153 | 154 | Get an instance of the given . 155 | 156 | The requested service. 157 | if there is an error in resolving the service instance. 158 | The requested object. 159 | 160 | 161 | 162 | Get an instance of the given . 163 | 164 | Type of object requested. 165 | if there is an error resolving 166 | the service instance. 167 | The requested service instance. 168 | 169 | 170 | 171 | Get an instance of the given named . 172 | 173 | Type of object requested. 174 | Name the object was registered with. 175 | if there is an error resolving 176 | the service instance. 177 | The requested service instance. 178 | 179 | 180 | 181 | Get all instances of the given currently 182 | registered in the container. 183 | 184 | Type of object requested. 185 | if there is are errors resolving 186 | the service instance. 187 | A sequence of instances of the requested . 188 | 189 | 190 | 191 | Get an instance of the given . 192 | 193 | Type of object requested. 194 | if there is are errors resolving 195 | the service instance. 196 | The requested service instance. 197 | 198 | 199 | 200 | Get an instance of the given named . 201 | 202 | Type of object requested. 203 | Name the object was registered with. 204 | if there is are errors resolving 205 | the service instance. 206 | The requested service instance. 207 | 208 | 209 | 210 | Get all instances of the given currently 211 | registered in the container. 212 | 213 | Type of object requested. 214 | if there is are errors resolving 215 | the service instance. 216 | A sequence of instances of the requested . 217 | 218 | 219 | 220 | When implemented by inheriting classes, this method will do the actual work of resolving 221 | the requested service instance. 222 | 223 | Type of instance requested. 224 | Name of registered service you want. May be null. 225 | The requested service instance. 226 | 227 | 228 | 229 | When implemented by inheriting classes, this method will do the actual work of 230 | resolving all the requested service instances. 231 | 232 | Type of service requested. 233 | Sequence of service instance objects. 234 | 235 | 236 | 237 | Format the exception message for use in an 238 | that occurs while resolving a single service. 239 | 240 | The actual exception thrown by the implementation. 241 | Type of service requested. 242 | Name requested. 243 | The formatted exception message string. 244 | 245 | 246 | 247 | Format the exception message for use in an 248 | that occurs while resolving multiple service instances. 249 | 250 | The actual exception thrown by the implementation. 251 | Type of service requested. 252 | The formatted exception message string. 253 | 254 | 255 | 256 | This delegate type is used to provide a method that will 257 | return the current container. Used with the 258 | static accessor class. 259 | 260 | An . 261 | 262 | 263 | 264 | -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/SL5/Microsoft.Practices.ServiceLocation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Microsoft.Practices.ServiceLocation 5 | 6 | 7 | 8 | 9 | The standard exception thrown when a ServiceLocator has an error in resolving an object. 10 | 11 | 12 | 13 | 14 | Initializes a new instance of the class. 15 | 16 | 17 | 18 | 19 | Initializes a new instance of the class with a specified error message. 20 | 21 | 22 | The message that describes the error. 23 | 24 | 25 | 26 | 27 | Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. 28 | 29 | 30 | The error message that explains the reason for the exception. 31 | 32 | 33 | The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. 34 | 35 | 36 | 37 | 38 | The generic Service Locator interface. This interface is used 39 | to retrieve services (instances identified by type and optional 40 | name) from a container. 41 | 42 | 43 | 44 | 45 | Get an instance of the given . 46 | 47 | Type of object requested. 48 | if there is an error resolving 49 | the service instance. 50 | The requested service instance. 51 | 52 | 53 | 54 | Get an instance of the given named . 55 | 56 | Type of object requested. 57 | Name the object was registered with. 58 | if there is an error resolving 59 | the service instance. 60 | The requested service instance. 61 | 62 | 63 | 64 | Get all instances of the given currently 65 | registered in the container. 66 | 67 | Type of object requested. 68 | if there is are errors resolving 69 | the service instance. 70 | A sequence of instances of the requested . 71 | 72 | 73 | 74 | Get an instance of the given . 75 | 76 | Type of object requested. 77 | if there is are errors resolving 78 | the service instance. 79 | The requested service instance. 80 | 81 | 82 | 83 | Get an instance of the given named . 84 | 85 | Type of object requested. 86 | Name the object was registered with. 87 | if there is are errors resolving 88 | the service instance. 89 | The requested service instance. 90 | 91 | 92 | 93 | Get all instances of the given currently 94 | registered in the container. 95 | 96 | Type of object requested. 97 | if there is are errors resolving 98 | the service instance. 99 | A sequence of instances of the requested . 100 | 101 | 102 | 103 | A strongly-typed resource class, for looking up localized strings, etc. 104 | 105 | 106 | 107 | 108 | Returns the cached ResourceManager instance used by this class. 109 | 110 | 111 | 112 | 113 | Overrides the current thread's CurrentUICulture property for all 114 | resource lookups using this strongly typed resource class. 115 | 116 | 117 | 118 | 119 | Looks up a localized string similar to Activation error occured while trying to get all instances of type {0}. 120 | 121 | 122 | 123 | 124 | Looks up a localized string similar to Activation error occured while trying to get instance of type {0}, key "{1}". 125 | 126 | 127 | 128 | 129 | This class provides the ambient container for this application. If your 130 | framework defines such an ambient container, use ServiceLocator.Current 131 | to get it. 132 | 133 | 134 | 135 | 136 | Set the delegate that is used to retrieve the current container. 137 | 138 | Delegate that, when called, will return 139 | the current ambient container. 140 | 141 | 142 | 143 | The current ambient container. 144 | 145 | 146 | 147 | 148 | This class is a helper that provides a default implementation 149 | for most of the methods of . 150 | 151 | 152 | 153 | 154 | Get an instance of the given . 155 | 156 | The requested service. 157 | if there is an error in resolving the service instance. 158 | The requested object. 159 | 160 | 161 | 162 | Get an instance of the given . 163 | 164 | Type of object requested. 165 | if there is an error resolving 166 | the service instance. 167 | The requested service instance. 168 | 169 | 170 | 171 | Get an instance of the given named . 172 | 173 | Type of object requested. 174 | Name the object was registered with. 175 | if there is an error resolving 176 | the service instance. 177 | The requested service instance. 178 | 179 | 180 | 181 | Get all instances of the given currently 182 | registered in the container. 183 | 184 | Type of object requested. 185 | if there is are errors resolving 186 | the service instance. 187 | A sequence of instances of the requested . 188 | 189 | 190 | 191 | Get an instance of the given . 192 | 193 | Type of object requested. 194 | if there is are errors resolving 195 | the service instance. 196 | The requested service instance. 197 | 198 | 199 | 200 | Get an instance of the given named . 201 | 202 | Type of object requested. 203 | Name the object was registered with. 204 | if there is are errors resolving 205 | the service instance. 206 | The requested service instance. 207 | 208 | 209 | 210 | Get all instances of the given currently 211 | registered in the container. 212 | 213 | Type of object requested. 214 | if there is are errors resolving 215 | the service instance. 216 | A sequence of instances of the requested . 217 | 218 | 219 | 220 | When implemented by inheriting classes, this method will do the actual work of resolving 221 | the requested service instance. 222 | 223 | Type of instance requested. 224 | Name of registered service you want. May be null. 225 | The requested service instance. 226 | 227 | 228 | 229 | When implemented by inheriting classes, this method will do the actual work of 230 | resolving all the requested service instances. 231 | 232 | Type of service requested. 233 | Sequence of service instance objects. 234 | 235 | 236 | 237 | Format the exception message for use in an 238 | that occurs while resolving a single service. 239 | 240 | The actual exception thrown by the implementation. 241 | Type of service requested. 242 | Name requested. 243 | The formatted exception message string. 244 | 245 | 246 | 247 | Format the exception message for use in an 248 | that occurs while resolving multiple service instances. 249 | 250 | The actual exception thrown by the implementation. 251 | Type of service requested. 252 | The formatted exception message string. 253 | 254 | 255 | 256 | This delegate type is used to provide a method that will 257 | return the current container. Used with the 258 | static accessor class. 259 | 260 | An . 261 | 262 | 263 | 264 | -------------------------------------------------------------------------------- /Sources/packages/MvvmLight.4.1.26.1/lib/sl4-wp71/Microsoft.Practices.ServiceLocation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Microsoft.Practices.ServiceLocation 5 | 6 | 7 | 8 | 9 | The standard exception thrown when a ServiceLocator has an error in resolving an object. 10 | 11 | 12 | 13 | 14 | Initializes a new instance of the class. 15 | 16 | 17 | 18 | 19 | Initializes a new instance of the class with a specified error message. 20 | 21 | 22 | The message that describes the error. 23 | 24 | 25 | 26 | 27 | Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. 28 | 29 | 30 | The error message that explains the reason for the exception. 31 | 32 | 33 | The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified. 34 | 35 | 36 | 37 | 38 | The generic Service Locator interface. This interface is used 39 | to retrieve services (instances identified by type and optional 40 | name) from a container. 41 | 42 | 43 | 44 | 45 | Get an instance of the given . 46 | 47 | Type of object requested. 48 | if there is an error resolving 49 | the service instance. 50 | The requested service instance. 51 | 52 | 53 | 54 | Get an instance of the given named . 55 | 56 | Type of object requested. 57 | Name the object was registered with. 58 | if there is an error resolving 59 | the service instance. 60 | The requested service instance. 61 | 62 | 63 | 64 | Get all instances of the given currently 65 | registered in the container. 66 | 67 | Type of object requested. 68 | if there is are errors resolving 69 | the service instance. 70 | A sequence of instances of the requested . 71 | 72 | 73 | 74 | Get an instance of the given . 75 | 76 | Type of object requested. 77 | if there is are errors resolving 78 | the service instance. 79 | The requested service instance. 80 | 81 | 82 | 83 | Get an instance of the given named . 84 | 85 | Type of object requested. 86 | Name the object was registered with. 87 | if there is are errors resolving 88 | the service instance. 89 | The requested service instance. 90 | 91 | 92 | 93 | Get all instances of the given currently 94 | registered in the container. 95 | 96 | Type of object requested. 97 | if there is are errors resolving 98 | the service instance. 99 | A sequence of instances of the requested . 100 | 101 | 102 | 103 | A strongly-typed resource class, for looking up localized strings, etc. 104 | 105 | 106 | 107 | 108 | Returns the cached ResourceManager instance used by this class. 109 | 110 | 111 | 112 | 113 | Overrides the current thread's CurrentUICulture property for all 114 | resource lookups using this strongly typed resource class. 115 | 116 | 117 | 118 | 119 | Looks up a localized string similar to Activation error occured while trying to get all instances of type {0}. 120 | 121 | 122 | 123 | 124 | Looks up a localized string similar to Activation error occured while trying to get instance of type {0}, key "{1}". 125 | 126 | 127 | 128 | 129 | This class provides the ambient container for this application. If your 130 | framework defines such an ambient container, use ServiceLocator.Current 131 | to get it. 132 | 133 | 134 | 135 | 136 | Set the delegate that is used to retrieve the current container. 137 | 138 | Delegate that, when called, will return 139 | the current ambient container. 140 | 141 | 142 | 143 | The current ambient container. 144 | 145 | 146 | 147 | 148 | This class is a helper that provides a default implementation 149 | for most of the methods of . 150 | 151 | 152 | 153 | 154 | Get an instance of the given . 155 | 156 | The requested service. 157 | if there is an error in resolving the service instance. 158 | The requested object. 159 | 160 | 161 | 162 | Get an instance of the given . 163 | 164 | Type of object requested. 165 | if there is an error resolving 166 | the service instance. 167 | The requested service instance. 168 | 169 | 170 | 171 | Get an instance of the given named . 172 | 173 | Type of object requested. 174 | Name the object was registered with. 175 | if there is an error resolving 176 | the service instance. 177 | The requested service instance. 178 | 179 | 180 | 181 | Get all instances of the given currently 182 | registered in the container. 183 | 184 | Type of object requested. 185 | if there is are errors resolving 186 | the service instance. 187 | A sequence of instances of the requested . 188 | 189 | 190 | 191 | Get an instance of the given . 192 | 193 | Type of object requested. 194 | if there is are errors resolving 195 | the service instance. 196 | The requested service instance. 197 | 198 | 199 | 200 | Get an instance of the given named . 201 | 202 | Type of object requested. 203 | Name the object was registered with. 204 | if there is are errors resolving 205 | the service instance. 206 | The requested service instance. 207 | 208 | 209 | 210 | Get all instances of the given currently 211 | registered in the container. 212 | 213 | Type of object requested. 214 | if there is are errors resolving 215 | the service instance. 216 | A sequence of instances of the requested . 217 | 218 | 219 | 220 | When implemented by inheriting classes, this method will do the actual work of resolving 221 | the requested service instance. 222 | 223 | Type of instance requested. 224 | Name of registered service you want. May be null. 225 | The requested service instance. 226 | 227 | 228 | 229 | When implemented by inheriting classes, this method will do the actual work of 230 | resolving all the requested service instances. 231 | 232 | Type of service requested. 233 | Sequence of service instance objects. 234 | 235 | 236 | 237 | Format the exception message for use in an 238 | that occurs while resolving a single service. 239 | 240 | The actual exception thrown by the implementation. 241 | Type of service requested. 242 | Name requested. 243 | The formatted exception message string. 244 | 245 | 246 | 247 | Format the exception message for use in an 248 | that occurs while resolving multiple service instances. 249 | 250 | The actual exception thrown by the implementation. 251 | Type of service requested. 252 | The formatted exception message string. 253 | 254 | 255 | 256 | This delegate type is used to provide a method that will 257 | return the current container. Used with the 258 | static accessor class. 259 | 260 | An . 261 | 262 | 263 | 264 | --------------------------------------------------------------------------------