Browse Source

Fixed ComponentInspector sample.

pull/297/head
Andreas Weizel 12 years ago
parent
commit
e20c3e3898
  1. 7
      samples/ComponentInspector/ComponentInspector.AddIn/ComponentInspector.AddIn.csproj
  2. 2
      samples/ComponentInspector/ComponentInspector.AddIn/ComponentInspector.addin
  3. 1
      samples/ComponentInspector/ComponentInspector.AddIn/Src/ComponentInspectorView.cs
  4. 5
      samples/ComponentInspector/ComponentInspector.AddIn/Src/ShowComponentInspectorCommand.cs
  5. 6
      samples/ComponentInspector/ComponentInspector.Core/ComponentInspector.Core.csproj
  6. 3
      samples/ComponentInspector/ComponentInspector.Core/Src/Controls/ErrorDialog.cs
  7. 14
      samples/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/ComponentInspectorProperties.cs
  8. 4
      samples/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/PreviouslyOpenedAssemblyCollection.cs
  9. 4
      samples/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/PreviouslyOpenedTypeLibraryCollection.cs
  10. 4
      samples/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/SavedCastInfoCollection.cs
  11. 14
      samples/ComponentInspector/ComponentInspector.sln
  12. 19
      samples/ComponentInspector/ComponentInspector/ComponentInspector.csproj
  13. 19
      samples/ComponentInspector/ComponentInspector/Src/ComponentInspectorApplication.cs
  14. 75
      samples/ComponentInspector/ComponentInspector/Src/PropertyService.cs
  15. 7
      samples/ComponentInspector/ComponentInspector/app.config
  16. 4
      src/Automated.proj

7
samples/ComponentInspector/ComponentInspector.AddIn/ComponentInspector.AddIn.csproj

@ -15,8 +15,9 @@ @@ -15,8 +15,9 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
@ -45,7 +46,7 @@ @@ -45,7 +46,7 @@
</Reference>
<Reference Include="ICSharpCode.SharpDevelop">
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.dll</HintPath>
<Private>False</Private>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Xml" />

2
samples/ComponentInspector/ComponentInspector.AddIn/ComponentInspector.addin

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
<Import assembly="ComponentInspector.AddIn.dll"/>
</Runtime>
<Path name="/Workspace/Tools">
<Path name="/SharpDevelop/Workbench/Tools">
<MenuItem id="ShowComponentInspector"
insertafter="ShowAddInScout"
label="${res:ComponentInspector.ToolsMenu.ShowComponentInspectorMenuItem}"

1
samples/ComponentInspector/ComponentInspector.AddIn/Src/ComponentInspectorView.cs

@ -9,6 +9,7 @@ using System; @@ -9,6 +9,7 @@ using System;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Workbench;
using NoGoop.ObjBrowser;
namespace ICSharpCode.ComponentInspector.AddIn

5
samples/ComponentInspector/ComponentInspector.AddIn/Src/ShowComponentInspectorCommand.cs

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
using System;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.ComponentInspector.AddIn
@ -16,7 +17,7 @@ namespace ICSharpCode.ComponentInspector.AddIn @@ -16,7 +17,7 @@ namespace ICSharpCode.ComponentInspector.AddIn
public override void Run()
{
// Switch to previously opened view.
foreach (IViewContent viewContent in WorkbenchSingleton.Workbench.ViewContentCollection) {
foreach (IViewContent viewContent in SD.Workbench.ViewContentCollection) {
ComponentInspectorView openView = viewContent as ComponentInspectorView;
if (openView != null) {
openView.WorkbenchWindow.SelectWindow();
@ -26,7 +27,7 @@ namespace ICSharpCode.ComponentInspector.AddIn @@ -26,7 +27,7 @@ namespace ICSharpCode.ComponentInspector.AddIn
// Create new view.
ComponentInspectorView view = new ComponentInspectorView();
WorkbenchSingleton.Workbench.ShowView(view);
SD.Workbench.ShowView(view);
}
}
}

6
samples/ComponentInspector/ComponentInspector.Core/ComponentInspector.Core.csproj

@ -17,7 +17,8 @@ @@ -17,7 +17,8 @@
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<NoWarn>0618,0626,0108</NoWarn>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
@ -46,6 +47,9 @@ @@ -46,6 +47,9 @@
<Reference Include="ICSharpCode.Core.WinForms">
<HintPath>..\..\..\bin\ICSharpCode.Core.WinForms.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpDevelop">
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />

3
samples/ComponentInspector/ComponentInspector.Core/Src/Controls/ErrorDialog.cs

@ -15,6 +15,7 @@ using System.Windows.Forms; @@ -15,6 +15,7 @@ using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.Core.WinForms;
using ICSharpCode.SharpDevelop;
using NoGoop.Util;
namespace NoGoop.Controls
@ -290,7 +291,7 @@ namespace NoGoop.Controls @@ -290,7 +291,7 @@ namespace NoGoop.Controls
void CopyInfoToClipboard()
{
ClipboardWrapper.SetText(GetClipboardString());
SD.Clipboard.SetText(GetClipboardString());
}
string GetClipboardString()

14
samples/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/ComponentInspectorProperties.cs

@ -10,6 +10,7 @@ using System.IO; @@ -10,6 +10,7 @@ using System.IO;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
namespace NoGoop.ObjBrowser
{
@ -22,14 +23,19 @@ namespace NoGoop.ObjBrowser @@ -22,14 +23,19 @@ namespace NoGoop.ObjBrowser
}
static ComponentInspectorProperties()
{
properties = PropertyService.Get("ComponentInspector.Properties", new Properties());
{
properties = SD.PropertyService.NestedProperties("ComponentInspector.Properties");
}
static Properties Properties {
public static void Update()
{
SD.PropertyService.SetNestedProperties("ComponentInspector.Properties", Properties);
}
static Properties Properties {
get {
return properties;
}
}
}
public static bool ShowGettingStartedDialog {

4
samples/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/PreviouslyOpenedAssemblyCollection.cs

@ -60,10 +60,10 @@ namespace NoGoop.ObjBrowser @@ -60,10 +60,10 @@ namespace NoGoop.ObjBrowser
/// </summary>
string[] PreviouslyOpenedAssemblies {
get {
return properties.Get("PreviouslyOpenedAssemblies", new string[0]);
return (string[]) properties.GetList<string>("PreviouslyOpenedAssemblies");
}
set {
properties.Set("PreviouslyOpenedAssemblies", value);
properties.SetList("PreviouslyOpenedAssemblies", value);
}
}

4
samples/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/PreviouslyOpenedTypeLibraryCollection.cs

@ -55,10 +55,10 @@ namespace NoGoop.ObjBrowser @@ -55,10 +55,10 @@ namespace NoGoop.ObjBrowser
/// </summary>
string[] PreviouslyOpenedTypeLibraries {
get {
return properties.Get("PreviouslyOpenedTypeLibraries", new string[0]);
return (string[]) properties.GetList<string>("PreviouslyOpenedTypeLibraries");
}
set {
properties.Set("PreviouslyOpenedTypeLibraries", value);
properties.SetList("PreviouslyOpenedTypeLibraries", value);
}
}

4
samples/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/SavedCastInfoCollection.cs

@ -56,10 +56,10 @@ namespace NoGoop.ObjBrowser @@ -56,10 +56,10 @@ namespace NoGoop.ObjBrowser
/// </summary>
string[] SavedCasts {
get {
return properties.Get("SavedCasts", new string[0]);
return (string[]) properties.GetList<string>("SavedCasts");
}
set {
properties.Set("SavedCasts", value);
properties.SetList("SavedCasts", value);
}
}

14
samples/ComponentInspector/ComponentInspector.sln

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 4.0.0.6209
# SharpDevelop 5.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComponentInspector", "ComponentInspector\ComponentInspector.csproj", "{000E4F64-5D0D-4EB1-B0BF-1A62ADBC6EAD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComponentInspector.AddIn", "ComponentInspector.AddIn\ComponentInspector.AddIn.csproj", "{869951D5-A0D6-4DC6-9F1D-E6B9A12AC446}"
@ -14,17 +14,17 @@ Global @@ -14,17 +14,17 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{000E4F64-5D0D-4EB1-B0BF-1A62ADBC6EAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{000E4F64-5D0D-4EB1-B0BF-1A62ADBC6EAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{000E4F64-5D0D-4EB1-B0BF-1A62ADBC6EAD}.Release|Any CPU.Build.0 = Release|Any CPU
{000E4F64-5D0D-4EB1-B0BF-1A62ADBC6EAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{000E4F64-5D0D-4EB1-B0BF-1A62ADBC6EAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{869951D5-A0D6-4DC6-9F1D-E6B9A12AC446}.Debug|Any CPU.Build.0 = Debug|Any CPU
{000E4F64-5D0D-4EB1-B0BF-1A62ADBC6EAD}.Release|Any CPU.Build.0 = Release|Any CPU
{869951D5-A0D6-4DC6-9F1D-E6B9A12AC446}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{869951D5-A0D6-4DC6-9F1D-E6B9A12AC446}.Release|Any CPU.Build.0 = Release|Any CPU
{869951D5-A0D6-4DC6-9F1D-E6B9A12AC446}.Debug|Any CPU.Build.0 = Debug|Any CPU
{869951D5-A0D6-4DC6-9F1D-E6B9A12AC446}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6F4983F-DE41-4AEC-88E7-1FA9AFB4E6FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{869951D5-A0D6-4DC6-9F1D-E6B9A12AC446}.Release|Any CPU.Build.0 = Release|Any CPU
{E6F4983F-DE41-4AEC-88E7-1FA9AFB4E6FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E6F4983F-DE41-4AEC-88E7-1FA9AFB4E6FF}.Release|Any CPU.Build.0 = Release|Any CPU
{E6F4983F-DE41-4AEC-88E7-1FA9AFB4E6FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6F4983F-DE41-4AEC-88E7-1FA9AFB4E6FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6F4983F-DE41-4AEC-88E7-1FA9AFB4E6FF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

19
samples/ComponentInspector/ComponentInspector/ComponentInspector.csproj

@ -15,10 +15,13 @@ @@ -15,10 +15,13 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<NoWarn>0618</NoWarn>
<ApplicationIcon>..\ComponentInspector.Core\BitmapResources\CompInsp.ico</ApplicationIcon>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile />
<NoWin32Manifest>False</NoWin32Manifest>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\ComponentInspector\</OutputPath>
@ -27,6 +30,7 @@ @@ -27,6 +30,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\ComponentInspector\</OutputPath>
@ -36,18 +40,29 @@ @@ -36,18 +40,29 @@
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<Prefer32Bit>True</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.Core">
<HintPath>..\..\..\bin\ICSharpCode.Core.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpDevelop">
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\ComponentInspectorApplication.cs" />
<Compile Include="Src\PropertyService.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="app.config" />

19
samples/ComponentInspector/ComponentInspector/Src/ComponentInspectorApplication.cs

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
// </file>
using System;
using System.ComponentModel.Design;
using System.Configuration;
using System.IO;
using System.Resources;
@ -14,6 +15,7 @@ using System.Security.Policy; @@ -14,6 +15,7 @@ using System.Security.Policy;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using NoGoop.Controls;
using NoGoop.ObjBrowser.Dialogs;
using NoGoop.Util;
@ -139,18 +141,21 @@ namespace NoGoop.ObjBrowser @@ -139,18 +141,21 @@ namespace NoGoop.ObjBrowser
void InitializeServices()
{
PropertyService.InitializeService(GetConfigurationDirectory(), String.Empty, "ComponentInspector");
PropertyService.Load();
ResourceService.InitializeService(GetResourceDirectory());
ResourceService.RegisterNeutralStrings(new ResourceManager("ComponentInspector.Resources.StringResources", typeof(ComponentInspectorApplication).Assembly));
SD.InitializeForUnitTests();
var container = ServiceSingleton.GetRequiredService<IServiceContainer>();
// Replace IPropertyService initialized by InitializeForUnitServices() with our own PropertyService
container.RemoveService(typeof(IPropertyService));
container.AddService(typeof(IPropertyService), new PropertyService());
container.AddService(typeof(ICSharpCode.Core.IResourceService), new ResourceServiceImpl(
GetResourceDirectory(), SD.PropertyService));
}
string GetResourceDirectory()
{
string resourceDirectory = ConfigurationSettings.AppSettings.Get("ResourceDirectory");
if (resourceDirectory != null) {
return Path.Combine(Application.StartupPath, resourceDirectory);
var path = new DirectoryName(Path.Combine(Application.StartupPath, resourceDirectory));
return path;
}
return Path.Combine(Application.StartupPath, "resources");
}
@ -170,7 +175,7 @@ namespace NoGoop.ObjBrowser @@ -170,7 +175,7 @@ namespace NoGoop.ObjBrowser
if (!Directory.Exists(configDirectory)) {
Directory.CreateDirectory(configDirectory);
}
PropertyService.Save();
SD.PropertyService.Save();
}
}
}

75
samples/ComponentInspector/ComponentInspector/Src/PropertyService.cs

@ -0,0 +1,75 @@ @@ -0,0 +1,75 @@
/*
* Created by SharpDevelop.
* User: WheizWork
* Date: 16.01.2014
* Time: 00:35
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.IO;
using System.Threading;
using System.Xml;
using ICSharpCode.Core;
using NoGoop.Controls;
namespace NoGoop.ObjBrowser
{
/// <summary>
/// Description of PropertyService.
/// </summary>
public class PropertyService : PropertyServiceImpl
{
const string PropertiesName = "ComponentInspectorProperties";
DirectoryName dataDirectory;
DirectoryName configDirectory;
FileName propertiesFileName;
public PropertyService()
: base(LoadPropertiesFromStream(GetConfigDirectory().CombineFile(PropertiesName + ".xml")))
{
this.configDirectory = GetConfigDirectory();
this.dataDirectory = new DirectoryName(Environment.CurrentDirectory);
propertiesFileName = configDirectory.CombineFile(PropertiesName + ".xml");
}
private static DirectoryName GetConfigDirectory()
{
return new DirectoryName(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"ICSharpCode"));
}
public override DirectoryName ConfigDirectory {
get {
return configDirectory;
}
}
public override DirectoryName DataDirectory {
get {
return dataDirectory;
}
}
static Properties LoadPropertiesFromStream(FileName fileName)
{
if (!File.Exists(fileName)) {
return new Properties();
}
try {
return Properties.Load(fileName);
} catch (XmlException ex) {
ErrorDialog.Show("Error loading properties: " + ex.Message + "\nSettings have been restored to default values.");
} catch (IOException ex) {
ErrorDialog.Show("Error loading properties: " + ex.Message + "\nSettings have been restored to default values.");
}
return new Properties();
}
public override void Save()
{
ComponentInspectorProperties.Update();
this.MainPropertiesContainer.Save(propertiesFileName);
}
}
}

7
samples/ComponentInspector/ComponentInspector/app.config

@ -1,8 +1,11 @@ @@ -1,8 +1,11 @@
<configuration>
<?xml version="1.0" encoding="utf-8"?><configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<!-- The directory containing the resources relative to the
ComponentInspector executable -->
<add key="ResourceDirectory" value="..\..\..\data\resources" />
<add key="ResourceDirectory" value="..\..\..\..\..\data\resources" />
</appSettings>
<system.diagnostics>

4
src/Automated.proj

@ -91,10 +91,10 @@ @@ -91,10 +91,10 @@
<MSBuild Projects="$(SamplesSrc)\CodonCreation\CodonCreation.sln"
Targets="build;clean"
Properties="Configuration=Release;BranchName=$(BranchName)"/>
<!-- <MSBuild Projects="$(SamplesSrc)\ComponentInspector\ComponentInspector.sln"
<MSBuild Projects="$(SamplesSrc)\ComponentInspector\ComponentInspector.sln"
Targets="build;clean"
Properties="Configuration=Release;BranchName=$(BranchName)"/>
<MSBuild Projects="$(SamplesSrc)\CppBackendBinding\CppBackendBinding.sln"
<!-- <MSBuild Projects="$(SamplesSrc)\CppBackendBinding\CppBackendBinding.sln"
Targets="build;clean"
Properties="Configuration=Release;BranchName=$(BranchName)"/>-->
<MSBuild Projects="$(SamplesSrc)\CustomPad\CustomPad.sln"

Loading…
Cancel
Save