Beispiel #1
0
        internal static void InitSysDependencies()
        {
            // load logger
            if (IsRunningInUnitTest)
            {
                Logger = new DebugLogger();
            }
            else
            {
                Logger = new DefaultLogger();
            }
            Log.Init(Logger);

            // load platform context:
            //     platform-dependent implementation
            if (CurrentOS.IsAndroid)
            {
                PlatformContext = OSImplentation.Android.AndroidContext.MapFactory();
            }
            else if (CurrentOS.IsWindows)
            {
                PlatformContext = OSImplentation.Windows.WindowsContext.MapFactory();
            }
            else if (CurrentOS.IsLinux)
            {
                PlatformContext = OSImplentation.Linux.LinuxContext.MapFactory();
            }
        }
Beispiel #2
0
        internal static void InitSysDependencies()
        {
            Time.Init();

            // load logger
            if (IsRunningInUnitTest)
            {
                try
                {
                    Logger = new EchoLogger();
                    EchoLogger.Show();
                    Log.Enabled = true;
                }
                catch (System.Net.Sockets.SocketException)
                {
                    Debug.WriteLine("Failed to connect to EchoLogger. The program will continue without logging.");
                    Log.Enabled = false;
                }
            }
            else
            {
                Logger      = new ConsoleLogger();
                Log.Enabled = true;
            }
            Log.Init(Logger);

            // load platform context:
            //     platform-dependent implementation
            if (CurrentOS.IsAndroid)
            {
                PlatformContext = OSImplentation.Android.AndroidContext.MapFactory();
            }
            else if (CurrentOS.IsWindows)
            {
                PlatformContext = OSImplentation.Windows.WindowsContext.MapFactory();
            }
            else if (CurrentOS.IsLinux)
            {
                PlatformContext = OSImplentation.Linux.LinuxContext.MapFactory();
            }
        }