Ejemplo n.º 1
0
        //DB 입력 부분
        public void inputDB()
        {
            TextView txt_input_url = FindViewById <TextView>(Resource.Id.txt_input_url);

            URL_Log log = new URL_Log()
            {
                Url    = txt_input_url.Text,
                Result = fcnt + " / " + total
            };

            db.InsertIntoTableURL_Log(log);
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.History);
            var tolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(tolbar);
            ActionBar.Title = "과거 내역";
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            //db 생성
            db = new Database();
            db.createDataBase();


            string folder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);

            Log.Info("DB_PATH", folder);

            lstData = FindViewById <ListView>(Resource.Id.db_list);

            var dbDel = FindViewById <Button>(Resource.Id.dbDel);


            //데이터 로드
            LoadData();

            //이벤트
            dbDel.Click += delegate
            {
                URL_Log log = new URL_Log();
                db.DeleteTableURL_Log(log);
                LoadData();
            };

            lstData.ItemClick += (s, e) =>
            {
                for (int i = 0; i < lstData.Count; i++)
                {
                    if (e.Position == i)
                    {
                        lstData.GetChildAt(i).SetBackgroundColor(Android.Graphics.Color.DarkGray);
                    }
                    else
                    {
                        lstData.GetChildAt(i).SetBackgroundColor(Android.Graphics.Color.Transparent);
                    }
                }
            };
        }
Ejemplo n.º 3
0
 public bool DeleteTableURL_Log(URL_Log URL_Log)
 {
     try
     {
         using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "URL_Log.db")))
         {
             connection.Query <URL_Log>("DELETE FROM URL_Log");
             return(true);
         }
     }
     catch (SQLiteException ex)
     {
         Log.Info("SQLiteEx", ex.Message);
         return(false);
     }
 }
Ejemplo n.º 4
0
 public bool UpdateTableURL_Log(URL_Log URL_Log)
 {
     try
     {
         using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "URL_Log.db")))
         {
             connection.Query <URL_Log>("UPDATE URL_Log set Url=?,Result=? Where Id=?", URL_Log.Url, URL_Log.Result, URL_Log.Id);
             return(true);
         }
     }
     catch (SQLiteException ex)
     {
         Log.Info("SQLiteEx", ex.Message);
         return(false);
     }
 }
Ejemplo n.º 5
0
 public bool InsertIntoTableURL_Log(URL_Log URL_Log)
 {
     try
     {
         using (var connection = new SQLiteConnection(System.IO.Path.Combine(folder, "URL_Log.db")))
         {
             connection.Insert(URL_Log);
             return(true);
         }
     }
     catch (SQLiteException ex)
     {
         Log.Info("SQLiteEx", ex.Message);
         return(false);
     }
 }