Read data for Inteliprompts in RadSyntaxEditor from dll or xml - winforms

RadSyntaxControl is newly created control from Telerik and has a feature for InteliPrompts but in every sample, I found out the user must manually populate CompletionInfoCollection, as you can see in this example.
CompletionInfoCollection completionList = new CompletionInfoCollection()
{
new CompletionInfo("Achitect", "A software developer expert.", Image.FromFile(#"../../SyntaxEditor/ Achitect.png")),
};
this.radSyntaxEditor1.SyntaxEditorElement.IntelliPrompts.CompletionListWindow.Presenter.CompletionListItems = completionList;
It is ok if there are just a few items for autocomplete but what in a case if I want to autocomplete for language like C#. Telerik has a syntax highlight for C#, but I cannot find a way to populate IntelliPromts with data in that manner.
The sample code is from Telerik Blogs
Thank you :)

Nenad,
As you have already found out, RadSyntaxEditor uses a CompletionInfoCollection to define intelliprompts which aim to speed up coding by reducing typos and other common mistakes. It is just necessary to define a separate CompletionInfo for each item that you want in the completion list window. It is up to you what list to be displayed and how you will get this information. This job is not intended to be done by the RadSyntaxEditor control. Additional information is available in the following help article: https://docs.telerik.com/devtools/winforms/controls/syntax-editor/features/intelliprompts
I have researched in the forums and since the English version of IntelliSense files are embedded in Visual Studio, I have found the following MSDN article which offers different language packs for the IntelliSense. Hence, you can at least use it to investigate what are the keywords and replace the translation according to your needs: https://learn.microsoft.com/en-us/dotnet/core/install/localized-intellisense
I hope this information helps.

Related

How to handle Solutions, Projects and their contents in a VisualStudio extension

In short:
I'm new to VisualStudio Extensibility and my goal is to create an extension with a ToolWindow (which already works) showing different views for each context of a VisualStudio solution, i. e. a view for the solution, a view for a project etc.. The window should be opened by clicking on a context menu entry in the context menus of the Solution Explorer, Class View, Object Browser and (ideally) any other window showing contents like projects, namespaces, classes etc..
After searching I found a lot of information, but for some points I couldn't find very helpful information. How do I ...
... create a context menu item for the VisualStudio views?
... get the currently open solution as an instance in code?
... get the projects of the solution and their contens as instances in code?
... add/remove items to/from a solution/project/class/... in code?
... react to selection changes in the Solution Explorer?
What I've done, so far:
I read the docs for Starting to Develop Visual Studio Extensions and downloaded the VSSDK-Extensibility-Samples. Especially the WPF_Toolwindow example was interesting for my purposes, so I built and ran it, which was successful, so far. Another interesting sample would have been the WPFDesigner_XML, but it always throws a NullReferenceException, so I decided to stick with the former ToolWindow, which is completely fine, for now.
Furtermore, I tried to understand the example by having a close look at each file in the project, running it in the debugger and analyzing what happened. I'm confident I understood it, but am also open for corrections of my possibly misguided thoughts following.
Now, I have created a new project, based on the WPF_Toolwindow sample, renamed and adapted to my needs (basically, I created new GUIDs, renamed the namespaces and removed things I won't use). This extension still works in the debugger. I even uninstalled everything from the experimental instance and debugged the extension from scratch.
What I try to achieve:
Have the ToolWindow load a specific view/viewmodel, when the selection changes in the Solution Explorer (or any other VisualStudio view). Alternatively, there should be a context menu item for every node's context menu in the Solution Explorer tree (or any other VisualStudio view).
Get the currently open solution, the containing projects and basically everything from the Solution Explorer's content as instances processable in my viewmodel. I need to properly add/remove
classes/structs/enums to/from
a folder in a project
a namespace
properties/fields to/from a class/struct
Generate code based on information of the solution and add the file properly to a project.
Does anyone know of examples for something like this or can anyone give me some hints, where I can find further information? Any help would be appreciated. Thanks in advance.
(1) The items already have a context menu and I want to add a new command to this menu.
if you want to add a sub menu to the context menu, the following link provide a complete sample
https://github.com/visualstudioextensibility/VSX-Samples/tree/master/CommandSubmenu
(3) Yes, basically adding a file to a project without manually manipulating the project file would be nice.
You can add the file to project via Project.ProjectItems.AddFromFile, and the following provide a sample for your reference.
https://www.mztools.com/Articles/2014/MZ2014009.aspx
Update:
I select a project and a similar event is fired. Are there such events I can subscribe to?
You could use IVsMonitorSelection to implement. here is the code which retrieve related project path for your reference.
IntPtr hierarchyPointer, selectionContainerPointer;
Object selectedObject = null;
IVsMultiItemSelect multiItemSelect;
uint projectItemId;
IVsMonitorSelection monitorSelection =
(IVsMonitorSelection)Package.GetGlobalService(
typeof(SVsShellMonitorSelection));
monitorSelection.GetCurrentSelection(out hierarchyPointer,
out projectItemId,
out multiItemSelect,
out selectionContainerPointer);
IVsHierarchy selectedHierarchy = Marshal.GetTypedObjectForIUnknown(
hierarchyPointer,
typeof(IVsHierarchy)) as IVsHierarchy;
if (selectedHierarchy != null)
{
ErrorHandler.ThrowOnFailure(selectedHierarchy.GetProperty(
projectItemId,
(int)__VSHPROPID.VSHPROPID_ExtObject,
out selectedObject));
}
Project selectedProject = selectedObject as Project;
string projectPath = selectedProject.FullName;
For more information about the usage, please refer to:
https://www.mztools.com/articles/2007/mz2007024.aspx

Spreadsheet Gear migration errors

I am migrating Spreadsheet gear of my application from 6.0.3.190 to
7.4.1.104.I am getting my issues with Color property.Can any one help me in this.Now I am using using Color = System.Drawing.Color; and also ToSGColor().This became very hectic to do in all places where ever we use color.I expect we should have some shortcut to do this.Can any one suggest me How can i get all functionalities with few changes only.I am also getting exceptions to c onvert IColorFormat.LineColor to system.drawing.Color.
Note the "Breaking Changes" page in the SpreadsheetGear 2012 documentation, which lists this particular change:
In order to support WPF and Silverlight, the core API has been
separated from the GDI+ and Windows Forms APIs and therefore uses the
new SpreadsheetGear.Color type rather than
SpreadsheetGear.Drawing.Color. SpreadsheetGear.Drawing.Color has been
moved to SpreadsheetGear2012.Drawing.dll. See
SpreadsheetGear.Drawing.Color for an example which uses the implicit
and static converters to convert between SpreadsheetGear.Color,
SpreadsheetGear.Drawing.Color and System.Drawing.Color.
SpreadsheetGear.Colors and SpreadsheetGear.SystemColors provide
helpful predefined colors to replace the use of predefined colors in
System.Drawing.Color.
So you'll need to ensure than any place where you were previously using System.Drawing colors now use SpreadsheetGear.Drawing colors, including API like IColorFormat.LineColor.
There aren't really any "migration" tools to automatically convert such instances to the new API. So you'll need to resolve these errors for each code file. Doing a Find/Replace keyword search for "System.Drawing" and "SpreadsheetGear.Drawing" could possibly speed up the process, though this would depend on what using statements you have added to each code file.

need to create a custom control

I have below requirement:
I wanted to create a custom control in which developer should be able to access below three properties.
Label:
IsRequired
content.
Example 1:
Name(Label): TextBox/any input control(Content)
Example 2:
Name(Label)*(IsRequired): TextBox/any input control(Content)
Developer should be able to apply globalization to the Label
If the field is required then he should be able to set a property
to enable * symbol
Developer should be able set any input control as a content of the control.
I request your suggestions, if you send me a sample code that would be good for me.
This demo doesn't seem latest but should be a good start. Googling around a bit more with the keywords found in the demo will also yield some relevant results.

What's a good, affordable "knob" library?

I'm currently thinking of a new pet project, an "editor" for MIDI-enabled synths. I've got the MIDI side covered, I suppose, but what I'm looking for right now is something that can pass for nice "dials" and "knobs" like you see in Ableton Live, Reason, Reaktor, and so forth.
Putting my form full of trackbars, is sort of wasteful, y'know?
So, what is a nice affordable .NET 2.0 library that has that sort of graphical components?
1- http://www.codeproject.com/KB/cs/industrial_controls.aspx has some related controls (C#)
2- http://www.c-sharpcorner.com/UploadFile/desaijm/KnobControlusingWindowsForms11182005004925AM/KnobControlusingWindowsForms.aspx is another C# based Knob Control
Used the (2) personally on one project and it worked great (though not visually very strong). (1) looks cooler but havn't explored
Check out some of these. If none just do search for ".net gauges". Most of the major UI control libraries have a gauge or dashboard library.
http://www.perpetuumsoft.com/Product.aspx?lang=en&pid=44
http://www.brothersoft.com/software_developer/microsoft_.net/.net_dashboard_suite_56186.html
http://www.componentone.com/SuperProducts/GaugesSilverlight/
http://www.dundas.com/
I've never used this myself, but found KineticaRT controls. $67.06.
(source: eclipse.co.uk)
GMSI.Net Knob v2.0. $169.00.
alt text http://www.globalmajic.com/mc_images/product/thumbnail/net_knob150.jpg

Explain System.Diagnostics.CodeAnalysis.SuppressMessage

I have this kind of code in some applications (from microsoft)
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(
"Microsoft.Naming",
"CA1702:CompoundWordsShouldBeCasedCorrectly",
MessageId = "CounterClockwise",
Scope = "member",
Target = "ScePhotoViewer.PhotoDisplayControl.#RotatePhotoCounterClockwiseCommand"
)]
Can anyone explain me this ?
Is there any blog explaining how to use it, the real benefits...
Thanks
Jonathan
This attribute is used by Team Foundation Server's (TFS) code analysis functionality to exclude code fragments that would otherwise trigger warnings. You can safely remove them if you're not using TFS code analysis.
The attributes can be added by hand or, more usually, are added automatically via the Visual Studio GUI when the "Suppress Message" option is selected in the error list.
This attribute simply suppresses the generation of the specified warning messages during code analysis by TFS. No code is is excluded.

Resources