Ejemplo n.º 1
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            int positionId         = Convert.ToInt32(dgvPositions.CurrentRow.Cells["colId"].Value);
            int selectedRowIndex   = dgvPositions.CurrentRow.Index;
            PositionModifyForm frm = new PositionModifyForm();

            frm.ReloadPositions += (s, ea) =>
            {
                PositionsEventArgs eventArgs = ea as PositionsEventArgs;
                if (eventArgs != null)
                {
                    PositionViewModel position = MappingHelper.MapPositionModelToPositionViewModel(eventArgs.position);
                    bsPositions[selectedRowIndex] = position;
                }
            };

            frm.ShowDialog();
        }
Ejemplo n.º 2
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            PositionAddForm frm = new PositionAddForm();

            frm.ReloadPositions += (s, ea) =>
            {
                PositionsEventArgs eventArgs = ea as PositionsEventArgs;
                if (eventArgs != null)
                {
                    PositionViewModel position = MappingHelper.MapPositionModelToPositionViewModel(eventArgs.position);
                    bsPositions.Add(position);
                    dgvPositions.ClearSelection();
                    dgvPositions.Rows[dgvPositions.Rows.Count - 1].Selected = true;
                }
            };

            frm.ShowDialog();
        }
Ejemplo n.º 3
0
 // perform necessary shifting of image when positional object moves
 protected internal void PositionBind(object sender, PositionsEventArgs e)
 {
     // relocates the UI object when it moves
     Dispatcher.Invoke((Action)Relocate);
 }