/
DockablePage.xaml.cs
154 lines (129 loc) · 4.44 KB
/
DockablePage.xaml.cs
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
using Autodesk.Revit.UI;
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Markup;
namespace RevitFamilyPalette
{
public partial class DockablePage : Page, IDockablePaneProvider, IComponentConnector, IStyleConnector
{
private Guid m_targetGuid;
private DockPosition m_position = DockPosition.Left;
private int m_left = 1;
private int m_rigth = 1;
private int m_top = 1;
private int m_bottom = 1;
private ExternalEvent m_exEvent;
private EventLoadfamily m_Handler;
//internal DockablePage MyDockableDialog;
//internal TextBlock LabelTitle;
//internal System.Windows.Controls.TabControl tabControl1;
//internal System.Windows.Controls.Button AddFamilies;
//internal System.Windows.Controls.Button buttonRefresh;
//private bool _contentLoaded;
public Dictionary<string, ObservableCollection<FamilyFileInfo>> dict
{
get;
set;
}
public DockablePage(ExternalEvent exEvent, EventLoadfamily handler)
{
this.InitializeComponent();
this.m_exEvent = exEvent;
this.m_Handler = handler;
}
public void SetupDockablePane(DockablePaneProviderData data)
{
data.FrameworkElement = this;
data.InitialState = new DockablePaneState();
data.InitialState.DockPosition = DockPosition.Left;
data.InitialState.TabBehind = DockablePanes.BuiltInDockablePanes.ProjectBrowser;
}
public void SetInitialDockingPatameters(int left, int rigth, int top, int bottom, DockPosition position, Guid targetGuid)
{
this.m_position = position;
this.m_left = left;
this.m_rigth = rigth;
this.m_top = top;
this.m_bottom = bottom;
this.m_targetGuid = targetGuid;
}
private void MyDockableDialog_Loaded(object sender, RoutedEventArgs e)
{
}
private void AddFamilies_Click(object sender, RoutedEventArgs e)
{
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
bool flag = folderBrowserDialog.ShowDialog() != DialogResult.OK;
if (!flag)
{
string selectedPath = folderBrowserDialog.SelectedPath;
this.dict = FilesScaner.GetInfo(selectedPath);
this.tabControl1.ItemsSource = this.dict;
}
}
private void ListBox_MouseUp(object sender, MouseButtonEventArgs e)
{
System.Windows.Controls.ListView listView = sender as System.Windows.Controls.ListView;
FamilyFileInfo familyFileInfo = (FamilyFileInfo)listView.SelectedItem;
EventLoadfamily.familyPath = familyFileInfo.FilePath;
this.m_exEvent.Raise();
}
private void buttonRefresh_Click(object sender, RoutedEventArgs e)
{
this.dict.Clear();
}
//[GeneratedCode("PresentationBuildTasks", "4.0.0.0"), DebuggerNonUserCode]
//public void InitializeComponent()
//{
// bool contentLoaded = this._contentLoaded;
// if (!contentLoaded)
// {
// this._contentLoaded = true;
// Uri resourceLocator = new Uri("/TestDockable3;component/dockablepage.xaml", UriKind.Relative);
// System.Windows.Application.LoadComponent(this, resourceLocator);
// }
//}
//[GeneratedCode("PresentationBuildTasks", "4.0.0.0"), EditorBrowsable(EditorBrowsableState.Never), DebuggerNonUserCode]
//void IComponentConnector.Connect(int connectionId, object target)
//{
// switch (connectionId)
// {
// case 1:
// this.MyDockableDialog = (DockablePage)target;
// this.MyDockableDialog.Loaded += new RoutedEventHandler(this.MyDockableDialog_Loaded);
// return;
// case 2:
// this.LabelTitle = (TextBlock)target;
// return;
// case 3:
// this.tabControl1 = (System.Windows.Controls.TabControl)target;
// return;
// case 5:
// this.AddFamilies = (System.Windows.Controls.Button)target;
// this.AddFamilies.Click += new RoutedEventHandler(this.AddFamilies_Click);
// return;
// case 6:
// this.buttonRefresh = (System.Windows.Controls.Button)target;
// this.buttonRefresh.Click += new RoutedEventHandler(this.buttonRefresh_Click);
// return;
// }
// this._contentLoaded = true;
//}
//[GeneratedCode("PresentationBuildTasks", "4.0.0.0"), EditorBrowsable(EditorBrowsableState.Never), DebuggerNonUserCode]
//void IStyleConnector.Connect(int connectionId, object target)
//{
// if (connectionId == 4)
// {
// ((System.Windows.Controls.ListView)target).MouseUp += new MouseButtonEventHandler(this.ListBox_MouseUp);
// }
//}
}
}