//Note:model, Settings init done in viewmodel (after default handler set) #endregion ConsoleAppBase #region CommandLineSwitch Action Delegates /// <summary> /// Instance of an action conforming to delegate Action(Of TSettings), where TSettings is String. /// Command 't' tests the use of parameters. /// </summary> /// <param name="value"></param> /// <param name="outputDelegate"></param> static private void t(String value, ConsoleApplication.TOutputDelegate outputDelegate) { try { outputDelegate(String.Format("t:\t{0}", value)); } catch (Exception ex) { Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error); throw; } }
/// <summary> /// Validate and set selected settings. /// Instance of an action conforming to delegate Action<T>, where T is String. /// </summary> /// <param name="value"></param> /// <param name="outputDelegate"></param> static void f(String value, ConsoleApplication.TOutputDelegate outputDelegate) { try { #if debug outputDelegate(String.Format("s{0}\t{1}", ConsoleApplication.CommandLineSwitchValueSeparator, value)); #endif //validate settings file path if (!System.IO.File.Exists(value)) { throw new ArgumentException(String.Format("Invalid settings file path: '{0}'", value)); } Filename = value; } catch (Exception ex) { Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error); throw; } }