Ejemplo n.º 1
0
        private IOperation CreateRowRemovingFromTableOperation(string[] row)
        {
            TableRow tempDeletedRow = new TableRow(row);

            System.Action redo = () =>
            {
                Execute.OnUIThread(() =>
                {
                    if (!TableRows.Remove(new TableRow(row)))
                    {
                        tempDeletedRow = null;
                        return;
                    }
                    NotifyOfPropertyChange(() => TableRows);
                });
            };
            System.Action undo = () =>
            {
                Execute.OnUIThread(() =>
                {
                    if (tempDeletedRow != null)
                    {
                        TableRows.Add(tempDeletedRow);
                        NotifyOfPropertyChange(() => TableRows);
                    }
                });
            };

            return(new SimpleOperation(redo, undo));
        }