本文整理汇总了C#中IController类的典型用法代码示例。如果您正苦于以下问题:C# IController类的具体用法?C# IController怎么用?C# IController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IController类属于命名空间,在下文中一共展示了IController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AppendFrame
public void AppendFrame(IController source)
{
var lg = LogGeneratorInstance();
lg.SetSource(source);
_log.Add(lg.GenerateLogEntry());
Changes = true;
}
示例2: ReleaseController
public void ReleaseController(IController controller)
{
// If the container was tracking this instance release it
// otherwise pass it down to the default factory to release
if (!_kernel.Release(controller))
_defaultFactory.ReleaseController(controller);
}
示例3: Render
public void Render(IController controller)
{
ComputeState(controller);
Gl.glClear(Gl.GL_COLOR_BUFFER_BIT);
Gl.glMatrixMode(Gl.GL_MODELVIEW);
Gl.glPushMatrix();
Gl.glLoadIdentity();
Gl.glTranslatef(-1, -1, 0);
Gl.glScalef((float) 2 / board.Width, (float) 2 / board.Height, 1);
Gl.glBegin(Gl.GL_QUADS);
foreach (var i in board) {
if (!i.Alive)
continue;
Color.FromHSL(i.Hue, 1, 0.5f).Use();
Gl.glVertex2i(i.X , i.Y );
Gl.glVertex2i(i.X + 1, i.Y );
Gl.glVertex2i(i.X + 1, i.Y + 1);
Gl.glVertex2i(i.X , i.Y + 1);
}
Gl.glEnd();
Gl.glPopMatrix();
}
示例4: ButtonConnection
public ButtonConnection(IController contoller)
{
log.Debug(m => m("Init button connection"));
var toggleBtn = ConnectorPin.P1Pin12.Input().PullDown();
var backBtn = ConnectorPin.P1Pin16.Input().PullDown();
var nextBtn = ConnectorPin.P1Pin18.Input().PullDown();
// toggle
toggleBtn.OnStatusChanged(state =>
{
if (state)
contoller.TogglePlay();
});
// next
nextBtn.OnStatusChanged(state =>
{
if (state)
contoller.PlayNext();
});
// previous
backBtn.OnStatusChanged(state =>
{
if (state)
contoller.PlayPrevious();
});
// open connection
_gpioConnection = new GpioConnection(toggleBtn, backBtn, nextBtn);
}
示例5: ActionScene
public ActionScene(
IController playerOneController,
IController playerTwoController,
Game game,
Texture2D theTexture,
Texture2D backgroundTexture,
Rectangle screenBounds,
SpriteFont font,
Vector2 gameoverPosition)
: this(game, theTexture, backgroundTexture, font, gameoverPosition)
{
this.TwoPlayers = true;
this._player1 = new Player(Game, ref this._actionTexture, new Vector2(x: screenBounds.Width / 3, y: 0), new Rectangle(323, 15, 30, 30), playerOneController);
this._player1.Initialize();
Components.Add(this._player1);
this._scorePlayer2 = new Score(game, font, Color.Red)
{
Position =
new Vector2(
this.Game.Window.ClientBounds.Width - 200, 10)
};
Components.Add(this._scorePlayer2);
this._player2 = new Player(Game, ref this._actionTexture, new Vector2((int)(screenBounds.Width / 1.5), 0), new Rectangle(360, 17, 30, 30), playerTwoController);
this._player2.Initialize();
Components.Add(this._player2);
}
示例6: GroupCommand
/// <summary>
/// Initializes a new instance of the <see cref="T:GroupCommand"/> class.
/// </summary>
/// <param name="controller">The controller.</param>
/// <param name="bundle">The bundle.</param>
public GroupCommand(IController controller, IBundle bundle)
: base(controller)
{
this.Text = "Group";
this.controller = controller;
this.bundle = bundle;//the bundle should contain only IShape and IConnection entities!
}
示例7: PenStyleCommand
/// <summary>
/// Initializes a new instance of the <see cref="T:PenStyleCommand"/> class.
/// </summary>
/// <param name="controller">The controller.</param>
/// <param name="bundle">The bundle.</param>
/// <param name="penStyle">The pen style.</param>
public PenStyleCommand(IController controller, CollectionBase<IDiagramEntity> bundle, IPenStyle penStyle)
: base(controller) {
this.Text = "Fill style";
this.controller = controller;
this.bundle = bundle;//the bundle should contain only IShape and IConnection entities!
this.newStyle = penStyle;
}
示例8: ReleaseController
public void ReleaseController(IController controller)
{
if (((ControllerBase)controller).ControllerContext.RouteData.Route is ContentRoute)
this._cmsFactory.ReleaseController(controller);
else
this._factory.ReleaseController(controller);
}
示例9: SetUp
public void SetUp()
{
controller = MockRepository.GenerateMock<IController>();
stepUICMock = MockRepository.GenerateMock<IStepUIC>();
controller.Stub(x => x.LoadHistory()).Return(new List<IHistoryItem>());
shellViewModelSUT = new MainShellViewModel(controller, stepUICMock);
}
示例10: OnAfterRendering
protected override void OnAfterRendering(IEngineContext context, IController controller,
IControllerContext controllerContext){
var mvc = MvcContext.Create((Controller) controller);
var logname = acl.token(mvc).Replace("/", ".").Substring(1);
var log = logger.get(logname);
log.info(() => myapp.usrName + "\t\tAFTER_RENDER:\t" + acl.token(mvc));
}
示例11: OpenGLWindow
public OpenGLWindow(IController controller, double frameRate)
{
if (controller == null) throw new ArgumentNullException("controller");
_controller = controller;
_frameRate = frameRate;
Width = controller.Width;
Height = controller.Height;
if (_controller.IsFullScreen)
WindowState = WindowState.Maximized;
Title = controller.Name;
InitializeComponent();
if (_controller.HasUserInterface)
{
if(_controller.CentralView != null)
MainGrid.Children.Add((UIElement)_controller.CentralView);
if (_controller.LeftView != null)
LeftGrid.Children.Add((UIElement)_controller.LeftView);
if (_controller.RightView != null)
RightGrid.Children.Add((UIElement)_controller.RightView);
if (_controller.TopView != null)
TopGrid.Children.Add((UIElement)_controller.TopView);
if (_controller.BottomView != null)
BottomGrid.Children.Add((UIElement)_controller.BottomView);
}
SizeChanged += OnSizeChanged;
KeyDown += OnKeyPress;
}
示例12: RenderFrame
public override void RenderFrame (IController controller)
{
float[] pcm = new float[controller.PlayerData.NativePCMLength];
controller.PlayerData.GetPCM(pcm);
gl.glMatrixMode(gl.GL_MODELVIEW);
gl.glPushMatrix();
gl.glRotatef(this.rotation, 0, 0, -1);
gl.glLineWidth(3);
gl.glBegin(gl.GL_LINE_STRIP);
for (int i = 0; i < pcm.Length; i++) {
float fi = ((float) i / pcm.Length) * 2 - 1;
fi *= LINE_LENGTH;
float v = pcm[i];
float av = Math.Abs(v);
gl.glColor4f(av, 0.5f + (0.5f * av), 1, 0.5f + (0.5f * av));
gl.glVertex2f(fi, v);
}
gl.glEnd();
gl.glPopMatrix();
}
示例13: Release
public void Release(IController controller)
{
var types = controller.GetType()
.GetInterfaces()
.Where(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IController<,>))
.Select(i => i.GetGenericArguments())
.First();
var controllerAccessor = Kernel.Resolve(
typeof(ControllerAccessor<,>)
.MakeGenericType(
types.ElementAt(0),
types.ElementAt(1)
)
) as IControllerAccessor;
var viewAccessor = Kernel.Resolve(
typeof(ViewAccessor<>)
.MakeGenericType(
types.ElementAt(1)
)
) as IViewAccessor;
if (controllerAccessor != null && viewAccessor != null)
{
var view = controllerAccessor.GetView(controller);
var viewModel = controllerAccessor.GetViewModel(controller);
Kernel.ReleaseComponent(view);
Kernel.ReleaseComponent(viewModel);
}
Kernel.ReleaseComponent(controller);
}
示例14: WebInterface
public WebInterface(IController controller)
{
log.Debug(m => m("Startup webserver at '{0}'", hostUrl));
Controller = controller;
_server = WebApp.Start<Startup>(hostUrl);
}
示例15: Perform
public bool Perform(ExecuteWhen exec, IEngineContext context, IController controller, IControllerContext controllerContext)
{
/*
ArrayList admins = new ArrayList();
admins.Add("jpino");
admins.Add("logas");
admins.Add("lmolina");
if (admins.Contains (context.CurrentUser.Identity.Name.ToLower()))
return true;
else {
context.Flash["TypeMsg"] = "alert alert-error";
context.Flash["Msg"] = "Error : No eres admin";
context.Response.RedirectToUrl ("/");
return false;
}
*/
if (context.CurrentUser.IsInRole ("admin"))
return true;
else {
context.Flash["TypeMsg"] = "alert alert-error";
context.Flash["Msg"] = "Error : No eres admin";
context.Response.RedirectToUrl ("/");
return false;
}
}