Exemplo n.º 1
0
        static void DownKeyHandle(object sender, int key)
        {
            DefaultRole u = sender as User;

            if (key == 1)
            {
                u.StartNotepad();
            }
            if (key == 2)
            {
                u.StartCalc();
            }
        }
Exemplo n.º 2
0
        /// <summary>加载时触发</summary>
        protected override void OnLoaded()
        {
#if __CORE__
            if (StartPage.IsNullOrEmpty())
            {
                StartPage =
                    // 避免出现生成 "/Admin/Admin/Index/Main" 这样的情况
                    //NewLife.Web.HttpContext.Current?.Request.PathBase.ToString().EnsureEnd("/") +
                    "/Admin/Index/Main";
            }
#else
            if (StartPage.IsNullOrEmpty())
            {
                StartPage = System.Web.HttpRuntime.AppDomainAppVirtualPath.EnsureEnd("/") + "Admin/Index/Main";
            }
#endif

            var web = Runtime.IsWeb;

            //if (AvatarPath.IsNullOrEmpty()) AvatarPath = web ? "..\\Avatars" : "Avatars";
            if (DefaultRole.IsNullOrEmpty() || DefaultRole == "3")
            {
                DefaultRole = "普通用户";
            }

            if (JwtSecret.IsNullOrEmpty() || JwtSecret.Split(':').Length != 2)
            {
                JwtSecret = $"HS256:{Rand.NextString(16)}";
            }

            // 取版权信息
            if (Copyright.IsNullOrEmpty())
            {
                var asm = Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly();
                if (asm != null)
                {
                    var att = asm.GetCustomAttribute <AssemblyCopyrightAttribute>();
                    if (att != null)
                    {
                        Copyright = att.Copyright;
                    }
                }
            }

            base.OnLoaded();
        }
Exemplo n.º 3
0
 public SuperUser(DefaultRole u) : base(u)
 {
 }
Exemplo n.º 4
0
 public DecoratorDefaultRoleToSuperUser(DefaultRole u) => defRole = u;