Example #1
0
        /// <summary>
        /// Найти соответствующее типу контрола оформление в теме
        /// </summary>
        /// <param name="Control">Контрол для которого ищется оформление</param>
        /// <param name="Theme">Тема в которой</param>
        /// <returns></returns>
        public static IAppearance FindAppearance(this IDefaultControl Control, ITheme Theme)
        {
            if (Theme.Sets == null)
            {
                return(null);
            }

            //Проходим весь набор форомлений для компонентов
            //Если находим подходящий для текущего элемента, то применяем его
            foreach (ControlType controlType in Theme.Sets.Keys)
            {
                IAppearance appearance = Theme.Sets[controlType];

                if (controlType == ControlType.Caption && Control is ICaptionControl)
                {
                    return(appearance);
                }


                if (controlType == ControlType.Buttons && Control is IButtonsControl)
                {
                    return(appearance);
                }

                if (controlType == ControlType.Table && Control is ITableControl)
                {
                    return(appearance);
                }

                if (controlType == ControlType.Detail && Control is IDetailControl)
                {
                    return(appearance);
                }

                if (controlType == ControlType.Total && Control is ITotalControl)
                {
                    return(appearance);
                }

                if (controlType == ControlType.Input && Control is IInputControl)
                {
                    return(appearance);
                }

                if (controlType == ControlType.Status && Control is IStatusControl)
                {
                    return(appearance);
                }

                if (controlType == ControlType.Default)
                {
                    return(appearance);
                }
            }

            return(null);
        }
Example #2
0
        /// <summary>
        /// Обработка изменения темы
        /// </summary>
        /// <param name="theme"></param>
        void OnThemeChange(ITheme Theme)
        {
            IDefaultControl control    = this as IDefaultControl;
            IAppearance     appearance = control.FindAppearance(Theme);

            if (appearance != null)
            {
                this.SetAppearance(appearance);
            }
        }
Example #3
0
        public async Task UnitAppearance()
        {
            await Cluster.GrainFactory.GetGrain <IGame>(0).InitGame();

            IEntity unit = await Cluster.GrainFactory.GetGrain <IPrefabManager>(0).Clone("test", "human.init");

            await unit.Enable();

            IAppearance appearance = await unit.Get <IAppearance>();

            Assert.NotNull(appearance);

            AppearanceContainer container = await appearance.GetData();

            Assert.NotEmpty(container.Appearances);
        }
Example #4
0
 public new void SetAppearance(IAppearance appearance)
 {
     base.SetAppearance(appearance);
 }
Example #5
0
 public void SetAppearance(IAppearance appearance)
 {
     //TODO Добавить обработку установки внешнего вида
 }
Example #6
0
 public new void SetAppearance(IAppearance appearance)
 {
     throw new System.NotImplementedException();
 }
Example #7
0
 public void SetAppearance(IAppearance appearance)
 {
     this.WPFControl.SetAppearance(appearance);
 }
Example #8
0
 /// <summary>
 /// Получить шрифт
 /// </summary>
 /// <param name="appearence">Оформление для компонента</param>
 /// <param name="value">Строковое представление шрифта</param>
 /// <returns></returns>
 public static Font GetFont(this IAppearance appearence, string value)
 {
     //TODO Добавить парсинг параметра value в цвет
     return(SystemFonts.DefaultFont);
 }
Example #9
0
 /// <summary>
 /// Получить цвет
 /// </summary>
 /// <param name="appearence">Оформление для компонента</param>
 /// <param name="value">Строковое представление цвета</param>
 /// <returns></returns>
 public static Color GetColor(this IAppearance appearence, string value)
 {
     //TODO Добавить парсинг параметра value в цвет
     return(Color.Transparent);
 }