Task ValidateHasColor(IBoxView boxView, Color color, Action action = null)
 {
     return(InvokeOnMainThreadAsync(() =>
     {
         var nativeBoxView = GetNativeBoxView(CreateHandler(boxView));
         action?.Invoke();
         nativeBoxView.AssertContainsColor(color);
     }));
 }
Beispiel #2
0
        public void OnBoxSelected(Mp4Box box)
        {
            RemoveViews();

            if (box != null)
            {
                IBoxView view = _MainService.GetView(box);
                if (view != null)
                {
                    IRegion mainRegion = _RegionManager.Regions[RegionNames.MainRegion];
                    mainRegion.Add(view);
                    mainRegion.Activate(view);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="box"></param>
        /// <returns></returns>
        public IBoxView GetView(Mp4Box box)
        {
            Type type = null;

            if (!viewsCache.ContainsKey(box.GetType()))
            {
                Assembly assembly = Assembly.GetAssembly(this.GetType());

                List <Type> types = new List <Type>(assembly.GetTypes());

                type = types.Find(t =>
                {
                    object[] customAttributes = t.GetCustomAttributes(typeof(BoxViewTypeAttribute), false);

                    return(typeof(IBoxView).IsAssignableFrom(t) && customAttributes.Length == 1 &&
                           ((BoxViewTypeAttribute)customAttributes[0]).BoxType == box.GetType());
                });

                if (type != null)
                {
                    viewsCache.Add(box.GetType(), type);
                }
                else
                {
                    type = null;
                }
            }
            else
            {
                type = viewsCache[box.GetType()];
            }

            if (type != null)
            {
                IBoxView view = (IBoxView)type.GetConstructor(Type.EmptyTypes).Invoke(null);

                view.Box = box;

                return(view);
            }
            else
            {
                return(null);
            }
        }
Beispiel #4
0
 public static void InvalidateBoxView(this MauiBoxView nativeView, IBoxView boxView)
 {
     nativeView.Invalidate();
 }
 public static void InvalidateBoxView(this W2DGraphicsView nativeView, IBoxView boxView)
 {
     nativeView.Invalidate();
 }