I have sample Test, and upload to my board.
Oprtationg is so good.
but sevral Time I turn off and turn on the board,
the Speed become low. and EWR doesn;t storage my data.
Q1) Why EWR dont work?
Q2) what is the method ExtendedWeakReference.FlushAll(); ??
under my Code
using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Touch;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Shapes;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Input;
namespace StorageManagerTest
{
//TargetClass: static vs. instance
//float(value type) is possible?
//Wrap float with class(Ref. Type)
public class Program : Application
{
private Window mainWindow;
public static TestClass testClass;
public ExtendedWeakReference settingsReference;
public Rectangle rect;
public static void Main()
{
Program myApplication = new Program();
Window mainWindow = myApplication.CreateWindow();
myApplication.Run(mainWindow);
}
public Window CreateWindow()
{
mainWindow = new Window();
mainWindow.Height = SystemMetrics.ScreenHeight;
mainWindow.Width = SystemMetrics.ScreenWidth;
Canvas can = new Canvas();
Debug.Print("Test StorageManager");
rect = new Rectangle();
rect.Height = SystemMetrics.ScreenHeight;
rect.Width = SystemMetrics.ScreenWidth;
Canvas.SetRight(rect, 0);
Canvas.SetBottom(rect, 0);
rect.Fill = new SolidColorBrush(Colors.Blue);
settingsReference = ExtendedWeakReference.RecoverOrCreate(typeof(TestClass), 0, ExtendedWeakReference.c_SurvivePowerdown);
//settingsReference.PushBackIntoRecoverList();
settingsReference.Priority = (Int32)ExtendedWeakReference.PriorityLevel.System;
if (settingsReference.Target == null)
{
testClass = new TestClass();
testClass.number = 2;
Debug.Print("Class Null value");
rect.Fill = new SolidColorBrush(Colors.Blue);
}
else
{
Debug.Print("Good");
Debug.Print("Result: " + ((TestClass)settingsReference.Target).number.ToString());
rect.Fill = new SolidColorBrush(Colors.Red);
}
settingsReference.Target = testClass;
ExtendedWeakReference.FlushAll();
can.Children.Add(rect);
mainWindow.Child = can;
return mainWindow;
}
}
public class TestClass
{
public float number;
}
}