-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathSetOpeningTasksPlacementConfigCmd.cs
More file actions
90 lines (78 loc) · 3.15 KB
/
Copy pathSetOpeningTasksPlacementConfigCmd.cs
File metadata and controls
90 lines (78 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using System.Globalization;
using System.Reflection;
using System.Windows;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using dosymep.Bim4Everyone;
using dosymep.Bim4Everyone.SimpleServices;
using dosymep.WpfCore.Ninject;
using dosymep.WpfUI.Core.Ninject;
using Ninject;
using RevitClashDetective.Models.GraphicView;
using RevitClashDetective.Models.Handlers;
using RevitOpeningPlacement.Models;
using RevitOpeningPlacement.Models.Configs;
using RevitOpeningPlacement.Services;
using RevitOpeningPlacement.ViewModels.OpeningConfig;
using RevitOpeningPlacement.Views.Settings;
namespace RevitOpeningPlacement;
/// <summary>
/// Команда для задания настроек расстановки заданий на отверстия в файле ВИС
/// </summary>
[Transaction(TransactionMode.Manual)]
public class SetOpeningTasksPlacementConfigCmd : BasePluginCommand {
public SetOpeningTasksPlacementConfigCmd() {
PluginName = "Настройки расстановки заданий";
}
public void ExecuteCommand(UIApplication uiApplication) {
Execute(uiApplication);
}
protected override void Execute(UIApplication uiApplication) {
using var kernel = uiApplication.CreatePlatformServices();
kernel.Bind<RevitRepository>()
.ToSelf()
.InSingletonScope();
kernel.Bind<RevitClashDetective.Models.RevitRepository>()
.ToSelf()
.InSingletonScope();
kernel.Bind<RevitEventHandler>()
.ToSelf()
.InSingletonScope();
kernel.Bind<ParameterFilterProvider>()
.ToSelf()
.InSingletonScope();
kernel.Bind<IDocTypesProvider>()
.ToMethod(c => {
return new DocTypesProvider(new DocTypeEnum[] { DocTypeEnum.AR, DocTypeEnum.KR });
})
.InSingletonScope();
kernel.Bind<IRevitLinkTypesSetter>()
.To<DocTypeLoadedLinksSetter>()
.InTransientScope();
kernel.Bind<IDocTypesHandler>()
.To<DocTypesHandler>()
.InSingletonScope();
kernel.BindMainWindow<MainViewModel, MainWindow>();
kernel.Bind<UnionTaskSettingsView>()
.ToSelf()
.InTransientScope()
.WithPropertyValue(nameof(Window.DataContext), c => c.Kernel.Get<MainViewModel>());
kernel.UseWpfUIMessageBox<MainViewModel>()
.UseWpfOpenFileDialog<MainViewModel>()
.UseWpfSaveFileDialog<MainViewModel>();
kernel.Bind<OpeningConfig>()
.ToMethod(c =>
OpeningConfig.GetOpeningConfig(uiApplication.ActiveUIDocument.Document)
);
kernel.Bind<ConfigFileService>()
.ToSelf()
.InSingletonScope();
kernel.UseWpfUIThemeUpdater();
string assemblyName = Assembly.GetExecutingAssembly().GetName().Name;
kernel.UseWpfLocalization($"/{assemblyName};component/assets/localization/Language.xaml",
CultureInfo.GetCultureInfo("ru-RU"));
kernel.Get<IRevitLinkTypesSetter>().SetRevitLinkTypes();
Notification(kernel.Get<MainWindow>());
}
}