예제 #1
0
        /// <summary>
        /// Initializes the singleton device instance.
        /// </summary>
        /// <param name="newInstance">The singleton device instance.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="newInstance"/> is <c>null</c>.</exception>
        public static void Initialize(Device newInstance)
        {
            if (newInstance == null)
            {
                throw new ArgumentNullException();
            }

            MXContainer.RegisterSingleton <IImageCache>(typeof(ImageCache));
            MXContainer.RegisterSingleton <INetwork>(typeof(NetworkAsynch));
            MXContainer.RegisterSingleton <ILog>(typeof(DiagnosticDebugLogger));
            MXContainer.RegisterSingleton <IEncryption>(typeof(MockEncryption));
            MXContainer.RegisterSingleton <IFile>(typeof(NullFile));
            MXContainer.RegisterSingleton <IThread>(typeof(NullThread));
            MXContainer.RegisterSingleton <IReflector>(typeof(NullReflector));
            MXContainer.RegisterSingleton <Resources.IResources>(typeof(Resources.NullResources));
            MXContainer.RegisterSingleton <ImageComposition.ICompositor>(typeof(ImageComposition.NullCompositor));

            Instance = newInstance;
            Instance.SessionDataRoot = DataPath.AppendPath("session");
            Instance.Initialize();
            if (!File.Exists(SessionDataPath))
            {
                File.CreateDirectory(SessionDataPath);
            }
        }