void bnModify_Click(object sender, System.EventArgs e)
 {
     try
     {
         if (this.listViewProfile.SelectedIndices.Count > 0)
         {
             int iSel = this.listViewProfile.SelectedIndices[0];
             Pic.DAL.SQLite.PPDataContext      db = new Pic.DAL.SQLite.PPDataContext();
             Pic.DAL.SQLite.CardboardProfile[] cardboardProfiles       = Pic.DAL.SQLite.CardboardProfile.GetAll(db);
             Pic.DAL.SQLite.CardboardProfile   currentCardboardProfile = cardboardProfiles[iSel];
             FormCreateCardboardProfile        dlg = new FormCreateCardboardProfile();
             dlg.ProfileName = currentCardboardProfile.Name;
             dlg.Code        = currentCardboardProfile.Code;
             dlg.Thickness   = currentCardboardProfile.Thickness;
             if (DialogResult.OK == dlg.ShowDialog())
             {
                 // set new values
                 currentCardboardProfile.Name      = dlg.ProfileName;
                 currentCardboardProfile.Code      = dlg.Code;
                 currentCardboardProfile.Thickness = dlg.Thickness;
                 // update database
                 currentCardboardProfile.Update(db);
                 // refill list view
                 FillListView();
                 // select current item
                 listViewProfile.Items[iSel].Selected = true;
             }
         }
     }
     catch (Exception ex)
     {
         Debug.Fail(ex.ToString());
         _log.Debug(ex.ToString());
     }
 }
 private void btCreate_Click(object sender, EventArgs e)
 {
     try
     {
         FormCreateCardboardProfile dlg = new FormCreateCardboardProfile();
         if (DialogResult.OK == dlg.ShowDialog())
         {
             Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext();
             Pic.DAL.SQLite.CardboardProfile.CreateNew(db, dlg.ProfileName, dlg.Code, dlg.Thickness);
             FillListView();
         }
     }
     catch (Exception ex)
     {
         Debug.Fail(ex.ToString());
         _log.Debug(ex.ToString());
     }
 }
Beispiel #3
0
 void bnModify_Click(object sender, System.EventArgs e)
 {
     try
     {
         if (this.listViewProfile.SelectedIndices.Count > 0)
         {
             int iSel = this.listViewProfile.SelectedIndices[0];
             Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext();
             Pic.DAL.SQLite.CardboardProfile[] cardboardProfiles = Pic.DAL.SQLite.CardboardProfile.GetAll(db);
             Pic.DAL.SQLite.CardboardProfile currentCardboardProfile = cardboardProfiles[iSel];
             FormCreateCardboardProfile dlg = new FormCreateCardboardProfile();
             dlg.ProfileName = currentCardboardProfile.Name;
             dlg.Code = currentCardboardProfile.Code;
             dlg.Thickness = currentCardboardProfile.Thickness;
             if (DialogResult.OK == dlg.ShowDialog())
             {
                 // set new values
                 currentCardboardProfile.Name = dlg.ProfileName;
                 currentCardboardProfile.Code = dlg.Code;
                 currentCardboardProfile.Thickness = dlg.Thickness;
                 // update database
                 currentCardboardProfile.Update(db);
                 // refill list view
                 FillListView();
                 // select current item
                 listViewProfile.Items[iSel].Selected = true;
             }
         }
     }
     catch (Exception ex)
     {
         Debug.Fail(ex.ToString());
         _log.Debug(ex.ToString());
     }
 }
Beispiel #4
0
 private void btCreate_Click(object sender, EventArgs e)
 {
     try
     {
         FormCreateCardboardProfile dlg = new FormCreateCardboardProfile();
         if (DialogResult.OK == dlg.ShowDialog())
         {
             Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext();
             Pic.DAL.SQLite.CardboardProfile.CreateNew(db, dlg.ProfileName, dlg.Code, dlg.Thickness);
             FillListView();
         }
     }
     catch (Exception ex)
     {
         Debug.Fail(ex.ToString());
         _log.Debug(ex.ToString());
     }
 }