/// <summary> /// New progress bar. /// </summary> /// <param name="console"></param> /// <param name="maxTicks"></param> /// <param name="message"></param> public ConsoleProgressBar(IConsoleInterface console, int maxTicks, string message) { _console = console; TextColor = _console.ForegroundColor; _maxTicks = Math.Max(1, maxTicks); _message = message; }
/// <summary> /// Constructor injects Console Interface and all Math Services /// </summary> /// <param name="consoleInterface">Console interface</param> /// <param name="addService">Add service</param> /// <param name="multiplyService">Multiply service</param> public CalculatorController( IConsoleInterface consoleInterface, ICalculatorAddService addService, ICalculatorMultiplyService multiplyService) { _consoleInterface = consoleInterface; _addService = addService; _multiplyService = multiplyService; }
/// <summary> /// Initializes a new instance of <see cref="ConsoleLogger"/>. /// </summary> public ConsoleLogger(IConsoleInterface console) : base(console) { Stopwatch = Stopwatch.StartNew(); _console = console; }
public ConsoleFactory(IConsoleRedirectTester tester = null) { var redirectTester = tester ?? new ConsoleRedirectTester(); _console = redirectTester.IsOutputRedirected() ? new RedirectedConsole(ConsoleStream.Out) : new DefaultConsole(ConsoleStream.Out) as IConsoleInterface; _error = redirectTester.IsErrorRedirected() ? new RedirectedConsole(ConsoleStream.Error) : new DefaultConsole(ConsoleStream.Error) as IConsoleInterface; }
/// <summary> /// Initializes a new instance of <see cref="CommandLineConsoleLogger"/>. /// </summary> public CommandLineConsoleLogger(IConsoleInterface console) : base(console) { }
protected void SetAsDisconnected() { // Make sure to invoke GUI changes on the correct thread this.Invoke((MethodInvoker) delegate() { if (_wcfFactory != null) { try { _wcfFactory.Close(); } catch (CommunicationObjectFaultedException) { } } _proxy = null; _wcfFactory = null; _connectionPingTimer.Stop(); txtInput.Enabled = false; lblConnectionStatus.Text = "Disconnected"; _connectedHostName = null; // Set all the menu item statuses connectToolStripMenuItem.Enabled = true; disconnectToolStripMenuItem.Enabled = false; executeToolStripMenuItem.Enabled = false; }); }
public static string Prompt(this IConsoleInterface con, string message) { con.WriteLine(message); return(con.ReadLine()); }
/// <inheritdoc /> public SakoeLogger(IConsoleInterface console) : base(console) { }
private void connectToolStripMenuItem_Click(object sender, EventArgs e) { var connectForm = new fmConnect(); connectForm.CallBack = _callbacks; connectForm.ShowDialog(); // Upon exiting, if a non-null proxy was returned the connection was successful if (connectForm.Proxy == null) { SetAsDisconnected(); } else { _proxy = connectForm.Proxy; _wcfFactory = connectForm.WcfChannelFactory; _connectedHostName = connectForm.ConnectedHost; SetAsConnected(); } }
public TicTacToePresenter(IConsoleInterface view, IGame game) { _view = view; _game = game; }
public ErrorAdapter(IConsoleInterface consoleInterface, string errorPrefix) : base(consoleInterface, errorPrefix) { }
/// <inheritdoc /> public GlobalLogger(IConsoleInterface console) : base(console) { }
public Employee(IEmail email, IConsoleInterface consoleInt) { this.EmailService = email; this.ConsoleInt = consoleInt; }
//TODO: Refactor ContactsUi to use constructor injection for the ContactRepository //TODO: add a private readonly field for ContactRepository (typed as the interface it implements) public ContactsUi(IConsoleInterface consoleInterface = null, IRepository <Contact> repContact = null) { this.consoleInterface = consoleInterface ?? new ConsoleInterface(); this._ContactRepository = repContact ?? new ContactRepository(); }