private void AddDataItem_Click(object sender, RoutedEventArgs e)
 {
     if (DataOperations.UserDataOperations.SelectUserDataCount(DataStatic.LoggedUser.Id) < maxDataCount)
     {
         var addWindow = new AddUserDataWindow();
         addWindow.Closing += AddWindowOnClosing;
         addWindow.Show();
     }
 }
        private void EditDataItem_OnClick(object sender, RoutedEventArgs e)
        {
            try
            {
                var menuItem    = (MenuItem)sender;
                var contextMenu = (ContextMenu)menuItem.Parent;
                var item        = (DataGrid)contextMenu.PlacementTarget;
                var toEdit      = (UserDataDto)item.SelectedCells[0].Item;

                var addWindow = new AddUserDataWindow(toEdit.Id, toEdit.Comment, toEdit.ServName, toEdit.ServPassword, true);
                addWindow.Closing += AddWindowOnClosing;
                addWindow.Show();
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception);
                //throw;
            }
        }