/// <summary> /// DB接続入力情報をチェックする(非同期で呼び出す) /// </summary> private void ValidDatabaseAsync() { //Serverが未入力の場合 if (string.IsNullOrEmpty(this.txtSqlServer.Text)) { return; } if (this.cmbAuthMode.SelectedItem == null) { return; } AuthenticateMode mode = ((ListItem <AuthenticateMode>) this.cmbAuthMode.SelectedItem).Value; if (mode == AuthenticateMode.SqlServer) { //DB UserIDが未入力の場合 if (string.IsNullOrEmpty(this.txtDbUserId.Text)) { return; } //DB Passwordが未入力の場合 if (string.IsNullOrEmpty(this.txtDbUserId.Text)) { return; } } string database = ""; if (cmbDataBase.SelectedItem != null) { database = (string)cmbDataBase.SelectedItem; } string server = this.txtSqlServer.Text; string userId = this.txtDbUserId.Text; string psw = this.txtDBPassword.Text; //SQL Serve接続テスト SqlAccessor sqlAccessor = Accessor.AccessorFactory.GetSqlAccessor(mode, server, userId, psw, database); //データベースリスト更新 InitDatabaseListAsync(sqlAccessor); }
/// <summary> /// Authenticate in Dropbox. /// </summary> /// <param name="mode">Authentication mode.</param> /// <returns> /// A client session in Dropbox service. /// </returns> public static DropboxClient ClientFrom(AuthenticateMode mode) { var authorizedToken = AuthenticateFrom(mode); return(new DropboxClient(iTinExportKey, iTinExportSecret, authorizedToken)); }
/// <summary> /// DB接続入力情報をチェックする /// </summary> private bool ValidDatabase() { //Serverが未入力の場合 if (string.IsNullOrEmpty(this.txtSqlServer.Text)) { RSM.ShowMessage(this, RS.Exclamations.NotServer); FocusControl(this.txtSqlServer); return(false); } if (this.cmbAuthMode.SelectedItem == null) { RSM.ShowMessage(this, RS.Exclamations.NotAuthMode); FocusControl(this.cmbAuthMode); return(false); } AuthenticateMode mode = ((ListItem <AuthenticateMode>) this.cmbAuthMode.SelectedItem).Value; if (mode == AuthenticateMode.SqlServer) { //DB UserIDが未入力の場合 if (string.IsNullOrEmpty(this.txtDbUserId.Text)) { RSM.ShowMessage(this, RS.Exclamations.NotDBUserID); FocusControl(this.txtDbUserId); return(false); } //DB Passwordが未入力の場合 if (string.IsNullOrEmpty(this.txtDBPassword.Text)) { RSM.ShowMessage(this, RS.Exclamations.NotDBPassword); FocusControl(this.txtDBPassword); return(false); } } string database = ""; if (cmbDataBase.SelectedItem != null) { database = (string)cmbDataBase.SelectedItem; } if (string.IsNullOrEmpty(database)) { RSM.ShowMessage(this, RS.Exclamations.NotDataBase); return(false); } string server = this.txtSqlServer.Text; string userId = this.txtDbUserId.Text; string psw = this.txtDBPassword.Text; //SQL Serve接続テスト using (SqlAccessor sqlAccessor = Accessor.AccessorFactory.GetSqlAccessor(mode, server, userId, psw, database)) { if (!sqlAccessor.TryConnect()) { RSM.ShowMessage(this, RS.Exclamations.DbConnectFailed); FocusControl(this.txtSqlServer); return(false); } } return(true); }
/// <summary> /// Authenticate in skydrive. /// </summary> /// <param name="mode">Authentication mode.</param> /// <returns> /// A client session in SkyDrive service. /// </returns> public static SkyDriveClient ClientFrom(AuthenticateMode mode) { var authorizedToken = AuthenticateFrom(mode); return(new SkyDriveClient(iTinExportEngineId, string.Empty, authorizedToken)); }