Archive for the ‘Programming’ Category.

Monodevelop: Howto add a WinForm project and file template

I am running MonoDevelop 2.4 on my acer aspire one x150 netbook running Ubuntu 9.04 (Jaunty).

From time to time I needed to write and run little test applications in C#. As I am alsos running another PC with Visual Studio 2005 and 2008, I like these for providing me a WinForm template, so I dont have to start from scratch.

Unfortunately MonoDevelop does not come with a WinForm template and I searched the internet on how to extend the templates provided by MonoDevelop to add a WinForm template. Although I found some resources on how to add templates to MonoDevelop, none of them worked as described.

Adding a template by using addins directory

Some sources state you can add templates by creating two files within the MonoDevelop home dir. For example adding HelloTemplate.xpt.xml and MyTemplates.addin.xml to “~/.config/MonoDevelop/addins”. I tried this approach, but it did not work as a WinForm project template.

Adding a template by using a packed template

Similar to the previous attempt but using mdtool to pack the files:
mdtool setup pack addins/addin.xml -d:addins
and
mdtool setup rep-build addins
where you finally get a mpack file with your xml template files. Unfortunately this did also not work for project templates.

Adding a template to the sources and recompile

As I already had the MonoDevelop sources as I have compiled and installed MonoDevelop 2.4 from sources, I looked for the existing templates and added my WinForm project and file template.

Screenshot Start New WinForm project

Screenshot Add New WinForm file

The source templates for CSharp are located on my netbook at: “/usr/local/src/monodevelop-2.4/src/addins/CSharpBinding/templates”. The Makefile references the template files in this directory. I had to add two template files to the directory and to the Makefile and the file CSharpBinding.add.xml. Then I did a make within the directory /usr/local/src/monodevelop-2.4/src/addins/CSharpBinding and then a “sudo make install” and finally got my WinForm project and file template available in MonoDevelop.

Continue reading ‘Monodevelop: Howto add a WinForm project and file template’ »

Mobile Development: A binary clock for the taskbar

Hello

do you also like the binary watches from IO?

OK, I like them and was inspired to make some binary clock for the Windows Mobile taskbar.

The time shown here is 14:23 displayed as binary dots. The top row (red) shows the hours in 24h format. The second row shows the minutes and the bottom row shows the seconds.

What you see here is encoded in binary:

01110   is equal to 0*16 1*8 1*4 1*2 0*1 = 8 + 4 + 2 = 14
10111   is equal to 1*16 0*8 1*4 1*2 1*1 = 16 + 4 + 2 + 1 = 23
00100   is equal to 0*16 0*8 1*4 0*2 0*1 = 4 = 4

So you see, it shows the time is 14:23:04

Continue reading ‘Mobile Development: A binary clock for the taskbar’ »

Windows Mobile: Hide StartButton in WinMo 6.5.x

Here is a very short tip based on a finding at xda-developers.com

See also here for how to hide the Start and Done button temporary.

For kiosk mode applications you dont want the user access the device settings or the start menu and all the programs and games accessible from there. One step to this kiosk mode is disabling the Start Button, the button that opens a menu to access programs and settings.

In versions of windows mobile before 6.5.3, you could disable access to the start button by subclassing HHTaskbar and discard clicks in the Start button area or simply disable the whole HHTaskbar window.

Now, with windows mobile 6.5.3 the start button is part of the menu bar and no longer part of the taskbar (which is now called MenuBar). To hide the start button on a windows Mobile 6.5.x device you can use following registry change:

[HKEY_LOCAL_MACHINE\Software\Microsoft\Shell\BubbleTiles]
"TextModeEnabled"=dword:00000001
"HardwareStartKeyEnabled"=dword:00000001
"HardwareDoneKeyEnabled"=dword:00000001

With this change the “MenuBar” will no longer show the Start Button graphic nor the Done button, Windows Mobile will no longer decorate the menu texts . Only two menu entries will now show on bottom of the today screen.

TextModeEnabled switches the display of soft menu entries from the default graphic tiles display to a text only display as it was and is in windows mobile 6.1.

HardwareStartKeyEnabled controls the display of the Start button (the big windows start symbol on the left of the soft menu). If you change to enabled (0x01) you dont get a start button and have to use a key on your keypad to launch the start screen!

HardwareDoneButton controls the display of the Done button at the right of the menu bar (the big (X)). When enabled, you have no chance to close apps that do not have an exit option in there menu, except you have a key on on your keyboard assigned to the Done function! Done now not only hides an app, with winmo 6.5 the app is closed and removed from memory now.

The Start entry at top left corner remains there but is only an indicator.

NO more Start Button, No more Done (X) Button

Continue reading ‘Windows Mobile: Hide StartButton in WinMo 6.5.x’ »

Windows Mobile: SetSystemTime and DST, Einstein’s Relativity Theory?

Wow, as I first saw this issue, I thought I was facing Einstein’s Relativity Theory.

The issue is simple to explain:
1) The WinMo device has a local time and date within DST
2) You use SetSystemTime to set a new system time and date outside the DST frame
3) The local time changes but DST is still applied!

Continue reading ‘Windows Mobile: SetSystemTime and DST, Einstein’s Relativity Theory?’ »