package com.szu;


import com.szu.accountsoft.dao.PwdDAO;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

public class StartActivity extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.start);
		
		new Handler().postDelayed(new Runnable() {
			PwdDAO pwdDAO = new PwdDAO(StartActivity.this);// 创建PwdDAO对象
			@Override
			public void run() {
				// TODO Auto-generated method stub
				if(pwdDAO.getCount() == 0)
				{
					Dialog alertDialog = new AlertDialog.Builder(StartActivity.this)
					.setTitle("还没有账号？")
					.setMessage("注册吗？")
					.setPositiveButton("确认", new DialogInterface.OnClickListener() {
						@Override
						public void onClick(DialogInterface arg0, int arg1) {
							// TODO Auto-generated method stub
							Intent StartIntent = new Intent(StartActivity.this, Register_Activity.class);
							startActivity(StartIntent);
							finish();
						}
					})
					.setNegativeButton("退出", new DialogInterface.OnClickListener() {
						
						@Override
						public void onClick(DialogInterface dialog, int which) {
							// TODO Auto-generated method stub
							dialog.dismiss();
							finish();
						}
					}).show();
					
					
				}
				else
				{
					Intent StartIntent = new Intent(StartActivity.this, Login.class);
					startActivity(StartIntent);
					finish();
				}
			}
		}, 2000);
	}

}
