/// <summary> /// Adds an extra data to BugSense describing a cartridge. /// </summary> /// <param name="cart"></param> public static void AddBugSenseCrashExtraData(WF.Player.Core.Cartridge cart) { var extraDataList = BugSenseHandler.Instance.CrashExtraData; string guid = cart.Guid; if (guid != null) { extraDataList.Add(new BugSense.Core.Model.CrashExtraData("cartGuid", guid)); } string name = cart.Name; if (name != null) { extraDataList.Add(new BugSense.Core.Model.CrashExtraData("cartName", name.Trim())); } string engineGameState = "<unknown>"; Models.WherigoModel model = App.Current.Model; if (model != null) { Models.WFCoreAdapter core = model.Core; if (core != null) { engineGameState = core.GameState.ToString(); } } extraDataList.Add(new BugSense.Core.Model.CrashExtraData("engineGameState", engineGameState)); }
protected override void OnModelChanged(Models.WherigoModel newModel) { if (newModel != null && newModel.Core.IsReady) { // Refreshes all visibilities. RefreshVisibilities(); } }
protected override void OnModelChanged(Models.WherigoModel newModel) { if (newModel != null) { // Refreshes the statuses. RefreshCompassStatuses(); RefreshLocationStatuses(); } }
private void OnModelChangingInternal(Models.WherigoModel oldValue, Models.WherigoModel newValue) { // Unregisters old event handlers. if (oldValue != null) { oldValue.Core.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(Core_PropertyChanged); } // Registers new event handlers. if (newValue != null) { newValue.Core.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(Core_PropertyChanged); } // Notifies children. OnModelChanging(oldValue, newValue); }
protected override void OnModelChanging(Models.WherigoModel oldValue, Models.WherigoModel newValue) { // Removes handlers on the old model. if (oldValue != null) { // Disables the compass. oldValue.Core.IsCompassEnabled = false; // Removes handlers. oldValue.Core.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(Core_PropertyChanged); } // Adds handlers to the new model. if (newValue != null) { // Enables the compass for diagnostics. newValue.Core.IsCompassEnabled = true; // Adds handlers. newValue.Core.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(Core_PropertyChanged); } }
protected override void OnModelChanging(Models.WherigoModel oldValue, Models.WherigoModel newValue) { // Unregisters event handlers. if (oldValue != null) { newValue.Core.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(Core_PropertyChanged); } // Registers event handlers. if (newValue != null) { // Registers this event manually to bypass BaseViewModel's relay restrictions. // (OnCorePropertyChanged is not relayed until the Engine is ready.) newValue.Core.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(Core_PropertyChanged); // Makes sure the compass is running. newValue.Core.IsCompassEnabled = true; // Refreshes the heading accuracy. RefreshCalibrationFromCore(newValue.Core); } }
/// <summary> /// Called when the underlying model is changing. /// </summary> /// <param name="oldValue"></param> /// <param name="newValue"></param> protected virtual void OnModelChanging(Models.WherigoModel oldValue, Models.WherigoModel newValue) { }
/// <summary> /// Called when the underlying model has changed. /// </summary> /// <param name="newModel"></param> protected virtual void OnModelChanged(Models.WherigoModel newModel) { }