private double ParseValue(object value) { IntegrityCheck.IsNotNull(value); double val; bool isValSuccessful = double.TryParse((string)value, out val); IntegrityCheck.IsTrue(isValSuccessful); return(val); }
private T ToState(Type stateType) { IntegrityCheck.IsTrue( typeof(T).IsAssignableFrom(stateType), "Supplied type doesn't derive from {0}", typeof(T).Name); IntegrityCheck.IsFalse( stateType.IsAbstract, "Cannot transition to abstract state {0}", stateType.Name); T state; bool isFound = m_States.TryGetValue(stateType, out state); IntegrityCheck.IsTrue(isFound, "State {0} not found in m_States", stateType.Name); IntegrityCheck.IsNotNull( state, "State {0} found in m_States, but value was null", stateType.Name); return(state); }
public override void SaveTemplate() { IntegrityCheck.IsTrue(Outer.m_TemplatingViewModel.IsSaveTemplatePermitted); TransitionTo(typeof(Saving)); }
/// <summary> /// Gets the event responses for a given event. /// </summary> /// <typeparam name="T">The class to cast the event arguments to</typeparam> /// <param name="eventName">Name of the event.</param> /// <returns></returns> public IEnumerable <T> GetEventResponses <T>(string eventName) where T : EventArgs { IntegrityCheck.IsTrue(m_EventResponses.ContainsKey(eventName)); return(m_EventResponses[eventName].Select(x => (T)x)); }