Esempio n. 1
0
        public static void Register(MPAccount account, string name = "default")
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException("message", nameof(name));
            }

            if (_accounts.ContainsKey(name))
            {
                throw new WeixinException($"名称'{name}'已注册");
            }

            _accounts[name] = account;
        }
Esempio n. 2
0
        public WeixinMpApi(MPAccount account) : base()
        {
            Account = account;

            if (DependencyManager.TryResolve <IAccessTokenStoreService>(out var storeService))
            {
                AccessTokenStoreService = storeService;
            }
            else
            {
                AccessTokenStoreService = new DefaultAccessTokenStoreService();
            }

            AsyncHelper.RunSync(() => TryUpdateTokenAsync(true));
        }