Ejemplo n.º 1
0
        public static void ClassInit(TestContext context)
        {
            IUnityContainer container = new UnityContainer();

            container.RegisterInstance <IBindingOperations>(new MockBindingOperations());
            TestFactory.Initialize(type => (Test)container.Resolve(type));
            ViewModelFactory.Initialize(type => container.Resolve(type));
            TestViewModelFactory.Initialize((testType, target) => new TestViewModel(testType, target));
            TestParameterViewModelFactory.Initialize(type =>
            {
                string name = type.Name;
                string viewModelTypeName = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{1}.{0}ViewModel, {1}", name, "Ziggy.ViewModels");
                return((TestParameterViewModel)container.Resolve(Type.GetType(viewModelTypeName)));
            });
            TestResultViewModelFactory.Initialize((type, result) =>
            {
                string name = type.Name;
                string viewModelTypeName = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{1}.{0}ViewModel, {1}", name, "Ziggy.ViewModels");
                return((TestResultViewModel)container.Resolve(Type.GetType(viewModelTypeName), new ParameterOverride("result", result)));
            });
            TargetViewModelFactory.Initialize(obj => container.Resolve <TargetViewModel>(new ParameterOverride("target", obj)));
            TargetFactory.Initialize(type => container.Resolve(type));
        }
Ejemplo n.º 2
0
        static TouchFactory()
        {
            Device.Initialize(new TouchDevice());

            AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs e)
            {
                Instance.LogUnhandledException((Exception)e.ExceptionObject);
            };

            UIDevice.CurrentDevice.BeginGeneratingDeviceOrientationNotifications();

            TargetFactory.Initialize(new TouchFactory());

            iApp.Log.Info("Running iOS " + UIDevice.CurrentDevice.SystemVersion);

            KeyWindow = new UIWindow(UIScreen.MainScreen.Bounds);
            KeyWindow.MakeKeyAndVisible();
            KeyWindow.RootViewController = new UIViewController();

            Instance.LanguageCode = NSLocale.CurrentLocale.CollatorIdentifier.Replace('_', '-');

            iApp.VanityImagePath = (Instance.Settings.ContainsKey("UILaunchImageFile") ?
                                    Instance.Settings["UILaunchImageFile"].Replace(".png", string.Empty) : string.Empty) + "-Detail.png";
        }