public InstancePack CreateInstance(Netool.Logging.InstanceLogger logger, InstanceType type, object settings) { IInstance instance; if (settings == null) { throw new ArgumentNullException("settings"); } switch (type) { case InstanceType.Server: var s = settings as TcpServerSettings; if (s == null) { throw new InvalidSettingsTypeException(); } instance = new CalcServer(s); break; default: throw new NotImplementedException(); } var view = new DefaultInstanceView(); var cont = new DefaultInstanceController(view, instance, logger, loader); view.SetController(cont); return(new InstancePack(view, cont, type)); }
public InstancePack RestoreInstance(Netool.Logging.InstanceLogger logger) { var view = new DefaultInstanceView(); var cont = new DefaultInstanceController(view, logger, loader); view.SetController(cont); return(new InstancePack(view, cont, cont.GetInstanceType())); }
public InstancePack CreateInstance(Netool.Logging.InstanceLogger logger, InstanceType type) { IInstance instance; switch (type) { case InstanceType.Server: instance = createServer(); break; default: throw new NotImplementedException(); } if (instance == null) { throw new SetupAbortedByUserException(); } var view = new DefaultInstanceView(); var cont = new DefaultInstanceController(view, instance, logger, loader); view.SetController(cont); return(new InstancePack(view, cont, type)); }