Tuesday, July 1, 2008

How to build a Bookvar addin

 

tmp10D

In this short post I'll try to give you a brief introduction of how you can build your own addin for Bookvar. We have been receiving some requests to include export to plain text functionality and thus I decided to build a sample addin that does it.

Before I continue I'd like to mention that the following content is mostly for developers. Non-developer folks will understand very little of it and may not find it interesting. However, you can scroll directly to the bottom of the post. There, you will find a link from which you can download the addin and also instructions for deployment.

 

Prerequisites

 

Before you start building your magnificent addin you need to have a couple of prerequisites installed.

 

Visual Studio 2008

 

tmp14D

In order to create any kind of addin for Bookvar you need to have Visual Studio 2008 installed. There is no limitation of what kind of Visual Studio edition you use - you can use the free Express edition. You can get it from:

http://www.microsoft.com/express/download/

 

Bookvar installation

 

tmp19C

To test and work with your addin you need to have Bookvar installed. You can get it directly from:

http://bookvar.net

 

The Process of creation

 

Initial project creation

 

To start with you need to create a Visual Studio project that you are going to work on. The type of project that you have to choose is Class Library project type:

ScreenShot

 

Assembly references

 

Once you have created the project you need to add some assembly references to it.

First you need to add the Bookvar assemblies that provide class infrastructure for your addin. The assemblies are:

Bookvar.Common

Bookvar.ObjectModel

Bookvar.Addins.AddInViews

You can find these assemblies in Bookvar's installations folder (by default it is 

C:\Program Files\AVAXO\Bookvar).

Additionally you need to reference some other .NET Framework assemblies:

PresentationFramework

System.AddIn

WindowsBase

When you are done adding assembly references you are ready to start coding.

 

The actual code

 

By default Class Library projects come with one dummy class file called Class1.cs. You can either rename the file (which will rename the class in it) or delete it and create a new one with the name you like. I called mine ExportToPlainTextAddin.cs. It will be the only class that I intend to create for this addin, however you can have as many as you need.

The next step is to add some using statements, attributes and inherit a base class. After that my class declaration looks more like this:

    1 using System;

    2 using System.AddIn;

    3 using System.IO;

    4 using System.Text;

    5 using System.Windows.Forms;

    6 using Bookvar.AddIns.AddInViews;

    7 using Bookvar.Common;

    8 using Bookvar.ObjectModel;

    9 

   10 namespace ExportToPlainText

   11 {

   12     [AddIn("Export To Plain Text Addin", Version = "1.0.0.0")]

   13     public class ExportToPlainTextAddin : BookvarAddinView

 

The base class for my addin is BookvarAddinView. It is abstract so you need to implement (override) one property and one method:

 

 public override void Execute(Topic topic)

 public override AddinInfo Info

 

The Info property is of type AddinInfo. It has some properties that are used for visualizing the addin button in the ribbon toolbar. The most interesting one is Image as it is used for displaying the icon for the addin. You need to assign a byte array to it that represents the image you want to show. The best way is to have the image embedded as a resource into the addin assembly and extract it from there.

 

   77 public override AddinInfo Info

   78 {

   79     get

   80     {

   81 

   82         AddinInfo info = new AddinInfo

   83         {

   84             Name = "Plain Text",

   85             Group = "Export",

   86             Description = "Exports a mind map to a plain text file",

   87             Image = AssemblyUtility.LoadImageFromResources(

   88                 typeof(ExportToPlainTextAddin).Assembly,

   89                 "ExportToPlainText.Notepad30.png")

   90         };

   91 

   92         return info;

   93     }

   94 }

 

The method you need to override is void Execute(Topic topic). It is called every time the addin is executed. Here, we meet a new type called Topic. It represents mind map topic with all of its properties like notes, hyperlink, attachments etc. For now we will need mainly on the Name and Note properties as we are going to export only those to a text file.

In my addin I'm going to show a SaveFileDialog first and if the user enters a name of a file, I'll save the content of the mind map in that file. Here is how my Execute method looks like:

 

   21 public override void Execute(Topic topic)

   22 {

   23     SaveFileDialog fileDialog = new SaveFileDialog

   24     {

   25         Filter = "Plain Text (*.txt)|*.txt|All Files (*.*)|*.*"

   26     };

   27     if (fileDialog.ShowDialog() == DialogResult.OK)

   28     {

   29         string fileToExportTo = fileDialog.FileName;

   30         string exportedText =

   31                     GetTopicTextContent(topic, String.Empty, 0);

   32         File.WriteAllText(fileToExportTo,exportedText);

   33 

   34         MessageBox.Show("Map exported successfully!",

   35                 "Success",

   36                 MessageBoxButtons.OK,

   37                 MessageBoxIcon.None);

   38     }

   39 

   40 }

 

In this method I'm calling a method called GetTopicTextContent. It runs through the topic's children recursively and returns its text representation. I'm not going to write that method's code here as it is not showing anything interesting. However, if you want to see it I'll attach a link to the source code of this addin for download.

 

Testing and deployment

 

In order to test whether your addin works you need to put it in action. To do this, you need to create a separate folder under the addins folder of Bookvar (by default it is situated here - C:\Program Files\AVAXO\Bookvar\Addins). In my sample the folder is called ExportToPlainText. Once you build your addin project, you need to copy from its bin directory all files except one dll to the newly created folder. The dll you have to not have copied is the Bookvar.Addins.AddInViews.dll.

It is a bit sloppy to copy assemblies every time you build, however except for the ExportToPlainText.dll all others will not change and so there is no need to copy them every time. For the ExportToPlainText.dll you can use a post build event commands to copy it automatically. Have in mind that if the Bookvar is running and has loaded your addin, you won't be able to override it.

Once you have your addin finished you can pack it up in a simple XCopy installer that will just copy your folder to Bookvar's Addin folder.

 

Download

 

The compiled and ready for work version of the addin can be downloaded from here and the source code for it from here.

 

Installation instructions

 

To get the addin to work you just need to extract the folder that is contained into the zip to Bookvar's addin folder (by default it is - C:\Program Files\AVAXO\Bookvar\Addins) and start Bookvar and have fun.

P.S.: If you start developing your own addins we encourage you to send them to us so we can include them in future releases.

Thursday, May 29, 2008

New 'alpheta' release

A new version of Bookvar was released. This is mostly a maintenance release - fixing the bugs you have reported. Some enhancements made it through as well - for example adding live images and resizing is much slicker.

We hope that the new version will allow you to use Bookvar with less problems, while we continue moving forward. Wish us luck and thanks for all the support!

Tuesday, April 15, 2008

Strengthening Bookvar

We are proud to introduce you to the new version of Bookvar. The quality is still alpheta (beyond alpha, but not still beta), but we tried very hard to introduce some features that will greatly improve the way you interact with the application. We have received great feedback about Bookvar with suggestions for improvements as well as comments that pointed out the pain zones with the current version. Most problems came out from that Bookvar was not stable enough and the users were constantly pressing the save button. Let me show you what we have done:

New features

Here are the new features that we introduced in this release:

  • Undo/Redo - previously it was impossible to undo your actions. With this release we introduce this functionality, so it will be easier for you to manage your mind maps and undo or redo your changes. The standard keyboard commands (Undo-Ctrl+Z and Redo-Ctrl+Y) can be used as well.
  • Auto Update - from now on Bookvar will ping our servers for a new version whenever you start it (this is configurable from the options window). If a new version is available you will be available to download and install it immediately. This will allow you to stay in touch with the updates that we are going to push these months.
  • Auto Save and Crash Recovery - by popular demand we are introducing this feature. It will allow you to set interval at which your open mind maps will be saved to a temporary file. If the system crashes on next start a window with all recovered maps will be presented to you. You will have a different options how to act upon the maps, but the most important is that your time is not lost and your work is destroyed.
  • Some smaller improvements include:
    • Curved lines for connection between topics.
    • Standard save as functionality
    • Full screen mode for video player when you add a movie to a topic.
    • Other minor cosmetic changes.

Bug fixes

We have fixed a bunch of bugs in these release (as well as introduced a dozen new ones :) )

  • Map Layout Persistence - there were some nasty problems when you try to rearrange the map and then save it. We have tried hard to fix this and believe that the current release is much more better in this direction. There are still some problems to nail down, but we will address them in the future releases.
  • Topic Buttons Not Visible - when you hide and then show (using the +/- button) some topic that have notes, attachments or link the button which are displayed around the topic were not visible any more. This is now fixed.
  • Long Content in Notes - If you put long text in the notes the buttons for save and cancel were not visible. It is OK now.
  • Some other ones we have encountered while we were using Bookvar

You can find the new version on its usual place here. From now on it will automatically inform you about the new updates, so this will be the last release that you have to download manually.

Have fun and Feel Free To Mind.

Wednesday, November 28, 2007

Bookvar on final .NET 3.5 Framework

Great news: We have released a new version of Bookvar - alpheta 2. (alpheta = post alpha before beta version, in maths' terms alpha < alpheta < beta). Here are the improvements:

Final .NET 3.5 integration

This version is built against the final version of the .NET 3.5 framework, no more betas. If you have already installed Bookvar it's preferred first to uninstall it, then to uninstall .NET 3.5 beta 2. After that just run the new setup file. It will install the new framework first, unless you already have it installed.

Multilingual support

We have added localization infrastructure that will allow Bookvar to have multilingual support. Currently we have two languages - English and Bulgarian. They can be toggled from the options window. If you're interested in localizing Bookvar into your language drop us a line from the contact form.

Media (image, movies, attachments) improvements

There are two main improvements in the media aspect of Bookvar:

  • Inserting Image/File to selected topic. Currently if you want to add an image to a particular topic you should click the image button in the ribbon. For example adding a web (live) image to selected topic was impossible, because a new child topic was created with the image. This is now changed and the default behavior is the image to be added to the topic on which you drop it. This also applies for images/files that you drag from the file system directly on the mind map. If you however want to create a subtopic you should press the Ctrl key before dropping the item .
  • Resizing of images or videos is persisted. In the previous version it was very annoying that the resizing of image (or video) added to a topic was not persisted in the file. This lead to a lot of manual work if you want the added image to be smaller for example. All this is now working as expected and the dimensions are stored in the .bmm file.

Other improvements and bug fixes

There are a lot of little improvements and fixes. Here is a list of some of them:

  • Vista dialog boxes added. The new vista based dialog boxes are added when it is required to browse the files system. What is cool about them is that they have the search box in the top right corner.
  • Presentation Exit button. Till now the only way to exit from presentation mode was to press Backspace. We have so used to this that did not noticed that there are no button for the operation. A couple of user's send us feedback about it and now we have a exit button in presentation mode.
  • Multiple subtopics copy problem. When you try to copy a topic with multiple subtopics an error occurred, that is now fixed. By the way the only way to copy topics now is to start drag an existing topic in the same time if you hold down the Ctrl key the topics will not be moved, but copied.
  • Recent files locked problem. If you try to open two Bookvar instances at same time, sometimes you get an error because the file where store your recent files get's locked. This is fixed now.
  • Some inconsistencies in windows' icons and labels.

That's all for this month's release. Go download Bookvar and have fun with it. And don't remember to send us your feedback.

P.S.: We have over 1300 downloads just for one month in the wild. Thanks to all guys that have installed and tried Bookvar. We have some great feedback from people all over the world. This will keep us motivated to continue to innovate in the mind mapping space. So stay tuned, because great things are about to happen.

Tuesday, November 13, 2007

Bookvar shortcuts

There have been a lot of questions about Bookvar shortcuts and documentation. We are planning to setup wiki for documentation. But now I will give you shortcuts we have so far.


General

Ctrl+NCreate new mindmap
Ctrl+OOpen existing mindmap
Ctrl+SSave mindmap
Ctrl+TabSwitch between mindmaps
Alt+NShow notes

Mind Map

Enter Add new topic
Insert Add new subtopic
Delete Delete topic
F3Focus selected topic and move it to the center of the screen

Presentation - works with presenter devices

PageUpMove to previous topic
NextMove to next topic
BacksapceExit from presentation mode

Friday, November 2, 2007

Bookvar available for free download

Today is a big day for us - guys behind Bookvar. We have released our first publicly available for download version of Bookvar. It is available from it's web site - http://bookvar.net. Note that this version is an alpha quality and requires .NET Framework 3.5 Beta 2.

Bookvar site

As you can see the design of this blog has changed (if you are reading this from feed reader please visit the original url :) to match the design of Bookvar's site. Still the site is not full of information, but this will be fixed in the upcoming months. However we have created some eye candy stuff - Silverlight based features viewer on the home page and also a Silverlight based mind map viewer - check the site map page. You can also participate in Bookvar forums. There you can tell us your opinion about Bookvar and what features you want to see in the future. We are eager to hear from you and shape Bookvar as the next generation tool for mind mapping.

1st of November

You maybe thinking that we've picked up 1st of November as release day for some reason and yes you think right :) First of November is a national holiday here in Bulgaria - Day of the leaders of the Bulgarian National Revival. Educational institutions celebrate this holiday and this is why we pick up this day. Because we believe that Bookvar can improve the way we currently do education in school and university. We are currently in the process of integrating Bookvar into Bulgarian education - both in university and school. Stay tuned for more information about this.

What's next

We highly encourage you to download Bookvar right away. Play with it and send us your feedback and issues. Because this release is an alpha it is highly possible bug submission window to show from time to time :) Don't be afraid to send us these defects. We will hunt them down and fix them.

We plan to release a new version of Bookvar at least once per month. In the next couple of months we will focus on stabilizing what we currently have, but also has the plans for a couple of must have features. We are also listing to your feedback and suggestions.

If you have created interesting mind maps please shared them with us.

Happy mind mapping to all.

P.S.: You can also check the Facebook group about Bookvar.

Tuesday, October 2, 2007

Bookvar at DevReach, .NET Rocks! and Tim Huckaby Wowed

Today we (Bookvar Team - including Dido, Jordan and me, Ivo was unable to come) attended DevReach.

DevReach

DevReach is an annual conference about Microsoft technologies. Actually it is the biggest event of this kind on Balkans and the region. It attracts one of the most impressive speakers in the .NET community. Just look at the list of sessions and figure it out for yourself. This year's keynote was presented by Tim Huckaby. This guy is doing phenomenal things with his company Interknowlogy. Tim presented for the first time their heart surgery app, as well as their other brilliant WPF based applications. You can check them here. After the keynote Tim gave a session about the way they built their cool apps. When the session ended the Bookvar's moment came. We (Deyan and I) sneak next to Tim and showed him Bookvar. He was showing his great application for about 2 hours and now he was the spectator of WPF goodness. I can explain his reaction with only one word. He was wowed. He immediately wanted to show off the application to other speakers as well and propose to demo the app at WPF panel at the end of the day. And guess what the WPF panel was actually a .NET Rocks! show.

.NET Rocks!

For those of you who did not know what is .NET Rocks! is
an audio podcast about .NET technologies. It is hosted by Carl Franklin and Richard Campbell and is absolute must listen for every .NET developer. So before the actual recording I was able to demonstrate Bookvar in front of about 50 developers & speakers. Perfect audience to show all the cool stuff that we have built. Unfortunately this cannot be recorded on podcast, but here is a picture of the .NET Rocks mind map I have done for the event.

So man when we can actually download Bookvar and explore it?

We are officially announcing that Bookvar will be available for free download on 1st of November here. The version that we will release can be called post Alfa and pre Beta, but we will call it beta 1. It will allow you to start creating mind maps right away and what is most important submit bugs and request so we will be able to improve it on the next release.

So until then keep listing to the great .NET Rocks! podcasts and have fun.