public void Execute(UIApplication app)
        {
            Transaction trans = new Transaction(app.ActiveUIDocument.Document, "Получить выбранные семейства");

            trans.Start();
            UIDocument uidoc = app.ActiveUIDocument;

            Autodesk.Revit.DB.Document doc = uidoc.Document;
            Selection sel = app.ActiveUIDocument.Selection;
            ICollection <Autodesk.Revit.DB.ElementId> selectedIds = uidoc.Selection.GetElementIds();
            //Reference annotation = sel.PickObject(ObjectType.Element, "Select item");
            FamilyInstance elem         = doc.GetElement(selectedIds.FirstOrDefault()) as FamilyInstance;
            FamilySymbol   familySymbol = elem.Symbol;
            FamilyDto      famDto       = new FamilyDto();

            if (FamilyName == null || FamilyName == "")
            {
                famDto.Name = familySymbol.Name;
            }
            else
            {
                famDto.Name = FamilyName;
            }

            famDto.FamilySymbolDto = familySymbol;
            famDto.ImagePath       = Path;
            famDto.ID = familySymbol.Id.ToString();
            MainWindowViewModel.familyDto = famDto;
            //MainWindowViewModel.FamilySymbolList.Add(famDto);
            trans.Commit();
            ChangeUI?.Invoke(this);
        }
예제 #2
0
        public void SetNewLog(string loadTime, string dicription, int projectId)
        {
            LogDto newLog = new LogDto();

            newLog.Date         = DateTime.Today.ToString();
            newLog.LoadTime     = loadTime;
            newLog.Description  = dicription;
            newLog.ComputerName = Environment.MachineName;
            newLog.UserName     = Environment.UserName;

            newLog.ProjectId = projectId;

            context.LogsDto.Add(newLog);
            context.SaveChanges();

            ChangeUI?.Invoke(this);
        }