private void grid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (!UIHelper.TestGridControlForRowCell(sender, e))
         return;
     var card = new CardRegister{
         Width = SystemParameters.PrimaryScreenWidth - 150,
         Height = SystemParameters.PrimaryScreenHeight - 150,
         MinWidth = 800,
         MinHeight = 600,
         Owner = Window.GetWindow(this)
     };
     card.Model.Load(model.FocusedGridRow);
     card.ShowDialog();
     model.ReloadItem(model.FocusedGridRow);
 }
        private void BarButtonItemAdd_OnItemClick(object sender, ItemClickEventArgs e)
        {
            var card = new CardRegister
            {
                WindowStartupLocation = WindowStartupLocation.CenterScreen,
                Width = SystemParameters.PrimaryScreenWidth - 150,
                Height = SystemParameters.PrimaryScreenHeight - 150,
                MinWidth = 800,
                MinHeight = 600,
                Owner = Window.GetWindow(this)
            };
            card.Model.Create();
            card.ShowDialog();

            try
            {
                model.ReloadModel();
            }
            catch (Exception)
            {
                // TODO:
                throw;
            }
        }
        private void grid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (!UIHelper.TestGridControlForRowCell(sender, e))
                    return;
                var card = new CardRegister()
                {
                    Width = SystemParameters.PrimaryScreenWidth - 150,
                    Height = SystemParameters.PrimaryScreenHeight - 150,
                    MinWidth = 800,
                    MinHeight = 600,
                    Owner = Window.GetWindow(this)
                };
                card.Model.Load(model.FocusedGridRow);
                card.ShowDialog();
                model.ReloadItem(model.FocusedGridRow);
            }
            catch (Exception)
            {
                // TODO
                throw;
            }

            /*
            if (!(((TableView)((GridControl) e.Source).View).CalcHitInfo(e.OriginalSource as DependencyObject)).InRowCell)
                return;
            var row = (ItemCommon)((GridControl)sender).GetFocusedRow();
            if (row != null)
            {
                try
                {
                    var card = new CardRegister()
                    {
                        Width = SystemParameters.PrimaryScreenWidth - 150,
                        Height = SystemParameters.PrimaryScreenHeight - 150,
                        MinWidth = 800,
                        MinHeight = 600,
                        Owner = Window.GetWindow(this)
                    };
                    card.Model.Load(row);
                    card.ShowDialog();
                    model.ReloadItem(row);
                }
                catch (Exception)
                {
                    // TODO:
                    throw;
                }
            }
             * */
        }