示例#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();
        }