Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

minor changes

  • Loading branch information...
commit 10599484123665f24d6132bec7a3a292f0303842 1 parent 9c2837b
@DinisCruz DinisCruz authored
Showing with 671 additions and 823 deletions.
  1. +2 −1  .gitignore
  2. +3 −12 O2.Platform.exe/O2_Platform.csproj
  3. +2 −2 O2.Platform.exe/Program.cs
  4. +3 −2 O2.Platform.exe_3.5_x64/O2_Platform_3.5_x64.csproj
  5. +14 −14 O2_External_SharpDevelop/O2_External_SharpDevelop.csproj
  6. BIN  O2_External_SharpDevelop/TmpKey.snk
  7. +419 −419 O2_External_SharpDevelop/_O2SharpDevelop/CodeCompletion/O2CodeCompletion.cs
  8. +25 −14 ...nal_SharpDevelop/_O2SharpDevelop/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/DomPersistence.cs
  9. +2 −2 O2_External_SharpDevelop/_O2SharpDevelop/ICSharpCode.TextEditor/Project/Src/Document/AbstractSegment.cs
  10. +1 −1  ...xternal_SharpDevelop/_O2SharpDevelop/ICSharpCode.TextEditor/Project/Src/Document/LineManager/LineManager.cs
  11. +1 −1  ...harpDevelop/_O2SharpDevelop/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/CodeCompletionWindow.cs
  12. +1 −1  O2_External_SharpDevelop/_O2SharpDevelop/ICSharpCode.TextEditor/Project/Src/Gui/TextEditorControl.cs
  13. +1 −7 O2_External_WinFormsUI/{DI.cs → DI.cs.txt}
  14. +46 −36 O2_External_WinFormsUI/Forms/O2AscxGUI.cs
  15. +10 −10 O2_External_WinFormsUI/Forms/O2GuiWithDockPanel.Controllers.cs
  16. +24 −24 O2_External_WinFormsUI/Forms/O2GuiWithDockPanel.cs
  17. +8 −7 O2_External_WinFormsUI/O2Environment/O2DockContent.cs
  18. +32 −32 O2_External_WinFormsUI/O2Environment/O2DockPanel.cs
  19. +32 −31 O2_External_WinFormsUI/O2Environment/O2DockUtils.cs
  20. +9 −7 O2_External_WinFormsUI/O2Environment/O2MessagesHandler.cs
  21. +2 −6 O2_External_WinFormsUI/O2_External_WinFormsUI.csproj
  22. BIN  O2_External_WinFormsUI/_External_Dlls/WeifenLuo.WinFormsUI.Docking.dll
  23. BIN  O2_External_WinFormsUI/_External_Dlls/_WeifenLuo.WinFormsUI.Docking.dll.previousVersion
  24. BIN  O2_External_WinFormsUI/_External_Dlls/nunit.framework.dll
  25. +17 −17 VisualStudio Solution Files/{O2.VisualStudio.AddIn.sln → O2.FluentSharp.VisualStudio_2010.sln}
  26. +0 −26 VisualStudio Solution Files/O2.Platform.3.5.sln.txt
  27. +0 −82 VisualStudio Solution Files/O2.Platform.4.0 - (for MonoDevelop).sln
  28. +17 −37 VisualStudio Solution Files/{O2.Platform.4.0 - All Projects.sln → O2.Platform.4.0 - Main Projects.sln}
  29. +0 −32 VisualStudio Solution Files/O2.Platform.4.0.sln
View
3  .gitignore
@@ -10,4 +10,5 @@ UpgradeLog.xml
*.userprefs
binaries
/Misc_Microsoft_MPL_Libs/packages
-*.nupkg
+*.nupkg
+/VisualStudio Solution Files/packages
View
15 O2.Platform.exe/O2_Platform.csproj
@@ -76,21 +76,12 @@
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
- <EmbeddedResource Include="..\..\O2.FluentSharp\binaries\O2_FluentSharp_BCL.dll">
- <Link>_Dlls_Embeded\O2_FluentSharp_BCL.dll</Link>
- </EmbeddedResource>
- <EmbeddedResource Include="..\..\O2.FluentSharp\binaries\O2_FluentSharp_CoreLib.dll">
- <Link>_Dlls_Embeded\O2_FluentSharp_CoreLib.dll</Link>
- </EmbeddedResource>
- <EmbeddedResource Include="..\..\O2.FluentSharp\binaries\O2_FluentSharp_NGit.dll">
- <Link>_Dlls_Embeded\O2_FluentSharp_NGit.dll</Link>
- </EmbeddedResource>
- <EmbeddedResource Include="..\..\O2.FluentSharp\binaries\O2_FluentSharp_REPL.dll">
- <Link>_Dlls_Embeded\O2_FluentSharp_REPL.dll</Link>
- </EmbeddedResource>
<EmbeddedResource Include="..\..\O2.FluentSharp\binaries\O2_FluentSharp_Roslyn.dll">
<Link>_Dlls_Embeded\O2_FluentSharp_Roslyn.dll</Link>
</EmbeddedResource>
+ <EmbeddedResource Include="..\..\O2.FluentSharp\binaries\O2_FluentSharp_REPL.exe">
+ <Link>_Dlls_Embeded\O2_FluentSharp_REPL.exe</Link>
+ </EmbeddedResource>
<Content Include="O2_Setup.cs.txt" />
<Content Include="O2_Setup.cs %28with no dependency on O2 Dlls%29.txt" />
<Compile Include="Program.cs" />
View
4 O2.Platform.exe/Program.cs
@@ -20,7 +20,7 @@ static void Main(string[] args)
//launch_O2Gui_Via_Emebeded_Assembly(args);
}
-/* public static void launch_O2Gui_Via_Emebeded_Assembly(string[] args)
+ /*public static void launch_O2Gui_Via_Emebeded_Assembly(string[] args)
{
var resourceName = "O2.Platform._Dlls_Embeded.O2_FluentSharp_CoreLib.dll";
var assemblyStream = Assembly.GetEntryAssembly().GetManifestResourceStream(resourceName);
@@ -29,7 +29,7 @@ static void Main(string[] args)
var type = assembly.GetType("O2.Kernel.launch");
var method = type.GetMethod("o2Gui");
method.Invoke(null, new object[] { args });
- } */
+ } */
}
View
5 O2.Platform.exe_3.5_x64/O2_Platform_3.5_x64.csproj
@@ -22,6 +22,8 @@
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@@ -36,8 +38,6 @@
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
@@ -49,6 +49,7 @@
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
<PlatformTarget>x64</PlatformTarget>
+ <NoStdLib>false</NoStdLib>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
View
28 O2_External_SharpDevelop/O2_External_SharpDevelop.csproj
@@ -24,7 +24,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>..\binaries\</OutputPath>
+ <OutputPath>bin\debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -39,11 +39,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
- <SignAssembly>false</SignAssembly>
+ <SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyFile>TmpKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Cecil">
@@ -441,16 +440,6 @@
<Compile Include="_O2SharpDevelop\TextEditor_ExtensionMethods.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\..\O2.FluentSharp\O2.FluentSharp.BCL\O2.FluentSharp.BCL.csproj">
- <Project>{DF7E73CB-02AC-4689-BB8C-AC21FFCCDDC5}</Project>
- <Name>O2.FluentSharp.BCL</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\O2.FluentSharp\O2.FluentSharp.CoreLib\O2.FluentSharp.CoreLib.csproj">
- <Project>{0A7CE0E0-B092-43B5-AB80-99BA909019C9}</Project>
- <Name>O2.FluentSharp.CoreLib</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -490,6 +479,7 @@
<EmbeddedResource Include="_O2SharpDevelop\ICSharpCode.TextEditor\Project\Resources\Tex-Mode.xshd" />
<EmbeddedResource Include="_O2SharpDevelop\ICSharpCode.TextEditor\Project\Resources\VBNET-Mode.xshd" />
<EmbeddedResource Include="_O2SharpDevelop\ICSharpCode.TextEditor\Project\Resources\XML-Mode.xshd" />
+ <None Include="TmpKey.snk" />
<None Include="_O2SharpDevelop\NRefactory\Project\Src\Lexer\BuildKeywords.pl" />
<None Include="_O2SharpDevelop\NRefactory\Project\Src\Parser\CSharp\cs.ATG" />
<None Include="_O2SharpDevelop\NRefactory\Project\Src\Parser\Frames\Parser.frame" />
@@ -529,6 +519,16 @@
<ItemGroup>
<Folder Include="Controls\" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\O2.FluentSharp\O2.FluentSharp.BCL\O2.FluentSharp.BCL.csproj">
+ <Project>{DF7E73CB-02AC-4689-BB8C-AC21FFCCDDC5}</Project>
+ <Name>O2.FluentSharp.BCL</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\O2.FluentSharp\O2.FluentSharp.CoreLib\O2.FluentSharp.CoreLib.csproj">
+ <Project>{0A7CE0E0-B092-43B5-AB80-99BA909019C9}</Project>
+ <Name>O2.FluentSharp.CoreLib</Name>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
View
BIN  O2_External_SharpDevelop/TmpKey.snk
Binary file not shown
View
838 O2_External_SharpDevelop/_O2SharpDevelop/CodeCompletion/O2CodeCompletion.cs
@@ -33,33 +33,33 @@ public class O2CodeCompletion : ICompletionDataProvider
public TextEditorControl textEditor;
//public TextEditorControl textEditorToGrabCodeFrom; // (Was not really working) to support behind the scenes AST building
public List<string> extraSourceCodeToProcess;
- public LanguageProperties CurrentLanguageProperties = LanguageProperties.CSharp;
- public ProjectContentRegistry pcRegistry;
+ public LanguageProperties CurrentLanguageProperties = LanguageProperties.CSharp;
+ public ProjectContentRegistry pcRegistry;
public DefaultProjectContent myProjectContent;
- public ParseInformation parseInformation = new ParseInformation();
+ public ParseInformation parseInformation = new ParseInformation();
public Dictionary<string, ICompilationUnit> mappedCompilationUnits { get; set; } // so that we support dynamic CodeCompletion from multiple files
- //public ICompilationUnit lastCompilationUnit;
- public string DummyFileName = "edited.cs";
+ //public ICompilationUnit lastCompilationUnit;
+ public string DummyFileName = "edited.cs";
public int startOffset = 0;
- public ImageList SmallIcons;
- public Form HostForm { get; set; }
+ public ImageList SmallIcons;
+ public Form HostForm { get; set; }
public Location CodeCompleteCaretLocationOffset { get; set; }
public string CodeCompleteTargetText { get; set; }
- public CodeCompletionWindow codeCompletionWindow;
- public Action<string> statusMessage;
+ public CodeCompletionWindow codeCompletionWindow;
+ public Action<string> statusMessage;
public bool OnlyShowCodeCompleteResulstFromO2Namespace { get; set; }
public bool UseParseCodeThread { get; set; }
public ExpressionResult currentExpression;
public List<String> loadedReferences { get; set; }
public List<String> gacAssemblies { get; set; }
- public O2CodeCompletion(TextEditorControl _textEditor)
- : this(_textEditor,(text)=>text.info())
- {
- }
+ public O2CodeCompletion(TextEditorControl _textEditor)
+ : this(_textEditor,(text)=>text.info())
+ {
+ }
- public O2CodeCompletion(TextEditorControl _textEditor, Action<string> status)
- {
+ public O2CodeCompletion(TextEditorControl _textEditor, Action<string> status)
+ {
OnlyShowCodeCompleteResulstFromO2Namespace = false; //true;
UseParseCodeThread = true;
extraSourceCodeToProcess = new List<string>();
@@ -67,18 +67,18 @@ public O2CodeCompletion(TextEditorControl _textEditor, Action<string> status)
gacAssemblies = GacUtils.assemblyNames(true);
loadedReferences = new List<string>();
- _textEditor.invokeOnThread(
- ()=>{
- textEditor = _textEditor;
+ _textEditor.invokeOnThread(
+ ()=>{
+ textEditor = _textEditor;
statusMessage = status;
- loadIcons();
- setupEnvironment();
- });
- }
-
-
- public void setupEnvironment()
- {
+ loadIcons();
+ setupEnvironment();
+ });
+ }
+
+
+ public void setupEnvironment()
+ {
try
{
textEditor.ActiveTextAreaControl.TextArea.KeyEventHandler += TextAreaKeyEventHandler;
@@ -106,7 +106,7 @@ public void setupEnvironment()
ex.log("in setupEnvironment");
}
- }
+ }
void Caret_PositionChanged(object sender, EventArgs e)
{
@@ -114,25 +114,25 @@ void Caret_PositionChanged(object sender, EventArgs e)
// "Current Offset: {0}".format(caret.Offset).info();
// showLocationDetails(caret.Position);
}
-
- void loadIcons()
- {
- //System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(O2CodeCompletion));
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
- SmallIcons = new ImageList();
- SmallIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
- }
- /*public O2CodeCompletion(Form hostForm)
- {
- HostForm = hostForm;
- }*/
+
+ void loadIcons()
+ {
+ //System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(O2CodeCompletion));
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
+ SmallIcons = new ImageList();
+ SmallIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
+ }
+ /*public O2CodeCompletion(Form hostForm)
+ {
+ HostForm = hostForm;
+ }*/
/* public void open(string fileToOpen)
- {
- textEditor.open(fileToOpen);
- //DummyFileName = fileToOpen; // DC - check if this makes the diference
- }
+ {
+ textEditor.open(fileToOpen);
+ //DummyFileName = fileToOpen; // DC - check if this makes the diference
+ }
*/
public void mapDotNetReferencesForCodeComplete()
{
@@ -150,8 +150,8 @@ public void mapDotNetReferencesForCodeComplete()
addReference("WindowsFormsIntegration");*/
}
- public void startAddReferencesThread()
- {
+ public void startAddReferencesThread()
+ {
O2Thread.mtaThread(
() =>
{
@@ -172,27 +172,27 @@ public void startAddReferencesThread()
//statusMessage("Dependencies loaded");
});
- }
-
- public void addReference(string referenceAssembly)
- {
+ }
+
+ public void addReference(string referenceAssembly)
+ {
try
{
if (loadedReferences.contains(referenceAssembly).isFalse())
{
- if (referenceAssembly.fileExists())
- this.myProjectContent.add_Reference(this.pcRegistry, referenceAssembly, statusMessage);
- else
- {
- var assembly = referenceAssembly.assembly();
- if (assembly.notNull() && assembly.Location.fileExists())
- {
- this.myProjectContent.add_Reference(this.pcRegistry, assembly.Location, statusMessage);
- }
- else
- "[addReference] could not find assembly for: {0}".error(referenceAssembly);
-
- }
+ if (referenceAssembly.fileExists())
+ this.myProjectContent.add_Reference(this.pcRegistry, referenceAssembly, statusMessage);
+ else
+ {
+ var assembly = referenceAssembly.assembly();
+ if (assembly.notNull() && assembly.Location.fileExists())
+ {
+ this.myProjectContent.add_Reference(this.pcRegistry, assembly.Location, statusMessage);
+ }
+ else
+ "[addReference] could not find assembly for: {0}".error(referenceAssembly);
+
+ }
//if (gacAssemblies.contains(assemblyWithoutExtension))
// this.myProjectContent.add_Reference(this.pcRegistry, assemblyWithoutExtension, statusMessage);
@@ -205,7 +205,7 @@ public void addReference(string referenceAssembly)
{
ex.log("in O2CodeCompletion addReference:{0}".format(referenceAssembly));
}
- }
+ }
public void addReferences(List<string> referencesToAdd)
{
@@ -225,23 +225,23 @@ public void addReferences(List<string> referencesToAdd)
});
}
- // this will regularly parse the current source code so that we have code completion for its methods
- public void startParseCodeThread()
- {
- O2Thread.mtaThread(
- ()=>{
- while (!textEditor.IsDisposed && UseParseCodeThread)
- {
+ // this will regularly parse the current source code so that we have code completion for its methods
+ public void startParseCodeThread()
+ {
+ O2Thread.mtaThread(
+ ()=>{
+ while (!textEditor.IsDisposed && UseParseCodeThread)
+ {
this.parseSourceCode(DummyFileName, this.textEditor.get_Text());
foreach (var codeOrFile in extraSourceCodeToProcess)
if (codeOrFile.isFile())
this.parseSourceCode(codeOrFile,codeOrFile.contents());
else
this.parseSourceCode(codeOrFile);
- this.sleep(2000,false);
- }
- });
- }
+ this.sleep(2000,false);
+ }
+ });
+ }
public void parseFile(string fileToParse)
{
@@ -293,8 +293,8 @@ public void parseSourceCode(string file, string code)
}
}
-
- public ICompilationUnit ConvertCompilationUnit(CompilationUnit compilationUnit)
+
+ public ICompilationUnit ConvertCompilationUnit(CompilationUnit compilationUnit)
{
NRefactoryASTConvertVisitor converter;
converter = new NRefactoryASTConvertVisitor(myProjectContent);
@@ -304,11 +304,11 @@ public ICompilationUnit ConvertCompilationUnit(CompilationUnit compilationUnit)
- // Was part of the CodeCompletionKeyHandler file
-
- /// <summary>
- /// Return true to handle the keypress, return false to let the text area handle the keypress
- /// </summary>
+ // Was part of the CodeCompletionKeyHandler file
+
+ /// <summary>
+ /// Return true to handle the keypress, return false to let the text area handle the keypress
+ /// </summary>
public bool TextAreaKeyEventHandler(char key)
{
if (codeCompletionWindow != null)
@@ -369,21 +369,21 @@ public void onDot_showCodeCompleteWindow()
}
o2Timer.stop();
}
-
- void CloseCodeCompletionWindow(object sender, EventArgs e)
- {
- if (codeCompletionWindow != null) {
- codeCompletionWindow.Closed -= new EventHandler(CloseCodeCompletionWindow);
- codeCompletionWindow.Dispose();
- codeCompletionWindow = null;
- }
- }
-
-
- // was part of Tool Tip Provider
-
- void OnToolTipRequest(object sender, ToolTipRequestEventArgs e)
- {
+
+ void CloseCodeCompletionWindow(object sender, EventArgs e)
+ {
+ if (codeCompletionWindow != null) {
+ codeCompletionWindow.Closed -= new EventHandler(CloseCodeCompletionWindow);
+ codeCompletionWindow.Dispose();
+ codeCompletionWindow = null;
+ }
+ }
+
+
+ // was part of Tool Tip Provider
+
+ void OnToolTipRequest(object sender, ToolTipRequestEventArgs e)
+ {
O2Thread.mtaThread(
() =>
{
@@ -411,7 +411,7 @@ void OnToolTipRequest(object sender, ToolTipRequestEventArgs e)
ex.log("in OnToolTipRequest");
}
});
- }
+ }
public void showLocationDetails(TextLocation location)
{
@@ -500,122 +500,122 @@ private ResolveResult resolveLocation(TextLocation logicalPosition)
return rr;
}
-
- static string GetText(ResolveResult result)
- {
- if (result == null) {
- return null;
- }
- if (result is MixedResolveResult)
- return GetText(((MixedResolveResult)result).PrimaryResult);
- IAmbience ambience = new CSharpAmbience();
- ambience.ConversionFlags = ConversionFlags.StandardConversionFlags | ConversionFlags.ShowAccessibility;
- if (result is MemberResolveResult) {
- return GetMemberText(ambience, ((MemberResolveResult)result).ResolvedMember);
- } else if (result is LocalResolveResult) {
- LocalResolveResult rr = (LocalResolveResult)result;
- ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedTypeNames
- | ConversionFlags.ShowReturnType;
- StringBuilder b = new StringBuilder();
- if (rr.IsParameter)
- b.Append("parameter ");
- else
- b.Append("local variable ");
- b.Append(ambience.Convert(rr.Field));
- return b.ToString();
- } else if (result is NamespaceResolveResult) {
- return "namespace " + ((NamespaceResolveResult)result).Name;
- } else if (result is TypeResolveResult) {
- IClass c = ((TypeResolveResult)result).ResolvedClass;
- if (c != null)
- return GetMemberText(ambience, c);
- else
- return ambience.Convert(result.ResolvedType);
- } else if (result is MethodGroupResolveResult) {
- MethodGroupResolveResult mrr = result as MethodGroupResolveResult;
- IMethod m = mrr.GetMethodIfSingleOverload();
- if (m != null)
- return GetMemberText(ambience, m);
- else
- return "Overload of " + ambience.Convert(mrr.ContainingType) + "." + mrr.Name;
- } else {
- return null;
- }
- }
-
- static string GetMemberText(IAmbience ambience, IEntity member)
- {
- StringBuilder text = new StringBuilder();
- if (member is IField) {
- text.Append(ambience.Convert(member as IField));
- } else if (member is IProperty) {
- text.Append(ambience.Convert(member as IProperty));
- } else if (member is IEvent) {
- text.Append(ambience.Convert(member as IEvent));
- } else if (member is IMethod) {
- text.Append(ambience.Convert(member as IMethod));
- } else if (member is IClass) {
- text.Append(ambience.Convert(member as IClass));
- } else {
- text.Append("unknown member ");
- text.Append(member.ToString());
- }
- string documentation = member.Documentation;
- if (documentation != null && documentation.Length > 0) {
- text.Append('\n');
- text.Append(CodeCompletionData.XmlDocumentationToText(documentation));
- }
- return text.ToString();
- }
-
-
- // part of the CodeCompletionProvider (public class CodeCompletionProvider : ICompletionDataProvider)
-
-
- public ImageList ImageList {
- get {
- return this.SmallIcons;
- }
- }
-
- public string PreSelection {
- get {
- return null;
- }
- }
-
- public int DefaultIndex {
- get {
- return -1;
- }
- }
-
- public CompletionDataProviderKeyResult ProcessKey(char key)
- {
- if (char.IsLetterOrDigit(key) || key == '_') {
- return CompletionDataProviderKeyResult.NormalKey;
- } else {
- // key triggers insertion of selected items
- return CompletionDataProviderKeyResult.InsertionKey;
- }
- }
-
- /// <summary>
- /// Called when entry should be inserted. Forward to the insertion action of the completion data.
- /// </summary>
- public bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
- {
- textArea.Caret.Position = textArea.Document.OffsetToPosition(insertionOffset);
- return data.InsertAction(textArea, key);
- }
-
- public ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
- {
- // We can return code-completion items like this:
-
- //return new ICompletionData[] {
- // new DefaultCompletionData("Text", "Description", 1)
- //};
+
+ static string GetText(ResolveResult result)
+ {
+ if (result == null) {
+ return null;
+ }
+ if (result is MixedResolveResult)
+ return GetText(((MixedResolveResult)result).PrimaryResult);
+ IAmbience ambience = new CSharpAmbience();
+ ambience.ConversionFlags = ConversionFlags.StandardConversionFlags | ConversionFlags.ShowAccessibility;
+ if (result is MemberResolveResult) {
+ return GetMemberText(ambience, ((MemberResolveResult)result).ResolvedMember);
+ } else if (result is LocalResolveResult) {
+ LocalResolveResult rr = (LocalResolveResult)result;
+ ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedTypeNames
+ | ConversionFlags.ShowReturnType;
+ StringBuilder b = new StringBuilder();
+ if (rr.IsParameter)
+ b.Append("parameter ");
+ else
+ b.Append("local variable ");
+ b.Append(ambience.Convert(rr.Field));
+ return b.ToString();
+ } else if (result is NamespaceResolveResult) {
+ return "namespace " + ((NamespaceResolveResult)result).Name;
+ } else if (result is TypeResolveResult) {
+ IClass c = ((TypeResolveResult)result).ResolvedClass;
+ if (c != null)
+ return GetMemberText(ambience, c);
+ else
+ return ambience.Convert(result.ResolvedType);
+ } else if (result is MethodGroupResolveResult) {
+ MethodGroupResolveResult mrr = result as MethodGroupResolveResult;
+ IMethod m = mrr.GetMethodIfSingleOverload();
+ if (m != null)
+ return GetMemberText(ambience, m);
+ else
+ return "Overload of " + ambience.Convert(mrr.ContainingType) + "." + mrr.Name;
+ } else {
+ return null;
+ }
+ }
+
+ static string GetMemberText(IAmbience ambience, IEntity member)
+ {
+ StringBuilder text = new StringBuilder();
+ if (member is IField) {
+ text.Append(ambience.Convert(member as IField));
+ } else if (member is IProperty) {
+ text.Append(ambience.Convert(member as IProperty));
+ } else if (member is IEvent) {
+ text.Append(ambience.Convert(member as IEvent));
+ } else if (member is IMethod) {
+ text.Append(ambience.Convert(member as IMethod));
+ } else if (member is IClass) {
+ text.Append(ambience.Convert(member as IClass));
+ } else {
+ text.Append("unknown member ");
+ text.Append(member.ToString());
+ }
+ string documentation = member.Documentation;
+ if (documentation != null && documentation.Length > 0) {
+ text.Append('\n');
+ text.Append(CodeCompletionData.XmlDocumentationToText(documentation));
+ }
+ return text.ToString();
+ }
+
+
+ // part of the CodeCompletionProvider (public class CodeCompletionProvider : ICompletionDataProvider)
+
+
+ public ImageList ImageList {
+ get {
+ return this.SmallIcons;
+ }
+ }
+
+ public string PreSelection {
+ get {
+ return null;
+ }
+ }
+
+ public int DefaultIndex {
+ get {
+ return -1;
+ }
+ }
+
+ public CompletionDataProviderKeyResult ProcessKey(char key)
+ {
+ if (char.IsLetterOrDigit(key) || key == '_') {
+ return CompletionDataProviderKeyResult.NormalKey;
+ } else {
+ // key triggers insertion of selected items
+ return CompletionDataProviderKeyResult.InsertionKey;
+ }
+ }
+
+ /// <summary>
+ /// Called when entry should be inserted. Forward to the insertion action of the completion data.
+ /// </summary>
+ public bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
+ {
+ textArea.Caret.Position = textArea.Document.OffsetToPosition(insertionOffset);
+ return data.InsertAction(textArea, key);
+ }
+
+ public ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
+ {
+ // We can return code-completion items like this:
+
+ //return new ICompletionData[] {
+ // new DefaultCompletionData("Text", "Description", 1)
+ //};
var targetText = "";
if (CodeCompleteCaretLocationOffset.Line == 0)
{
@@ -628,15 +628,15 @@ public ICompletionData[] GenerateCompletionData(string fileName, TextArea textAr
targetText = getAdjustedSnippetText(textArea, firstMethodOffset);
}
- NRefactoryResolver resolver = new NRefactoryResolver(this.myProjectContent.Language);
- //ResolveResult rr = resolver.Resolve(FindExpression(textArea),
+ NRefactoryResolver resolver = new NRefactoryResolver(this.myProjectContent.Language);
+ //ResolveResult rr = resolver.Resolve(FindExpression(textArea),
ResolveResult rr = resolver.Resolve(currentExpression,
- this.parseInformation,
+ this.parseInformation,
targetText);
- List<ICompletionData> resultList = new List<ICompletionData>();
- if (rr.notNull())// && )
+ List<ICompletionData> resultList = new List<ICompletionData>();
+ if (rr.notNull())// && )
{
- ArrayList completionData = rr.GetCompletionData(this.myProjectContent);
+ ArrayList completionData = rr.GetCompletionData(this.myProjectContent);
/*"[CodeComplete] expression '{0}' was resolved into type: {1} with {2} results".info(currentExpression.Expression,
rr.ResolvedType.FullyQualifiedName,
completionData.isNull() ? -1
@@ -648,23 +648,23 @@ public ICompletionData[] GenerateCompletionData(string fileName, TextArea textAr
completionData.isNull()
? -1
: completionData.Count);
- if (completionData != null) {
- AddCompletionData(resultList, completionData);
- }
- }
+ if (completionData != null) {
+ AddCompletionData(resultList, completionData);
+ }
+ }
else
"[CodeComplete] expression '{0}' could not be resolved".error(currentExpression.Expression);
// "In generate completion Data, There were {0} results found".format(resultList.Count).debug();
- return resultList.ToArray();
- }
-
- /// <summary>
- /// Find the expression the cursor is at.
- /// Also determines the context (using statement, "new"-expression etc.) the
- /// cursor is at.
- /// </summary>
- ExpressionResult FindExpression()//TextArea textArea)
- {
+ return resultList.ToArray();
+ }
+
+ /// <summary>
+ /// Find the expression the cursor is at.
+ /// Also determines the context (using statement, "new"-expression etc.) the
+ /// cursor is at.
+ /// </summary>
+ ExpressionResult FindExpression()//TextArea textArea)
+ {
var textArea = textEditor.ActiveTextAreaControl.TextArea;
try
{
@@ -683,7 +683,7 @@ ExpressionResult FindExpression()//TextArea textArea)
ex.log("in FindExpression");
return new ExpressionResult(); ;
}
- }
+ }
public ExpressionResult getExpressionFromTextArea(TextArea textArea)
{
@@ -734,32 +734,32 @@ public string getAdjustedSnippetText(TextArea textArea, int firstMethodOffset)
return currentText;
}
- void AddCompletionData(List<ICompletionData> resultList, ArrayList completionData)
- {
+ void AddCompletionData(List<ICompletionData> resultList, ArrayList completionData)
+ {
// var currentCodeCompleteText = "";
// var lenght = textEditor.currentOffset() - startOffset;
// if (lenght >0)
// currentCodeCompleteText = textEditor.get_Text(startOffset,lenght);
// "{0}:{1} = {2}".format(startOffset,lenght , currentCodeCompleteText).debug();
- // used to store the method names for grouping overloads
- Dictionary<string, CodeCompletionData> nameDictionary = new Dictionary<string, CodeCompletionData>();
-
- // Add the completion data as returned by SharpDevelop.Dom to the
- // list for the text editor
- foreach (object obj in completionData) {
- if (obj is string) {
- // namespace names are returned as string
- resultList.Add(new DefaultCompletionData((string)obj, "namespace " + obj, 5));
- } else if (obj is IClass) {
- IClass c = (IClass)obj;
- resultList.Add(new CodeCompletionData(c,this));
- } else if (obj is IMember) {
- IMember m = (IMember)obj;
- if (m is IMethod && ((m as IMethod).IsConstructor)) {
- // Skip constructors
- continue;
- }
+ // used to store the method names for grouping overloads
+ Dictionary<string, CodeCompletionData> nameDictionary = new Dictionary<string, CodeCompletionData>();
+
+ // Add the completion data as returned by SharpDevelop.Dom to the
+ // list for the text editor
+ foreach (object obj in completionData) {
+ if (obj is string) {
+ // namespace names are returned as string
+ resultList.Add(new DefaultCompletionData((string)obj, "namespace " + obj, 5));
+ } else if (obj is IClass) {
+ IClass c = (IClass)obj;
+ resultList.Add(new CodeCompletionData(c,this));
+ } else if (obj is IMember) {
+ IMember m = (IMember)obj;
+ if (m is IMethod && ((m as IMethod).IsConstructor)) {
+ // Skip constructors
+ continue;
+ }
// if OnlyShowCodeCompleteResulstFromO2Namespace filter for only O2.* namepace
if (OnlyShowCodeCompleteResulstFromO2Namespace && m.DeclaringType.Namespace.starts("O2") == false)
continue;
@@ -768,177 +768,177 @@ void AddCompletionData(List<ICompletionData> resultList, ArrayList completionDat
// if (currentCodeCompleteText != "" && m.DotNetName.nregEx(currentCodeCompleteText))
// continue;
//if
- // Group results by name and add "(x Overloads)" to the
- // description if there are multiple results with the same name.
- CodeCompletionData data;
- if (nameDictionary.TryGetValue(m.Name, out data)) {
- data.AddOverload();
- } else {
- nameDictionary[m.Name] = data = new CodeCompletionData(m,this);
- resultList.Add(data);
- }
- } else {
- // Current ICSharpCode.SharpDevelop.Dom should never return anything else
- throw new NotSupportedException();
- }
- }
- }
-
+ // Group results by name and add "(x Overloads)" to the
+ // description if there are multiple results with the same name.
+ CodeCompletionData data;
+ if (nameDictionary.TryGetValue(m.Name, out data)) {
+ data.AddOverload();
+ } else {
+ nameDictionary[m.Name] = data = new CodeCompletionData(m,this);
+ resultList.Add(data);
+ }
+ } else {
+ // Current ICSharpCode.SharpDevelop.Dom should never return anything else
+ throw new NotSupportedException();
+ }
+ }
+ }
+
}
public class CodeCompletionData : DefaultCompletionData, ICompletionData
- {
- public O2CodeCompletion o2CodeCompletion;
+ {
+ public O2CodeCompletion o2CodeCompletion;
public IMember member;
public IClass c;
public CSharpAmbience csharpAmbience = new CSharpAmbience();
-
- public CodeCompletionData(IMember member, O2CodeCompletion _o2CodeCompletion)
- : base(member.Name, null, GetMemberImageIndex(member))
- {
- this.member = member;
- o2CodeCompletion = _o2CodeCompletion;
- }
-
- public CodeCompletionData(IClass c, O2CodeCompletion _o2CodeCompletion)
- : base(c.Name, null, GetClassImageIndex(c))
- {
- this.c = c;
- o2CodeCompletion = _o2CodeCompletion;
- }
-
- int overloads = 0;
-
- public void AddOverload()
- {
- overloads++;
- }
-
- static int GetMemberImageIndex(IMember member)
- {
- // Missing: different icons for private/public member
- if (member is IMethod)
- return 1;
- if (member is IProperty)
- return 2;
- if (member is IField)
- return 3;
- if (member is IEvent)
- return 6;
- return 3;
- }
-
- static int GetClassImageIndex(IClass c)
- {
- switch (c.ClassType) {
- case ICSharpCode.SharpDevelop.Dom.ClassType.Enum:
- return 4;
- default:
- return 0;
- }
- }
-
- string description;
-
- // DefaultCompletionData.Description is not virtual, but we can reimplement
- // the interface to get the same effect as overriding.
- string ICompletionData.Description {
- get {
- if (description == null) {
- IEntity entity = (IEntity)member ?? c;
- description = GetText(entity);
- if (overloads > 1) {
- description += " (+" + overloads + " overloads)";
- }
- description += Environment.NewLine + XmlDocumentationToText(entity.Documentation);
- }
- return description;
- }
- }
-
- /// <summary>
- /// Converts a member to text.
- /// Returns the declaration of the member as C# or VB code, e.g.
- /// "public void MemberName(string parameter)"
- /// </summary>
- string GetText(IEntity entity)
- {
- return (string)o2CodeCompletion.textEditor.invokeOnThread(
- ()=> {
- IAmbience ambience = csharpAmbience;
- if (entity is IMethod)
- return ambience.Convert(entity as IMethod);
- if (entity is IProperty)
- return ambience.Convert(entity as IProperty);
- if (entity is IEvent)
- return ambience.Convert(entity as IEvent);
- if (entity is IField)
- return ambience.Convert(entity as IField);
- if (entity is IClass)
- return ambience.Convert(entity as IClass);
- // unknown entity:
- return entity.ToString();
- });
- }
-
- static public string XmlDocumentationToText(string xmlDoc)
- {
- PublicDI.log.error(xmlDoc);
- StringBuilder b = new StringBuilder();
- try {
- using (XmlTextReader reader = new XmlTextReader(new StringReader("<root>" + xmlDoc + "</root>"))) {
- reader.XmlResolver = null;
- while (reader.Read()) {
- switch (reader.NodeType) {
- case XmlNodeType.Text:
- b.Append(reader.Value);
- break;
- case XmlNodeType.Element:
- switch (reader.Name) {
- case "filterpriority":
- reader.Skip();
- break;
- case "returns":
- b.AppendLine();
- b.Append("Returns: ");
- break;
- case "param":
- b.AppendLine();
- b.Append(reader.GetAttribute("name") + ": ");
- break;
- case "remarks":
- b.AppendLine();
- b.Append("Remarks: ");
- break;
- case "see":
- if (reader.IsEmptyElement) {
- b.Append(reader.GetAttribute("cref"));
- } else {
- reader.MoveToContent();
- if (reader.HasValue) {
- b.Append(reader.Value);
- } else {
- b.Append(reader.GetAttribute("cref"));
- }
- }
- break;
- }
- break;
- }
- }
- }
- return b.ToString();
- } catch (XmlException) {
- return xmlDoc;
- }
- }
- }
-
-
- public static class SharpdevelopExtensionMethods
+
+ public CodeCompletionData(IMember member, O2CodeCompletion _o2CodeCompletion)
+ : base(member.Name, null, GetMemberImageIndex(member))
+ {
+ this.member = member;
+ o2CodeCompletion = _o2CodeCompletion;
+ }
+
+ public CodeCompletionData(IClass c, O2CodeCompletion _o2CodeCompletion)
+ : base(c.Name, null, GetClassImageIndex(c))
+ {
+ this.c = c;
+ o2CodeCompletion = _o2CodeCompletion;
+ }
+
+ int overloads = 0;
+
+ public void AddOverload()
+ {
+ overloads++;
+ }
+
+ static int GetMemberImageIndex(IMember member)
+ {
+ // Missing: different icons for private/public member
+ if (member is IMethod)
+ return 1;
+ if (member is IProperty)
+ return 2;
+ if (member is IField)
+ return 3;
+ if (member is IEvent)
+ return 6;
+ return 3;
+ }
+
+ static int GetClassImageIndex(IClass c)
+ {
+ switch (c.ClassType) {
+ case ICSharpCode.SharpDevelop.Dom.ClassType.Enum:
+ return 4;
+ default:
+ return 0;
+ }
+ }
+
+ string description;
+
+ // DefaultCompletionData.Description is not virtual, but we can reimplement
+ // the interface to get the same effect as overriding.
+ string ICompletionData.Description {
+ get {
+ if (description == null) {
+ IEntity entity = (IEntity)member ?? c;
+ description = GetText(entity);
+ if (overloads > 1) {
+ description += " (+" + overloads + " overloads)";
+ }
+ description += Environment.NewLine + XmlDocumentationToText(entity.Documentation);
+ }
+ return description;
+ }
+ }
+
+ /// <summary>
+ /// Converts a member to text.
+ /// Returns the declaration of the member as C# or VB code, e.g.
+ /// "public void MemberName(string parameter)"
+ /// </summary>
+ string GetText(IEntity entity)
+ {
+ return (string)o2CodeCompletion.textEditor.invokeOnThread(
+ ()=> {
+ IAmbience ambience = csharpAmbience;
+ if (entity is IMethod)
+ return ambience.Convert(entity as IMethod);
+ if (entity is IProperty)
+ return ambience.Convert(entity as IProperty);
+ if (entity is IEvent)
+ return ambience.Convert(entity as IEvent);
+ if (entity is IField)
+ return ambience.Convert(entity as IField);
+ if (entity is IClass)
+ return ambience.Convert(entity as IClass);
+ // unknown entity:
+ return entity.ToString();
+ });
+ }
+
+ static public string XmlDocumentationToText(string xmlDoc)
+ {
+ PublicDI.log.error(xmlDoc);
+ StringBuilder b = new StringBuilder();
+ try {
+ using (XmlTextReader reader = new XmlTextReader(new StringReader("<root>" + xmlDoc + "</root>"))) {
+ reader.XmlResolver = null;
+ while (reader.Read()) {
+ switch (reader.NodeType) {
+ case XmlNodeType.Text:
+ b.Append(reader.Value);
+ break;
+ case XmlNodeType.Element:
+ switch (reader.Name) {
+ case "filterpriority":
+ reader.Skip();
+ break;
+ case "returns":
+ b.AppendLine();
+ b.Append("Returns: ");
+ break;
+ case "param":
+ b.AppendLine();
+ b.Append(reader.GetAttribute("name") + ": ");
+ break;
+ case "remarks":
+ b.AppendLine();
+ b.Append("Remarks: ");
+ break;
+ case "see":
+ if (reader.IsEmptyElement) {
+ b.Append(reader.GetAttribute("cref"));
+ } else {
+ reader.MoveToContent();
+ if (reader.HasValue) {
+ b.Append(reader.Value);
+ } else {
+ b.Append(reader.GetAttribute("cref"));
+ }
+ }
+ break;
+ }
+ break;
+ }
+ }
+ }
+ return b.ToString();
+ } catch (XmlException) {
+ return xmlDoc;
+ }
+ }
+ }
+
+
+ public static class SharpdevelopExtensionMethods
{
- public static void add_Reference(this DefaultProjectContent projectContent, ProjectContentRegistry pcRegistry, string assemblyToLoad, Action<string> debugMessage)
- {
+ public static void add_Reference(this DefaultProjectContent projectContent, ProjectContentRegistry pcRegistry, string assemblyToLoad, Action<string> debugMessage)
+ {
try
{
debugMessage("Loading Code Completion Reference: {0}".format(assemblyToLoad));
@@ -960,6 +960,6 @@ public static void add_Reference(this DefaultProjectContent projectContent, Proj
{
ex.log("in DefaultProjectContent.add_Reference");
}
- }
+ }
}
}
View
39 ...O2SharpDevelop/ICSharpCode.SharpDevelop.Dom/Project/Src/ReflectionLayer/DomPersistence.cs
@@ -9,7 +9,8 @@
using System.Collections.Generic;
using System.Globalization;
using System.IO;
-using System.Reflection;
+using System.Reflection;
+using O2.DotNetWrappers.ExtensionMethods;
namespace ICSharpCode.SharpDevelop.Dom
{
@@ -118,19 +119,29 @@ public ReflectionProjectContent LoadProjectContent(string cacheFileName)
}
void SaveCacheIndex(Dictionary<string, string> cacheIndex)
- {
- string indexFile = GetIndexFileName();
- using (FileStream fs = new FileStream(indexFile, FileMode.Create, FileAccess.Write)) {
- using (BinaryWriter writer = new BinaryWriter(fs)) {
- writer.Write(IndexFileMagic);
- writer.Write(FileVersion);
- writer.Write(cacheIndex.Count);
- foreach (KeyValuePair<string, string> e in cacheIndex) {
- writer.Write(e.Key);
- writer.Write(e.Value);
- }
- }
- }
+ {
+ try
+ {
+ string indexFile = GetIndexFileName();
+ using (FileStream fs = new FileStream(indexFile, FileMode.Create, FileAccess.Write))
+ {
+ using (BinaryWriter writer = new BinaryWriter(fs))
+ {
+ writer.Write(IndexFileMagic);
+ writer.Write(FileVersion);
+ writer.Write(cacheIndex.Count);
+ foreach (KeyValuePair<string, string> e in cacheIndex)
+ {
+ writer.Write(e.Key);
+ writer.Write(e.Value);
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.log("[in SaveCacheIndex]");
+ }
}
void AddFileNameToCacheIndex(string cacheFile, ReflectionProjectContent pc)
View
4 ...arpDevelop/_O2SharpDevelop/ICSharpCode.TextEditor/Project/Src/Document/AbstractSegment.cs
@@ -14,9 +14,9 @@ namespace ICSharpCode.TextEditor.Document
/// </summary>
public class AbstractSegment : ISegment
{
- [CLSCompliant(false)]
+ //[CLSCompliant(false)]
protected int offset = -1;
- [CLSCompliant(false)]
+ //[CLSCompliant(false)]
protected int length = -1;
#region ICSharpCode.TextEditor.Document.ISegment interface implementation
View
2  ...op/_O2SharpDevelop/ICSharpCode.TextEditor/Project/Src/Document/LineManager/LineManager.cs
@@ -77,7 +77,7 @@ public void Remove(int offset, int length)
public void Replace(int offset, int length, string text)
{
- Debug.WriteLine("Replace offset="+offset+" length="+length+" text.Length="+text.Length);
+ //Debug.WriteLine("Replace offset="+offset+" length="+length+" text.Length="+text.Length);
int lineStart = GetLineNumberForOffset(offset);
int oldNumberOfLines = this.TotalNumberOfLines;
DeferredEventList deferredEventList = new DeferredEventList();
View
2  ...rpDevelop/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/CodeCompletionWindow.cs
@@ -92,7 +92,7 @@ public static CodeCompletionWindow ShowCompletionWindow_Thread(Form parent,TextE
return codeCompletionWindow;
}
- catch (Exception ex)
+ catch// (Exception ex)
{
busy = false;
return null;
View
2  ..._SharpDevelop/_O2SharpDevelop/ICSharpCode.TextEditor/Project/Src/Gui/TextEditorControl.cs
@@ -277,7 +277,7 @@ void CommitUpdateRequested(object sender, EventArgs e)
// this.secondaryTextArea.TextArea.Update();
// }
}
- catch (Exception ex)
+ catch// (Exception ex)
{
}
View
8 O2_External_WinFormsUI/DI.cs → O2_External_WinFormsUI/DI.cs.txt
@@ -19,9 +19,7 @@ static DI()
config = PublicDI.config;
o2MessageQueue = KO2MessageQueue.getO2KernelQueue();
- new O2MessagesHandler(); // set up O2Message hook
-
- autoAddLogViewerToGui = true;
+
}
// DI objects
@@ -31,11 +29,7 @@ static DI()
public static IReflection reflection;
// local global vars
- public static Dictionary<String, O2DockContent> dO2LoadedO2DockContent = new Dictionary<String, O2DockContent>();
- public static O2GuiWithDockPanel o2GuiWithDockPanel;
- public static bool o2GuiStandAloneFormMode;
- public static bool autoAddLogViewerToGui { get; set; }
}
}
View
82 O2_External_WinFormsUI/Forms/O2AscxGUI.cs
@@ -20,9 +20,19 @@ namespace O2.External.WinFormsUI.Forms
[Serializable]
public class O2AscxGUI
{
+ public static Dictionary<String, O2DockContent> dO2LoadedO2DockContent = new Dictionary<String, O2DockContent>();
+ public static O2GuiWithDockPanel o2GuiWithDockPanel;
+ public static bool o2GuiStandAloneFormMode;
+
+ public static bool autoAddLogViewerToGui { get; set; }
+
static O2AscxGUI()
{
- new O2MessagesHandler(); // make sure the Messages Handler is setup
+ new O2MessagesHandler(); // make sure the Messages Handler is setup
+
+ autoAddLogViewerToGui = true;
+
+ //o2MessageQueue = KO2MessageQueue.getO2KernelQueue();
}
public static AutoResetEvent guiClosed = new AutoResetEvent(false);
@@ -38,7 +48,7 @@ public static bool launch(string parentFormTitle)
{
if (isGuiLoaded())
{
- DI.log.error("There is already a GUI loaded and only one can be loaded");
+ PublicDI.log.error("There is already a GUI loaded and only one can be loaded");
return false;
}
parentFormTitle = ClickOnceDeployment.getFormTitle_forClickOnce(parentFormTitle);
@@ -49,12 +59,12 @@ public static bool launch(string parentFormTitle)
var maxTimeToWaitForGuiCreation = 20000;
if (O2DockPanel.guiLoaded.WaitOne(maxTimeToWaitForGuiCreation))
{
- DI.o2GuiWithDockPanel.invokeOnThread(()=>DI.o2GuiWithDockPanel.Text = parentFormTitle);
+ O2AscxGUI.o2GuiWithDockPanel.invokeOnThread(()=>O2AscxGUI.o2GuiWithDockPanel.Text = parentFormTitle);
return true;
}
if (false == DebugMsg.IsDebuggerAttached())
- //DI.log.reportCriticalErrorToO2Developers(null, null, "from O2AscxGUI: GUI was not available after 20 seconds");
- DI.log.error("from O2AscxGUI: GUI was not available after 20 seconds");
+ //PublicDI.log.reportCriticalErrorToO2Developers(null, null, "from O2AscxGUI: GUI was not available after 20 seconds");
+ PublicDI.log.error("from O2AscxGUI: GUI was not available after 20 seconds");
return false;
}
catch (Exception)
@@ -67,11 +77,11 @@ public static bool launch(string parentFormTitle, int width, int height)
{
if (launch(parentFormTitle))
{
- DI.o2GuiWithDockPanel.invokeOnThread(
+ O2AscxGUI.o2GuiWithDockPanel.invokeOnThread(
() =>
{
- DI.o2GuiWithDockPanel.Height = height;
- DI.o2GuiWithDockPanel.Width = width;
+ O2AscxGUI.o2GuiWithDockPanel.Height = height;
+ O2AscxGUI.o2GuiWithDockPanel.Width = width;
});
return true;
@@ -84,7 +94,7 @@ public static bool waitForAscxGuiClose(int milisecondsToWait)
{
if (false == guiClosed.WaitOne(milisecondsToWait))
{
- DI.log.error("in waitForAscxGuiClose , Gui didn't close after {0} seconds", milisecondsToWait / 1000);
+ PublicDI.log.error("in waitForAscxGuiClose , Gui didn't close after {0} seconds", milisecondsToWait / 1000);
return false;
}
return true;
@@ -100,31 +110,31 @@ public static bool close()
if (isGuiLoaded())
try
{
- if (DI.o2GuiWithDockPanel.okThread(delegate { close(); }))
+ if (O2AscxGUI.o2GuiWithDockPanel.okThread(delegate { close(); }))
{
- // before we close this we need to remove all loaded Ascx from the DI.dO2LoadedO2DockContent
- DI.dO2LoadedO2DockContent.Clear();
+ // before we close this we need to remove all loaded Ascx from the O2AscxGUI.dO2LoadedO2DockContent
+ O2AscxGUI.dO2LoadedO2DockContent.Clear();
// now close the GUI
- DI.o2GuiWithDockPanel.Close();
+ O2AscxGUI.o2GuiWithDockPanel.Close();
- //DI.o2GuiWithDockPanel.Dispose();
+ //O2AscxGUI.o2GuiWithDockPanel.Dispose();
}
}
catch (Exception ex)
{
- DI.log.ex(ex, "in O2AscxGUI.close");
+ PublicDI.log.ex(ex, "in O2AscxGUI.close");
return false;
}
- if (DI.o2GuiWithDockPanel == null)
+ if (O2AscxGUI.o2GuiWithDockPanel == null)
return true;
if (false == DebugMsg.IsDebuggerAttached())
waitForAscxGuiClose(5000);
else
waitForAscxGuiClose();
- DI.log.info("Gui Closed");
+ PublicDI.log.info("Gui Closed");
return true;
}
@@ -135,7 +145,7 @@ public static void closeAscxParent(string ascxControlName)
var ascxControlToClose = (ContainerControl)getAscx(ascxControlName);
if (ascxControlToClose == null)
- DI.log.error(
+ PublicDI.log.error(
"in O2AscxGui.closeAscxParent, could not get control: {0}", ascxControlName);
else
O2Forms.closeParentForm(ascxControlToClose);
@@ -150,35 +160,35 @@ public static void setLogViewerDockState(O2DockState o2DockState)
public static void logInfo(string infoMessageToLog)
{
- DI.log.info(infoMessageToLog);
+ PublicDI.log.info(infoMessageToLog);
}
public static void logDebug(string debugMessageToLog)
{
- DI.log.debug(debugMessageToLog);
+ PublicDI.log.debug(debugMessageToLog);
}
public static void logError(string errorMessageToLog)
{
- DI.log.error(errorMessageToLog);
+ PublicDI.log.error(errorMessageToLog);
}
/*public static void showMessageBox(string messageBoxText)
{
- DI.log.showMessageBox(messageBoxText);
+ PublicDI.log.showMessageBox(messageBoxText);
}
public static DialogResult showMessageBox(string message, string messageBoxTitle,
MessageBoxButtons messageBoxButtons)
{
- return DI.log.showMessageBox(message, messageBoxTitle, messageBoxButtons);
+ return PublicDI.log.showMessageBox(message, messageBoxTitle, messageBoxButtons);
}*/
public static void openAscx(string ascxControlToLoad, O2DockState dockState, String guiWindowName)
{
- var type = DI.reflection.getType(ascxControlToLoad);
+ var type = PublicDI.reflection.getType(ascxControlToLoad);
if (type == null)
- DI.log.error("in O2AscxGui.openAscx, could not resolve type called: {0}", ascxControlToLoad);
+ PublicDI.log.error("in O2AscxGui.openAscx, could not resolve type called: {0}", ascxControlToLoad);
else
openAscx(type, dockState, guiWindowName);
}
@@ -215,9 +225,9 @@ public static Control openAscx(Type ascxControlToLoad, O2DockState dockState, St
}
public static void openAscxASync(string ascxControlToLoad, O2DockState dockState, String guiWindowName)
{
- var type = DI.reflection.getType(ascxControlToLoad);
+ var type = PublicDI.reflection.getType(ascxControlToLoad);
if (type == null)
- DI.log.error("in O2AscxGui.openAscx, could not resolve type called: {0}", ascxControlToLoad);
+ PublicDI.log.error("in O2AscxGui.openAscx, could not resolve type called: {0}", ascxControlToLoad);
else
openAscxASync(type, dockState, guiWindowName);
}
@@ -231,8 +241,8 @@ public static void openAscxASync(Type ascxControlToLoad, O2DockState dockState,
// was not working (tried to fix the annoying cases where the windows cursor was stuck with the HourGlass shape
/* public static void setCursor(Cursor cursor)
{
- if (DI.o2GuiWithDockPanel != null)
- DI.o2GuiWithDockPanel.Cursor = cursor;
+ if (O2AscxGUI.o2GuiWithDockPanel != null)
+ O2AscxGUI.o2GuiWithDockPanel.Cursor = cursor;
}*/
public static void openAscxAsForm(Type ascxControlToLoad)
@@ -247,16 +257,16 @@ public static void openAscxAsForm(Type ascxControlToLoad, string formName)
public static void openAscxAsForm(string ascxControlToLoad, string formName)
{
- Type typeOfAscxControlToLoad = DI.reflection.getType(ascxControlToLoad);
+ Type typeOfAscxControlToLoad = PublicDI.reflection.getType(ascxControlToLoad);
if (typeOfAscxControlToLoad == null)
- DI.log.error("in O2Messages.openAscxAsForm could not resolve Type:{0}", ascxControlToLoad);
+ PublicDI.log.error("in O2Messages.openAscxAsForm could not resolve Type:{0}", ascxControlToLoad);
else
O2DockContent.launchO2DockContentAsStandAloneForm(typeOfAscxControlToLoad, formName);
}
public static Control getGuiWithDockPanelAsControl()
{
- return DI.o2GuiWithDockPanel;
+ return O2AscxGUI.o2GuiWithDockPanel;
}
public static Control getAscx(string ascxControlName)
@@ -271,7 +281,7 @@ public static bool isAscxLoaded(string ascxControlName)
public static bool isGuiLoaded()
{
- return DI.o2GuiWithDockPanel != null;
+ return O2AscxGUI.o2GuiWithDockPanel != null;
}
public static object invokeOnAscxControl(string ascxTargetControl, string methodToExecute)
@@ -283,7 +293,7 @@ public static object invokeOnAscxControl(string ascxTargetControl, string method
{
var ascxControl = getAscx(ascxTargetControl);
if (ascxControl != null)
- return DI.reflection.invoke(ascxControl, methodToExecute, methodParameters);
+ return PublicDI.reflection.invoke(ascxControl, methodToExecute, methodParameters);
return null;
}
@@ -297,7 +307,7 @@ public static List<String> invokeAndGetStringList(string ascxTargetControl, stri
var ascxControl = getAscx(ascxTargetControl);
if (ascxControl != null)
{
- var returnData = DI.reflection.invoke(ascxControl, methodToExecute, methodParameters);
+ var returnData = PublicDI.reflection.invoke(ascxControl, methodToExecute, methodParameters);
if (returnData != null && returnData is List<String>)
return (List<String>) returnData;
}
@@ -323,7 +333,7 @@ public static void addControlToMenu(Type ascxControlToLoad, String guiWindowName
public static void addControlToMenu(string menuItemName, Action onMenuItemClick)
{
- DI.o2GuiWithDockPanel.addToLoadedO2ModulesMenu(menuItemName, onMenuItemClick);
+ O2AscxGUI.o2GuiWithDockPanel.addToLoadedO2ModulesMenu(menuItemName, onMenuItemClick);
}
public static void addControlToMenu(Type ascxControlToLoad, O2DockState dockState, String guiWindowName)
View
20 O2_External_WinFormsUI/Forms/O2GuiWithDockPanel.Controllers.cs
@@ -37,7 +37,7 @@ private void o2MessageQueue_onMessages(IO2Message o2Message)
if (o2Message is IM_GUIAction)
{
var mGuiAction = (IM_GUIAction) o2Message;
- DI.log.info("O2GuiWithDockPanel received IM_GUIAction of action: {0}", mGuiAction.GuiAction);
+ PublicDI.log.info("O2GuiWithDockPanel received IM_GUIAction of action: {0}", mGuiAction.GuiAction);
switch (mGuiAction.GuiAction)
{
@@ -78,7 +78,7 @@ public void sendEmailToO2Support(string subject, string text, bool sendSync)
BackgroundImage =
Screenshots.getScreenshotOfFormObjectAndItsControls(this)
};
- DI.log.debug("Sending email to O2 Support with: " + text);
+ PublicDI.log.debug("Sending email to O2 Support with: " + text);
Mail.sendMail(PublicDI.sEmailHost, "O2User@ouncelabs.com",
PublicDI.sEmailToSendBugReportsTo, "",
"Email from O2 User - " + subject,
@@ -90,8 +90,8 @@ public void sendEmailToO2Support(string subject, string text, bool sendSync)
}
catch (Exception ex)
{
- DI.log.ex(ex, "in sendEmailToO2Support");
- DI.log.error(
+ PublicDI.log.ex(ex, "in sendEmailToO2Support");
+ PublicDI.log.error(
"Could not send support email, please ensure that this o2 module is connected to the Internet");
}
}
@@ -106,7 +106,7 @@ private void emailMessageSent(bool result)
if (result)
{
toolStripTextBoxForMailServer.Visible = false;
- DI.log.debug("Email sucessfull sent. Thanks");
+ PublicDI.log.debug("Email sucessfull sent. Thanks");
setDefaultEmailO2SupportMessage();
sendMessageToolStripMenuItem1.Text =
"Mail Sent OK: You can type another message and Click here to send it (or press entrer)";
@@ -132,7 +132,7 @@ private void emailMessageSent(bool result)
public static void CloseThisForm()
{
- DI.o2GuiWithDockPanel.Close();
+ O2AscxGUI.o2GuiWithDockPanel.Close();
}
@@ -145,14 +145,14 @@ public static void openLogViewerControl()
public Control getAscx(string ascxControlName)
{
- if (DI.dO2LoadedO2DockContent.ContainsKey(ascxControlName))
- return DI.dO2LoadedO2DockContent[ascxControlName].control;
+ if (O2AscxGUI.dO2LoadedO2DockContent.ContainsKey(ascxControlName))
+ return O2AscxGUI.dO2LoadedO2DockContent[ascxControlName].control;
return null;
}
public void addControlToLoadedO2ModulesMenu(O2DockContent controlToLoad)
{
- DI.o2GuiWithDockPanel.invokeOnThread(
+ O2AscxGUI.o2GuiWithDockPanel.invokeOnThread(
() =>
{
// Make sure there isn't alread an item with this type
@@ -169,7 +169,7 @@ public void addControlToLoadedO2ModulesMenu(O2DockContent controlToLoad)
public void addToLoadedO2ModulesMenu(string menuItemName, Action onMenuItemClick)
{
- DI.o2GuiWithDockPanel.invokeOnThread(
+ O2AscxGUI.o2GuiWithDockPanel.invokeOnThread(
() =>
{
var toolStripItem = new ToolStripMenuItem(
View
48 O2_External_WinFormsUI/Forms/O2GuiWithDockPanel.cs
@@ -12,12 +12,13 @@
using O2.Views.ASCX.classes.MainGUI;
using O2.Views.ASCX.Forms;
using WeifenLuo.WinFormsUI.Docking;
+using O2.Kernel.InterfacesBaseImpl;
namespace O2.External.WinFormsUI.Forms
{
public partial class O2GuiWithDockPanel : Form
{
- //private string guiXmlFormat = Path.Combine(DI.o2CorLibConfig.O2TempDir, "GuiFormat.xml");
+ //private string guiXmlFormat = Path.Combine(PublicDI.o2CorLibConfig.O2TempDir, "GuiFormat.xml");
public O2GuiWithDockPanel()
{
@@ -26,8 +27,8 @@ public O2GuiWithDockPanel()
{
// set the logRedirection in the publicDI log so that all messages go to the GUIs Log (and visible by the LogViewer)
PublicDI.log.LogRedirectionTarget = new WinFormsUILog(); // first create the one we are going to use locally
- DI.o2MessageQueue.onMessages += o2MessageQueue_onMessages;
- DI.o2GuiWithDockPanel = this;
+ KO2MessageQueue.getO2KernelQueue().onMessages += o2MessageQueue_onMessages;
+ O2AscxGUI.o2GuiWithDockPanel = this;
cbAutoSendLogsOnClose.Checked = false; // ClickOnceDeployment.isApplicationBeingExecutedViaClickOnceDeployment();
}
}
@@ -51,10 +52,10 @@ private void O2GuiWithDockPanel_FormClosing(object sender, FormClosingEventArgs
sendEmailToO2Support("On Form Closing", "Closed at: " + DateTime.Now.ToShortTimeString(), false);
PublicDI.log.LogRedirectionTarget = null;
- DI.o2MessageQueue.onMessages -= o2MessageQueue_onMessages;
- DI.o2GuiWithDockPanel = null; // reset this value since this GUI is not available anymore
+ KO2MessageQueue.getO2KernelQueue().onMessages -= o2MessageQueue_onMessages;
+ O2AscxGUI.o2GuiWithDockPanel = null; // reset this value since this GUI is not available anymore
O2AscxGUI.guiClosed.Set(); // set flag to the treads on WaitFor() can continute
- DI.log.info("O2GuiWithDockPanel form Closing"); // this log entry should now go to the Debug View
+ PublicDI.log.info("O2GuiWithDockPanel form Closing"); // this log entry should now go to the Debug View
}
private void requestHelpFromO2SupportToolStripMenuItem_Click(object sender, EventArgs e)
@@ -180,18 +181,18 @@ private void O2GuiWithDockPanel_DragDrop(object sender, DragEventArgs e)
private void ozasmtQuerytoViewAndFilterOzasmtFilesToolStripMenuItem_Click(object sender, EventArgs e)
{
- //DI.windowsForms.openAscx(typeof (ascx_OzasmtQuery), false, "O2 Tool - Ozasmt Query");
+ //PublicDI.windowsForms.openAscx(typeof (ascx_OzasmtQuery), false, "O2 Tool - Ozasmt Query");
}
private void findingsEditorToolStripMenuItem_Click(object sender, EventArgs e)
{
- //DI.windowsForms.openAscx(typeof (ascx_FindingEditor), true, "O2 Tool - Finding Editor");
+ //PublicDI.windowsForms.openAscx(typeof (ascx_FindingEditor), true, "O2 Tool - Finding Editor");
}
private void currentTempDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
{
- //DI.windowsForms.openAscx(typeof (ascx_Directory), true, "O2 Temp Directory");
+ //PublicDI.windowsForms.openAscx(typeof (ascx_Directory), true, "O2 Temp Directory");
}
private void logToolStripMenuItem_Click(object sender, EventArgs e)
@@ -203,39 +204,39 @@ private void logToolStripMenuItem_Click(object sender, EventArgs e)
private void findingsViewerToolStripMenuItem_Click(object sender, EventArgs e)
{
- //DI.windowsForms.openAscx(typeof (ascx_FindingsViewer), true, "O2 Tool - Findings Viewer");
+ //PublicDI.windowsForms.openAscx(typeof (ascx_FindingsViewer), true, "O2 Tool - Findings Viewer");
}
private void cirViewertoViewCirDataFilesToolStripMenuItem_Click(object sender, EventArgs e)
{
-// DI.windowsForms.openAscx(typeof (ascx_CirViewer_CirData), false, "O2 Tool - Cir Viewer");
+// PublicDI.windowsForms.openAscx(typeof (ascx_CirViewer_CirData), false, "O2 Tool - Cir Viewer");
}
private void unziputilToUnzipFilesOnUsingDragAndDropToolStripMenuItem_Click(object sender, EventArgs e)
{
- // DI.windowsForms.openAscx(typeof (ascx_Unzip), true, "O2 Tool - Unzip files");
+ // PublicDI.windowsForms.openAscx(typeof (ascx_Unzip), true, "O2 Tool - Unzip files");
}
/* private void o2ReflectorveryBetaVersionOfAnBuiltInNETReflectorToolToolStripMenuItem_Click(object sender,
EventArgs e)
{
- DI.windowsForms.openAscx(typeof (ascx_O2Reflector), false, "O2 Tool - O2 Reflector");
+ PublicDI.windowsForms.openAscx(typeof (ascx_O2Reflector), false, "O2 Tool - O2 Reflector");
}
*/
private void webAutomationusesFirefoxGeckoWebBrowserControlToolStripMenuItem_Click(object sender, EventArgs e)
{
- // DI.windowsForms.openAscx(typeof (ascx_WebAutomation), false, "Web Automation using Firefox Gecko Web Browser Control");
+ // PublicDI.windowsForms.openAscx(typeof (ascx_WebAutomation), false, "Web Automation using Firefox Gecko Web Browser Control");
}
/* private void sourceCodeViewerToolStripMenuItem_Click(object sender, EventArgs e)
{
- DI.windowsForms.openAscx(typeof (ascx_SourceCodeEditor), false, "File Viewer");
+ PublicDI.windowsForms.openAscx(typeof (ascx_SourceCodeEditor), false, "File Viewer");
}
private void sourceCodeEditorwriteAndExecuteDynamicCCodeToolStripMenuItem_Click(object sender, EventArgs e)
{
- DI.windowsForms.openAscx(typeof (ascx_Scripts), false, "C# Scripts Editor");
+ PublicDI.windowsForms.openAscx(typeof (ascx_Scripts), false, "C# Scripts Editor");
}
private void editThisO2ModuleStartUpXmlConfigFileToolStripMenuItem_Click(object sender, EventArgs e)
@@ -246,28 +247,28 @@ private void editThisO2ModuleStartUpXmlConfigFileToolStripMenuItem_Click(object
private void dynamicallyInvokeO2sInternalClassesAndMethodsToolStripMenuItem_Click(object sender, EventArgs e)
{
ascx_AssemblyInvoke.loadAsO2DockPanel(DockState.Float, "O2 Object Model").loadAssembly(
- DI.reflection.getCurrentAssembly(), false);
+ PublicDI.reflection.getCurrentAssembly(), false);
}*/
private void webAutomationusesFirefoxGeckoWebBrowserControlToolStripMenuItem_Click_1(object sender, EventArgs e)
{
-// DI.windowsForms.openAscx(typeof (ascx_WebAutomation), false, "Web automation - using Firefox Gecko engine");
+// PublicDI.windowsForms.openAscx(typeof (ascx_WebAutomation), false, "Web automation - using Firefox Gecko engine");
}
private void fileMappingsfilteredByFileTypeToolStripMenuItem_Click(object sender, EventArgs e)
{
-// DI.windowsForms.openAscx(typeof (ascx_FileMappings), false, "File Mappings");
+// PublicDI.windowsForms.openAscx(typeof (ascx_FileMappings), false, "File Mappings");
}
/* private void assemblyObjectInvocationshouldWorkWithMostNetAssesmbliesToolStripMenuItem_Click(object sender,
EventArgs e)
{
- DI.windowsForms.openAscx(typeof (ascx_AssemblyInvoke), false, "Generic Assembly Invoke");
+ PublicDI.windowsForms.openAscx(typeof (ascx_AssemblyInvoke), false, "Generic Assembly Invoke");
}*/
private void crashO2HeyYouKnowYouWantToToolStripMenuItem_Click(object sender, EventArgs e)
{
- DI.log.info("Crashing O2 :)");
+ PublicDI.log.info("Crashing O2 :)");
throw new Exception("How to crash O2 in 1 click!");
}
@@ -278,7 +279,7 @@ private void relauchThisO2ModuleInTempDirToolStripMenuItem_Click(object sender,
private void whichDirectoryIsThisO2ModuleRunningFromToolStripMenuItem_Click(object sender, EventArgs e)
{
- //DI.log.showMessageBox(DI.config.CurrentExecutableDirectory, "This O2 module is running from:",
+ //PublicDI.log.showMessageBox(PublicDI.config.CurrentExecutableDirectory, "This O2 module is running from:",
// MessageBoxButtons.OK);
O2AscxGUI.openAscxASync(typeof (ascx_O2InstallAndTempDirectories), O2DockState.Float, "O2 Install and Temp Directories");
@@ -290,8 +291,7 @@ private void editThisO2ModuleStartUpXmlConfigFileToolStripMenuItem_Click(object
}
private void o2CREPLScriptToolStripMenuItem_Click(object sender, EventArgs e)
- {
-
+ {
open.scriptEditor_MtaThread();
}
View
15 O2_External_WinFormsUI/O2Environment/O2DockContent.cs
@@ -6,6 +6,7 @@
using O2.External.WinFormsUI.Forms;
using O2.Interfaces.Views;
using WeifenLuo.WinFormsUI.Docking;
+using O2.Kernel;
namespace O2.External.WinFormsUI.O2Environment
{
@@ -87,7 +88,7 @@ public bool createControlFromType()
}
catch (Exception ex)
{
- DI.log.ex(ex, "in createControlFromType");
+ PublicDI.log.ex(ex, "in createControlFromType");
}
return false;
@@ -97,7 +98,7 @@ public static void launchO2DockContentAsStandAloneForm(Type typeOfControlToLoad,
{
if (typeOfControlToLoad == null)
- DI.log.error("in launchO2DockContentAsStandAloneForm typeOfControlToLoad was null");
+ PublicDI.log.error("in launchO2DockContentAsStandAloneForm typeOfControlToLoad was null");
else
try
{
@@ -106,7 +107,7 @@ public static void launchO2DockContentAsStandAloneForm(Type typeOfControlToLoad,
{
try
{
- DI.o2GuiStandAloneFormMode = true;
+ O2AscxGUI.o2GuiStandAloneFormMode = true;
//var controlToLoad = (Control) Activator.CreateInstance(typeOfControlToLoad);
// if (typeOfControlToLoad != null)
// {
@@ -120,7 +121,7 @@ public static void launchO2DockContentAsStandAloneForm(Type typeOfControlToLoad,
O2DockUtils.addO2DockContentToDIGlobalVar(o2DockContent);
o2DockContent.dockContent.Closed += (sender, e) =>
{
- if (DI.dO2LoadedO2DockContent.Count == 0) // if there are no more controls trigger the end of the GUI session
+ if (O2AscxGUI.dO2LoadedO2DockContent.Count == 0) // if there are no more controls trigger the end of the GUI session
O2AscxGUI.guiClosed.Set();
};
@@ -128,14 +129,14 @@ public static void launchO2DockContentAsStandAloneForm(Type typeOfControlToLoad,
}
else
{
- DI.log.error(
+ PublicDI.log.error(
"in launchO2DockContentAsStandAloneForm, could not create instance of controlToLoad: {0}",
typeOfControlToLoad.ToString());
}
}
catch (Exception ex)
{
- DI.log.ex(ex, "in launchO2DockContentAsStandAloneForm");
+ PublicDI.log.ex(ex, "in launchO2DockContentAsStandAloneForm");
}
sync.Set();
});
@@ -143,7 +144,7 @@ public static void launchO2DockContentAsStandAloneForm(Type typeOfControlToLoad,
}
catch (Exception ex)
{
- DI.log.ex(ex);
+ PublicDI.log.ex(ex);
}
}
View
64 O2_External_WinFormsUI/O2Environment/O2DockPanel.cs
@@ -53,7 +53,7 @@ public void openO2DockContentInNewDockPanel(string controlToLoad)
{
Type typeToLoad = Type.GetType(controlToLoad);
if (typeToLoad == null)
- DI.log.error("in openO2DockContentInNewDockPanel, could not resolve type: {0}", controlToLoad);
+ PublicDI.log.error("in openO2DockContentInNewDockPanel, could not resolve type: {0}", controlToLoad);
else
openO2DockContentInNewDockPanel(typeToLoad);
}
@@ -70,7 +70,7 @@ public void openO2DockContentInNewDockPanel(O2DockContent o2DockContent)
public void openO2DockContentInNewDockPanel(List<O2DockContent> controlsToLoad)
{
- if (DI.autoAddLogViewerToGui)
+ if (O2AscxGUI.autoAddLogViewerToGui)
addLogViewerToControlsToLoad(controlsToLoad);
@@ -86,24 +86,24 @@ public void openO2DockContentInNewDockPanel(List<O2DockContent> controlsToLoad)
private O2GuiWithDockPanel getO2GuiWithDockPanel()
{
- if (DI.o2GuiWithDockPanel == null)
+ if (O2AscxGUI.o2GuiWithDockPanel == null)
{
- DI.o2GuiWithDockPanel = new O2GuiWithDockPanel();
- DI.o2GuiWithDockPanel.Text =
- ClickOnceDeployment.getFormTitle_forClickOnce(formName ?? DI.o2GuiWithDockPanel.Text);
- DI.o2GuiWithDockPanel.Width = (formWidth > 0) ? formWidth : DI.o2GuiWithDockPanel.Width;
- DI.o2GuiWithDockPanel.Height = (formHeight > 0) ? formHeight : DI.o2GuiWithDockPanel.Height;
+ O2AscxGUI.o2GuiWithDockPanel = new O2GuiWithDockPanel();
+ O2AscxGUI.o2GuiWithDockPanel.Text =
+ ClickOnceDeployment.getFormTitle_forClickOnce(formName ?? O2AscxGUI.o2GuiWithDockPanel.Text);
+ O2AscxGUI.o2GuiWithDockPanel.Width = (formWidth > 0) ? formWidth : O2AscxGUI.o2GuiWithDockPanel.Width;
+ O2AscxGUI.o2GuiWithDockPanel.Height = (formHeight > 0) ? formHeight : O2AscxGUI.o2GuiWithDockPanel.Height;
}
- return DI.o2GuiWithDockPanel;
+ return O2AscxGUI.o2GuiWithDockPanel;
}
private void addControlToO2GuiWithDockPanelSync(O2DockContent controlToAdd)
{
var controlAdded = new AutoResetEvent(false);
var o2GuiWithDockPanel = getO2GuiWithDockPanel();
- //if (DI.o2GuiWithDockPanel.Handle != null)
- if (DI.o2GuiWithDockPanel.InvokeRequired)
- DI.o2GuiWithDockPanel.Invoke(new EventHandler(delegate { addControlToO2GuiWithDockPanelSync(o2GuiWithDockPanel,controlToAdd, controlAdded); }));
+ //if (O2AscxGUI.o2GuiWithDockPanel.Handle != null)
+ if (O2AscxGUI.o2GuiWithDockPanel.InvokeRequired)
+ O2AscxGUI.o2GuiWithDockPanel.Invoke(new EventHandler(delegate { addControlToO2GuiWithDockPanelSync(o2GuiWithDockPanel,controlToAdd, controlAdded); }));
else
addControlToO2GuiWithDockPanelSync(o2GuiWithDockPanel,controlToAdd, controlAdded);
@@ -119,7 +119,7 @@ private static void addControlToO2GuiWithDockPanelSync(O2GuiWithDockPanel o2GuiW
//var sync = new AutoResetEvent(false);
// add the control on the o2GuiThread
- //DI.o2GuiWithDockPanel.Invoke(new EventHandler(delegate {
+ //O2AscxGUI.o2GuiWithDockPanel.Invoke(new EventHandler(delegate {
try
{
if (controlToAdd.createControlFromType())
@@ -133,17 +133,17 @@ private static void addControlToO2GuiWithDockPanelSync(O2GuiWithDockPanel o2GuiW
}
if (controlToAdd.dockState == DockState.Document)
{
- if (DI.o2GuiWithDockPanel.Width < controlToAdd.desiredWidth)
- DI.o2GuiWithDockPanel.Width = controlToAdd.desiredWidth + 10;
- if (DI.o2GuiWithDockPanel.Height < controlToAdd.desiredHeight + 100)
- DI.o2GuiWithDockPanel.Height = controlToAdd.desiredHeight + 100;
+ if (O2AscxGUI.o2GuiWithDockPanel.Width < controlToAdd.desiredWidth)
+ O2AscxGUI.o2GuiWithDockPanel.Width = controlToAdd.desiredWidth + 10;
+ if (O2AscxGUI.o2GuiWithDockPanel.Height < controlToAdd.desiredHeight + 100)
+ O2AscxGUI.o2GuiWithDockPanel.Height = controlToAdd.desiredHeight + 100;
}
O2DockUtils.addO2DockContentToDIGlobalVar(controlToAdd);
}
}
catch(Exception ex)
{
- DI.log.ex(ex, "in addControlToO2GuiWithDockPanelSync");
+ PublicDI.log.ex(ex, "in addControlToO2GuiWithDockPanelSync");
}
controlAdded.Set();
@@ -156,8 +156,8 @@ private void addControlsToFormAndStartIt(IEnumerable<O2DockContent> controlsToAd
{
// if (mainO2Form.getDockPanel().okThread(delegate { addControlsToFormAndStartIt(mainO2Form, controlsToLoad); }))
{
- // check if the DI.o2GuiWithDockPanel exists, and if it doesn't create it (we need to do do this here because of multi=thread conflics
- // that occour sometimes if the DI.o2GuiWithDockPanel is created on a separate thread
+ // check if the O2AscxGUI.o2GuiWithDockPanel exists, and if it doesn't create it (we need to do do this here because of multi=thread conflics
+ // that occour sometimes if the O2AscxGUI.o2GuiWithDockPanel is created on a separate thread
foreach (O2DockContent controlToAdd in controlsToAdd)
addControlToO2GuiWithDockPanelSync(controlToAdd);
@@ -168,12 +168,12 @@ private void addControlsToFormAndStartIt(IEnumerable<O2DockContent> controlsToAd
//ClickOnceDeployment.startThreadFor_checkForClickOnceUpdatesAndInstall(); // removed
guiLoaded.Set();
- Application.Run(DI.o2GuiWithDockPanel);
+ Application.Run(O2AscxGUI.o2GuiWithDockPanel);
}
catch (Exception ex)
{
- //DI.log.reportCriticalErrorToO2Developers(this, ex, "Inside Application.Run(mainO2Form);");
- DI.log.error("Inside Application.Run(mainO2Form);: " + ex.Message);
+ //PublicDI.log.reportCriticalErrorToO2Developers(this, ex, "Inside Application.Run(mainO2Form);");
+ PublicDI.log.error("Inside Application.Run(mainO2Form);: " + ex.Message);
}
}
}
@@ -234,9 +234,9 @@ public static O2DockContent addAscxControlToO2GuiWithDockPanel(Type ascxControlT
DockState dockState,
String name, bool showControl)
{
- if (DI.o2GuiWithDockPanel == null)
+ if (O2AscxGUI.o2GuiWithDockPanel == null)
{
- DI.log.error(" in addAscxControlToO2GuiWithDockPanelWithDockState o2GuiWithDockPanel was null, so aborting load of {0}", ascxControlToLoad.FullName);
+ PublicDI.log.error(" in addAscxControlToO2GuiWithDockPanelWithDockState o2GuiWithDockPanel was null, so aborting load of {0}", ascxControlToLoad.FullName);
return null;
}
var o2DocContent = new O2DockContent(ascxControlToLoad, dockState, name);
@@ -254,7 +254,7 @@ public static O2DockContent addAscxControlToO2GuiWithDockPanel(Type ascxControlT
if (false == DebugMsg.IsDebuggerAttached())
o2DocContent.controlLoadedIntoGui.WaitOne();
else if (false == o2DocContent.controlLoadedIntoGui.WaitOne(10000))
- DI.log.error("Failed to load control {0} in 10 sec", o2DocContent.name);
+ PublicDI.log.error("Failed to load control {0} in 10 sec", o2DocContent.name);
}
return o2DocContent;
}
@@ -263,11 +263,11 @@ public static void showO2DockContentInDockPanel(O2DockContent o2DockContent)
{
try
{
- DI.log.info("on O2DockPanel.showO2DockContentInDockPanel: {0} [{1}]", o2DockContent.name, o2DockContent.type);
- if (DI.o2GuiWithDockPanel.okThread(delegate { showO2DockContentInDockPanel(o2DockContent); }))
+ PublicDI.log.info("on O2DockPanel.showO2DockContentInDockPanel: {0} [{1}]", o2DockContent.name, o2DockContent.type);
+ if (O2AscxGUI.o2GuiWithDockPanel.okThread(delegate { showO2DockContentInDockPanel(o2DockContent); }))
{
// if (o2DocContent.dockContent.okThread(delegate { showO2DockContentInDockPanel(o2DocContent); }))
- // if (DI.o2GuiWithDockPanel.getDockPanel().okThread(
+ // if (O2AscxGUI.o2GuiWithDockPanel.getDockPanel().okThread(
// delegate { showO2DockContentInDockPanel(o2DocContent); }))
// now that we are on the correct thread the control can be created
@@ -275,7 +275,7 @@ public static void showO2DockContentInDockPanel(O2DockContent o2DockContent)
{
if (o2DockContent.dockContent.TopLevelControl != null)
{
- o2DockContent.dockContent.Show(DI.o2GuiWithDockPanel.getDockPanel(), o2DockContent.dockState);
+ o2DockContent.dockContent.Show(O2AscxGUI.o2GuiWithDockPanel.getDockPanel(), o2DockContent.dockState);
if (o2DockContent.dockState == DockState.Float &&
o2DockContent.dockContent.TopLevelControl != null)
@@ -286,13 +286,13 @@ public static void showO2DockContentInDockPanel(O2DockContent o2DockContent)
}
}
else
- DI.log.error("in showO2DockContentInDockPanel, could not create instance of controlToLoad: {0}",
+ PublicDI.log.error("in showO2DockContentInDockPanel, could not create instance of controlToLoad: {0}",
o2DockContent.type.ToString());
}
}
catch (Exception ex)
{
- DI.log.ex(ex, "on O2DockPanel.showO2DockContentInDockPanel");
+ PublicDI.log.ex(ex, "on O2DockPanel.showO2DockContentInDockPanel");
}
o2DockContent.controlLoadedIntoGui.Set();
}
View
63 O2_External_WinFormsUI/O2Environment/O2DockUtils.cs
@@ -8,6 +8,7 @@
using O2.External.WinFormsUI.Forms;
using O2.Interfaces.Views;
using WeifenLuo.WinFormsUI.Docking;
+using O2.Kernel;
namespace O2.External.WinFormsUI.O2Environment
{
@@ -20,9 +21,9 @@ public static bool setDockState(string name, O2DockState state)
public static bool setDockState(string name, DockState state)
{
- if (DI.dO2LoadedO2DockContent.ContainsKey(name))
+ if (O2AscxGUI.dO2LoadedO2DockContent.ContainsKey(name))
{
- DI.dO2LoadedO2DockContent[name].dockContent.DockState = state;
+