Ejemplo n.º 1
0
 private void HandleFormLoad(object sender, EventArgs e)
 {
     _readItem = Communicator.Instance.GetReadItem() ?? new ReadItem();
     if (_readItem == null)
     {
         _currentChapter = _startingChapter = 1;
         setCurrentChapterTextBox.Text = setStartingChapterTextBox.Text = @"1";
     }
     else
     {
         setCurrentChapterTextBox.Text = _readItem.CurrentChapter.ToString();
         setStartingChapterTextBox.Text = _readItem.StartingChapter.ToString();
         if (_readItem.LastRead != null) setDateLastReadDateTimePicker.Value = (DateTime) _readItem.LastRead;
         setOnlineURLTextbox.Text = _readItem.OnlineUrl;
         personalNoteTextBox.Text = _readItem.PersonalNote;
         if (_readItem.FinishedReading != null)
             finishedReadingCheckBox.Checked = (bool) _readItem.FinishedReading;
     }
 }
Ejemplo n.º 2
0
        public static void InsertNewReadingItem(ReadItem item)
        {
            try
            {
                using (SQLiteConnection sqLiteConnection = new SQLiteConnection(ConnectionString))
                {
                    sqLiteConnection.Open();
                    using (SQLiteCommand insertCommand = new SQLiteCommand(sqLiteConnection))
                    {
                        insertCommand.CommandText =
                            "INSERT INTO READING_LIST (MANGA_ID, READ_STARTING_CHAPTER, READ_CURRENT_CHAPTER, READ_ONLINE_URL, " +
                            "READ_IS_FINISHED, READ_LAST_TIME, READ_NOTE) VALUES (?, ?, ?, ?, ?, ?, ?)";
                        insertCommand.Parameters.AddWithValue(null, GetMangaId(item.Title));
                        insertCommand.Parameters.AddWithValue(null, item.StartingChapter);
                        insertCommand.Parameters.AddWithValue(null, item.CurrentChapter);
                        insertCommand.Parameters.AddWithValue(null, item.OnlineUrl);
                        insertCommand.Parameters.AddWithValue(null, item.FinishedReading);
                        insertCommand.Parameters.AddWithValue(null, item.LastRead);
                        insertCommand.Parameters.AddWithValue(null, item.PersonalNote);
                        insertCommand.ExecuteNonQuery();
                    }
                    sqLiteConnection.Close();
                }
            }

            catch (Exception ex)
            {
                ErrorMessageBox.Show(ex.Message, ex.ToString());
                Logger.ErrorLogger("error.txt", ex.ToString());
            }
        }
Ejemplo n.º 3
0
 public void SetReadItem(ReadItem readItemItem)
 {
     _readItemItem = readItemItem;
 }
Ejemplo n.º 4
0
 public void ClearReadItem()
 {
     _readItemItem = null;
 }