// function for editing selected meter
        private void EditMeter(object sender, RoutedEventArgs e)
        {
            /*
             * find selected row, get ID from first column (hidden column "ID")
             * send "self" that "update" function could be called from another window
             * send ID to the Editing window, open it;
             * Function in the editing window loads data based on ID
             */
            for (var vis = sender as Visual; vis != null; vis = VisualTreeHelper.GetParent(vis) as Visual)
            {
                if (vis is DataGridRow)
                {
                    var row = (DataGridRow)vis;
                    int id  = Convert.ToInt32((tblMeters.SelectedCells[0].Column.GetCellContent(row) as TextBlock).Text);

                    ManageMeter manageMeter = new ManageMeter(this, id);
                    manageMeter.Show();
                }
            }
        } // edit meter
        } // delete meter

        // ========== BUTTONS ========== //

        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            ManageMeter manageMeter = new ManageMeter(this, 0);

            manageMeter.Show();
        }