public HomeController( IMathService mathService, ILogger <HomeController> logger) { _logger = logger; _mathService = mathService; }
public PiService( AppDbContext ctx, IMathService mathService) { _ctx = ctx; _mathService = mathService; }
private void Form1_Load(object sender, EventArgs e) { var endPoint = new EndpointAddress( "http://localhost:4444/MathService"); channel = ChannelFactory<IMathService>.CreateChannel(new BasicHttpBinding(), endPoint); }
private void Form1_Load(object sender, EventArgs e) { var endPoint = new EndpointAddress( "http://localhost:4444/MathService"); channel = ChannelFactory <IMathService> .CreateChannel(new BasicHttpBinding(), endPoint); }
public CalculatorFromContainerViewModel() { if (!IsInDesignMode) { _mathService = SimpleIoc.Default.GetInstance <IMathService>(); } }
public ReferenceController(IMathService mathService, IStringService stringService, IShapeService shapeService, ITokenSettings tokenSettings) { _mathService = mathService; _stringService = stringService; _shapeService = shapeService; _tokenSettings = tokenSettings; }
static void Main(string[] args) { m_Proxy = ProxyGen.GetChannel <IMathService>(); m_Tests = ConsoleHelpers.ReadInt("Enter how many iterations for the test: "); m_StartNum = BigInteger.Parse(ConsoleHelpers.ReadString("Enter a start number for calculating square roots: ")); // start the service m_Proxy.Sqrt(144); TimeSpan syncTime = TestSync(); TimeSpan asyncTime = TestAsync(); Console.WriteLine(); Console.WriteLine(new string('=', 50)); Console.WriteLine("Synchronous Test:"); Console.WriteLine($"Total Seconds: {syncTime}"); Console.WriteLine(new string('=', 50)); Console.WriteLine(); Console.WriteLine(new string('=', 50)); Console.WriteLine("Asynchronous Test:"); Console.WriteLine($"Total Seconds: {asyncTime}"); Console.WriteLine(new string('=', 50)); Console.WriteLine("Press <ENTER> to quit..."); Console.ReadLine(); }
protected void _mod_Command(object sender, CommandEventArgs e) { if (int.TryParse(_op1.Text, out a) && int.TryParse(_op2.Text, out b)) { IMathService service = (IMathService)RemotingHelper.GetObject(typeof(IMathService)); _addResult.Text = service.Mod(a, b).ToString(); } }
private void Form1_Load(object sender, EventArgs e) { _basicHttpChannel = new ChannelFactory <MathServiceLibrary.IMathService>("MathService_BasicHttp").CreateChannel(); _wsHttpChannel = new ChannelFactory <MathServiceLibrary.IMathService>("MathService_WsHttp").CreateChannel(); _netTcpChannel = new ChannelFactory <MathServiceLibrary.IMathService>("MathService_NetTcp").CreateChannel(); }
private void Form1_Load(object sender, EventArgs e) { var endPoint = new EndpointAddress( "net.tcp://localhost:6666/MathService"); channel = ChannelFactory <IMathService> . CreateChannel(new NetTcpBinding(), endPoint); }
public static ServerServiceDefinition BindService(IMathService serviceImpl) { return(ServerServiceDefinition.CreateBuilder("/math.Math/") .AddMethod(divMethod, serviceImpl.Div) .AddMethod(fibMethod, serviceImpl.Fib) .AddMethod(sumMethod, serviceImpl.Sum) .AddMethod(divManyMethod, serviceImpl.DivMany).Build()); }
public void Initialize() { var address = new EndpointAddress(ConfigHelper.MathServiceUrl); var bind = new BasicHttpBinding(); var factory = new ChannelFactory <IMathService>(bind, address); this._channel = factory.CreateChannel(); }
/// <summary> /// Constructor. Sets up maths reference and initial colour. /// </summary> /// <param name="mathService"></param> /// <param name="dateTimeService"></param> /// <param name="initialColor"></param> public Hands(IMathService mathService, IDateTimeService dateTimeService, Color initialColor) { _mathService = mathService; _dateTimeService = dateTimeService; _secondBrush = new SolidBrush(initialColor); _minuteBrush = new SolidBrush(initialColor); _hourlyBrush = new SolidBrush(initialColor); }
public static ServerServiceDefinition BindService(IMathService serviceImpl) { return(ServerServiceDefinition.CreateBuilder(ServiceName) .AddMethod(DivMethod, serviceImpl.Div) .AddMethod(FibMethod, serviceImpl.Fib) .AddMethod(SumMethod, serviceImpl.Sum) .AddMethod(DivManyMethod, serviceImpl.DivMany).Build()); }
public MainWindowViewModel(IMathService mathService, ICharacterCountService characterCountService) { _mathService = mathService; _characterCountService = characterCountService; AddCommand = new DelegateCommand(Add); CountCommand = new DelegateCommand(Count); DivideCommand = new DelegateCommand(Divide); }
/// <summary> /// Constructor initializes the math object and initial font color. /// </summary> /// <param name="mathService"></param> /// <param name="initialColor"></param> public Numerals(IMathService mathService, Color initialColor) { _mathService = mathService; _fontBrush = new SolidBrush(initialColor); _font = new Font("Segoe UI", 16); _stringFormat = new StringFormat(); _stringFormat.Alignment = StringAlignment.Center; _stringFormat.LineAlignment = StringAlignment.Center; }
public PricingService(ICryptoCompareDataService cryptoCompareDataService, IMathService mathService, IBuilderFactory builderFactory, IPricingContext pricingContext, IExchangeApiServiceFactory exchangeApiServiceFactory) { _threads = new List <Thread>(); _builderFactory = builderFactory; _pricingContext = pricingContext; _exchangeApiServiceFactory = exchangeApiServiceFactory; _cryptoCompareDataService = cryptoCompareDataService; _mathService = mathService; }
//public TradingService(string exchangeCurrentlyHoldingFunds, string primaryCoin, decimal investment) // : this(exchangeCurrentlyHoldingFunds, primaryCoin, investment, new MathService(), new ExchangeApiServiceFactory(), new CryptoCompareDataService(), new ConfigService(), new EmailService()) //{ } public TradingService(IMathService mathService, IExchangeApiServiceFactory apiServiceFactory, ICryptoCompareDataService cryptoCompareDataService, IConfigService configService, IEmailService emailService, IPricingService pricingService, IPricingContext pricingContext) { _mathService = mathService; _apiServiceFactory = apiServiceFactory; _cryptoCompareDataService = cryptoCompareDataService; _configService = configService; _emailService = emailService; _pricingService = pricingService; _pricingContext = pricingContext; }
private void button_mul_Click(object sender, RoutedEventArgs e) { int firstNum = Convert.ToInt32(text_first_num.Text); int secNum = Convert.ToInt32(text_second_num.Text); IMathService mathHandler = RequestFactory.GetMathServiceHandler(); float ans = mathHandler.Multiply(firstNum, secNum); text_answ.Text = Convert.ToString(ans); }
public DefaultControllerTests() { validationService = Substitute.For <IValidationService>(); mathService = Substitute.For <IMathService>(); controller = new DefaultController(validationService, mathService) { ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext() } }; }
private void button_divd_Click(object sender, RoutedEventArgs e) { int firstNum = Convert.ToInt32(text_first_num.Text); int secNum = Convert.ToInt32(text_second_num.Text); IMathService mathHandler = RequestFactory.GetMathServiceHandler(); double ans = mathHandler.Divide(firstNum, secNum); //var ans_str = DoFormat(ans); text_answ.Text = ans.ToString(); }
public ExchangeRateService( IConfiguration configurationRoot, IFixerClient fixerClient, IMathService mathService, IResponseParser responseParser) { ConfigurationRoot = configurationRoot; FixerClient = fixerClient; MathService = mathService; ResponseParser = responseParser; FixerClient.AssignApiKey(GetAccessKey()); }
static void Main(string[] args) { m_Proxy = ProxyGen.GetChannel <IMathService>(); m_StartNum = BigInteger.Parse(ConsoleHelpers.ReadString("Please enter a start number: ")); m_Tests = ConsoleHelpers.ReadInt("Please enter the number of tests: "); m_Proxy.Sqrt(m_StartNum); TimeSpan syncTime = TestSync(); TimeSpan asyncTime = TestAsync(); Console.WriteLine("Total seconds of synchronous test: {0}", syncTime.TotalSeconds); Console.WriteLine("Total seconds of asynchronous test: {0}", asyncTime.TotalSeconds); }
/// <summary> /// Main entry method for the program /// </summary> /// <param name="args">No arguments used</param> static void Main(string[] args) { // initialize the client proxy channel to the service m_Proxy = ProxyGen.GetChannel <IMathService>(); // have the user enter new values for m_Tests and m_StartNum m_Tests = Utilities.ConsoleHelpers.ReadInt("Please enter the number of iterations to perform per test: ", 1, 1000000); // Utilities class did not have a BigInteger helper method so I made my own here string bigInteger = Utilities.ConsoleHelpers.ReadString("Enter the initial number to use in each loop when calculating square roots: "); // Makes sure it can parse to a BigInteger before continuing while (!BigInteger.TryParse(bigInteger, out m_StartNum)) { // Could not Parse Your Big Integer, Please try again Console.WriteLine("Could not parse your big integer, please try again: "); bigInteger = Utilities.ConsoleHelpers.ReadString("Enter the initial number to use in each loop when calculating square roots: "); } // end of while loop // Now, to make sure both tests are treated “equally”, make a quick call // to the service to “spin it up”. That way when the tests are executed // there is no initial delay. Just call either Sqrt or IsPrime on m_Proxy // with an arbitrary number. bool temp = m_Proxy.IsPrime(330); // Now, make a call to the TestSync and TestAsync methods // and store their return values in two different TimeSpan objects, // maybe called syncTime and asyncTime, respectively. TimeSpan syncTime = TestSync(); TimeSpan asyncTime = TestAsync(); // Outputs to the console the TotalSeconds value from // each of the TimeSpan objects with an appropriate header // for each.The user can then see the apparent difference // in performance between the synchronous and asynchronous calls, if any. Console.WriteLine(new string('=', 40)); Console.WriteLine("{0,30}", "Time Spans in Seconds"); Console.WriteLine(new string('_', 40)); Console.WriteLine("{0, 15} {1, 15}", "Synchronous", "Asynchronous"); Console.WriteLine("{0, 15} {1, 15}", syncTime.TotalSeconds, asyncTime.TotalSeconds); Console.WriteLine(new string('=', 40)); // Wait for the user to want to quit the application Console.WriteLine("Press <Enter> to Quit..."); Console.ReadLine(); } // end of main method
public DenseStorageInfoService(Matrix <T> matrix, IMathService <T> mathService) { A = matrix; S = matrix.Storage as DenseColumnMajorMatrixStorage <T>; this.math = mathService; this.StorageInfo = new StorageInfo(); this.StorageInfo.RowCount = S.RowCount; this.StorageInfo.ColumnCount = S.ColumnCount; this.StorageInfo.ValueCount = S.RowCount * S.ColumnCount; int size = Helper.SizeOf <T>(); this.StorageInfo.TotalBytes = size * S.RowCount * S.ColumnCount; }
public SparseStorageInfoService(Matrix <T> matrix, IMathService <T> mathService) { A = matrix; S = matrix.Storage as SparseCompressedRowMatrixStorage <T>; this.math = mathService; this.StorageInfo = new StorageInfo(); this.StorageInfo.RowCount = S.RowCount; this.StorageInfo.ColumnCount = S.ColumnCount; this.StorageInfo.ValueCount = S.ValueCount; int size = Helper.SizeOf <T>(); int i = Constants.SizeOfInt; this.StorageInfo.TotalBytes = i * S.RowPointers.Length + i * S.ColumnIndices.Length + size * S.Values.Length; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); //initialize DI Contianer Container.Initialize(); mathService = Container.mathService; btnCompute = FindViewById <Button>(Resource.Id.btnCompute); operation = FindViewById <Spinner>(Resource.Id.spinner_operator); editNum1 = FindViewById <EditText>(Resource.Id.edit_num1); editNum2 = FindViewById <EditText>(Resource.Id.edit_num2); alert = new AlertDialog.Builder(this); btnCompute.Click += BtnCompute_Click; operation.ItemSelected += Operation_ItemSelected; }
public override async Task <long[][]> Run(IMathService MathService, long[] InputValues, long[] StepValues) { // Create output array. var outputValues = new long[InputValues.Length][]; for (var index = 0; index < outputValues.Length; index++) { outputValues[index] = new long[StepValues.Length]; } // To establish baseline performance, call math service methods sequentially. for (var index = 0; index < InputValues.Length; index++) { var inputValue = InputValues[index]; var stepValue = StepValues[0]; // Step 1 : Power var outputValue = await MathService.Power(inputValue, stepValue); outputValues[index][0] = outputValue; inputValue = outputValue; // Step 2 : Add stepValue = StepValues[1]; outputValue = await MathService.Add(inputValue, stepValue); outputValues[index][1] = outputValue; inputValue = outputValue; // Step 3 : Multiply stepValue = StepValues[2]; outputValue = await MathService.Multiply(inputValue, stepValue); outputValues[index][2] = outputValue; inputValue = outputValue; // Step 4 : Modulo stepValue = StepValues[3]; outputValue = await MathService.Modulo(inputValue, stepValue); outputValues[index][3] = outputValue; // Display values. DisplayValues(InputValues, StepValues, outputValues); } return(outputValues); }
static void Main(string[] args) { HttpChannel channel = new HttpChannel(); const string SERVICE_NAME = "mathService"; ChannelServices.RegisterChannel(channel, false); BrokerHelper brokerHelper = new BrokerHelper(); // connect to Broker string serverLocation = brokerHelper.locateServer(SERVICE_NAME); Console.WriteLine("Try to connect to server from location: " + serverLocation); IMathService clientProxy = (IMathService) Activator.GetObject(typeof(IMathService), serverLocation); Console.WriteLine("Client.main(): Reference acquired"); dynamic total = clientProxy.Sum(99, 1); Console.WriteLine("Calling remote method {0} + {1} = {2}", 99, 1, total); }
public ChildService( UserManager <EDIApplicationUser> userManager, ILoggerFactory loggerFactory, IAsyncRepository <Child> childRepository, IAsyncRepository <QuestionnairesDataDemographic> questionnairesDataDemographic, IAsyncRepository <QuestionnairesDataSectionA> questionnairesDataSectionA, IAsyncRepository <QuestionnairesDataSectionB> questionnairesDataSectionB, IAsyncRepository <QuestionnairesDataSectionC> questionnairesDataSectionC, IAsyncRepository <QuestionnairesDataSectionD> questionnairesDataSectionD, IAsyncRepository <QuestionnairesDataSectionE> questionnairesDataSectionE, IAsyncIdentityRepository accountRepository, ServiceContext dbContext, IHostEnvironment hostingEnvironment, IHttpContextAccessor httpContextAccessor, AuthenticationStateProvider authenticationStateProvider, ISharedService sharedService, UserSettings UserSettings, IMathService mathService, IOptions <EDIAppSettings> settings) { _logger = loggerFactory.CreateLogger <ChildService>(); _httpContextAccessor = httpContextAccessor; _childRepository = childRepository; _questionnairesDataDemographic = questionnairesDataDemographic; _questionnairesDataSectionA = questionnairesDataSectionA; _questionnairesDataSectionB = questionnairesDataSectionB; _questionnairesDataSectionC = questionnairesDataSectionC; _questionnairesDataSectionD = questionnairesDataSectionD; _questionnairesDataSectionE = questionnairesDataSectionE; _accountRepository = accountRepository; _dbContext = dbContext; _hostingEnvironment = hostingEnvironment; _authenticationStateProvider = authenticationStateProvider; _userSettings = UserSettings; _mathService = (MathService)mathService; EDIppSettings = settings.Value; _sharedService = sharedService; }
/// <summary> /// Constructor. Sets up the math service and initial color. /// </summary> /// <param name="mathService"></param> /// <param name="initialColor"></param> public Center(IMathService mathService, Color initialColor) { _mathService = mathService; _brush = new SolidBrush(initialColor); }
/// <summary> /// Constructor. Sets up the MathService reference and initial color. /// </summary> /// <param name="mathService"></param> /// <param name="initialColor"></param> public Tick(IMathService mathService, Color initialColor) { _mathService = mathService; _tickPen = new Pen(initialColor, 1); }
public AnalyzeStatusesService(IMathService mathService) { _mathService = mathService; }
public void SetUp() { mathService = new MathService(); dataService = new DataService(mathService); }
public void SetUp() { mathService = new MathService(); }
/// <summary> /// interaction with external dependency /// return enumerable with powers of given number /// </summary> /// <param name="number"></param> /// <param name="powers">max number of returned powers</param> /// <param name="service"></param> /// <returns></returns> public IEnumerable<double> DoArrayStuffWithIface(double number, int powers, IMathService service) { return Enumerable.Range(1, powers) .Select(power => service.Power(number, power)) .ToArray(); }
public void Setup() { _analysis = MockRepository.GenerateMock<IMathService>(); _target = new AnalyzeStatusesService(_analysis); }
public CachingDataModel(string filePath, FullDataPropertiesDto fullDataPropertiesDto, IMathService mathService) : base(filePath, fullDataPropertiesDto, mathService) { // }
public Clock() { InitializeComponent(); InitializeMenu(); SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true); _mathService = new MathService(ClientRectangle); _background = new Background(Properties.Settings.Default.backgroundColor); _hands = new Hands(_mathService, new DateTimeService(), Properties.Settings.Default.handColor); _numerals = new Numerals(_mathService, Properties.Settings.Default.foreColor); _ticks = new Tick(_mathService, Properties.Settings.Default.tickColor); _center = new Center(_mathService, Properties.Settings.Default.handColor); _resizeGrip = new ResizeGrip(_mathService); if (!Properties.Settings.Default.lastWindowSize.IsEmpty) { Size = Properties.Settings.Default.lastWindowSize; } if (!Properties.Settings.Default.lastWindowLocation.IsEmpty) { Location = Properties.Settings.Default.lastWindowLocation; } MouseDown += (object o, MouseEventArgs e) => { if (e.Button == MouseButtons.Left) { Win32.NativeMethods.ReleaseCapture(); Win32.NativeMethods.SendMessage(Handle, Win32.Constants.WM_NCLBUTTONDOWN, Win32.Constants.HTCAPTION, 0); } }; ResizeBegin += (o, e) => { _timer.Stop(); }; ResizeEnd += (o, e) => { _timer.Start(); }; Resize += (o, e) => { _mathService.Rectangle = ClientRectangle; }; Properties.Settings.Default.PropertyChanged += (o, e) => { _hands.Color = Properties.Settings.Default.handColor; _numerals.Color = Properties.Settings.Default.foreColor; _ticks.Color = Properties.Settings.Default.tickColor; _background.Color = Properties.Settings.Default.backgroundColor; _center.Color = Properties.Settings.Default.handColor; _resizeGrip.Color = Properties.Settings.Default.backgroundColor; Invalidate(); }; Paint += (object o, PaintEventArgs e) => { e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; _graphicsService.Graphics = e.Graphics; _background.Draw(_graphicsService); _hands.Draw(_graphicsService); _numerals.Draw(_graphicsService); _ticks.Draw(_graphicsService); _center.Draw(_graphicsService); _resizeGrip.Draw(_graphicsService); }; FormClosing += (o, e) => { Properties.Settings.Default.lastWindowLocation = Location; Properties.Settings.Default.lastWindowSize = Size; Properties.Settings.Default.Save(); }; OnResize(EventArgs.Empty); _timer = new Timer(); _timer.Interval = 1000; _timer.Tick += (o, e) => { Invalidate(); }; _timer.Start(); }
private void Form1_Load(object sender, EventArgs e) { var endPoint = new EndpointAddress("net.tcp://localhost:6666/MathService"); channel = ChannelFactory<IMathService>.CreateChannel(new NetTcpBinding(), endPoint); }
public DataModel(string filePath, FullDataPropertiesDto fullDataPropertiesDto, IMathService mathService) { FilePath = filePath; dataPropertiesModel = GetDataPropertiesModel(fullDataPropertiesDto); this.mathService = mathService; }
public DataService(IMathService mathService) { this.mathService = mathService; }
public MathServiceIntegrationTests() { _mathService = new MathService(new InputParser(new UserFlagParser())); }
public NullObjectTest() { ILogger logger = new NullLogger(); this.mathService = new MathService(logger); }
/// <summary> /// Constructor. Sets up the math service. /// </summary> /// <param name="mathService"></param> public ResizeGrip(IMathService mathService) { _mathService = mathService; }
public FibonacciController(ILogger <FibonacciController> logger, IMathService mathService) { _logger = logger; //logger was injected here to easily add logging functionality and any part of the class. _mathService = mathService; }
public static ServerServiceDefinition BindService(IMathService serviceImpl) { return ServerServiceDefinition.CreateBuilder("/math.Math/") .AddMethod(divMethod, serviceImpl.Div) .AddMethod(fibMethod, serviceImpl.Fib) .AddMethod(sumMethod, serviceImpl.Sum) .AddMethod(divManyMethod, serviceImpl.DivMany).Build(); }