Exemplo n.º 1
0
        public ExportScheduleToExcelViewModel(UIDocument uidoc)
        {
            // Lưu trữ Data từ Revit
            Doc   = uidoc.Document;
            UiDoc = uidoc;

            // Khởi tạo data cho WPF window

            List <ViewSchedule> allViewSchedule =
                new FilteredElementCollector(Doc)
                .OfCategory(BuiltInCategory.OST_Schedules)
                .Cast <ViewSchedule>()
                .Where(vs => vs.CropBox != null)
                .Where(vs => vs.Definition.CategoryId.IntegerValue
                       != (int)BuiltInCategory.OST_Revisions)
                .ToList();

            foreach (ViewSchedule v in allViewSchedule)
            {
                ViewScheduleExtension viewExtension
                    = new ViewScheduleExtension(v);

                AllViewSchedules.Add(viewExtension);
            }

            AllViewSchedules.Sort((v1, v2)
                                  => string.CompareOrdinal(v1.ViewScheduleName, v2.ViewScheduleName));

            ExportExcelFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
        }
Exemplo n.º 2
0
        private void IsExportClick(object sender, RoutedEventArgs e)
        {
            ViewScheduleExtension first = _viewModel.SelectedViewSchedules
                                          .FirstOrDefault();
            bool selected = first.IsExport;

            foreach (var vs in _viewModel.SelectedViewSchedules)
            {
                vs.IsExport = !selected;
            }
        }