Suivez et participez au développement du nouvel OpenCellar : PLOC.co
Page d'accueil
 
Français  English  
Open Cellar Home Edition - 1.2 - Le logiciel gratuit pour gérér efficacement votre cave à vins sous Windows. Open Cellar Mobile Edition - Beta 2 - La gestion de cave à vins a enfin sa solution Mobile sur Pocket PC. Open Cellar Cross Platform - Beta 1 - La gestion gratuite de vins disponible sous Mac OSX et Linux. Mon Open Cellar Les forums d'Open Cellar Place des vins
Rechercher : Bienvenue (se connecter - créer un compte)
Options de page

Nuage de tags
Mon premier AddIn
Open Cellar a été conçu de manière a être facilement étendu au moyen de code .net
Comme le veut la tradition du programmeur nous développerons notre premier complément, le fameux Hello World :-)

1) Présentation du modèle
Interface IAddIn

- OnCommand(int command) : se produit lorsque l'utilisateur clique sur le menu Compléments -> Votre complément -> Menu n.

- OnInitialize(IApplication application) : méthode appelée par Open Cellar à l'initialisation du complément.

- OnRegisterMenus(AddInMenus addInMenus) : méthode appelée pour enregistrer ses menus au sein de l'application (Compléments -> Mon Complément -> Mes sous menus.

- OnUnInitialize() : méthode appelée à la fermeture d'Open Cellar.

Classe AddInMenus

- SetMainMenuCaption(string caption) : définit le titre du menu principal

- Register(int command, string caption) : enregistre un sous menu, caption étant le texte et command étant l'identifiant de la commande qui sera passée à la void OnCommand(int command)


2) Configuration de l'outil de développement
Open Cellar pour Windows est développé en .net 1.1, nous aurons donc besoin de Visual Studio 2003 ou SharpDevelop
Démarrez votre éditeur, créez un nouveau projet (OpenCellar.AddIn.HelloWorld) de type ClassLibrary puis ajoutez aux références l'assembly OpenCellar.Application.dll et System.Windows.Forms

3) Développement du complément
Ajoutez à votre projet une classe HelloWorld qui hérite de l'interface IAddIn puis recopiez le code suivant :

using System;
using OpenCellar.Application;

namespace OpenCellar.AddIn.HelloWorld
{
	/// 
	/// HelloWorld
	/// 
	public class HelloWorld : IAddIn
	{
		/// 
		/// Initialise une instance de classe HelloWorld.
		/// 
		public HelloWorld()
		{
			
		}

		private IApplication application;

		public void OnInitialize(IApplication application)
		{
			// Conserve une référence à l'application hôte.
			this.application = application;
		}

		public void OnUnInitialize()
		{
			// Pas de ressources à libérées...
		}

		public void OnRegisterMenus(AddInMenus addInMenus)
		{
			// Enregistre le menu principal
			addInMenus.SetMainMenuCaption("Mon premier complément");

			// Enregistre le sous menu
			addInMenus.Register(40, "Hello World :-)");
		}

		public void OnCommand(int command)
		{
			if(command == 40)
			{
				// Affiche un message d'information
				this.application.ShowMessage("Mon premier complément",
					"Hello World",
					System.Windows.Forms.MessageBoxIcon.Information,
					System.Windows.Forms.MessageBoxButtons.OK);
			}
		}
	}
}



4) Installation complément
Compilez puis copiez la dll OpenCellar.AddIn.HelloWorld.dll dans le répertoire AddIns d'OC.
Redémarrez OpenCellar puis cliquez sur le menu Compléments -> Mon premier complément -> HelloWorld.

Félicitations vous venez de développer votre premier complément :-)

 

Commentaires
 30/01/2012 13:59 - Anonyme
Never would have thunk I would find this so idnispesnbale.
 31/01/2012 13:28 - Anonyme
MTMRmp <a href="http://clikkvlwwyyj.com/">clikkvlwwyyj</a>
 31/01/2012 17:43 - Anonyme
Ox1uOb , [url=http://lgplfabmcazo.com/]lgplfabmcazo[/url], [link=http://padmuaeqggbs.com/]padmuaeqggbs[/link], http://khbyfdoefdbf.com/
 02/02/2012 19:13 - Anonyme
TGyejv <a href="http://vupogerkdroh.com/">vupogerkdroh</a>
 03/02/2012 11:40 - Anonyme
6Q5Io4 , [url=http://ruazgztddtqe.com/]ruazgztddtqe[/url], [link=http://bzhoemyydeld.com/]bzhoemyydeld[/link], http://igkqycugwpea.com/
 03/02/2012 11:40 - Anonyme
6Q5Io4 , [url=http://ruazgztddtqe.com/]ruazgztddtqe[/url], [link=http://bzhoemyydeld.com/]bzhoemyydeld[/link], http://igkqycugwpea.com/
 20/10/2015 23:36 - Anonyme
It appears this is a relust of moving from PGraphics to OpenGL in the shift from 1.5.x to 2.0. Wordcram appears to depend on classes that were deprecated and have now been removed. Unfortunately processing 1.5.1 is only available for a limited number of platforms (which does not include linux x64) so I have not been able to test this by trying 1.5.1.
 30/11/2015 18:25 - Anonyme
I have processing 2.0b3 and wocrrdam 0.5.3 and for some reason installation isn't working. I cannot load the examples and my program will not run and I'm not sure why. I am very new to this but have comp sci knowledge..
 30/11/2015 18:25 - Anonyme
I have processing 2.0b3 and wocrrdam 0.5.3 and for some reason installation isn't working. I cannot load the examples and my program will not run and I'm not sure why. I am very new to this but have comp sci knowledge..
 30/11/2015 18:25 - Anonyme
I have processing 2.0b3 and wocrrdam 0.5.3 and for some reason installation isn't working. I cannot load the examples and my program will not run and I'm not sure why. I am very new to this but have comp sci knowledge..
 03/12/2015 01:49 - Anonyme
30 Worst Passwords Analysis By Hacked Linkedin Passwords [Infograph] Posted on June 9, 2012 | 0 Comments Rapid7.coma0recently created an belowa0Infographa0and puiblsh 30 worsts passwords people area0usinga0in a0online sites. Thea0info grapha0analysis the Linkedin passwords as they hacked on 6 June and about 6.5 Million password. You can download the full list of passwords.a0 http://kmgswf.com [url=http://dwqzikyvy.com]dwqzikyvy[/url] [link=http://zkwxjqex.com]zkwxjqex[/link]
 03/12/2015 01:49 - Anonyme
30 Worst Passwords Analysis By Hacked Linkedin Passwords [Infograph] Posted on June 9, 2012 | 0 Comments Rapid7.coma0recently created an belowa0Infographa0and puiblsh 30 worsts passwords people area0usinga0in a0online sites. Thea0info grapha0analysis the Linkedin passwords as they hacked on 6 June and about 6.5 Million password. You can download the full list of passwords.a0 http://kmgswf.com [url=http://dwqzikyvy.com]dwqzikyvy[/url] [link=http://zkwxjqex.com]zkwxjqex[/link]
 03/12/2015 01:49 - Anonyme
30 Worst Passwords Analysis By Hacked Linkedin Passwords [Infograph] Posted on June 9, 2012 | 0 Comments Rapid7.coma0recently created an belowa0Infographa0and puiblsh 30 worsts passwords people area0usinga0in a0online sites. Thea0info grapha0analysis the Linkedin passwords as they hacked on 6 June and about 6.5 Million password. You can download the full list of passwords.a0 http://kmgswf.com [url=http://dwqzikyvy.com]dwqzikyvy[/url] [link=http://zkwxjqex.com]zkwxjqex[/link]
 04/12/2015 21:23 - Anonyme
I've just noticed this too. Check out the rqntirmeeus of the other major banks:BNS: 8-16 character length no special charactersRBC: 8-32 character length no spacesCIBC: 6-12 character length no special characters?BMO: 6 character minimum, >= 1 number or special characterA decade ago some of these policies would have been borderline inexcusable; now they're just frightening. http://istgjuacwr.com [url=http://jreplxmsm.com]jreplxmsm[/url] [link=http://aqhwea.com]aqhwea[/link]
 04/12/2015 21:23 - Anonyme
I've just noticed this too. Check out the rqntirmeeus of the other major banks:BNS: 8-16 character length no special charactersRBC: 8-32 character length no spacesCIBC: 6-12 character length no special characters?BMO: 6 character minimum, >= 1 number or special characterA decade ago some of these policies would have been borderline inexcusable; now they're just frightening. http://istgjuacwr.com [url=http://jreplxmsm.com]jreplxmsm[/url] [link=http://aqhwea.com]aqhwea[/link]
 04/12/2015 21:23 - Anonyme
I've just noticed this too. Check out the rqntirmeeus of the other major banks:BNS: 8-16 character length no special charactersRBC: 8-32 character length no spacesCIBC: 6-12 character length no special characters?BMO: 6 character minimum, >= 1 number or special characterA decade ago some of these policies would have been borderline inexcusable; now they're just frightening. http://istgjuacwr.com [url=http://jreplxmsm.com]jreplxmsm[/url] [link=http://aqhwea.com]aqhwea[/link]
Ecrire un commentaire

Code de sécurité


© 2006-2014 Matthieu DUCROCQ Blog officiel d'Open Cellar - Tous droits réservés - Dernière mise à jour : janvier 2014 | twitter | facebook