/// <summary> /// Gets the DirectX control that implements the interface with the type supplied. /// </summary> /// <param name="controlType"></param> /// <returns></returns> public override ISimilizationControl GetControl(System.Type controlType) { ISimilizationControl ctl = null; if (typeof(ILoadGameWindow) == controlType) { ctl = new LoadGameWindow(this.controlHost); } else if (controlType == typeof(ISaveGameWindow)) { } else if (controlType == typeof(ICityControl)) { return(new CityDetailWindow(this.controlHost)); } else if (controlType == typeof(IOptionsControl)) { return(new OptionsWindow(this.controlHost)); } else if (controlType == typeof(INewCityControl)) { ctl = new NewCityWindow(this.controlHost, this.gameWindow); } else if (controlType == typeof(INewGameControl)) { ctl = new NewGameControl(this.controlHost); } else if (controlType == typeof(IHistograph)) { } else if (controlType == typeof(ISplashScreen)) { ctl = new SplashScreen(this.controlHost); } else if (controlType == typeof(IStartingScreen)) { ctl = new MainMenu(this.controlHost); } else if (controlType == typeof(IImprovementBuiltControl)) { } else if (controlType == typeof(IResearchNeededControl)) { } else if (controlType == typeof(ITechnologyControl)) { } else if (controlType == typeof(IDomesticAdvisorControl)) { } else if (controlType == typeof(IDiplomacyControl)) { } else if (controlType == typeof(IForeignAdvisorControl)) { } else if (controlType == typeof(IHelpControl)) { } else if (controlType == typeof(IGameWindow)) { if (this.gameWindow == null) { this.gameWindow = new GameWindow(this.controlHost); } this.StatusView = this.gameWindow.TaskBar; return(this.gameWindow); } return(ctl); }
/// <summary> /// Gets an <c>ISimilizationControl</c> that is of the specified type. /// </summary> /// <param name="controlType">A <c>System.Type</c> that refers to the /// type of interface that the control should implement.</param> /// <returns>A reference to an Windows Forms control that implements the /// specified interface</returns> /// <remarks>This method controls the mapping between the generic form /// and dialog interfaces declared in the Similization Client and the /// concrete windows forms classes that implement those interfaces. This /// method is an override of the same function in the more generic Similization /// Client, so this method is mostly called from code in the SimilizationClient.dll /// assembly.</remarks> public override ISimilizationControl GetControl(System.Type controlType) { ISimilizationControl ctl = null; if (typeof(ILoadGameWindow) == controlType) { ctl = new LoadGameWindow(); } else if (controlType == typeof(ISaveGameWindow)) { ctl = new SaveGameWindow(); } else if (controlType == typeof(IAboutBox)) { ctl = new AboutBox(); } else if (controlType == typeof(IOptionsControl)) { ctl = new OptionsDialog(); } else if (controlType == typeof(INewCityControl)) { ctl = new NewCityDialog(); } else if (controlType == typeof(INewGameControl)) { ctl = new NewGameWizard(); } else if (controlType == typeof(IHistograph)) { ctl = new HistographDialog(ClientApplication.Instance.ServerInstance.History); } else if (controlType == typeof(IStartingScreen)) { ctl = new WelcomeControl(); } else if (controlType == typeof(IImprovementBuiltControl)) { ctl = new ImprovementBuiltDialog(); } else if (controlType == typeof(IResearchNeededControl)) { ctl = new ResearchNeededDialog(); } else if (controlType == typeof(ITechnologyControl)) { ctl = new NewTechnologyDialog(); } else if (controlType == typeof(IDomesticAdvisorControl)) { AdvisorDialog dlg = new AdvisorDialog(Advisor.DomesticAdvisor); ctl = dlg.ActiveAdvisorControl; } else if (controlType == typeof(IDiplomacyControl)) { ctl = new NegotiationDialog(); } else if (controlType == typeof(IDiplomaticTiePicker)) { ctl = new DiplomaticTiePicker(); } else if (controlType == typeof(IForeignAdvisorControl)) { AdvisorDialog dlg = new AdvisorDialog(Advisor.ForeignAdvisor); ctl = dlg.ActiveAdvisorControl; } else if (controlType == typeof(IMilitaryAdvisorControl)) { AdvisorDialog dlg = new AdvisorDialog(Advisor.MilitaryAdvisor); ctl = dlg.ActiveAdvisorControl; } else if (controlType == typeof(IHelpControl)) { ctl = new HelpControl(); ((HelpControl)ctl).Parent = this.mainForm; } else if (controlType == typeof(IGameWindow)) { if (this.GameWindow == null) { ctl = new GameWindow(); } else { ctl = this.GameWindow; } } else if (controlType == typeof(ISplashScreen)) { ctl = new SplashScreen(); } return(ctl); }