Esempio n. 1
0
 private void btn_OK_Click(object sender, RoutedEventArgs e)
 {
     if (txtFileLocation.Content.ToString() != "")
     {
         this.Visibility = Visibility.Hidden;
     }
     else
     {
         Common.AlertDiag alert = new Common.AlertDiag();
         alert._strAlertNote = "Insert e-book location";
         alert.ShowInTaskbar = false;
         alert.WindowStyle   = WindowStyle.ToolWindow;
         alert.CancelButton  = Visibility.Hidden;
         alert.ShowDialog();
     }
 }
      private void btn_save_Click(object sender, RoutedEventArgs e)
      {
          string location = fileLocation1.txtFileLocation.Content.ToString();

          if (DataIsValidated())
          {
              string    strAuthor = ValidationLib.DefaultData(autoCompleteBox_Author.Text);
              TextRange textRange = new TextRange(txtReview.Document.ContentStart, txtReview.Document.ContentEnd);
              Book      editedBook;
              if (IsAddnewMode)
              {
                  if (location != "" || filelocation != "")
                  {
                      string   filesource = "";
                      string[] arrayFileSource;
                      if (location != "")
                      {
                          filesource      = location;
                          arrayFileSource = location.Split('\\');
                      }
                      else
                      {
                          filesource      = filelocation;
                          arrayFileSource = filelocation.Split('\\');
                      }
                      editedBook = AddData(new Book());
                      //string[] arrayFileSource = location.Split('\\');
                      //string[] arrayFileSource = filelocation.Split('\\');
                      _OldEbookFile = arrayFileSource[arrayFileSource.Count() - 1];
                      booklib.Add(editedBook, strAuthor, textRange.Text, filesource, _OldEbookFile);
                  }
              }
              else
              {
                  editedBook = AddData(_book);
                  string oldDri = CreateOldDirectory(_OldAuthor, _OldTitle);
                  booklib.Edit(editedBook, strAuthor, oldDri, textRange.Text, _OldEbookFile);
              }
              Common.AlertDiag alert1 = new Common.AlertDiag();
              alert1._strAlertNote = "E-book is inserted/Updated successfull";
              alert1.ShowInTaskbar = false;
              alert1.WindowStyle   = WindowStyle.ToolWindow;
              alert1.CancelButton  = Visibility.Hidden;
              alert1.ShowDialog();
              m.loadMain(new Home());
          }
      }
Esempio n. 3
0
        private void btn_ok_Click(object sender, RoutedEventArgs e)
        {
            StoreLocation store = new StoreLocation();

            LycuteApplication.SetLocation(tbx_Store.Content.ToString());
            store.CreateDatabase(tbx_Store.Content.ToString());
            DBHelper.ConfigDatabase();
            //alert
            Common.AlertDiag alert1 = new Common.AlertDiag();
            alert1._strAlertNote = "Location of e-book library is changed";
            alert1.ShowInTaskbar = false;
            alert1.WindowStyle   = WindowStyle.ToolWindow;
            alert1.CancelButton  = Visibility.Hidden;
            alert1.ShowDialog();

            m.loadMain(new Home());
        }
Esempio n. 4
0
        private void btn_ChoiceStructure_Click(object sender, RoutedEventArgs e)
        {
            Common.AlertDiag alert = new Common.AlertDiag();
            alert._strAlertNote = "This change can be lead to the reload of application. \n It can get the time for change setting";
            alert.ShowInTaskbar = false;
            alert.WindowStyle   = WindowStyle.ToolWindow;
            alert.ShowDialog();


            Setting.StructureStore configStructureDiag = new Setting.StructureStore();
            configStructureDiag.ShowInTaskbar = false;
            configStructureDiag.WindowStyle   = WindowStyle.ToolWindow;
            configStructureDiag.ShowDialog();

            if (_strStructure != "" && _strStructure != null)
            {
                txb_Structure.Text = _strStructure;
            }
        }
 private void btn_Delete_Click(object sender, RoutedEventArgs e)
 {
     //ask for sure to delete
     Common.AlertDiag alert = new Common.AlertDiag();
     alert._strAlertNote = "Do you sure to delete this ebook.\nYou will can NOT restore this ebook for next time";
     alert.ShowInTaskbar = false;
     alert.WindowStyle   = WindowStyle.ToolWindow;
     alert.ShowDialog();
     if (alert.result)
     {
         //remove the folder
         copy.Delete(pOldDirectory, "folder");
         //delete data in database
         booklib.Delete(_book.bok_ID);
         Common.AlertDiag alert1 = new Common.AlertDiag();
         alert1._strAlertNote = "E-book is deleted successfull";
         alert1.ShowInTaskbar = false;
         alert1.WindowStyle   = WindowStyle.ToolWindow;
         alert1.CancelButton  = Visibility.Hidden;
         alert1.ShowDialog();
         m.loadMain(new Home());
     }
 }