示例#1
0
        public static void SetColorFilter(this ADrawable drawable, AColor color, FilterMode mode)
        {
            if (drawable == null)
            {
                return;
            }

            if (NativeVersion.Supports(NativeApis.BlendModeColorFilter))
            {
                BlendMode?filterMode29 = GetFilterMode(mode);

                if (filterMode29 != null)
                {
                    drawable.SetColorFilter(new BlendModeColorFilter(color, filterMode29));
                }
            }
            else
            {
#pragma warning disable CS0612 // Type or member is obsolete
                PorterDuff.Mode?filterModePre29 = GetFilterModePre29(mode);
#pragma warning restore CS0612 // Type or member is obsolete

                if (filterModePre29 != null)
#pragma warning disable CS0618 // Type or member is obsolete
                {
                    drawable.SetColorFilter(color, filterModePre29);
                }
#pragma warning restore CS0618 // Type or member is obsolete
            }
        }
示例#2
0
        public static void RequestNewWindow(this Application nativeApplication, IApplication application, OpenWindowRequest?args)
        {
            if (application.Handler?.MauiContext is not IMauiContext applicationContext)
            {
                return;
            }

            var state  = args?.State;
            var bundle = state.ToBundle();

            var pm     = nativeApplication.PackageManager !;
            var intent = pm.GetLaunchIntentForPackage(nativeApplication.PackageName !) !;

            intent.AddFlags(ActivityFlags.NewTask);
            intent.AddFlags(ActivityFlags.MultipleTask);
            if (NativeVersion.Supports(NativeApis.LaunchAdjacent))
            {
                intent.AddFlags(ActivityFlags.LaunchAdjacent);
            }
            intent.PutExtras(bundle);

            nativeApplication.StartActivity(intent);
        }