Reading json file from custom message box
Hi
I implemented a method in my app for json files in folder to read in a message box when i try to run in the emulator it throws the following exception "An exception of type 'System.NotImplementedException' occurred in DevotionJson.DLL but was not handled in user code"
Kindly view my code below for necessary correction
CustomMessageBox cmb;
private void openMsgBox(object sender, RoutedEventArgs e)
{
// create new Stack panel
StackPanel sp = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Vertical };
//get policy text from file
string policy = getPolicy();
//Create new label
TextBlock tb = new TextBlock()
{
Text =policy,
TextWrapping = TextWrapping.Wrap,
FontSize = 25,
};
//Create new Scroll viewer
ScrollViewer sv = new ScrollViewer()
{
VerticalScrollBarVisibility=ScrollBarVisibility.Auto,
Height=500,
};
// add texblock in scroll viewer
sv.Content = tb;
//Add the controls to stack panel
sp.Children.Add(sv);
// Create new Custom Message Box instance
cmb = new CustomMessageBox()
{
// Set its content to our Stack Panel
Content = sp,
Opacity = 0.98,
// Left button of message box Button
LeftButtonContent = "Accepts",
//Right button of message Box
RightButtonContent="Reject",
};
//Handle msg box click
cmb.Dismissing += cmb_Dismissing;
//Show the message box...
cmb.Show();
}
private string getPolicy()
{
throw new NotImplementedException();
}
void cmb_Dismissing(object sender, DismissingEventArgs e)
{
if (e.Result==CustomMessageBoxResult.LeftButton)
{
MessageBox.Show("Now you can use this app.");
}
else
{
//do what you want
MessageBox.Show("It's mandatory to accepts the T&C to use this app. Exiting from app.");
App.Current.Terminate();
}
}
public string getPolicy(string JsonfilePath)
{
string strText = "This";
using (StreamReader r = new StreamReader("BibleInYear/Bible1.json"))
{
string json = r.ReadToEnd();
dynamic array = JsonConvert.DeserializeObject(json);
//... read text from json file
}
return strText;
}
I await your response and thank you in advance