Ejemplo n.º 1
0
        private static IMauiServiceCollection CreateHandlerCollection(IEnumerable <HandlerMauiAppBuilderExtensions.HandlerRegistration> registrationActions)
        {
            var collection = new MauiHandlersCollection();

            if (registrationActions != null)
            {
                foreach (var registrationAction in registrationActions)
                {
                    registrationAction.AddRegistration(collection);
                }
            }
            return(collection);
        }
Ejemplo n.º 2
0
		public static void Init(bool force = false)
		{
			if (hasInit && !force)
				return;
			hasInit = true;
			ThreadHelper.SetFireOnMainThread((a) => a?.Invoke()); 
			var handlers = new Dictionary<Type, Type> {
					{ typeof(Button), typeof(GenericViewHandler)},
					{ typeof(ContentView), typeof(GenericViewHandler)},
					{ typeof(Image), typeof(GenericViewHandler)},
					{ typeof(HStack), typeof(GenericViewHandler)},
					{ typeof(ListView), typeof(GenericViewHandler)},
					{ typeof(Text), typeof(TextHandler)},
					{ typeof(TextField), typeof(TextFieldHandler)},
					{ typeof(ProgressBar), typeof(ProgressBarHandler)},
					{ typeof(SecureField), typeof(SecureFieldHandler)},
					{ typeof(ScrollView), typeof(GenericViewHandler)},
					{ typeof(Slider), typeof(SliderHandler)},
					{ typeof(Toggle), typeof(GenericViewHandler)},
					{ typeof(View), typeof(GenericViewHandler)},
					{ typeof(VStack), typeof(GenericViewHandler)},
					{ typeof(ZStack), typeof(GenericViewHandler)},
				};
			var handlerCollection = new MauiHandlersCollection();
			foreach (var handler in handlers)
			{
				handlerCollection.AddTransient(handler.Key, handler.Value);
			}
			Handlers = new MauiHandlersServiceProvider(handlerCollection);

			MauiHotReloadHelper.IsEnabled = true;

			//Set Default Style
			var style = new Styles.Style();
			style.Apply();
		}