private void removeSaleWithoutAlert(NewSale selected_sale)
 {
     if (NewSales.Count == 1)
     {
         SaleDescriptions.RemoveAt(0);
         NewSales.Remove(selected_sale);
         NewSales.Add(new NewSale(this, HomeViewModel));
         SaleDescriptions.Add("New Sale");
         this.SelectedIndex = 0;
     }
     else
     {
         List <NewSale> temp_list = new List <NewSale>();
         foreach (NewSale new_sale in NewSales)
         {
             temp_list.Add(new_sale);
         }
         for (int i = 0; i < temp_list.Count; i++)
         {
             if (temp_list[i] == selected_sale)
             {
                 NewSales.Remove(selected_sale);
                 SaleDescriptions.RemoveAt(i);
                 this.SelectedIndex = NewSales.Count - 1;
                 break;
             }
         }
     }
 }
 public SalesViewModel(HomeViewModel home_view_model, Sales sales)
 {
     this.HomeViewModel     = home_view_model;
     this.AddNewSaleCommand = new RelayCommand(addNewSale);
     this.Sales             = sales;
     home_view_model.Title  = "Sales";
     NewSales.Add(new NewSale(this, HomeViewModel));
     SaleDescriptions.Add("New Sale");
     this.SelectedIndex = 0;
 }
 private void addNewSale(object parameter)
 {
     NewSales.Add(new NewSale(this, HomeViewModel));
     SaleDescriptions.Add("New Sale");
     this.SelectedIndex = NewSales.Count - 1;
 }