static async Task Main(string[] args) { try { // Load configuration from app settings var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json"); var config = builder.Build(); var settings = config.GetSection("Settings").Get <Settings>(); // Setup our DI var serviceProvider = new ServiceCollection() .AddMemoryCache() .AddSingleton <IConsolePrinterService, ConsolePrinterService>() .AddSingleton <IConsoleKeyMapperService, ConsoleKeyMapperService>() .AddSingleton <IJokeScrubUtil, JokeScrubUtil>() .AddSingleton <IPersonService>(x => new PersonService(settings.RandomPersonAPI)) .AddSingleton <IJokesJsonFeedService>(j => new JokesJsonFeedService(j.GetService <IJokeScrubUtil>(), settings.ChuckNorrisAPI, settings.DefaultNumberOfJokes)) .AddSingleton <IUserPromptService, UserPromptService>() .BuildServiceProvider(); // Kick start user interaction IUserPromptService userPrompt = serviceProvider.GetService <IUserPromptService>(); await userPrompt.StartInteractionAsync(); } catch (Exception ex) { Console.WriteLine(Environment.NewLine + Constants.ErrorSystemFault + " " + Constants.ErrorDetails + " " + ex?.Message); } }
public DungeonGame(IGameHost gameHost, IConsoleOutputService consoleOut, IUserPromptService userPrompt, ISoundPlayerService soundPlayer) : base(gameHost, consoleOut, userPrompt, soundPlayer) { }
public DungeonBoard(IConsoleOutputService consoleOut, ISoundPlayerService soundPlayer, IUserPromptService userPrompt, string mapName) : base(NumRows, NumColumns) { this.consoleOut = consoleOut; this.soundPlayer = soundPlayer; this.userPrompt = userPrompt; this.mapName = mapName; }
public SOLIDApplicationOrchestrator(IGetCarDetailsOrchestrator carDetailsOrchestrator, IValidationRuleService validationRuleService, IValidationResult validationResult, IUserPromptService userPrompt, IVehicleValidationRules vehicleValidationRules) { _carDetailsOrchestrator = carDetailsOrchestrator; _validationRuleService = validationRuleService; _validationResult = validationResult; _userPrompt = userPrompt; _vehicleValidationRules = vehicleValidationRules; }
public Game(IGameHost gameHost, IConsoleOutputService consoleOut, IUserPromptService userPrompt, ISoundPlayerService soundPlayer) { this.gameHost = gameHost; this.consoleOut = consoleOut; this.userPrompt = userPrompt; this.soundPlayer = soundPlayer; this.mapName = null; this.Reset(); }
public Portal(IUserPromptService userPrompt, string name, string description, GameBoard.Position destination, Password pwd, int maxAttempts) { this.userPrompt = userPrompt; this.Name = name; this.desc = description; this.destination = destination; this.pwd = pwd; this.maxAttempts = maxAttempts; }
void OpenCalcPropertiesDialog() { Form form1 = null; //should be a CalcPropertiesEditorForm which is private Cube cube = (Cube)this.ApplicationObject.ActiveWindow.ProjectItem.Object; System.IServiceProvider provider = (System.IServiceProvider) this.ApplicationObject.ActiveWindow.ProjectItem.ContainingProject; using (WaitCursor cursor1 = new WaitCursor()) { IUserPromptService oService = (IUserPromptService)provider.GetService(typeof(IUserPromptService)); foreach (Type t in System.Reflection.Assembly.GetAssembly(typeof(Microsoft.AnalysisServices.Design.Scripts)).GetTypes()) { if (t.FullName == "Microsoft.AnalysisServices.Design.Calculations.CalcPropertiesEditorForm") { form1 = (Form)t.GetConstructor(new Type[] { typeof(IUserPromptService) }).Invoke(new object[] { oService }); break; } } if (form1 == null) { throw new Exception("Couldn't create instance of CalcPropertiesEditorForm"); } object script1 = null; //should be a Microsoft.AnalysisServices.MdxCodeDom.MdxCodeScript object try { //validate the script because deploying an invalid script makes cube unusable Microsoft.AnalysisServices.Design.Scripts scripts = new Microsoft.AnalysisServices.Design.Scripts(cube); System.Reflection.BindingFlags getflags = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Instance; script1 = scripts.GetType().InvokeMember("mdxCodeScript", getflags, null, scripts, null); } catch (Microsoft.AnalysisServices.Design.ScriptParsingFailed ex) { string throwaway = ex.Message; //prevents a warning during compile MessageBox.Show("MDX Script in " + cube.Name + " is not valid.", "Problem Deploying MDX Script"); return; } if (cube.MdxScripts.Count == 0) { MessageBox.Show("There is no MDX script defined in this cube yet."); return; } System.Reflection.BindingFlags getmethodflags = System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Instance; form1.GetType().InvokeMember("Initialize", getmethodflags, null, form1, new object[] { cube.MdxScripts[0], script1, cube, null }); //now make custom changes to the form Button okButton = (Button)form1.Controls.Find("okButton", true)[0]; Panel panel = (Panel)form1.Controls.Find("gridPanel", true)[0]; Button descButton = new Button(); descButton.Text = "Edit Description"; descButton.Anchor = AnchorStyles.Left | AnchorStyles.Bottom; descButton.Left = panel.Left; descButton.Top = okButton.Top; descButton.Width += 40; descButton.Click += new EventHandler(descButton_Click); form1.Controls.Add(descButton); } if (Microsoft.DataWarehouse.DataWarehouseUtilities.ShowDialog(form1, provider) == DialogResult.OK) { using (WaitCursor cursor2 = new WaitCursor()) { System.Reflection.BindingFlags getflags = System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Instance; CalculationPropertyCollection collection1 = (CalculationPropertyCollection)form1.GetType().InvokeMember("GetResultProperties", getflags, null, form1, new object[] { }); DesignerTransaction transaction1 = null; try { IDesignerHost host1 = (IDesignerHost)ApplicationObject.ActiveWindow.Object; transaction1 = host1.CreateTransaction("BidsHelperCalcPropertiesUndoBatchDesc"); IComponentChangeService service1 = (IComponentChangeService)ApplicationObject.ActiveWindow.Object; service1.OnComponentChanging(cube.MdxScripts[0].CalculationProperties, null); cube.MdxScripts[0].CalculationProperties.Clear(); for (int num1 = collection1.Count - 1; num1 >= 0; num1--) { CalculationProperty property1 = collection1[num1]; collection1.RemoveAt(num1); cube.MdxScripts[0].CalculationProperties.Insert(0, property1); } service1.OnComponentChanged(cube.MdxScripts[0].CalculationProperties, null, null, null); } catch (CheckoutException exception1) { if (transaction1 != null) { transaction1.Cancel(); } if (exception1 != CheckoutException.Canceled) { throw exception1; } } finally { if (transaction1 != null) { transaction1.Commit(); } } } } }
public DungeonBoard(IConsoleOutputService consoleOut, ISoundPlayerService soundPlayer, IUserPromptService userPrompt) : this(consoleOut, soundPlayer, userPrompt, null) { }
public GetCarDetailsOrchestrator(IUserPromptService UserPrompt) { _userPrompt = UserPrompt; }