using MultiLayout;
using MultiLayout.UiModule;
using System.Windows;
using System.Windows.Media;
using Unity;

namespace FLY.Thick.Base.UI.CustomMenu
{
    public class CustomMenu : IMenu
    {
        public string Title { get; private set; }

        public Brush Brush { get; set; }




        IUnityContainer container;
        public CustomMenu(IUnityContainer container)
        {
            this.container = container;
            string title = (string)Application.Current.TryFindResource("str.CustomMenu.Custom");
            Title = title;
            
            Brush = new ImageBrush()
            {
                ImageSource = (new ImageSourceConverter()).ConvertFromString("pack://application:,,,/FLY.Thick.Base.UI;component/Images/bg_wheel.jpg") as ImageSource,
                Stretch = Stretch.UniformToFill
            };
        }

        public void OnClick()
        {
            if (!WdPassword.Authorize("CustomSetting"))
                return;
            var p = this.container.Resolve<PgCustomSections>();
            FlyLayoutManager.NavigationService.Navigate(p);
        }
    }
}
