Logging

Add-in Express™ Support Service
That's what is more important than anything else

Logging
 
Harald Holzmann




Posts: 39
Joined: 2017-08-08
Hello,

i have 2 questions:

1) Can you please tell me what is the best to use some kind of logging? I want to log something during development?
2) What is the correct way to red/write files? How do i get the correct location where i have permissions to create/write/read files?

Thanks,
Harald
Posted 09 Oct, 2017 08:21:59 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Harald,

You could study https://msdn.microsoft.com/en-us/library/bb250462(v=vs.85).aspx but I would suggest a universal solution: you can use a broker application; see section Protected Mode in the PDF file in folder {Add-in Express}\Docs on your development PC.


Andrei Smolin
Add-in Express Team Leader
Posted 09 Oct, 2017 08:28:54 Top
Harald Holzmann




Posts: 39
Joined: 2017-08-08
Hello Andrei,

thanks for your quick reply. I am just at the beginning of working with add in express, so I am now a little bit confused. My current situation is: I have a AX IE Add-on with a ToolBar. And now i need to write some File/Settings (json) to a file on the users computer. I read the section in the documentation, but i am not sure do i need an extra project of type "ADX IE Broker App"? If a I am correct i need the broker application to send data between my Add-On and the Broker Application. The Broker application here will do the persistence? How will the both Applications will be deployed and installed together?
Is there a sample Application available (best case in C#)?

Isn't there an easier solution, because i think this will be realy complicated? Is there an easier solution to have an persistence storage available?

Thanks for your support!
Harald
Posted 09 Oct, 2017 08:49:57 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Harald,

If you have Protected Mode on, your IE extension can only write to special locations as described at http://msdn.microsoft.com/en-us/library/bb250462.aspx. If Enhanced Protected Mode is on, your IE extension is unable to write anywhere. At the same time, you can use a broker application which is run with the privileges of the user running IE: you add a broker application project to your solution and then organize communication between the extension and the broker as described in the manual. Note that you can start communication after your IE extension gets the OnBrokerStarted event. We don't have an example. As to deployment, the setup project wizard asks you for a broker application when creating a setup project for your IE extension.


Andrei Smolin
Add-in Express Team Leader
Posted 09 Oct, 2017 10:04:57 Top
Harald Holzmann




Posts: 39
Joined: 2017-08-08
Hello Andrei,

thanks again for your answer. Now i have created the correct project as you described. No in my Toolbar-Project I have:


 private void onBrokerStarted(object sender, EventArgs e)
        {
            MessageBox.Show("Broker App started");
            Hashtable hashtableOut = new Hashtable();
            hashtableOut[1] = "One";
            hashtableOut[2] = "Two";

            object data = "Test";
            MessageBox.Show((string)data);
            SendDataToBroker(hashtableOut, out data);
            MessageBox.Show((string) data);

        }


And in my Broker-Application:

 private void onDataReceived(object sender, AddinExpress.IE.Broker.ADXIEBrokerDataReceivedEventArgs e)
        {
            var request = e.RequestData as Hashtable;
            var response = new Hashtable();
            response.Add("result", "ok");
            e.ResponseData = response;
        }


Can you confirm that the above code should work? Now the question is how do i receive messages from the broker? I cannot find a event like onBrokerDataReceived or anything similar.

In the documentation is written "BrokerGuid property ?Â?Ð?ã you must specify the GUID of the broker in this property, see The broker configuration file;". Where do i find this property in the toolbar application?

Another question how do i debug this? I canot register the broker app? How is this working?

Thanks,
Harald
Posted 10 Oct, 2017 01:34:56 Top
Harald Holzmann




Posts: 39
Joined: 2017-08-08
Hello,

in the mean time i got it working.

In the App module you have to define the guid of your broker app.

My broker is now:

        private void onDataReceived(object sender, AddinExpress.IE.Broker.ADXIEBrokerDataReceivedEventArgs e)
        {
            var request = e.RequestData as Hashtable;
            var response = new Hashtable();
            response.Add("result", "ok");
            e.ResponseData = response;
        }


and my toolbar, which sends/receives to the broker:

private void onBrokerStarted(object sender, EventArgs e)
        {
            MessageBox.Show("Broker App started");
            Hashtable hashtableOut = new Hashtable();
            hashtableOut.Add("Method", "WriteSubId");
            hashtableOut.Add("SubId", "123456789");

            object response = new Hashtable();
            SendDataToBroker(hashtableOut, out response);

            Hashtable responseHashTable = (Hashtable)response;
            MessageBox.Show((String)responseHashTable["result"]);
        }
Posted 10 Oct, 2017 02:36:27 Top
Harald Holzmann




Posts: 39
Joined: 2017-08-08
Hello Andrei,

which location of the registry is writeable by the broker-App? MI first guess was "SOFTWARE\LowRegistry\XXXXX" but that's not working. And on my PC (Win10) the directory doesn't even exists.

What is also important: Support IE10 and IE11 and Win XP SP3+.

Thanks,
Harald
Posted 10 Oct, 2017 03:07:56 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Harald,

Thank you for letting me know.

To All. If you find out this topic looking for the property that holds the broker GUID, see one of the properties below; you set them at the design time:

- in a BHO (IE add-on) project, see ADXIEModule.BrokerGuid
- in an IE Bar project, see ADXIEBarModule.BrokerGuid
- in an IE Toolbar project, see ADXIEToolBarModule.BrokerGuid


Andrei Smolin
Add-in Express Team Leader
Posted 10 Oct, 2017 03:12:31 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hello Harald,

Harald Holzmann writes:
which location of the registry is writeable by the broker-App? MI first guess was "SOFTWARE\LowRegistry\XXXXX" but that's not working. And on my PC (Win10) the directory doesn't even exists.


A broker is run with permissions of the user who starts IE.

LowRegistry? Are you looking for HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\LowRegistry?


Andrei Smolin
Add-in Express Team Leader
Posted 10 Oct, 2017 03:18:13 Top
Harald Holzmann




Posts: 39
Joined: 2017-08-08
LowRegistry? Are you looking for HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\LowRegistry?


I just need a Location in the Registry where I am allowed to create/read/write data from my broker application.

Thanks and best regards,
Harald
Posted 10 Oct, 2017 03:22:09 Top