MEF

Today I wish to tell about the build system a dynamic, modular application using Managed Extensibility Framework (MEF). Generally this is quite an old technology, which resulted from the system Add-On from the company Microsoft. MEF was a friendly shell over the monstrous system previously proposed. The result was so good that the MEF included in delivery .Net Framework 4 by default, so no need to search and download the library separately, and worry whether the library has a person.

It is also now clear that this technology can be used in the development of Enterprise, as it is in the main supply of the framework, but it’s such an argument against which project managers do not trample. Typically, project managers are very reluctant to use technologies and products which are not mentioned in press releases MS, even if the technology is widely and successfully used by the community. Although they can understand, this is the first point on which they will be kicking in the event of any overlap.

So, MEF easy to make the application modular, and adding new libraries can be carried out on the fly, without the use of sophisticated techniques. All the code is transparent and easy to understand.

MEF can be used starting with version. Net 3.5, taking the necessary libraries from CodePlex. As you may have guessed, from there you can take the source code and see how it all works.

Main features of MEF:

  • Provides a standardized way to organize workshops for the application and its appendices. In general, supplements are not tied to a specific application and implement a common interface can be used by different programs, which generally does not cancel and tight binding to the master application. Supplements may be dependent on one another and MEF alone connect them in the correct order.
  • Provides search and download of the add-ons by MEF
  • Allows you to tag metadata additions for additional opportunities to connect and filter adds.

Continue reading

Launch of .bat files out of Visual Studio 2010

Or how to hang a voluntary action to the context to any item in the Project Explorer.

As already mentioned in the title, this step will be to rotate. Bat files since they are widely used in our daily activities, and constantly open Explorer or FAR is not very convenient. Much better to have effect until the pile and hang it on the key combination to achieve complete nirvana

So, given: a project that uses a batch file

Required: run a batch file from the context menu in the Project Explorer.

Continue reading

NuGet creation

NuGet creation
The last time I spoke as NuGet is used, this time it is logical to tell you how to create your NuGet package and place it on a shared hosting or on your own in a local directory, or else in the gallery.

Creating your own package NuGet

For example, and I think in most cases, you’ll create a package NuGet without dependencies on other packages. So we need any project, for simplicity let it be a simple library with the N- of methods.

In order to be able to set library or libraries to include in the final NuGet package, you must add the project file with the extension “.Nuspec“, where there will be described all the properties and the internal function of our package. So far, in the studio there is no setting to create the files required extensions, so that you can create any text file, and change it’s dwells.

In general, the nuspec file looks as follows:

<?xml version="1.0" encoding="utf-8"?>
<package>
  <metadata>
    <id>WBR.ArgParser</id>
    <version>1.0.0</version>
    <title>Argument Parser library</title>
    <authors>Violet Tape</authors>
    <description>Easy to use library for parsing app arguments.</description>
    <language>en-US</language>
    <projectUrl>http://violet-tape.net</projectUrl>
    <iconUrl>http://violet-tape.net/images/commandprompt.png</iconUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
  </metadata>
  <files>
    <file src="bin\Release\WBR.ArgParser.dll" target="lib" />
  </files>
</package>

 

We can say that the comments here are irrelevant. The only thing that is necessary to specify is which tags are mandatory and which are optional.

Continue reading

NuGet using

Today I would like to talk about the use of NuGet. Surely you’ve heard something about this system of management of external dependencies. Recently, the system grows and more and more developers are putting their systems in the wrapper for distribution with the help of NuGet.

NuGet – a manager to control the dependencies on external libraries. With this tool you can install, update and remove according to your project with great ease. This applies both for the desktop software and the web. In particular, when expanding the CMS Orchard, she drags the half assembly during installation of the library on their own packages. There are examples of NuGet for Silverlight.

Notes from the back seats

When studying materials NuGet, a plus appears availability of shared libraries to your projects. Conditional opponents NuGet, or principled opposition asks why you need NuGet for their shared libraries, if there can be external to SVN, and other such things for VCS? So you can refer to the stable branch sources.

Developers NuGet answer that

  • do not control whether access to the version control system,
  • source code is not displayed to other groups
  • no need to monitor and switch to other audits by hand (maybe you want to jump from branch Release, to an earlier, or you are referring to an audit in trunk)

Quite good advantages. Especially now that your favorite library does not get lost among repositories and projects.

Continue reading

Enum with a human face

A problem

Quite often we have to use enums for a limited set of values. They are very easy to use in your code, but there are problems for bringing them to the interface of the application. Not only in Russian but in English. The values ​​in enum may consist of several words logically and embarrassing them to show in the user interface. For example:

public enum MyEnum {
    None,
    CompositeValue,
    Single
}

Naturally, it is show to the customer CompositeValue is not good. Much better to show “Composite Value”. Or, to translate it into Russian.

Continue reading

Win7 Jump List – II

The last time we stayed on the fact that we have a program that can “group” icons from taskbar. If you run it and understood, it was noticed that the program has one unpleasant flaw in the usability . When you set the program to run by default – it can not be seen. Required to rely on their memories and habits. So we will correct this deficiency.

As you probably noticed last time, the images I have shown are mini-icons-default applications and those applications I have several. So let us consider in more detail how to achieve this for you too.

Continue reading

Win7 Jump List

Probably about the new Win7 features just lazy person hasn’t written, and a lot of reviews on the internet on how to apply it. I noticed that reading technical articles, which simply tell show to apply, or that tool is not very interesting. Much more interesting when technology is used on a particular useful example, resulting in a small useful program. Of course, this turns out not always, but lately I’ve been more and more I try to do.

Thus, we’ll solve the following problem: I have a lot of icons in the taskbar is attached. 2 studios, SQL Server, Expression studio, office applications, browsers – all this would be helpful to group and to the default run basic applications.

Continue reading

Notepad – –

This article is somewhat unusual in comparison to all previous ones, because it’s more like a conclusion and the summaryzing of the previous articles of this season. This is an example of interaction between the components of which I wrote recently: interprocess communication, command manager, the registration of extensions. Example I named so because it was chosen as an example of Notepad++, but due to the fact that this program only shows the options capability in close to real-life, we get a minus-minus.

You can name the current compilation of the backbone for further development. Now the program can open by clicking on the file with a registered extension, the file opens in new tabs, or, if you ask, then close all other tabs and the file will open in a single tab. There will always be running only one instance at one time.

I think that I should still consider how it works in reality. Focusing only on the differences that have emerged in real life. At the same time and will be seen asdescriptive material is different from a working prototype.

Continue reading

Command Manager

Today I want to tell you about the pattern Command and Command Manager. All this went smoothly. In the last article, this is so and suggests itself, but I was too lazy to twist it back, I decided to tell apart. Although at first I had doubts as to whether to tell all. Because I go to distribute the 5 ways to implement (as the complexity and development of the idea, but then one still rejected), and this functionality is even more developed and built in WPF. In the end, I think it will be useful to beginners, to be better understood how to use it in the future, in WPF, and in general.

Let’s start with the official part, that’s what Wikipedia tells us about the purpose of this template:

Command – a design pattern used in object-oriented programming, which is for an action. The command object contains the action itself and its parameters. Provides processing commands in the form of an object that allows you to save her, to pass as a parameter of the method, and return it as a result, like any other object.

From the definition we can say that with the help of commands to make the application less connected with each other. This can be useful for writing plug-ins when there are different implementations of a single action, when to run the program, with arbitrary initial actions identified in the command line, for example.

Continue reading

Interprocess Communications

I have been interested for a long time how to do so that the one instance was running only. I mean I have known in theory with the help of what it should be done, but I haven’t tried yet..Another very interesting thing is how to do as for instance I open an Excel spreadsheet and it does not open in another application, but the fact that is already open. This course enrages sometimes, but still technology is interesting.

The rustling in the Internet has brought to what is called Interprocess Communication (IPC) and there are many ways how to implement it, depending on the ultimate goal, whether you have only one instance, or as in Excel, or something else. Further study of the issue and gave birth to this article.

Continue reading