Community
Showing results for 
Search instead for 
Do you mean 
Reply

Very first step to start with the SDK

Copper Super Contributor
Posts: 91
Country: USA

Very first step to start with the SDK

Hello,

 

Working with SDK is new for me. I don't really know where to start.

Once Act! is installed on my local machine, how do I start in Visual Studio? What kind of project do I have to create? We will use Act! on-premise. 

 

Is there any documentation available for a step by step process from the very beginning? I was following the Introduction to Act! and Act! architecture learning path. But after reading the references, the topic SDK Help - read about how to build add-ons could not be found in the downloaded SDK documentation.

 

Thank you

Copper Elite Contributor
Posts: 81
Country: Canada

Re: Very first step to start with the SDK

Ok, I will try to keep this very simple so it should be easy to understand.

 

After creating a project, Console or WinForms, you will need to reference some Act dlls before you can start. All the dlls you need are in the installation media, and can be found in a folder under the C: drive. For example, if you installed Act 17 Premium, the path will be, "C:\Act!_Premium_v17\ACTWG\GlobalAssemblyCache"

 

I would suggest you copy this entire folder and save it somewhere else on your drive, and call it the same name as the Act version (e.g. Act17). 

 

Next, go in your project properties, and from the "Reference Paths" section, add a reference to this folder. This will make all assemblies available to you. Now add a reference to Act.Framework, Act.Shared.Collections, and Act.Shared.ComponentModel. After adding the references, be sure to select all three, and turn off the "Copy Local" property, or else your build folder will be filled up with all the libraries these 3 rely on. You should never have to package these Act dlls with your application, because if Act is installed properly, your application will load all neccessary dlls from the  Windows/.Net GAC.

 

From the build tab, change the platform target to x86. Act is a 32 bit app and works with other 32 bit apps.

 

From here, you should be ready to develop an app that uses Act SDK. You will need an object for Act.Framework.ActFramework. Once you have the ActFramework object, you can simply call the LogOn method, and supply your database's PAD file path, and username and password. Below is some sample code for connecting to the Demo database.

 

 

using Act.Framework;
using System;
using System.Text;

namespace SampleApp
{
    public class SampleApp
    {
        static ActFramework _actFwk;

        public SampleApp()
        {
            _actFwk = new ActFramework();
        }

        public void DoStuff()
        {
            try
            {
                _actFwk.LogOn(@"C:\Users\Public\Documents\ACT\ACT Data\Databases\ACT2015Demo.PAD", "", "");

                ContactList lstContacts = _actFwk.Contacts.GetContacts(new Act.Shared.Collections.SortCriteria[] { });

                Console.WriteLine("This database has " + lstContacts.Count + " Contacts.");

                //Do other stuff..
                //..
            }
            catch (LockedDatabaseException ex)
            {
                // Database is locked. unable to log in
            }
            catch (Exception ex)
            {
                //Failed to log in. Wrong username/pass/PAD file, or other error.
            }

        }
    }
}

 

This should help you get started. Keep in mind, I didn't cover creating a plugin, so your Act does not need Act to be running. However, you will not have access to certain UI methods, such as getting the current Contact list. In order to create a plugin, you need a project with a class that implements IPlugin interface. I believe there is a "starter" plugin project on these boards if you look for it.

 

Regards,

Ahsan

Ahsan Khalid

Chief Technology Officer
Keystroke Quality Computing Inc.
www.keystroke.ca

Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Very first step to start with the SDK

[ Edited ]

I created an example add-on to refresh every x minutes or every x minutes that the computer is idle.

 

To install the auto refresher download the installer, close ACT!, run the installer and restart ACT!.


To help other SDK developers we included the full source code for this add-on in a Visual Studio VB.NET project.
You can find the zipped project file named "Durkin.Custom.Autorefresh.zip" in the ACT plugin folder after installation.

http://www.durkincomputing.com/ACTAddonsReleases/Durkin_Autorefresh_for_ACT.zip

 

Here a visual studio example in VB to add a tab. 

http://community.act.com/t5/Act-Developer-s-Forum/Sample-Plugin-to-add-a-Tab/m-p/150248

 

There is also a sample from Act!

http://community.act.com/t5/Act-Developer-s-Forum/Sample-Plugin-to-add-menu-item/td-p/149940

 

Hope this helps

-- Jim Durkin

 

Copper Super Contributor
Posts: 91
Country: USA

Re: Very first step to start with the SDK

Thank you Ashan for this answer  it is a great start.

 

I would like to understand at what point the method 'DoStuff()' is called. How does Act! know to run this piece of code in my dll?

 

So now let's say I did everything in wanted in 

public void DoStuff()

 Then I would compile the project. Since it is an Add-On, where should I copy my newly created dll?

 

You also said "so your Act does not need Act to be running" could you elaborate a bit more about that statement? Do this mean I can run my add-on without Act running? If so, how would this be done?

 

I reviewed the plugin project, I was able to compile and see the result in Act so this is great. My concern is since I am new I feel very limited because I feel that I don't know any of the objects used in Act Framework. I know they are built on .NET objects, but still. Is there any documentation to look at such as MSDN provides it for the .NET framework with decription for methods, input and output?

 

Thank you for your help

Gregory

Copper Elite Contributor
Posts: 81
Country: Canada

Re: Very first step to start with the SDK

[ Edited ]

Hi Gregory,

 

The DoStuff() can be called anything in your application. As I mentioned, the above code was for a standalone application, which does need Act to be running. You could have a button in your application which calls that method. 

 

Basically if your application only needs to work with the main database and doesn't require any user input, or the state of the ACT application, you should create a standalone application, which can be a regular Console or Windows application that uses the ActFramework object. If you are just getting started, I recommend taking this approach, as it is a lot simpler. Also, the application can be run from anywhere.

 

However, If you do need to create a Plugin, Act will need to be running, and you will have access to certain events which will fire when Act is started, logged on to the database, a view loaded etc. You can use these event handlers to add menu items, buttons, and anything else to Act. A plugin is a dll file that goes in the Act Plugins directory which is "C:\Program Files (x86)\ACT\Act for Windows\Plugins" by default.

 

Another difference with the plugin is that now, you have a reference to ActApplication. Take a look at the properties and methods available, and you can access the framework by using _actApp.ActFramework. 

 

I've made a test plugin project for you here: https://mega.co.nz/#!mARyBAIL!Ptl6Y4r2hOFfuuMYeMwCicwgM6MmhVt0F5X9N9Edwlc

 

The above project shoud create a dll on build that should get copied to your Act plugins folder (confirm path is correct). Once you launch Act, it should create a new menu item under the tools menu called "Hello World". Make sure you change the path to the Act DLL folder in the project properties. So after you have a good understanding, you can replace the messagebox and show a form instead, and do whatever else you need.

 

As for help with other methods and properties in the Framework, your best bet is searching the help file that comes with the SDK, or asking a question on these boards.

 

Regards,

Ahsan

Ahsan Khalid

Chief Technology Officer
Keystroke Quality Computing Inc.
www.keystroke.ca

Copper Super Contributor
Posts: 91
Country: USA

Re: Very first step to start with the SDK

[ Edited ]

Ahsan,

 

Thanks again. All of this is really going to help.

 

I managed to implement the sample given in the SDK documentation. I can start from that for an eventual plugin.

 

Just a quick detail. I located the code reference file in the SDK documentation (.chm file) but when I open it, I can see the contents tree and index etc... in the left panel but everything comes blank in the right panel? Is it just me?  I found out that the chm file, when opened in w wrong location,  cannot work properly sometimes. Got it to work Smiley Happy

 

Gregory

Copper Super Contributor
Posts: 91
Country: USA

Re: Very first step to start with the SDK

Hello Jim,

 

Thank you for your help here.

After reviewing you project sample, I have a few question.

 

I notice (like all the sample I looked at so far) that there is always one class only. Is it possible to have multiple classes in an add-on project? If so, should only one class implement IPlugin?

 

In the case of a plugin, the dll must be placed in the plugin folder of act. But what about an add-on which is not a plugin or a custom control or an add-on which includes a plugin and a custom control?

 

Thank you Jim

 

Regards

Gregory

Copper Elite Contributor
Posts: 81
Country: Canada

Re: Very first step to start with the SDK

[ Edited ]

You can have as many classes in a plugin project as you like but I believe that only 1 should implement IPlugin. As for the custom controls, I believe they should go in the Tools folder, rather than the Plugins folder.

 

Ahsan Khalid

Chief Technology Officer
Keystroke Quality Computing Inc.
www.keystroke.ca

Avid Listener
Posts: 49
Country: USA

Re: Very first step to start with the SDK

I don't know what I'm doing wrong here.  I took all the dll's from this folder, C:\Act!_Premium_v17\ACTWG\GlobalAssemblyCache, and put them in another folder.  I put a reference path to the new folder. 

 

Then it says to add a reference to Act.Framework, Act.Shared.Collections, and Act.Shared.ComponentModel.  Does that mean add a Using stmt to the top of my pgm, in this case Program.cs? When I try that, these libraries are not available.  Does "add a reference" mean something else?

 

I have Act! Premium (Web) version installed.  Should I uninstall it and install the windows version instead?

Kevin Varnon
ClientTrax CRM
Kansas City
(785) 408-3702
kevin@clienttrax.com
Silver Super Contributor
Posts: 2,328
Country: USA

Re: Very first step to start with the SDK

If you are using one of the later versions of Visual Studio if you click on the link to add the reference it should add it for you.


Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!