Exemple #1
0
        string weibo_ids = "";  //含有关键字的微博ids

        public QQWeibo(int rate)
        {
            appKey       = "801426797";
            appSecret    = "0e9382190a5f764b57e09c15cda96e09";
            accessToken  = xmlUtil.GetValue("QQWbAccessToken");
            openId       = xmlUtil.GetValue("QQWbOpenId");
            callBackUrl  = xmlUtil.GetValue("QQWbCallbackUrl");
            openKey      = xmlUtil.GetValue("QQWbOpenKey");
            RefreshToken = xmlUtil.GetValue("QQWbRefreshToken");
            expire_in    = xmlUtil.GetValue("QQWbExpire_in");
            fetchDateStr = xmlUtil.GetValue("QQWbFetchAccessTokenDate");

            timer           = new System.Timers.Timer(rate);
            timer.AutoReset = true;
            timer.Elapsed  += new ElapsedEventHandler(timer_Elapsed);
            if (string.IsNullOrEmpty(accessToken) || string.IsNullOrEmpty(openKey) || string.IsNullOrEmpty(openId) || string.IsNullOrEmpty(RefreshToken) || string.IsNullOrEmpty(expire_in) || string.IsNullOrEmpty(fetchDateStr))
            {
                if (MessageBox.Show("腾讯微博未授权或授权已过期,请在系统设置中进行授权!", "注意", MessageBoxButtons.OKCancel, MessageBoxIcon.Error) == DialogResult.OK)
                {
                    Finder.QQWeibo weibo = new Finder.QQWeibo();
                    if (weibo.ShowDialog() == DialogResult.OK)
                    {
                        accessToken  = xmlUtil.GetValue("QQWbAccessToken");
                        openId       = xmlUtil.GetValue("QQWbOpenId");
                        callBackUrl  = xmlUtil.GetValue("QQWbCallbackUrl");
                        openKey      = xmlUtil.GetValue("QQWbOpenKey");
                        RefreshToken = xmlUtil.GetValue("QQWbRefreshToken");
                        expire_in    = xmlUtil.GetValue("QQWbExpire_in");
                        fetchDateStr = xmlUtil.GetValue("QQWbFetchAccessTokenDate");
                    }
                }
            }
            timer.Enabled = false;
        }
Exemple #2
0
        public QQWeibo(int rate)
        {
            appKey = "801426797";
            appSecret = "0e9382190a5f764b57e09c15cda96e09";
            accessToken = xmlUtil.GetValue("QQWbAccessToken");
            openId = xmlUtil.GetValue("QQWbOpenId");
            callBackUrl = xmlUtil.GetValue("QQWbCallbackUrl");
            openKey = xmlUtil.GetValue("QQWbOpenKey");
            RefreshToken = xmlUtil.GetValue("QQWbRefreshToken");
            expire_in = xmlUtil.GetValue("QQWbExpire_in");
            fetchDateStr = xmlUtil.GetValue("QQWbFetchAccessTokenDate");

            timer = new System.Timers.Timer(rate);
            timer.AutoReset = true;
            timer.Elapsed +=new ElapsedEventHandler(timer_Elapsed);
            if (string.IsNullOrEmpty(accessToken) || string.IsNullOrEmpty(openKey) || string.IsNullOrEmpty(openId) || string.IsNullOrEmpty(RefreshToken) || string.IsNullOrEmpty(expire_in) || string.IsNullOrEmpty(fetchDateStr))
            {
                if (MessageBox.Show("腾讯微博未授权或授权已过期,请在系统设置中进行授权!", "注意", MessageBoxButtons.OKCancel, MessageBoxIcon.Error) == DialogResult.OK)
                {
                    Finder.QQWeibo weibo = new Finder.QQWeibo();
                    if (weibo.ShowDialog() == DialogResult.OK)
                    {
                        accessToken = xmlUtil.GetValue("QQWbAccessToken");
                        openId = xmlUtil.GetValue("QQWbOpenId");
                        callBackUrl = xmlUtil.GetValue("QQWbCallbackUrl");
                        openKey = xmlUtil.GetValue("QQWbOpenKey");
                        RefreshToken = xmlUtil.GetValue("QQWbRefreshToken");
                        expire_in = xmlUtil.GetValue("QQWbExpire_in");
                        fetchDateStr = xmlUtil.GetValue("QQWbFetchAccessTokenDate");
                    }
                }
            }
            timer.Enabled = false;
        }