using System;
using System.Drawing;
using Newtonsoft.Json;
// The 'windowHandle' parameter will contain the window handle for the:
// - Active window when run by hotkey
// - Trigger target when run by a Trigger rule
// - TitleBar Button owner when run by a TitleBar Button
// - Jump List owner when run from a Taskbar Jump List
// - Currently focused window if none of these match
public static class DisplayFusionFunction
{
//to get this script to work, you need the Newtonsoft Json library downloaded to your computer,
//then add the path to the Newtonsoft.Json.dll in the references of this script
//http://www.newtonsoft.com/json
public static void Run(IntPtr windowHandle)
{
//create a new test object
TestObject test = new TestObject(1, "testing");
//convert the object into json and display it to the user
string json = JsonConvert.SerializeObject(test);
BFS.Dialog.ShowMessageInfo(json);
//take the json and make a new test object with the newtonsoft deserializer
TestObject test2 = JsonConvert.DeserializeObject<TestObject>(json);
BFS.Dialog.ShowMessageInfo("Number: " + test2.Number + "\nText: " + test2.Text);
}
//this object will be used to test the functionality of the newtonsoft json library
private class TestObject
{
public int Number;
public string Text;
public TestObject(int number, string text)
{
this.Number = number;
this.Text = text;
}
}
}