public override void JoystickPressed(Gadgeteer.Modules.GHIElectronics.Joystick sender, Gadgeteer.Modules.GHIElectronics.Joystick.JoystickState state) { _Data = new ExampleData(); _Data.LastDate = DateTime.Now; SaveData(); PrintLastDate(); }
public static void XmlSerialize( string filename, ExampleData data) { var x = new XmlSerializer(typeof(ExampleData)); using (var Writer = new StreamWriter(filename, false)) { x.Serialize(Writer.BaseStream,data); } }
public override void Exit() { //To do at the end (desubscribe events...) if (MainHandle.SdCard.IsCardMounted) { //save date _Data = new ExampleData(); _Data.LastDate = DateTime.Now; SaveData(); } else { ConsoleDisplayN18.Clear(); ConsoleDisplayN18.WriteLine("Sorry I cannot save the date."); Thread.Sleep(1000); } StopListen();//Stop timer and interface }
private void ReadData() { if (IsMountSdCard()) //ask to mountSD { string rootDirectory = MainHandle.SdCard.GetStorageDevice().RootDirectory; _Data = ExampleData.XmlDeSerialize(rootDirectory + @"\" + _Filename); Debug.Print("Last record : " + _Data.LastDate.ToString()); } }