public StorageHandler() { EasyStorageSettings.SetSupportedLanguages(EasyStorage.Language.English); HighScores = new HighScores(); Settings = new Settings(); #if WINDOWS saveDevice = new PCSaveDevice("Leximo"); useStorage = true; GetHighScoresFromDevice(); //sharedSaveDevice = saveDevice; #else // add the GamerServicesComponent // create and add our SaveDevice sharedSaveDevice = new SharedSaveDevice("Leximo"); //Components.Add(sharedSaveDevice); // hook an event for when the device is selected sharedSaveDevice.DeviceSelected += (s, e) => GetHighScoresFromDevice(); // hook two event handlers to force the user to choose a new device if they cancel the // device selector or if they disconnect the storage device after selecting it sharedSaveDevice.DeviceSelectorCanceled += new EventHandler<SaveDeviceEventArgs>(sharedSaveDevice_DeviceSelectorCanceled);//(s, e) => e.Response = SaveDeviceEventResponse.Prompt; sharedSaveDevice.DeviceDisconnected += new EventHandler<SaveDeviceEventArgs>(sharedSaveDevice_DeviceDisconnected); //(s, e) => e.Response = SaveDeviceEventResponse.Prompt; // prompt for a device on the next Update // make sure we hold on to the device saveDevice = sharedSaveDevice; #endif }
protected void LoadSettings(object nothing) { Shorewood.IsStorageActive = true; try { if (useStorage) { if (saveDevice.FileExists(settingsFileName)) { if (saveDevice.Load(settingsFileName, DeserializeSettings)) { return; } } } } catch (Exception e) { Console.WriteLine(e); // add load error } finally { Shorewood.IsStorageActive = false; } Settings = new Settings(); }