예제 #1
0
        // DBへ登録
        private void setAppKey(AccessSQLite db, ClientAppJson client)
        {
            var app = new AppKey();

            app.ClientId  = client.client_id;
            app.ClientSec = client.client_secret;
            db.DeleteAppKeyMaster();
            db.InsertAppKeyMaster(app);
        }
예제 #2
0
        private void setAccessToken(AccessSQLite db, AccessTokenJson token)
        {
            var tok = new AccessToken();

            tok.Host  = DefaultValue.MSTDN_HOST;
            tok.Token = token.access_token;
            db.DeleteAccessTokenMaster();
            db.InsertAccessTokenMaster(tok);
        }
예제 #3
0
        protected void getAccessToken()
        {
            flg = false;
            AccessSQLite db = new AccessSQLite();
            IEnumerable <AccessToken> token = db.GetAccessTokenMaster();

            foreach (AccessToken data in token)
            {
                this.pHost  = data.Host;
                this.pToken = data.Token;
                flg         = true;
            }
        }
예제 #4
0
        protected void getAppKey()
        {
            flg = false;
            AccessSQLite         db      = new AccessSQLite();
            IEnumerable <AppKey> appData = db.GetAppKeyMaster();

            foreach (AppKey data in appData)
            {
                this.pClientId  = data.ClientId;
                this.pClientSec = data.ClientSec;
                flg             = true;
            }
        }
예제 #5
0
        // SQLiteからデータを取得
        protected void getUser()
        {
            flg = false;
            AccessSQLite           db         = new AccessSQLite();
            IEnumerable <UserData> userMaster = db.GetUserMaster();

            foreach (UserData data in userMaster)
            {
                this.pUser = data.UserId;
                this.pPass = data.Password;
                flg        = true;
            }
        }
예제 #6
0
 // DB更新
 private void UpdateDb()
 {
     try {
         AccessSQLite db = new AccessSQLite();
         UserData     ud = new UserData();
         ud.UserId   = this.User.Text;
         ud.Password = this.Password.Text;
         db.DeleteUserMaster();
         db.InsertUserMaster(ud);
     } catch (Exception e) {
         throw e;
     }
 }
예제 #7
0
        // 起動時処理
        protected async override void OnAppearing()
        {
            base.OnAppearing();
            try {
                var db = new AccessSQLite();
                getUser();
                if (!flg)
                {
                    MoveToLoginPage(DefaultValue.FST_SETTING_MSG);
                    return;
                }
                // 初回のみアプリIDの取得
                var access = new HttpRequest();
                getAppKey();
                if (!flg)
                {
                    try {
                        var client = await access.getClientAppJson(DefaultValue.MSTDN_HOST);

                        setAppKey(db, client);
                    } catch (Exception ex) {
                        MoveToLoginPage(DefaultValue.ERR_SETTING_MSG);
                        return;
                    }
                    getAppKey();
                }

                // 起動時にアクセストークンを取得する
                try {
                    var token = await access.getTokenJson(DefaultValue.MSTDN_HOST, pClientId, pClientSec, pUser, pPass);

                    setAccessToken(db, token);
                } catch (Exception ex) {
                    MoveToLoginPage(DefaultValue.ERR_SETTING_MSG);
                    return;
                }
            } catch (Exception exception) {
                ErrorProc(exception);
            }
            moveMain();
        }