├── .gitattributes
├── .gitignore
├── PBBenchmark
├── App.xaml
├── App.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── PBBenchmark.csproj
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
└── app.config
├── PBDotNet.sln
├── PBDotNet
├── App.xaml
├── App.xaml.cs
├── Controls
│ └── WpfPropertyGrid.cs
├── Images
│ ├── 16
│ │ └── Userobject.png
│ ├── .svn
│ │ ├── entries
│ │ ├── prop-base
│ │ │ ├── Library.png.svn-base
│ │ │ └── Target.png.svn-base
│ │ └── text-base
│ │ │ ├── Library.png.svn-base
│ │ │ └── Target.png.svn-base
│ ├── Library.png
│ └── Target.png
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── PBDotNet.csproj
├── PBSyntax.xshd
├── Properties
│ ├── .svn
│ │ ├── entries
│ │ └── text-base
│ │ │ ├── AssemblyInfo.cs.svn-base
│ │ │ ├── Resources.Designer.cs.svn-base
│ │ │ ├── Resources.resx.svn-base
│ │ │ ├── Settings.Designer.cs.svn-base
│ │ │ └── Settings.settings.svn-base
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Util
│ └── CmdlineArgs.cs
├── VsMuster.xml
├── app.config
└── packages.config
├── PBDotNetLib
├── PBDotNetLib.csproj
├── Properties
│ └── AssemblyInfo.cs
├── common
│ ├── PBProjFile.cs
│ └── PBSrcFile.cs
├── orca
│ ├── ILibEntry.cs
│ ├── LibEntry.cs
│ ├── Objecttype.cs
│ ├── Orca.cs
│ └── VirtualLibEntry.cs
├── pbuilder
│ ├── ILibrary.cs
│ ├── Library.cs
│ ├── Target.cs
│ ├── VirtualLibrary.cs
│ ├── Workspace.cs
│ └── powerscript
│ │ ├── Datawindow.cs
│ │ ├── Event.cs
│ │ ├── Method.cs
│ │ ├── Parameter.cs
│ │ ├── Type.cs
│ │ └── Variable.cs
├── util
│ └── PsrCleaner.cs
└── vstudio
│ ├── Project.cs
│ ├── Solution.cs
│ └── Solution.template
├── PBGenerator
├── App.xaml
├── App.xaml.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── PBGenerator.csproj
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
└── app.config
├── README.md
└── screenshot.png
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #################
2 | ## Eclipse
3 | #################
4 |
5 | *.pydevproject
6 | .project
7 | .metadata
8 | bin/
9 | tmp/
10 | *.tmp
11 | *.bak
12 | *.swp
13 | *~.nib
14 | local.properties
15 | .classpath
16 | .settings/
17 | .loadpath
18 |
19 | # External tool builders
20 | .externalToolBuilders/
21 |
22 | # Locally stored "Eclipse launch configurations"
23 | *.launch
24 |
25 | # CDT-specific
26 | .cproject
27 |
28 | # PDT-specific
29 | .buildpath
30 |
31 |
32 | #################
33 | ## Visual Studio
34 | #################
35 |
36 | ## Ignore Visual Studio temporary files, build results, and
37 | ## files generated by popular Visual Studio add-ons.
38 |
39 | # User-specific files
40 | *.suo
41 | *.user
42 | *.sln.docstates
43 |
44 | # Build results
45 |
46 | [Dd]ebug/
47 | [Rr]elease/
48 | x64/
49 | build/
50 | [Bb]in/
51 | [Oo]bj/
52 |
53 | # MSTest test Results
54 | [Tt]est[Rr]esult*/
55 | [Bb]uild[Ll]og.*
56 |
57 | *_i.c
58 | *_p.c
59 | *.ilk
60 | *.meta
61 | *.obj
62 | *.pch
63 | *.pdb
64 | *.pgc
65 | *.pgd
66 | *.rsp
67 | *.sbr
68 | *.tlb
69 | *.tli
70 | *.tlh
71 | *.tmp
72 | *.tmp_proj
73 | *.log
74 | *.vspscc
75 | *.vssscc
76 | .builds
77 | *.pidb
78 | *.log
79 | *.scc
80 |
81 | # Visual C++ cache files
82 | ipch/
83 | *.aps
84 | *.ncb
85 | *.opensdf
86 | *.sdf
87 | *.cachefile
88 |
89 | # Visual Studio profiler
90 | *.psess
91 | *.vsp
92 | *.vspx
93 |
94 | # Guidance Automation Toolkit
95 | *.gpState
96 |
97 | # ReSharper is a .NET coding add-in
98 | _ReSharper*/
99 | *.[Rr]e[Ss]harper
100 |
101 | # TeamCity is a build add-in
102 | _TeamCity*
103 |
104 | # DotCover is a Code Coverage Tool
105 | *.dotCover
106 |
107 | # NCrunch
108 | *.ncrunch*
109 | .*crunch*.local.xml
110 |
111 | # Installshield output folder
112 | [Ee]xpress/
113 |
114 | # DocProject is a documentation generator add-in
115 | DocProject/buildhelp/
116 | DocProject/Help/*.HxT
117 | DocProject/Help/*.HxC
118 | DocProject/Help/*.hhc
119 | DocProject/Help/*.hhk
120 | DocProject/Help/*.hhp
121 | DocProject/Help/Html2
122 | DocProject/Help/html
123 |
124 | # Click-Once directory
125 | publish/
126 |
127 | # Publish Web Output
128 | *.Publish.xml
129 | *.pubxml
130 |
131 | # NuGet Packages Directory
132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
133 | #packages/
134 |
135 | # Windows Azure Build Output
136 | csx
137 | *.build.csdef
138 |
139 | # Windows Store app package directory
140 | AppPackages/
141 |
142 | # Others
143 | sql/
144 | *.Cache
145 | ClientBin/
146 | [Ss]tyle[Cc]op.*
147 | ~$*
148 | *~
149 | *.dbmdl
150 | *.[Pp]ublish.xml
151 | *.pfx
152 | *.publishsettings
153 |
154 | # RIA/Silverlight projects
155 | Generated_Code/
156 |
157 | # Backup & report files from converting an old project file to a newer
158 | # Visual Studio version. Backup files are not needed, because we have git ;-)
159 | _UpgradeReport_Files/
160 | Backup*/
161 | UpgradeLog*.XML
162 | UpgradeLog*.htm
163 |
164 | # SQL Server files
165 | App_Data/*.mdf
166 | App_Data/*.ldf
167 |
168 | #############
169 | ## Windows detritus
170 | #############
171 |
172 | # Windows image file caches
173 | Thumbs.db
174 | ehthumbs.db
175 |
176 | # Folder config file
177 | Desktop.ini
178 |
179 | # Recycle Bin used on file shares
180 | $RECYCLE.BIN/
181 |
182 | # Mac crap
183 | .DS_Store
184 |
185 |
186 | #############
187 | ## Python
188 | #############
189 |
190 | *.py[co]
191 |
192 | # Packages
193 | *.egg
194 | *.egg-info
195 | dist/
196 | build/
197 | eggs/
198 | parts/
199 | var/
200 | sdist/
201 | develop-eggs/
202 | .installed.cfg
203 |
204 | # Installer logs
205 | pip-log.txt
206 |
207 | # Unit test / coverage reports
208 | .coverage
209 | .tox
210 |
211 | #Translations
212 | *.mo
213 |
214 | #Mr Developer
215 | .mr.developer.cfg
216 |
--------------------------------------------------------------------------------
/PBBenchmark/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/PBBenchmark/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Windows;
7 |
8 | namespace PBBenchmark
9 | {
10 | ///
11 | /// Interaktionslogik für "App.xaml"
12 | ///
13 | public partial class App : Application
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/PBBenchmark/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
5 |
11 |
12 |
--------------------------------------------------------------------------------
/PBBenchmark/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 | using Microsoft.Win32;
15 | using PBDotNetLib.pbuilder;
16 | using PBDotNetLib.orca;
17 | using System.Threading;
18 | using Powerscript = PBDotNetLib.pbuilder.powerscript;
19 | using System.Configuration;
20 |
21 | namespace PBBenchmark
22 | {
23 | ///
24 | /// Interaktionslogik für MainWindow.xaml
25 | ///
26 | public partial class MainWindow : Window
27 | {
28 | private List entries;
29 | private Workspace workspace;
30 | private object lockObj = new object();
31 | private Orca.Version pbVersion;
32 |
33 | public MainWindow()
34 | {
35 | InitializeComponent();
36 | string pbVersion = ConfigurationManager.AppSettings["PBVersion"];
37 | if (String.IsNullOrEmpty(pbVersion)) {
38 | this.pbVersion = Orca.Version.PB126;
39 | } else {
40 | switch (pbVersion) {
41 | case "115":
42 | this.pbVersion = Orca.Version.PB115;
43 | break;
44 | case "125":
45 | this.pbVersion = Orca.Version.PB125;
46 | break;
47 | case "126":
48 | this.pbVersion = Orca.Version.PB126;
49 | break;
50 | }
51 | }
52 | }
53 |
54 | private void button1_Click(object sender, RoutedEventArgs e)
55 | {
56 | DateTime start;
57 | TimeSpan result;
58 | OpenFileDialog dialog = new OpenFileDialog();
59 |
60 | if (!dialog.ShowDialog().Value)
61 | return;
62 |
63 | workspace = new Workspace(dialog.FileName, this.pbVersion);
64 |
65 | if (workspace.Targets.Length > 0)
66 | {
67 | start = DateTime.Now;
68 | ReadTarget(workspace.Targets[0]);
69 | result = DateTime.Now.Subtract(start);
70 | Result("ReadTarget: " + result.Minutes + ":" + result.Seconds);
71 |
72 | start = DateTime.Now;
73 | ReadCode();
74 | result = DateTime.Now.Subtract(start);
75 | Result("ReadCode: " + result.Minutes + ":" + result.Seconds);
76 |
77 | start = DateTime.Now;
78 | ParseCode();
79 | result = DateTime.Now.Subtract(start);
80 | Result("ParseCode: " + result.Minutes + ":" + result.Seconds);
81 | }
82 | }
83 |
84 | private void button2_Click(object sender, RoutedEventArgs e)
85 | {
86 | DateTime start;
87 | TimeSpan result;
88 | OpenFileDialog dialog = new OpenFileDialog();
89 |
90 | if (!dialog.ShowDialog().Value)
91 | return;
92 |
93 | workspace = new Workspace(dialog.FileName, this.pbVersion);
94 |
95 | if (workspace.Targets.Length > 0)
96 | {
97 | start = DateTime.Now;
98 | ReadTargetThreaded(workspace.Targets[0]);
99 | result = DateTime.Now.Subtract(start);
100 | Result("ReadTarget (Thread): " + result.Minutes + ":" + result.Seconds);
101 | }
102 | }
103 |
104 | private void Result(string message)
105 | {
106 | textBoxResult.Text += message + "\r\n";
107 | }
108 |
109 | private void ReadCode()
110 | {
111 | Orca orca = new Orca(this.pbVersion);
112 |
113 | foreach(LibEntry entry in entries)
114 | {
115 | orca.FillCode(entry);
116 | }
117 | }
118 |
119 | private void ReadTarget(Target target)
120 | {
121 | StringBuilder sb = new StringBuilder();
122 |
123 | entries = new List();
124 |
125 | ILibrary[] test1 = target.Libraries;
126 | foreach (Library lib in test1)
127 | {
128 | ILibEntry[] test = lib.EntryList;
129 | foreach (LibEntry entry in test)
130 | {
131 | sb.Append(entry.Name + "\r\n");
132 | //addText(entry.Name);
133 | }
134 | entries.AddRange(test);
135 | }
136 |
137 | addText(sb.ToString());
138 | }
139 |
140 | private void ParseCode()
141 | {
142 |
143 | foreach (LibEntry entry in entries)
144 | {
145 | switch (entry.Type)
146 | {
147 | case Objecttype.Datawindow:
148 | Powerscript.Datawindow.GetDatawindowFromSource(entry.Source);
149 |
150 | break;
151 | case Objecttype.Structure:
152 | case Objecttype.Menu:
153 | case Objecttype.Function:
154 | case Objecttype.Application:
155 | case Objecttype.Userobject:
156 | case Objecttype.Window:
157 | Powerscript.Type.GetTypesFromSource(entry.Source);
158 | break;
159 |
160 | }
161 | }
162 | }
163 |
164 | private void ReadTargetStart(object t)
165 | {
166 | Tuple v = (Tuple)t;
167 |
168 | for (int i = v.Item2; i < v.Item1.Libraries.Length; i = i + v.Item3)
169 | {
170 | ILibrary lib = v.Item1.Libraries[i];
171 |
172 | ILibEntry[] test = lib.EntryList;
173 | foreach (LibEntry entry in test)
174 | {
175 | //addText(entry.Name);
176 | }
177 | }
178 |
179 | addText("Done");
180 | }
181 |
182 | private void ReadTargetThreaded(Target target)
183 | {
184 | Thread t1, t2;
185 |
186 | t1 = new Thread(new ParameterizedThreadStart(this.ReadTargetStart));
187 | t1.Start(new Tuple(target, 0, 2));
188 |
189 | t2 = new Thread(new ParameterizedThreadStart(this.ReadTargetStart));
190 | t2.Start(new Tuple(target, 1, 2));
191 | }
192 |
193 | private void addText(string text)
194 | {
195 | /*lock (lockObj)
196 | {*/
197 | if (!textBox1.Dispatcher.CheckAccess())
198 | {
199 | textBox1.Dispatcher.Invoke((Action)delegate { addText(text); });
200 | return;
201 | }
202 |
203 | textBox1.Text += text + "\r\b";
204 | /*}*/
205 | }
206 |
207 |
208 |
209 |
210 | }
211 | }
212 |
--------------------------------------------------------------------------------
/PBBenchmark/PBBenchmark.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | x86
6 | 8.0.30703
7 | 2.0
8 | {29BA1D0E-A727-4A8E-8E0C-29C48E8BCC8E}
9 | WinExe
10 | Properties
11 | PBBenchmark
12 | PBBenchmark
13 | v4.5
14 |
15 |
16 | 512
17 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
18 | 4
19 |
20 |
21 | x86
22 | true
23 | full
24 | false
25 | bin\Debug\
26 | DEBUG;TRACE
27 | prompt
28 | 4
29 | false
30 |
31 |
32 | x86
33 | pdbonly
34 | true
35 | bin\Release\
36 | TRACE
37 | prompt
38 | 4
39 | false
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | 4.0
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 | MSBuild:Compile
60 | Designer
61 |
62 |
63 | MSBuild:Compile
64 | Designer
65 |
66 |
67 | App.xaml
68 | Code
69 |
70 |
71 | MainWindow.xaml
72 | Code
73 |
74 |
75 |
76 |
77 | Code
78 |
79 |
80 | True
81 | True
82 | Resources.resx
83 |
84 |
85 | True
86 | Settings.settings
87 | True
88 |
89 |
90 | ResXFileCodeGenerator
91 | Resources.Designer.cs
92 |
93 |
94 |
95 | SettingsSingleFileGenerator
96 | Settings.Designer.cs
97 |
98 |
99 |
100 |
101 |
102 | {5209AFDD-9359-4A54-9E03-AA6C5807E3C2}
103 | PBDotNetLib
104 |
105 |
106 |
107 |
114 |
--------------------------------------------------------------------------------
/PBBenchmark/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // Allgemeine Informationen über eine Assembly werden über die folgenden
8 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
9 | // die mit einer Assembly verknüpft sind.
10 | [assembly: AssemblyTitle("PBBenchmark")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("Microsoft")]
14 | [assembly: AssemblyProduct("PBBenchmark")]
15 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
20 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
21 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
22 | [assembly: ComVisible(false)]
23 |
24 | //Um mit dem Erstellen lokalisierbarer Anwendungen zu beginnen, legen Sie
25 | //ImCodeVerwendeteKultur in der .csproj-Datei
26 | //in einer fest. Wenn Sie in den Quelldateien beispielsweise Deutsch
27 | //(Deutschland) verwenden, legen Sie auf \"de-DE\" fest. Heben Sie dann die Auskommentierung
28 | //des nachstehenden NeutralResourceLanguage-Attributs auf. Aktualisieren Sie "en-US" in der nachstehenden Zeile,
29 | //sodass es mit der UICulture-Einstellung in der Projektdatei übereinstimmt.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //Speicherort der designspezifischen Ressourcenwörterbücher
36 | //(wird verwendet, wenn eine Ressource auf der Seite
37 | // oder in den Anwendungsressourcen-Wörterbüchern nicht gefunden werden kann.)
38 | ResourceDictionaryLocation.SourceAssembly //Speicherort des generischen Ressourcenwörterbuchs
39 | //(wird verwendet, wenn eine Ressource auf der Seite, in der Anwendung oder einem
40 | // designspezifischen Ressourcenwörterbuch nicht gefunden werden kann.)
41 | )]
42 |
43 |
44 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
45 | //
46 | // Hauptversion
47 | // Nebenversion
48 | // Buildnummer
49 | // Revision
50 | //
51 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
52 | // übernehmen, indem Sie "*" eingeben:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/PBBenchmark/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion:4.0.30319.34014
5 | //
6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
7 | // der Code erneut generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace PBBenchmark.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
17 | ///
18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
19 | // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
21 | // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PBBenchmark.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
51 | /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/PBBenchmark/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
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 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/PBBenchmark/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion:4.0.30319.34014
5 | //
6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
7 | // der Code erneut generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace PBBenchmark.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/PBBenchmark/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/PBBenchmark/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/PBDotNet.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.31101.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PBDotNet", "PBDotNet\PBDotNet.csproj", "{79D600D2-3E59-4A8C-8B22-3BF0092D51AD}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PBDotNetLib", "PBDotNetLib\PBDotNetLib.csproj", "{5209AFDD-9359-4A54-9E03-AA6C5807E3C2}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PBBenchmark", "PBBenchmark\PBBenchmark.csproj", "{29BA1D0E-A727-4A8E-8E0C-29C48E8BCC8E}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xceed.Wpf.AvalonDock", "..\..\CodePlex\WpfToolkit\Main\Source\ExtendedWPFToolkitSolution\Src\Xceed.Wpf.AvalonDock\Xceed.Wpf.AvalonDock.csproj", "{DB81988F-E0F2-45A0-A1FD-8C37F3D35244}"
13 | EndProject
14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xceed.Wpf.Toolkit", "..\..\CodePlex\WpfToolkit\Main\Source\ExtendedWPFToolkitSolution\Src\Xceed.Wpf.Toolkit\Xceed.Wpf.Toolkit.csproj", "{72E591D6-8F83-4D8C-8F67-9C325E623234}"
15 | EndProject
16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PBGenerator", "PBGenerator\PBGenerator.csproj", "{193EAABA-1552-4937-BE5E-3C330E3E0544}"
17 | EndProject
18 | Global
19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
20 | Debug|Any CPU = Debug|Any CPU
21 | Debug|Mixed Platforms = Debug|Mixed Platforms
22 | Debug|x86 = Debug|x86
23 | Release|Any CPU = Release|Any CPU
24 | Release|Mixed Platforms = Release|Mixed Platforms
25 | Release|x86 = Release|x86
26 | EndGlobalSection
27 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
28 | {79D600D2-3E59-4A8C-8B22-3BF0092D51AD}.Debug|Any CPU.ActiveCfg = Debug|x86
29 | {79D600D2-3E59-4A8C-8B22-3BF0092D51AD}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
30 | {79D600D2-3E59-4A8C-8B22-3BF0092D51AD}.Debug|Mixed Platforms.Build.0 = Debug|x86
31 | {79D600D2-3E59-4A8C-8B22-3BF0092D51AD}.Debug|x86.ActiveCfg = Debug|x86
32 | {79D600D2-3E59-4A8C-8B22-3BF0092D51AD}.Debug|x86.Build.0 = Debug|x86
33 | {79D600D2-3E59-4A8C-8B22-3BF0092D51AD}.Release|Any CPU.ActiveCfg = Release|x86
34 | {79D600D2-3E59-4A8C-8B22-3BF0092D51AD}.Release|Mixed Platforms.ActiveCfg = Release|x86
35 | {79D600D2-3E59-4A8C-8B22-3BF0092D51AD}.Release|Mixed Platforms.Build.0 = Release|x86
36 | {79D600D2-3E59-4A8C-8B22-3BF0092D51AD}.Release|x86.ActiveCfg = Release|x86
37 | {79D600D2-3E59-4A8C-8B22-3BF0092D51AD}.Release|x86.Build.0 = Release|x86
38 | {5209AFDD-9359-4A54-9E03-AA6C5807E3C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39 | {5209AFDD-9359-4A54-9E03-AA6C5807E3C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
40 | {5209AFDD-9359-4A54-9E03-AA6C5807E3C2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
41 | {5209AFDD-9359-4A54-9E03-AA6C5807E3C2}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
42 | {5209AFDD-9359-4A54-9E03-AA6C5807E3C2}.Debug|x86.ActiveCfg = Debug|Any CPU
43 | {5209AFDD-9359-4A54-9E03-AA6C5807E3C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
44 | {5209AFDD-9359-4A54-9E03-AA6C5807E3C2}.Release|Any CPU.Build.0 = Release|Any CPU
45 | {5209AFDD-9359-4A54-9E03-AA6C5807E3C2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
46 | {5209AFDD-9359-4A54-9E03-AA6C5807E3C2}.Release|Mixed Platforms.Build.0 = Release|Any CPU
47 | {5209AFDD-9359-4A54-9E03-AA6C5807E3C2}.Release|x86.ActiveCfg = Release|Any CPU
48 | {29BA1D0E-A727-4A8E-8E0C-29C48E8BCC8E}.Debug|Any CPU.ActiveCfg = Debug|x86
49 | {29BA1D0E-A727-4A8E-8E0C-29C48E8BCC8E}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
50 | {29BA1D0E-A727-4A8E-8E0C-29C48E8BCC8E}.Debug|Mixed Platforms.Build.0 = Debug|x86
51 | {29BA1D0E-A727-4A8E-8E0C-29C48E8BCC8E}.Debug|x86.ActiveCfg = Debug|x86
52 | {29BA1D0E-A727-4A8E-8E0C-29C48E8BCC8E}.Debug|x86.Build.0 = Debug|x86
53 | {29BA1D0E-A727-4A8E-8E0C-29C48E8BCC8E}.Release|Any CPU.ActiveCfg = Release|x86
54 | {29BA1D0E-A727-4A8E-8E0C-29C48E8BCC8E}.Release|Mixed Platforms.ActiveCfg = Release|x86
55 | {29BA1D0E-A727-4A8E-8E0C-29C48E8BCC8E}.Release|Mixed Platforms.Build.0 = Release|x86
56 | {29BA1D0E-A727-4A8E-8E0C-29C48E8BCC8E}.Release|x86.ActiveCfg = Release|x86
57 | {29BA1D0E-A727-4A8E-8E0C-29C48E8BCC8E}.Release|x86.Build.0 = Release|x86
58 | {DB81988F-E0F2-45A0-A1FD-8C37F3D35244}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
59 | {DB81988F-E0F2-45A0-A1FD-8C37F3D35244}.Debug|Any CPU.Build.0 = Debug|Any CPU
60 | {DB81988F-E0F2-45A0-A1FD-8C37F3D35244}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
61 | {DB81988F-E0F2-45A0-A1FD-8C37F3D35244}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
62 | {DB81988F-E0F2-45A0-A1FD-8C37F3D35244}.Debug|x86.ActiveCfg = Debug|Any CPU
63 | {DB81988F-E0F2-45A0-A1FD-8C37F3D35244}.Release|Any CPU.ActiveCfg = Release|Any CPU
64 | {DB81988F-E0F2-45A0-A1FD-8C37F3D35244}.Release|Any CPU.Build.0 = Release|Any CPU
65 | {DB81988F-E0F2-45A0-A1FD-8C37F3D35244}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
66 | {DB81988F-E0F2-45A0-A1FD-8C37F3D35244}.Release|Mixed Platforms.Build.0 = Release|Any CPU
67 | {DB81988F-E0F2-45A0-A1FD-8C37F3D35244}.Release|x86.ActiveCfg = Release|Any CPU
68 | {72E591D6-8F83-4D8C-8F67-9C325E623234}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
69 | {72E591D6-8F83-4D8C-8F67-9C325E623234}.Debug|Any CPU.Build.0 = Debug|Any CPU
70 | {72E591D6-8F83-4D8C-8F67-9C325E623234}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
71 | {72E591D6-8F83-4D8C-8F67-9C325E623234}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
72 | {72E591D6-8F83-4D8C-8F67-9C325E623234}.Debug|x86.ActiveCfg = Debug|Any CPU
73 | {72E591D6-8F83-4D8C-8F67-9C325E623234}.Release|Any CPU.ActiveCfg = Release|Any CPU
74 | {72E591D6-8F83-4D8C-8F67-9C325E623234}.Release|Any CPU.Build.0 = Release|Any CPU
75 | {72E591D6-8F83-4D8C-8F67-9C325E623234}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
76 | {72E591D6-8F83-4D8C-8F67-9C325E623234}.Release|Mixed Platforms.Build.0 = Release|Any CPU
77 | {72E591D6-8F83-4D8C-8F67-9C325E623234}.Release|x86.ActiveCfg = Release|Any CPU
78 | {193EAABA-1552-4937-BE5E-3C330E3E0544}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
79 | {193EAABA-1552-4937-BE5E-3C330E3E0544}.Debug|Any CPU.Build.0 = Debug|Any CPU
80 | {193EAABA-1552-4937-BE5E-3C330E3E0544}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
81 | {193EAABA-1552-4937-BE5E-3C330E3E0544}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
82 | {193EAABA-1552-4937-BE5E-3C330E3E0544}.Debug|x86.ActiveCfg = Debug|Any CPU
83 | {193EAABA-1552-4937-BE5E-3C330E3E0544}.Release|Any CPU.ActiveCfg = Release|Any CPU
84 | {193EAABA-1552-4937-BE5E-3C330E3E0544}.Release|Any CPU.Build.0 = Release|Any CPU
85 | {193EAABA-1552-4937-BE5E-3C330E3E0544}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
86 | {193EAABA-1552-4937-BE5E-3C330E3E0544}.Release|Mixed Platforms.Build.0 = Release|Any CPU
87 | {193EAABA-1552-4937-BE5E-3C330E3E0544}.Release|x86.ActiveCfg = Release|Any CPU
88 | EndGlobalSection
89 | GlobalSection(SolutionProperties) = preSolution
90 | HideSolutionNode = FALSE
91 | EndGlobalSection
92 | EndGlobal
93 |
--------------------------------------------------------------------------------
/PBDotNet/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/PBDotNet/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using PBDotNet.Util;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Configuration;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Windows;
8 |
9 | namespace PBDotNet
10 | {
11 | ///
12 | /// Interaktionslogik für "App.xaml"
13 | ///
14 | public partial class App : Application
15 | {
16 | protected override void OnStartup(StartupEventArgs e) {
17 | if (e.Args.Length > 0) {
18 | string path = e.Args[0];
19 |
20 | if(System.IO.File.Exists(path)){
21 | if(path.EndsWith(".pbw")){
22 | CmdlineArgs.Workspace = path;
23 | } else if (path.EndsWith(".pbl")) {
24 | CmdlineArgs.Library = path;
25 | }
26 | }
27 | }
28 | base.OnStartup(e);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/PBDotNet/Controls/WpfPropertyGrid.cs:
--------------------------------------------------------------------------------
1 | // *********************************************************************
2 | // PLEASE DO NOT REMOVE THIS DISCLAIMER
3 | //
4 | // WpfPropertyGrid - By Jaime Olivares
5 | // July 11, 2011
6 | // Article site: http://www.codeproject.com/KB/grid/WpfPropertyGrid.aspx
7 | // Author site: www.jaimeolivares.com
8 | // License: Code Project Open License (CPOL)
9 | //
10 | // *********************************************************************
11 |
12 | using System.Activities.Presentation;
13 | using System.Activities.Presentation.Model;
14 | using System.Activities.Presentation.View;
15 | using System.ComponentModel;
16 | using System.Reflection;
17 | using System.Windows.Controls;
18 | using System.Windows.Data;
19 | using System.Windows;
20 | using System;
21 |
22 | namespace PBDotNet.Controls {
23 | public enum PropertySort {
24 | NoSort = 0,
25 | Alphabetical = 1,
26 | Categorized = 2,
27 | CategorizedAlphabetical = 3
28 | };
29 |
30 | /// WPF Native PropertyGrid class, uses Workflow Foundation's PropertyInspector
31 | public class WpfPropertyGrid : Grid {
32 | #region Private fields
33 | private WorkflowDesigner Designer;
34 | private MethodInfo RefreshMethod;
35 | private MethodInfo OnSelectionChangedMethod;
36 | private MethodInfo IsInAlphaViewMethod;
37 | private TextBlock SelectionTypeLabel;
38 | private Control PropertyToolBar;
39 | private Border HelpText;
40 | private GridSplitter Splitter;
41 | private double HelpTextHeight = 60;
42 | #endregion
43 |
44 | #region Public properties
45 | /// Get or sets the selected object. Can be null.
46 | public object SelectedObject {
47 | get { return GetValue(SelectedObjectProperty); }
48 | set { SetValue(SelectedObjectProperty, value); }
49 | }
50 | /// Get or sets the selected object collection. Returns empty array by default.
51 | public object[] SelectedObjects {
52 | get { return GetValue(SelectedObjectsProperty) as object[]; }
53 | set { SetValue(SelectedObjectsProperty, value); }
54 | }
55 | /// XAML information with PropertyGrid's font and color information
56 | /// Documentation for WorkflowDesigner.PropertyInspectorFontAndColorData
57 | public string FontAndColorData {
58 | set {
59 | Designer.PropertyInspectorFontAndColorData = value;
60 | }
61 | }
62 | /// Shows the description area on the top of the control
63 | public bool HelpVisible {
64 | get { return (bool)GetValue(HelpVisibleProperty); }
65 | set { SetValue(HelpVisibleProperty, value); }
66 | }
67 | /// Shows the tolbar on the top of the control
68 | public bool ToolbarVisible {
69 | get { return (bool)GetValue(ToolbarVisibleProperty); }
70 | set { SetValue(ToolbarVisibleProperty, value); }
71 | }
72 | public PropertySort PropertySort {
73 | get { return (PropertySort)GetValue(PropertySortProperty); }
74 | set { SetValue(PropertySortProperty, value); }
75 | }
76 | #endregion
77 |
78 | #region Dependency properties registration
79 | public static readonly DependencyProperty SelectedObjectProperty =
80 | DependencyProperty.Register("SelectedObject", typeof(object), typeof(WpfPropertyGrid),
81 | new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, SelectedObjectPropertyChanged));
82 |
83 | public static readonly DependencyProperty SelectedObjectsProperty =
84 | DependencyProperty.Register("SelectedObjects", typeof(object[]), typeof(WpfPropertyGrid),
85 | new FrameworkPropertyMetadata(new object[0], FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, SelectedObjectsPropertyChanged, CoerceSelectedObjects));
86 |
87 | public static readonly DependencyProperty HelpVisibleProperty =
88 | DependencyProperty.Register("HelpVisible", typeof(bool), typeof(WpfPropertyGrid),
89 | new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, HelpVisiblePropertyChanged));
90 | public static readonly DependencyProperty ToolbarVisibleProperty =
91 | DependencyProperty.Register("ToolbarVisible", typeof(bool), typeof(WpfPropertyGrid),
92 | new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, ToolbarVisiblePropertyChanged));
93 | public static readonly DependencyProperty PropertySortProperty =
94 | DependencyProperty.Register("PropertySort", typeof(PropertySort), typeof(WpfPropertyGrid),
95 | new FrameworkPropertyMetadata(PropertySort.CategorizedAlphabetical, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, PropertySortPropertyChanged));
96 | #endregion
97 |
98 | #region Dependency properties events
99 | private static object CoerceSelectedObject(DependencyObject d, object value) {
100 | WpfPropertyGrid pg = d as WpfPropertyGrid;
101 |
102 | object[] collection = pg.GetValue(SelectedObjectsProperty) as object[];
103 |
104 | return collection.Length == 0 ? null : value;
105 | }
106 | private static object CoerceSelectedObjects(DependencyObject d, object value) {
107 | WpfPropertyGrid pg = d as WpfPropertyGrid;
108 |
109 | object single = pg.GetValue(SelectedObjectsProperty);
110 |
111 | return single == null ? new object[0] : value;
112 | }
113 |
114 | private static void SelectedObjectPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) {
115 | WpfPropertyGrid pg = source as WpfPropertyGrid;
116 | pg.CoerceValue(SelectedObjectsProperty);
117 |
118 | if (e.NewValue == null) {
119 | pg.OnSelectionChangedMethod.Invoke(pg.Designer.PropertyInspectorView, new object[] { null });
120 | pg.SelectionTypeLabel.Text = string.Empty;
121 | } else {
122 | var context = new EditingContext();
123 | var mtm = new ModelTreeManager(context);
124 | mtm.Load(e.NewValue);
125 | Selection selection = Selection.Select(context, mtm.Root);
126 |
127 | pg.OnSelectionChangedMethod.Invoke(pg.Designer.PropertyInspectorView, new object[] { selection });
128 | pg.SelectionTypeLabel.Text = e.NewValue.GetType().Name;
129 | }
130 |
131 | pg.ChangeHelpText(string.Empty, string.Empty);
132 | }
133 | private static void SelectedObjectsPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) {
134 | WpfPropertyGrid pg = source as WpfPropertyGrid;
135 | pg.CoerceValue(SelectedObjectsProperty);
136 |
137 | object[] collection = e.NewValue as object[];
138 |
139 | if (collection.Length == 0) {
140 | pg.OnSelectionChangedMethod.Invoke(pg.Designer.PropertyInspectorView, new object[] { null });
141 | pg.SelectionTypeLabel.Text = string.Empty;
142 | } else {
143 | bool same = true;
144 | Type first = null;
145 |
146 | var context = new EditingContext();
147 | var mtm = new ModelTreeManager(context);
148 | Selection selection = null;
149 |
150 | // Accumulates the selection and determines the type to be shown in the top of the PG
151 | for (int i = 0; i < collection.Length; i++) {
152 | mtm.Load(collection[i]);
153 | if (i == 0) {
154 | selection = Selection.Select(context, mtm.Root);
155 | first = collection[0].GetType();
156 | } else {
157 | selection = Selection.Union(context, mtm.Root);
158 | if (!collection[i].GetType().Equals(first))
159 | same = false;
160 | }
161 | }
162 |
163 | pg.OnSelectionChangedMethod.Invoke(pg.Designer.PropertyInspectorView, new object[] { selection });
164 | pg.SelectionTypeLabel.Text = same ? first.Name + " " : "Object ";
165 | }
166 |
167 | pg.ChangeHelpText(string.Empty, string.Empty);
168 | }
169 | private static void HelpVisiblePropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) {
170 | WpfPropertyGrid pg = source as WpfPropertyGrid;
171 |
172 | if (e.NewValue != e.OldValue) {
173 | if (e.NewValue.Equals(true)) {
174 | pg.RowDefinitions[1].Height = new GridLength(5);
175 | pg.RowDefinitions[2].Height = new GridLength(pg.HelpTextHeight);
176 | } else {
177 | pg.HelpTextHeight = pg.RowDefinitions[2].Height.Value;
178 | pg.RowDefinitions[1].Height = new GridLength(0);
179 | pg.RowDefinitions[2].Height = new GridLength(0);
180 | }
181 | }
182 | }
183 | private static void ToolbarVisiblePropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) {
184 | WpfPropertyGrid pg = source as WpfPropertyGrid;
185 | pg.PropertyToolBar.Visibility = e.NewValue.Equals(true) ? Visibility.Visible : Visibility.Collapsed;
186 | }
187 | private static void PropertySortPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) {
188 | WpfPropertyGrid pg = source as WpfPropertyGrid;
189 | PropertySort sort = (PropertySort)e.NewValue;
190 |
191 | bool isAlpha = (sort == PropertySort.Alphabetical || sort == PropertySort.NoSort);
192 | pg.IsInAlphaViewMethod.Invoke(pg.Designer.PropertyInspectorView, new object[] { isAlpha });
193 | }
194 | #endregion
195 |
196 | /// Default constructor, creates the UIElements including a PropertyInspector
197 | public WpfPropertyGrid() {
198 | this.ColumnDefinitions.Add(new ColumnDefinition());
199 | this.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
200 | this.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(0) });
201 | this.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(0) });
202 |
203 | this.Designer = new WorkflowDesigner();
204 | TextBlock title = new TextBlock() {
205 | Visibility = Visibility.Visible,
206 | TextWrapping = TextWrapping.NoWrap,
207 | TextTrimming = TextTrimming.CharacterEllipsis,
208 | FontWeight = FontWeights.Bold
209 | };
210 | TextBlock descrip = new TextBlock() {
211 | Visibility = Visibility.Visible,
212 | TextWrapping = TextWrapping.Wrap,
213 | TextTrimming = TextTrimming.CharacterEllipsis
214 | };
215 | DockPanel dock = new DockPanel() {
216 | Visibility = Visibility.Visible,
217 | LastChildFill = true,
218 | Margin = new Thickness(3, 0, 3, 0)
219 | };
220 |
221 | title.SetValue(DockPanel.DockProperty, Dock.Top);
222 | dock.Children.Add(title);
223 | dock.Children.Add(descrip);
224 | this.HelpText = new Border() {
225 | Visibility = Visibility.Visible,
226 | BorderBrush = SystemColors.ActiveBorderBrush,
227 | Background = SystemColors.ControlBrush,
228 | BorderThickness = new Thickness(1),
229 | Child = dock
230 | };
231 | this.Splitter = new GridSplitter() {
232 | Visibility = Visibility.Visible,
233 | ResizeDirection = GridResizeDirection.Rows,
234 | Height = 5,
235 | HorizontalAlignment = HorizontalAlignment.Stretch
236 | };
237 |
238 | var inspector = Designer.PropertyInspectorView;
239 | inspector.Visibility = Visibility.Visible;
240 | inspector.SetValue(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Stretch);
241 |
242 | this.Splitter.SetValue(Grid.RowProperty, 1);
243 | this.Splitter.SetValue(Grid.ColumnProperty, 0);
244 |
245 | this.HelpText.SetValue(Grid.RowProperty, 2);
246 | this.HelpText.SetValue(Grid.ColumnProperty, 0);
247 |
248 | Binding binding = new Binding("Parent.Background");
249 | title.SetBinding(BackgroundProperty, binding);
250 | descrip.SetBinding(BackgroundProperty, binding);
251 |
252 | this.Children.Add(inspector);
253 | this.Children.Add(this.Splitter);
254 | this.Children.Add(this.HelpText);
255 |
256 | Type inspectorType = inspector.GetType();
257 | var props = inspectorType.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance |
258 | System.Reflection.BindingFlags.DeclaredOnly);
259 |
260 | var methods = inspectorType.GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance |
261 | System.Reflection.BindingFlags.DeclaredOnly);
262 |
263 | this.RefreshMethod = inspectorType.GetMethod("RefreshPropertyList",
264 | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.DeclaredOnly);
265 | this.IsInAlphaViewMethod = inspectorType.GetMethod("set_IsInAlphaView",
266 | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.DeclaredOnly);
267 | this.OnSelectionChangedMethod = inspectorType.GetMethod("OnSelectionChanged",
268 | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.DeclaredOnly);
269 | this.SelectionTypeLabel = inspectorType.GetMethod("get_SelectionTypeLabel",
270 | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance |
271 | System.Reflection.BindingFlags.DeclaredOnly).Invoke(inspector, new object[0]) as TextBlock;
272 | this.PropertyToolBar = inspectorType.GetMethod("get_PropertyToolBar",
273 | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance |
274 | System.Reflection.BindingFlags.DeclaredOnly).Invoke(inspector, new object[0]) as Control;
275 | inspectorType.GetEvent("GotFocus").AddEventHandler(this,
276 | Delegate.CreateDelegate(typeof(RoutedEventHandler), this, "GotFocusHandler", false));
277 |
278 | this.SelectionTypeLabel.Text = string.Empty;
279 | }
280 | /// Updates the PropertyGrid's properties
281 | public void RefreshPropertyList() {
282 | RefreshMethod.Invoke(Designer.PropertyInspectorView, new object[] { false });
283 | }
284 |
285 | /// Traps the change of focused property and updates the help text
286 | /// Not used
287 | /// Points to the source control containing the selected property
288 | private void GotFocusHandler(object sender, RoutedEventArgs args) {
289 | //if (args.OriginalSource is TextBlock)
290 | //{
291 | string title = string.Empty;
292 | string descrip = string.Empty;
293 | var theSelectedObjects = this.GetValue(SelectedObjectsProperty) as object[];
294 |
295 | if (theSelectedObjects != null && theSelectedObjects.Length > 0) {
296 | Type first = theSelectedObjects[0].GetType();
297 | for (int i = 1; i < theSelectedObjects.Length; i++) {
298 | if (!theSelectedObjects[i].GetType().Equals(first)) {
299 | ChangeHelpText(title, descrip);
300 | return;
301 | }
302 | }
303 |
304 | object data = (args.OriginalSource as FrameworkElement).DataContext;
305 | PropertyInfo propEntry = data.GetType().GetProperty("PropertyEntry");
306 | if (propEntry == null) {
307 | propEntry = data.GetType().GetProperty("ParentProperty");
308 | }
309 |
310 | if (propEntry != null) {
311 | object propEntryValue = propEntry.GetValue(data, null);
312 | string propName = propEntryValue.GetType().GetProperty("PropertyName").GetValue(propEntryValue, null) as string;
313 | title = propEntryValue.GetType().GetProperty("DisplayName").GetValue(propEntryValue, null) as string;
314 | PropertyInfo property = theSelectedObjects[0].GetType().GetProperty(propName);
315 | object[] attrs = property.GetCustomAttributes(typeof(DescriptionAttribute), true);
316 |
317 | if (attrs != null && attrs.Length > 0)
318 | descrip = (attrs[0] as DescriptionAttribute).Description;
319 | }
320 | ChangeHelpText(title, descrip);
321 | }
322 | //}
323 | }
324 | /// Changes the text help area contents
325 | /// Title in bold
326 | /// Description with ellipsis
327 | private void ChangeHelpText(string title, string descrip) {
328 | DockPanel dock = this.HelpText.Child as DockPanel;
329 | (dock.Children[0] as TextBlock).Text = title;
330 | (dock.Children[1] as TextBlock).Text = descrip;
331 | }
332 | }
333 | }
334 |
--------------------------------------------------------------------------------
/PBDotNet/Images/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 89
5 | file://homeserver/Projekte/cases/C%23/PBDotNet/PBDotNet/PBDotNet/Images
6 | file://homeserver/Projekte/cases
7 |
8 |
9 |
10 | 2011-02-24T08:50:22.394531Z
11 | 50
12 | kemner
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | 67c2c364-8c93-3f49-a2e4-a4a597aa1360
28 |
29 | Library.png
30 | file
31 |
32 |
33 |
34 |
35 | 2011-02-24T21:03:45.072390Z
36 | 6214ab1d0c27f31834d9a5840f3e1404
37 | 2011-02-24T08:50:22.394531Z
38 | 50
39 | kemner
40 | has-props
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 2227
62 |
63 | Target.png
64 | file
65 |
66 |
67 |
68 |
69 | 2011-02-24T21:03:45.090391Z
70 | 966b85e036119bc5a735152d4fa9ac6e
71 | 2011-02-24T08:50:22.394531Z
72 | 50
73 | kemner
74 | has-props
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 1413
96 |
97 |
--------------------------------------------------------------------------------
/PBDotNet/Images/.svn/prop-base/Library.png.svn-base:
--------------------------------------------------------------------------------
1 | K 13
2 | svn:mime-type
3 | V 24
4 | application/octet-stream
5 | END
6 |
--------------------------------------------------------------------------------
/PBDotNet/Images/.svn/prop-base/Target.png.svn-base:
--------------------------------------------------------------------------------
1 | K 13
2 | svn:mime-type
3 | V 24
4 | application/octet-stream
5 | END
6 |
--------------------------------------------------------------------------------
/PBDotNet/Images/.svn/text-base/Library.png.svn-base:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devbar/PB-DotNet/d3d58a444ee8fa8096017caf95358364282b74f3/PBDotNet/Images/.svn/text-base/Library.png.svn-base
--------------------------------------------------------------------------------
/PBDotNet/Images/.svn/text-base/Target.png.svn-base:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devbar/PB-DotNet/d3d58a444ee8fa8096017caf95358364282b74f3/PBDotNet/Images/.svn/text-base/Target.png.svn-base
--------------------------------------------------------------------------------
/PBDotNet/Images/16/Userobject.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devbar/PB-DotNet/d3d58a444ee8fa8096017caf95358364282b74f3/PBDotNet/Images/16/Userobject.png
--------------------------------------------------------------------------------
/PBDotNet/Images/Library.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devbar/PB-DotNet/d3d58a444ee8fa8096017caf95358364282b74f3/PBDotNet/Images/Library.png
--------------------------------------------------------------------------------
/PBDotNet/Images/Target.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/devbar/PB-DotNet/d3d58a444ee8fa8096017caf95358364282b74f3/PBDotNet/Images/Target.png
--------------------------------------------------------------------------------
/PBDotNet/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
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 |
100 |
101 |
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 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
224 |
225 |
226 |
227 |
228 |
234 |
235 |
236 |
242 |
243 |
244 |
250 |
251 |
252 |
258 |
259 |
260 |
261 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
296 |
297 |
298 |
299 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
--------------------------------------------------------------------------------
/PBDotNet/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 | using Microsoft.Win32;
15 |
16 | using PBDotNetLib.pbuilder;
17 | using PBDotNetLib.orca;
18 | using Powerscript=PBDotNetLib.pbuilder.powerscript;
19 | using System.Configuration;
20 | using PBDotNet.Util;
21 | using System.IO;
22 | using System.Xml;
23 | using ICSharpCode.AvalonEdit.Highlighting.Xshd;
24 | using ICSharpCode.AvalonEdit.Highlighting;
25 | using System.ComponentModel;
26 | using Xceed.Wpf.Toolkit.PropertyGrid;
27 |
28 | namespace PBDotNet
29 | {
30 | ///
31 | /// Interaktionslogik für MainWindow.xaml
32 | ///
33 | public partial class MainWindow : Window
34 | {
35 | private Workspace workspace;
36 | private Orca.Version pbVersion;
37 | private IHighlightingDefinition highlightingDefinition = null;
38 |
39 | public MainWindow()
40 | {
41 | InitializeComponent();
42 | string pbVersion = ConfigurationManager.AppSettings["PBVersion"];
43 | if (String.IsNullOrEmpty(pbVersion)) {
44 | this.pbVersion = Orca.Version.PB126;
45 | } else {
46 | switch (pbVersion) {
47 | case "115":
48 | this.pbVersion = Orca.Version.PB115;
49 | break;
50 | case "125":
51 | this.pbVersion = Orca.Version.PB125;
52 | break;
53 | case "126":
54 | this.pbVersion = Orca.Version.PB126;
55 | break;
56 | }
57 | }
58 |
59 | if (CmdlineArgs.Workspace != null) {
60 | this.openWorkspace(CmdlineArgs.Workspace);
61 | } else if (CmdlineArgs.Library != null) {
62 | this.openLibrary(CmdlineArgs.Library);
63 | }
64 |
65 | using (Stream s = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("PBDotNet.PBSyntax.xshd")) {
66 | using (XmlTextReader reader = new XmlTextReader(s)) {
67 | highlightingDefinition = HighlightingLoader.Load(reader, HighlightingManager.Instance);
68 | }
69 | }
70 |
71 | txtSource.SyntaxHighlighting = this.highlightingDefinition;
72 | txtUoSource.SyntaxHighlighting = this.highlightingDefinition;
73 | txtUoIVariables.SyntaxHighlighting = this.highlightingDefinition;
74 | txtUoSVariables.SyntaxHighlighting = this.highlightingDefinition;
75 | txtUoGVariables.SyntaxHighlighting = this.highlightingDefinition;
76 | txtUoExtFunctions.SyntaxHighlighting = this.highlightingDefinition;
77 | }
78 |
79 | private void menuOpenWorkspace_Click(object sender, RoutedEventArgs e){
80 | OpenFileDialog dialog = new OpenFileDialog();
81 |
82 | dialog.Filter = "Powerbuilder Workspace (*.pbw)|*.pbw";
83 |
84 | if (!dialog.ShowDialog().Value)
85 | return;
86 |
87 | this.openWorkspace(dialog.FileName);
88 | }
89 |
90 |
91 | private void menuOpenLibrary_Click(object sender, RoutedEventArgs e) {
92 | OpenFileDialog dialog = new OpenFileDialog();
93 |
94 | dialog.Filter = "Powerbuilder Library (*.pbl)|*.pbl";
95 |
96 | if (!dialog.ShowDialog().Value)
97 | return;
98 |
99 | this.openLibrary(dialog.FileName);
100 | }
101 |
102 | private void openLibrary(string libraryPath) {
103 | ILibrary lib = null;
104 | if (libraryPath.EndsWith(".pbl"))
105 | lib = new Library(libraryPath, this.pbVersion);
106 | else
107 | lib = new VirtualLibrary(libraryPath);
108 |
109 | listPowerObjects.ItemsSource = lib.EntryList;
110 |
111 | listWorkspace.DataContext = null;
112 | listWorkspace.Visibility = System.Windows.Visibility.Collapsed;
113 | // TODO: Workspace ist jetzt ein Dock
114 | //gridWorkspace.Width = new GridLength(0);
115 | }
116 |
117 | private void openWorkspace(string workspacePath) {
118 | workspace = new Workspace(workspacePath, this.pbVersion);
119 |
120 | stWorkspace.Text = workspacePath;
121 | stVersion.Text = workspace.MajorVersion + "." + workspace.MinorVersion;
122 |
123 | listWorkspace.DataContext = workspace.Targets;
124 | listWorkspace.Visibility = System.Windows.Visibility.Visible;
125 | // TODO: Workspace ist jetzt ein Dock
126 | //gridWorkspace.Width = new GridLength(300);
127 | }
128 |
129 | private void listWorkspace_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs