-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathUnity4StateMachine.cs
More file actions
111 lines (92 loc) · 3.36 KB
/
Copy pathUnity4StateMachine.cs
File metadata and controls
111 lines (92 loc) · 3.36 KB
1
2
3
4
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//using IoC.StateMachine.Interfaces;
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using IoC.StateMachine;
//using IoC.StateMachine.Core;
//using IoC.StateMachine.Serialization;
//namespace IoC.ExampleApp
//{
// public class Unity4StateMachine : IAmContainer
// {
// public static void SetUpContainer(IUnityContainer _container)
// {
// _container.RegisterType<ISMService, SMService>();
// _container.RegisterInstance<IPersistenceService>(new DataContractPersistenceService(new List<string>() { "IoC.ExampleApp" }));
// _container.RegisterType<IStateProcessor, StateProcessor>();
// _container.RegisterType<ISMAction, InitContext>("InitContext");
// _container.RegisterType<ISMAction, CheckNumber>("CheckNumber");
// _container.RegisterType<ISMTrigger, GuessOKTrigger>("GuessOKTrigger");
// }
// private readonly IUnityContainer _container;
// public Unity4StateMachine(IUnityContainer container)
// {
// Affirm.ArgumentNotNull(container, "container");
// _container = container;
// }
// public void BuildUp(object target)
// {
// _container.BuildUp(target);
// }
// public object Get(Type service, string key = null)
// {
// return _container.Resolve(service, key);
// }
// public T Get<T>(string key = null)
// {
// return _container.Resolve<T>(key);
// }
// public IEnumerable<object> GetAll(Type service)
// {
// return _container.ResolveAll(service);
// }
// public IAmContainer GetChildContainer()
// {
// return new Unity4StateMachine(_container.CreateChildContainer());
// }
// public void Register(Type fromT)
// {
// _container.RegisterType(fromT);
// }
// public void Register(Type fromT, Type toT)
// {
// _container.RegisterType(fromT, toT);
// }
// public void RegisterInstance(Type service, object instance)
// {
// _container.RegisterInstance(service, instance);
// }
// #region IDisposable Support
// private bool disposedValue = false; // To detect redundant calls
// private bool isBeingDissposed = false;
// protected virtual void Dispose(bool disposing)
// {
// if (this.isBeingDissposed)
// return;
// if (!disposedValue)
// {
// if (disposing)
// {
// if (_container != null)
// {
// isBeingDissposed = true;
// _container.Dispose();
// isBeingDissposed = false;
// }
// }
// disposedValue = true;
// }
// }
// // This code added to correctly implement the disposable pattern.
// public void Dispose()
// {
// // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
// Dispose(true);
// // TODO: uncomment the following line if the finalizer is overridden above.
// // GC.SuppressFinalize(this);
// }
// #endregion
// }
//}