Tutorial on how to build an add-in in C# in RMS 2.0

I'll try to make this brief. I did this in VS2005 using C#.

1) Create a new C# project of the Class Library type. 2) Right click your project and select "Properties". 3) Select the "Build" tab and check the box for "Register for COM interop". 4) Select the "Signing" tab and select the combo box "Choose a strong name key file" and select "". Next type in a key file name and uncheck the "Protect my file with a password" checkbox. 5) Hit "Ctrl+S" to save your properties and close the properties page. 6) Add a reference to the "QSRules.dll" file (should be located in C:\Program Files\Microsoft Retail Management System\Store Operations, or wherever you installed RMS) 7) Create a class with the following code:

using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.IO; using System.Text; using System.Windows.Forms;

namespace RMSAddinTest { [Guid("6080A35A-8026-4c37-AC5A-933882B31186")] public interface Addin_Interface { [DispId(1)] bool Process(QSRules.SessionClass mySession); }

[Guid("8497F5C5-0317-49e4-A636-61B4016CE905"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface Addin_Events {} [Guid("8C780B6F-F16F-49ff-B1AB-1093E788E26A"), ClassInterface(ClassInterfaceType.None), ComSourceInterfaces(typeof(Addin_Events))] public class Addin : Addin_Interface { public bool Process(QSRules.SessionClass mySession) { if(DialogResult.OK==MessageBox.Show(String.Format("The current cashier is {0}.", mySession.Cashier.Name))) return true; else return false; } } }

8) Compile your project.

9) Copy the DLLs you created from your project to your RMS install folder. 10) Open the Store Operations Manager. 11) Choose Database -> Registers -> Custom POS Buttons (from the toolbar) 12) Select the "New" button 13) The number will be unique, select a number that hasn't been chosen. 14) Caption is whatever you want the button to say. 15) Command is RMSAddinTest.Addin (if you change your namespace and classname you need to change this as well). 16) Select OK and close the Store Operations Manager. 17) Open Store Operations POS. You should now see your custom button on the right. When you select the button it will show a MessageBox alerting the current cashier.

I hope this helps. Took me a bit to figure it out.

Reply to
Michael Lawrence
Loading thread data ...

In addition to this you will want to generate your own GUIDs for each of the interfaces using guidgen.exe.

Reply to
Michael Lawrenc

hello, nice article. i did all the steps but have some questions.

1- i put all the dlls from bin of my app to the RMS intall folder. is it okay? 2- What will be the style of the POS button? COM, internal command, external command, etc? what exactly will we select from the style dropdown.?

Michael Lawrenc wrote:

Tutorial on how to build an add-in in C# in RMS 2.0

24-Jul-07

I'll try to make this brief. I did this in VS2005 using C#.

1) Create a new C# project of the Class Library type. 2) Right click your project and select "Properties". 3) Select the "Build" tab and check the box for "Register for COM interop". 4) Select the "Signing" tab and select the combo box "Choose a strong name key file" and select "". Next type in a key file name and uncheck

the "Protect my file with a password" checkbox.

5) Hit "Ctrl+S" to save your properties and close the properties page. 6) Add a reference to the "QSRules.dll" file (should be located in C:\Program Files\Microsoft Retail Management System\Store Operations, or wherever you installed RMS) 7) Create a class with the following code:

using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.IO; using System.Text; using System.Windows.Forms;

namespace RMSAddinTest { [Guid("6080A35A-8026-4c37-AC5A-933882B31186")] public interface Addin_Interface { [DispId(1)] bool Process(QSRules.SessionClass mySession); }

[Guid("8497F5C5-0317-49e4-A636-61B4016CE905"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface Addin_Events {} [Guid("8C780B6F-F16F-49ff-B1AB-1093E788E26A"), ClassInterface(ClassInterfaceType.None), ComSourceInterfaces(typeof(Addin_Events))] public class Addin : Addin_Interface { public bool Process(QSRules.SessionClass mySession) { if(DialogResult.OK==MessageBox.Show(String.Format("The current cashier is {0}.", mySession.Cashier.Name))) return true; else return false; } } }

8) Compile your project.

9) Copy the DLLs you created from your project to your RMS install folder. 10) Open the Store Operations Manager. 11) Choose Database -> Registers -> Custom POS Buttons (from the toolbar) 12) Select the "New" button 13) The number will be unique, select a number that hasn't been chosen. 14) Caption is whatever you want the button to say. 15) Command is RMSAddinTest.Addin (if you change your namespace and classname you need to change this as well). 16) Select OK and close the Store Operations Manager. 17) Open Store Operations POS. You should now see your custom button on the right. When you select the button it will show a MessageBox alerting the current cashier.

I hope this helps. Took me a bit to figure it out.

Previous Posts Tutorial on how to build an add-in in C# in RMS 2.0 I'll try to make this brief. I did this in VS2005 using C#.

1) Create a new C# project of the Class Library type. 2) Right click your project and select "Properties". 3) Select the "Build" tab and check the box for "Register for COM interop". 4) Select the "Signing" tab and select the combo box "Choose a strong name key file" and select "". Next type in a key file name and uncheck

the "Protect my file with a password" checkbox.

5) Hit "Ctrl+S" to save your properties and close the properties page. 6) Add a reference to the "QSRules.dll" file (should be located in C:\Program Files\Microsoft Retail Management System\Store Operations, or wherever you installed RMS) 7) Create a class with the following code:

using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.IO; using System.Text; using System.Windows.Forms;

namespace RMSAddinTest { [Guid("6080A35A-8026-4c37-AC5A-933882B31186")] public interface Addin_Interface { [DispId(1)] bool Process(QSRules.SessionClass mySession); }

[Guid("8497F5C5-0317-49e4-A636-61B4016CE905"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)] public interface Addin_Events {} [Guid("8C780B6F-F16F-49ff-B1AB-1093E788E26A"), ClassInterface(ClassInterfaceType.None), ComSourceInterfaces(typeof(Addin_Events))] public class Addin : Addin_Interface { public bool Process(QSRules.SessionClass mySession) { if(DialogResult.OK==MessageBox.Show(String.Format("The current cashier is {0}.", mySession.Cashier.Name))) return true; else return false; } } }

8) Compile your project.

9) Copy the DLLs you created from your project to your RMS install folder. 10) Open the Store Operations Manager. 11) Choose Database -> Registers -> Custom POS Buttons (from the toolbar) 12) Select the "New" button 13) The number will be unique, select a number that hasn't been chosen. 14) Caption is whatever you want the button to say. 15) Command is RMSAddinTest.Addin (if you change your namespace and classname you need to change this as well). 16) Select OK and close the Store Operations Manager. 17) Open Store Operations POS. You should now see your custom button on the right. When you select the button it will show a MessageBox alerting the current cashier.

I h In addition to this you will want to generate your own GUIDs for each of the In addition to this you will want to generate your own GUIDs for each of the interfaces using guidgen.exe.

Submitted via EggHeadCafe - Software Developer Portal of Choice Win a free Professional license of CodeSmith Generator 5.2!

formatting link

Reply to
Kashif ali

BeanSmart website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.