public ColoredMandel(ICalculatorFactory factory) : base(factory) { c_layers = new List<ColorLayer>(); c_inscol = new ColorValue(true, 0, 0, 0); c_outcol = new ColorValue(true, 1, 1, 1); }
static void Main(string[] args) { int var1, var2; var result = 0.0; string op; Console.WriteLine("$-:欢迎使用四则运算1.0.0版本!"); Console.WriteLine("$-:请输入运算式:"); Console.Write("$-: var1: "); var1 = Int32.Parse(Console.ReadLine()); Console.Write("$-: op: "); op = Console.ReadLine(); Console.Write("$-: var2 "); var2 = Int32.Parse(Console.ReadLine()); //利用配置文件管理工具配置文件 Configuration conf = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); string factoryname = conf.AppSettings.Settings[op].Value; //用反射机制 //当前程序集 //Type type = Type.GetType(factoryname); //type.Assembly.CreateInstance(factoryname); Assembly ass = Assembly.Load("No_rz43_CalcualtorLib"); ICalculatorFactory ft = (ICalculatorFactory)ass.CreateInstance(factoryname); ICalculator cal = ft.GetCalcualtor(); result = cal.Calcualtor(var1, var2); Console.WriteLine("$-:result: {0}{1}{2}={3}", var1, op, var2, result); Console.ReadKey(); }
public void Init() { _mockDb = new Mock <ITaxCalculatorDb>(); var services = new ServiceCollection(); services.AddTransient <ITaxCalculatorDb>(sp => _mockDb.Object); services.AddTransient <ICalculatorFactory, CalculatorFactory>(); services.AddTransient <ITaxCalculatorRepository, TaxCalculatorRepository>(); services.AddTransient <ITaxCalculator, Core.TaxCalculator>(); _provider = services.BuildServiceProvider(); _db = _provider.GetService <ITaxCalculatorDb>(); _taxCalculator = _provider.GetService <ITaxCalculator>(); _taxCalculatorRepository = _provider.GetService <ITaxCalculatorRepository>(); _calculatorFactory = _provider.GetService <ICalculatorFactory>(); }
private MandelType c_type; // Mandel vagy Julia mod #endregion Fields #region Constructors public Mandel() { c_cent = 0; c_radius = 2; c_saveCent = 0; c_saveRadius = 2; c_type = MandelType.MANDEL_TYPE_MANDEL; c_julia = 0; c_timeused = 0; c_LayerData = new List<ProcessLayer>(); c_fractaltype = FractalType.FRACTAL_TYPE_MANDEL; c_param = 0; c_lineprocess = true; c_processnum = 1; c_function = ""; c_haschanged = true; c_calc = null; c_LayerDataHash = 0; c_factory = null; }
private void btnOps_Click(object sender, EventArgs e) { dataX = double.Parse(tb_in.Text); tb_out.Text += ((Button)sender).Text; tb_in.Text = "0"; #region 使用配置文件和反射机制,按照所按操作符获取运算 cal //利用配置文件管理工具配置文件 Configuration conf = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); string factoryname = conf.AppSettings.Settings[((Button)sender).Text].Value; op = ((Button)sender).Text; //用反射机制 //当前程序集 //Type type = Type.GetType(factoryname); //type.Assembly.CreateInstance(factoryname); Assembly ass = Assembly.Load("No_rz43_CalcualtorLib"); ICalculatorFactory ft = (ICalculatorFactory)ass.CreateInstance(factoryname); cal = ft.GetCalcualtor(); #endregion 使用配置文件和反射机制,按照所按操作符获取运算 cal }
public CalculatorController(ICalculatorFactory calculatorFactory) { _calcFactory = calculatorFactory; }
public CalculatorService(IParseService parseService, ICalculatorFactory calculatorFactory, IService <Calculation> calculationService) { _parseService = parseService; _calculatorFactory = calculatorFactory; _calculationService = calculationService; }
public CalculatorService(ICalculatorFactory calculatorFactory, ICalculationLogger logger) { _calculatorFactory = calculatorFactory; _logger = logger; }
public PayrollServiceController(ICalculatorFactory factory, IPayrollDetailsRepository payrollDetailsRepository) { this.factory = factory; this.payrollDetailsRepository = payrollDetailsRepository; }
public TaxCalculator(ITaxCalculatorRepository taxCalculatorRepository, ICalculatorFactory calculatorFactory) { _taxCalculatorRepository = taxCalculatorRepository; _calculatorFactory = calculatorFactory; }
public ProbabilityCalculatorSupervisor(ICalculatorFactory calculatorFactory, ICalculationStorer calculationsStorer) { this.calculatorFactory = calculatorFactory; this.calculationsStorer = calculationsStorer; }
public MathService(ICalculatorFactory factory) { _calculatorFactory = factory; }
public HomeController(ICalculatorFactory calculatorFactory) { this._calculator = calculatorFactory.CreateAndGetInstance(); }
public EmployeeService(IEmployeeRepository employeeRepository, ICalculatorFactory calculatorFactory) { _employeeRepository = employeeRepository; _salaryCalculatorFactory = calculatorFactory; }
public YahtzeeScorer(ICalculatorFactory calculatorFactory) { _calculatorFactory = calculatorFactory; }
public VerlofProcess(IVerlofHistoriekRepository verlofHistoriekRepository, ICalculatorFactory factory) { _verlofHistoriekRepository = verlofHistoriekRepository; _factory = factory; }
public DataPointManagementService(IDataPointRepository repository, IYahooStockQuoteServiceClient stockQuoteClient, ICalculatorFactory calculatorFactory) { this.repository = repository; this.stockQuoteClient = stockQuoteClient; this.calculatorFactory = calculatorFactory; }
public Calculator(ICalculatorFactory calculatorFactory) { _calculatorFactory = calculatorFactory; }
public MathEngine(ICalculatorFactory factory) { this.factory = factory; }
public HomeController(ICalculatorFactory calculatorFactory) { _calculatorLazy = new Lazy <ICalculator>(() => calculatorFactory.CreateCalculator(10)); }
public ThreadCalculatorFactory(int processes, ICalculatorFactory fr) { _factory = fr; _processes = processes; }
public Mandel(ICalculatorFactory factory) : this() { c_factory = factory; }
public TaxValueController(CalculatorContext context, ICalculatorFactory factory) { _context = context; _factory = factory; }
public YahtzeeScorer(ICalculatorFactory calculatorFactory) { _calculatorFactory = calculatorFactory; }