コード例 #1
0
        private IOperation CreateAddingToTableOperation(params string[] row)
        {
            var tempIsTableVisibile = IsTableVisible;
            var newRow = new TableRow(row);

            System.Action redo = () =>
            {
                Execute.OnUIThread(() =>
                {
                    TableRows.Add(newRow);
                    NotifyOfPropertyChange(() => TableRows);
                });
                ShowTable();
            };
            System.Action undo = () =>
            {
                Execute.OnUIThread(() =>
                {
                    TableRows.RemoveLast(newRow);
                    NotifyOfPropertyChange(() => TableRows);
                });
                if (tempIsTableVisibile)
                {
                    ShowTable();
                }
                else
                {
                    HideTable();
                }
            };

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