SilverStr
Posts: 28
Joined: 2013-03-31
|
So I am trying to understand how to use ADXIESharedMemory, and every post points to the sample for options in a small amount of GlobalData.
I would like to learn how to pass a block of key/value pairs sitting in a Dictionary<> across tabs. Can you help me to understand how that would be done? I would like to see samples of how each instance would push/pull the Dictionary and learn what boundaries for memory exist. ie: Is there any max size IE has for shared memory like this? Is there any limitations?
Looking forward to hearing how this all works!
Regards,
Dana |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
|
SilverStr
Posts: 28
Joined: 2013-03-31
|
So, being that this is being written to /Local, what happens if there are tabs in different integrity levels? A protected mode tab runs in LocalLow doesn't it? |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Hello,
Sorry for the delay. Here is the code that sends the dictionary between tabs/windows in IE. It works with protected mode as well.
private Dictionary<string, string> myCollection = null;
public void UpdateCollection(Dictionary<string, string> newCollection)
{
if ((this.myCollection != null) && newCollection != null)
{
this.myCollection.Clear();
foreach (string key in newCollection.Keys)
{
this.myCollection.Add(key, newCollection[key]);
}
}
}
private void IEModule_OnConnect(object sender, int threadId)
{
this.myCollection = new Dictionary<string, string>();
}
// pass data
private void adxieContextMenuCommandItem1_OnClick(object sender, object htmlElement)
{
this.myCollection.Clear();
this.myCollection.Add("1", "item 1: " + this.ThreadID.ToString());
this.myCollection.Add("2", "item 2: " + this.ThreadID.ToString());
this.myCollection.Add("3", "item 3: " + this.ThreadID.ToString());
ArrayList moduleList =
AddinExpress.IE.ADXIEModule.GetModulesByTypeName(this.GetType().FullName);
if (moduleList.Count > 0)
{
IEModule m;
for (int i = 0; i < moduleList.Count; i++)
{
m = moduleList[i] as IEModule;
if (m != null && m.ThreadID != this.ThreadID)
{
m.UpdateCollection(this.myCollection);
}
}
}
}
// show data
private void adxieContextMenuCommandItem2_OnClick(object sender, object htmlElement)
{
if (this.myCollection != null)
{
string text = String.Empty;
foreach (string key in this.myCollection.Keys)
{
text += key + " = " + this.myCollection[key] + "
";
}
MessageBox.Show(this, text, this.ModuleName);
}
}
|
|