示例#1
0
        /// <summary>
        /// modify global config
        /// </summary>
        /// <param name="defaultConfig"></param>
        public void Config(
            [NotNull] NotificationGlobalConfig defaultConfig)
        {
            if (defaultConfig == null)
            {
                return;
            }

            if (defaultConfig.Bottom != null)
            {
                _bottom = defaultConfig.Bottom.Value;
            }
            if (defaultConfig.Top != null)
            {
                _top = defaultConfig.Top.Value;
            }
            if (defaultConfig.Rtl != null)
            {
                _isRtl = defaultConfig.Rtl.Value;
            }
            if (defaultConfig.Placement != null)
            {
                _defaultPlacement = defaultConfig.Placement.Value;
            }
            if (defaultConfig.Duration != null)
            {
                _defaultDuration = defaultConfig.Duration.Value;
            }
            if (defaultConfig.CloseIcon != null)
            {
                _defaultCloseIcon = defaultConfig.CloseIcon;
            }
        }
示例#2
0
        private string GetClassName(NotificationPlacement placement)
        {
            string placementStr = placement.ToString();

            placementStr = placementStr[0] == 'T'
                ? "t" + placementStr.Substring(1)
                : "b" + placementStr.Substring(1);
            string className = $"{ClassPrefix} {ClassPrefix}-" + placementStr;

            if (_isRtl)
            {
                className += $" {ClassPrefix}-rtl";
            }

            return(className);
        }
示例#3
0
        private string GetStyle(NotificationPlacement placement)
        {
            switch (placement)
            {
            case NotificationPlacement.TopRight:
                return($"right: 0px; top:{_top}px; bottom: auto;");

            case NotificationPlacement.TopLeft:
                return($"left: 0px; top:{_top}px; bottom: auto;");

            case NotificationPlacement.BottomLeft:
                return($"left: 0px; top: auto; bottom: {_bottom}px;");

            default:
                return($"right: 0px; top: auto; bottom: {_bottom}px;");
            }
        }