示例#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();
        }
示例#2
0
        public void preview()
        {
            previewTranCon_.Reset();

            try
            {
                foreach (DataRow row in TaskTable.Rows)
                {
                    OpeningTask task = rowsToTasks_[row];

                    var opening = new Opening(task);
                    opening.AddProjection();

                    previewTranCon_.AppendCopyOfElement(opening.GetElement());

                    foreach (BCOM.Element projElement in opening.GetProjections())
                    {
                        previewTranCon_.AppendCopyOfElement(projElement);
                    }
                }
            }
            catch (Exception ex) // TODO
            {
                ex.AddToMessageCenter();
            }
        }