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

            if (PlatformVersion.Supports(PlatformApis.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 platformApplication, IApplication application, OpenWindowRequest?args)
        {
            if (application.Handler?.MauiContext is not IMauiContext applicationContext)
            {
                return;
            }

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

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

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

            platformApplication.StartActivity(intent);
        }