Пример #1
0
        public void addToModel()
        {
            previewTranCon_?.Reset();

            Session.Instance.StartUndoGroup();

            ElementHelper.RunByRecovertingSettings(() => {
                foreach (DataRow row in TaskTable.Rows)
                {
                    Session.Instance.SetUndoMark();

                    OpeningTask task = rowsToTasks_[row];
                    try
                    {
                        Opening opening = new Opening(task);
                        opening.AddPerforation();
                        opening.AddProjection();
                        opening.AddToModel(false);

                        row.SetField(FieldName.STATUS, "DONE");
                        // TODO статус о выполнении
                    }
                    catch (Exception ex)
                    {
                        // TODO статус о выполнении
                        row.SetField(FieldName.STATUS, "ERROR");
                        Session.Instance.Keyin("undo");
                        var last = App.ActiveModelReference.GetLastValidGraphicalElement();
                        last?.Rewrite();
                    }
                }
            });

            Session.Instance.EndUndoGroup();
        }