private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (lastLstIndex < Ticket.ticketArray.Count)
     {
         if (lastLstIndex != -1)
         {
             Ticket.saveTicket(Ticket.ticketArray[lastLstIndex], lblID.Text, lblSubject.Text, txtNotes.Text, txtSolution.Text, txtStatus.Text, dateTimePicker1.Value);
         }
     }
     JsonController.SaveJson();
 }
 private void lstBoxTickets_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lastLstIndex != -1)
     {
         try { Ticket.saveTicket(Ticket.ticketArray[lastLstIndex], lblID.Text, lblSubject.Text, txtNotes.Text, txtSolution.Text, txtStatus.Text, dateTimePicker1.Value); } catch { }
     }
     if (lstBoxTickets.SelectedIndex != -1)
     {
         populateTicketInformation(Ticket.ticketArray[lstBoxTickets.SelectedIndex]);
     }
     lastLstIndex = lstBoxTickets.SelectedIndex;
     fillTicketTable();
 }
 private void Form1_Activated(object sender, EventArgs e)
 {
     if (lastLstIndex != -1 && !fullOpen && lstBoxTickets.Items.Count > 0 && Ticket.ticketArray.Count < lastLstIndex)
     {
         Ticket.saveTicket(Ticket.ticketArray[lastLstIndex], lblID.Text, lblSubject.Text, txtNotes.Text, txtSolution.Text, txtStatus.Text, dateTimePicker1.Value);
     }
     if (fullOpen)
     {
         fullOpen = false;
     }
     fillTicketTable();
     if (lastLstIndex != -1)
     {
         try { populateTicketInformation(Ticket.ticketArray[lastLstIndex]); } catch { }
     }
     changeColor();
 }