protected override void OnAfterRendering(IEngineContext context, IController controller,
                                          IControllerContext controllerContext){
     if (writeAfterAction){
         return;
     }
     doLog(context);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:UngroupCommand"/> class.
 /// </summary>
 /// <param name="controller">The controller.</param>
 /// <param name="group">The group.</param>
 public UngroupCommand(IController controller, IGroup group)
   : base(controller) {
   this.Text = "Ungroup";
   this.controller = controller;
   this.mGroup = group;
   bundle = new Bundle();
 }
Example #3
0
 public MainForm()
 {
     InitializeComponent();
     model = new Model.Model(this);
     controller = new Controller.Controller(this, model);
     model.addObserver(this);
 }
Example #4
0
		public void AppendFrame(IController source)
		{
			var lg = LogGeneratorInstance();
			lg.SetSource(source);
			_log.Add(lg.GenerateLogEntry());
			Changes = true;
		}
        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();
        }
        public override void ReleaseController(IController controller) {
            var disposable = controller as IDisposable;

            if (disposable != null) {
                disposable.Dispose();
            }
        }
 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);
 }
        public void ReleaseController(IController controller)
        {
            if (controller is IDisposable)
                ((IDisposable)controller).Dispose();

            _container.Teardown(controller);
        }
 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);
 }
        public void Render (IController controller)
        {
            gl.glClearColor(0, 0, 0, 1);
            gl.glClear(gl.GL_COLOR_BUFFER_BIT);

            this.UpdateSpectrumLength(controller.PlayerData.NativeSpectrumLength);
            controller.PlayerData.GetSpectrum(this.newspec);
            this.MergeSpectrum();
            
            gl.glBegin(gl.GL_QUADS);
            
            for (int i = 0; i < this.spectrumLength; i++) {
                Color color = Color.FromHSL(120 * (1 - this.spectrum[i]), 1, 0.5f);
                
                float x1 = -1 + this.spacing * i;
                float x2 = -1 + this.spacing * (i + 1);

                float v = this.spectrum[i] * 2 - 1;

                color.Use();
                gl.glVertex2f(x1, v);
                gl.glVertex2f(x2, v);
                
                gl.glVertex2f(x2, -1);
                gl.glVertex2f(x1, -1);
            }

            gl.glEnd();
        }
        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);
        }
Example #12
0
        public UpdateContentItemAction(IView view, IController con, ContentItem item, PropertyDescriptor property, object previousValue)
        {
            _view = view;
            _con = con;

            _state = ContentItemState.Get(item);

            var name = property.Name;
            var value = previousValue;

            if (name == "Importer")
            {
                name = "ImporterName";
                value = ((ImporterTypeDescription)value).TypeName;
            }

            if (name == "Processor")
            {
                name = "ProcessorName";
                value = ((ProcessorTypeDescription)value).TypeName;
            }

            var field = _state.GetType().GetMember(name).SingleOrDefault() as FieldInfo;
            if (field == null)
            {
                if (!_state.ProcessorParams.ContainsKey(name))
                    throw new Exception();

                _state.ProcessorParams[name] = value;
            }
            else
            {
                field.SetValue(_state, value);
            }
        }
 /// <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;
 }
Example #14
0
        public void Render(IController controller, string path)
        {
            //ViewData = new ViewData();

            ViewData = controller.ViewData;

            try
            {
                var html = String.Empty;

                string _path = string.Format("~/View/{0}/{1}.aspx", controller.Name, path);
                //var writer = new StringWriter();
                //controller.Context.Server.Execute(_path, controller.Context.Response.Output, true);
                //BuildManager.CreateInstanceFromVirtualPath(_path, typeof(System.Web.UI.Page));
               // controller.Context.RewritePath(_path,false);
                //var page = BuildManager.CreateInstanceFromVirtualPath(_path, typeof(Page)) as IHttpHandler;

                //PageParser.GetCompiledPageInstance(_path, controller.Context.Server.MapPath(_path), controller.Context);//.ProcessRequest(controller.Context);
                //html = writer.ToString();
                Context.Response.Clear();
                using (HtmlTextWriter htmlw = new HtmlTextWriter(Context.Response.Output))
                {

                   Context.Server.Execute(_path, htmlw, true);

                }
                Context.Response.End();

            }
            catch (System.Exception e)
            {
                controller.Context.Response.Write(e.StackTrace);
                controller.Context.Response.Write(e.ToString());
            }
        }
 /// <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!
 }
		internal static void SaveInstance(object instance, IController controller,
										  ArrayList errors, ref IDictionary prop2Validation, bool create)
		{
			var isValid = true;

			var validationProvider = instance as IValidationProvider;
			if (validationProvider != null)
			{
				isValid = validationProvider.IsValid();

				if (!isValid)
				{
					errors.AddRange(validationProvider.ValidationErrorMessages);
					prop2Validation = validationProvider.PropertiesValidationErrorMessages;
				}
			}


			if (isValid)
			{
				if (create)
				{
					ActiveRecordMediator.Create(instance);
				}
				else
				{
					ActiveRecordMediator.Update(instance);
				}
			}
		}
Example #17
0
        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;
            }
        }
Example #18
0
 public CLI(IDirectoryLocator directoryLocator, PluginLoader pluginLoader, IController controller)
 {
     _logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
     _directoryLocator = directoryLocator;
     _pluginLoader = pluginLoader;
     _controller = controller;
 }
Example #19
0
        public bool AuthorizeContext(IControllerContext controllerContext, IController controller) {
            //ОБЩАЯ ПОЛИТИКА - ОТКРЫТОСТЬ ДЕЙСТВИЯ

            // сперва проверим не админ ли сам пользователь
            var usr = myapp.usr;
            if(myapp.roles.IsAdmin(usr)) return true; //админам можно
            
            // потом проверим не назначены ли пользователю спец-права на данное действие или контроллер
            var denyspecialrole = string.Format("DENY_{0}_{1}", controllerContext.Name, controllerContext.Action).ToUpper();
            if (myapp.roles.IsInRole(usr, denyspecialrole)) return false;
            var allowspecialrole = string.Format("ALLOW_{0}_{1}", controllerContext.Name, controllerContext.Action).ToUpper();
            if (myapp.roles.IsInRole(usr, allowspecialrole)) return true;
            var denycontrollerrolename = string.Format("DENY_{0}", controllerContext.Name).ToUpper();
            if (myapp.roles.IsInRole(usr, denycontrollerrolename)) return false;
            var allowcontrollerrolename = string.Format("ALLOW_{0}", controllerContext.Name).ToUpper();
            if (myapp.roles.IsInRole(usr, allowcontrollerrolename)) return true;

            //потом проверяем по атрибутам ролей
            IEnumerable<string> roles = getroles(controller, controllerContext);
            if (roles.Count() != 0) {
                if (roles.All(x => !myapp.roles.IsInRole(usr, x))) return false;
            }

            //если доехали до сюда, значит ошибок авторизации не было, значит дозволим выполнение
            return true;
        }
Example #20
0
 public FrmCellPicker(IController con, CellRepository repo, int idPris)
 {
     idPrisoner = idPris;
     controller = con;
     cellRepo = repo;
     InitializeComponent();
 }
        static public bool ReplyBadPacket( IController ctrl, uint flags )
        {
            //What is this for? Nack + Ping?  What can the TinyCLR possibly do with this information?
            OutgoingMessage msg = new OutgoingMessage( ctrl, new WireProtocol.Converter(), Commands.c_Monitor_Ping, Flags.c_NonCritical | Flags.c_NACK | flags, null );

            return msg.Send();
        }
Example #22
0
        static void Main()
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                _controller = new Controller();
                _controller.InitializeSettings();

                Tools.Instance.Logger.LoggerInitialize();

                Tools.Instance.Logger.LogInfo("MViewer application started");

                _controller.StartApplication();

                Thread.Sleep(Timeout.Infinite);
            }
            catch (Exception ex)
            {
                Tools.Instance.Logger.LogError(ex.ToString());
            }
            finally
            {
                Tools.Instance.Logger.LogInfo("MViewer application stopped");
            }
        }
 public void ReleaseController(IController controller)
 {
     if (((ControllerBase)controller).ControllerContext.RouteData.Route is ContentRoute)
         this._cmsFactory.ReleaseController(controller);
     else
         this._factory.ReleaseController(controller);
 }
Example #24
0
 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));
 }
    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;
    }
        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);
        }
            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();
            }
 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);
 }
        public WebInterface(IController controller)
        {
            log.Debug(m => m("Startup webserver at '{0}'", hostUrl));

            Controller = controller;
            _server = WebApp.Start<Startup>(hostUrl);
        }
Example #30
0
 /// <summary>
 ///             Calculates the param points. Implementers should return value equals or greater than
 ///             zero indicating whether the parameter can be bound successfully. The greater the value (points)
 ///             the more successful the implementation indicates to the framework
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="controller">The controller.</param>
 /// <param name="controllerContext">The controller context.</param>
 /// <param name="parameterInfo">The parameter info.</param>
 /// <returns>
 /// </returns>
 public int CalculateParamPoints(IEngineContext context, IController controller, IControllerContext controllerContext, ParameterInfo parameterInfo)
 {
     var token = context.Request[parameterName];
     if (CanConvert(parameterInfo.ParameterType, token))
         return 10;
     return 0;
 }
Example #31
0
 public void GetControllerState(IController controller)
 {
     InputCallbacks.Call();
     controller_state = _controllerDeck.ReadPort1(controller);
 }
        /// <summary>
        /// Obtains the aspx Page from the view name dispatch
        /// its execution using the standard ASP.Net API.
        /// </summary>
        public override void Process(String viewName, TextWriter output, IEngineContext context, IController controller,
                                     IControllerContext controllerContext)
        {
            AdjustContentType(context);

            var fullVirtualPathToTemplate = ResolveTemplateOnViewFolder(viewName);

            var buildManager = buildManagerAccessor.BuildManager;

            var pageType = buildManager.GetCompiledType(fullVirtualPathToTemplate);

            var page = (Page)Activator.CreateInstance(pageType);

            if (controllerContext.LayoutNames != null && controllerContext.LayoutNames.Length != 0)
            {
                page.MasterPageFile = ResolveMasterOnViewFolder(controllerContext.LayoutNames[0]);
            }

            var pageBase = page as PageBase;

            if (pageBase != null)
            {
                pageBase.ControllerContext = controllerContext;
                pageBase.UrlHelper         = (UrlHelper)controllerContext.Helpers["UrlHelper"];
                pageBase.FormHelper        = (FormHelper)controllerContext.Helpers["FormHelper"];
                pageBase.TextHelper        = (TextHelper)controllerContext.Helpers["TextHelper"];
            }

            ProcessPage(controller, page, context.UnderlyingContext);
        }
 public Bk2LogEntryGenerator(string systemId, IController source)
 {
     _systemId = systemId;
     _source   = source;
 }
Example #34
0
 /// <summary>
 /// Override this method if the filter was set to
 /// handle <see cref="ExecuteWhen.BeforeAction"/>
 /// </summary>
 /// <param name="context">The MonoRail request context</param>
 /// <param name="controller">The controller instance</param>
 /// <param name="controllerContext">The controller context.</param>
 /// <returns>
 ///     <c>true</c> if the request should proceed, otherwise <c>false</c>
 /// </returns>
 protected virtual bool OnBeforeAction(IEngineContext context, IController controller, IControllerContext controllerContext)
 {
     return(true);
 }
Example #35
0
 /// <summary>
 /// Override this method if the filter was set to
 /// handle <see cref="ExecuteWhen.AfterRendering"/>
 /// </summary>
 /// <param name="context">The MonoRail request context</param>
 /// <param name="controller">The controller instance</param>
 /// <param name="controllerContext">The controller context.</param>
 protected virtual void OnAfterRendering(IEngineContext context, IController controller, IControllerContext controllerContext)
 {
 }
Example #36
0
 /// <summary>
 /// Override this method if the filter was set to
 /// handle <see cref="ExecuteWhen.AfterAction"/>
 /// </summary>
 /// <param name="context">The MonoRail request context</param>
 /// <param name="controller">The controller instance</param>
 /// <param name="controllerContext">The controller context.</param>
 protected virtual void OnAfterAction(IEngineContext context, IController controller, IControllerContext controllerContext)
 {
 }
Example #37
0
        public override void Load(IController hud)
        {
            base.Load(hud);

            var grounLabelBackgroundBrush = Hud.Render.CreateBrush(255, 0, 0, 0, 0);

            DecoratorByClass.Add(HeroClass.Barbarian, new WorldDecoratorCollection(
                                     new MapLabelDecorator(Hud)
            {
                LabelFont = Hud.Render.CreateFont("tahoma", 6f, 200, 250, 10, 10, false, false, 128, 0, 0, 0, true),
                Up        = true,
            },
                                     new GroundLabelDecorator(Hud)
            {
                BackgroundBrush = grounLabelBackgroundBrush,
                BorderBrush     = Hud.Render.CreateBrush(200, 250, 10, 10, 1),
                TextFont        = Hud.Render.CreateFont("tahoma", 6f, 200, 250, 10, 10, false, false, 128, 0, 0, 0, true),
            }
                                     ));

            DecoratorByClass.Add(HeroClass.Crusader, new WorldDecoratorCollection(
                                     new MapLabelDecorator(Hud)
            {
                LabelFont = Hud.Render.CreateFont("tahoma", 6f, 240, 0, 200, 250, false, false, 128, 0, 0, 0, true),
                Up        = true,
            },
                                     new GroundLabelDecorator(Hud)
            {
                BackgroundBrush = grounLabelBackgroundBrush,
                BorderBrush     = Hud.Render.CreateBrush(240, 0, 200, 250, 1),
                TextFont        = Hud.Render.CreateFont("tahoma", 6f, 240, 0, 200, 250, false, false, 128, 0, 0, 0, true),
            }
                                     ));

            DecoratorByClass.Add(HeroClass.DemonHunter, new WorldDecoratorCollection(
                                     new MapLabelDecorator(Hud)
            {
                LabelFont = Hud.Render.CreateFont("tahoma", 6f, 255, 0, 0, 200, false, false, 128, 0, 0, 0, true),
                Up        = true,
            },
                                     new GroundLabelDecorator(Hud)
            {
                BackgroundBrush = grounLabelBackgroundBrush,
                BorderBrush     = Hud.Render.CreateBrush(255, 0, 0, 200, 1),
                TextFont        = Hud.Render.CreateFont("tahoma", 6f, 255, 0, 0, 200, false, false, 128, 0, 0, 0, true),
            }
                                     ));

            DecoratorByClass.Add(HeroClass.Monk, new WorldDecoratorCollection(
                                     new MapLabelDecorator(Hud)
            {
                LabelFont = Hud.Render.CreateFont("tahoma", 6f, 245, 120, 0, 200, false, false, 128, 0, 0, 0, true),
                Up        = true,
            },
                                     new GroundLabelDecorator(Hud)
            {
                BackgroundBrush = grounLabelBackgroundBrush,
                BorderBrush     = Hud.Render.CreateBrush(245, 120, 0, 200, 1),
                TextFont        = Hud.Render.CreateFont("tahoma", 6f, 245, 120, 0, 200, false, false, 128, 0, 0, 0, true),
            }
                                     ));

            DecoratorByClass.Add(HeroClass.WitchDoctor, new WorldDecoratorCollection(
                                     new MapLabelDecorator(Hud)
            {
                LabelFont = Hud.Render.CreateFont("tahoma", 6f, 155, 0, 155, 125, false, false, 128, 0, 0, 0, true),
                Up        = true,
            },
                                     new GroundLabelDecorator(Hud)
            {
                BackgroundBrush = grounLabelBackgroundBrush,
                BorderBrush     = Hud.Render.CreateBrush(155, 0, 155, 125, 1),
                TextFont        = Hud.Render.CreateFont("tahoma", 6f, 155, 0, 155, 125, false, false, 128, 0, 0, 0, true),
            }
                                     ));

            DecoratorByClass.Add(HeroClass.Wizard, new WorldDecoratorCollection(
                                     new MapLabelDecorator(Hud)
            {
                LabelFont = Hud.Render.CreateFont("tahoma", 6f, 255, 250, 50, 180, false, false, 128, 0, 0, 0, true),
                Up        = true,
            },
                                     new GroundLabelDecorator(Hud)
            {
                BackgroundBrush = grounLabelBackgroundBrush,
                BorderBrush     = Hud.Render.CreateBrush(255, 250, 50, 180, 1),
                TextFont        = Hud.Render.CreateFont("tahoma", 6f, 255, 250, 50, 180, false, false, 128, 0, 0, 0, true),
            }
                                     ));
        }
Example #38
0
 /// <summary>
 /// C'tor for the LoginWindow class
 /// </summary>
 /// <param name="_controller"></param>
 public LoginWindow(IController _controller)
 {
     WindowStartupLocation = WindowStartupLocation.CenterScreen;
     InitializeComponent();
     controller = _controller;
 }
Example #39
0
 public Engine()
 {
     this.writer     = new Writer();
     this.reader     = new Reader();
     this.controller = new Controller();
 }
Example #40
0
 public void SetSource(IController source)
 {
     _source = source;
 }
Example #41
0
        public void ConfigureAuth(IAppBuilder app)
        {
            app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

            String provisioningScope       = ConfigurationManager.AppSettings["SPPA:ProvisioningScope"];
            String provisioningEnvironment = ConfigurationManager.AppSettings["SPPA:ProvisioningEnvironment"];

            app.UseCookieAuthentication(new CookieAuthenticationOptions {
                CookiePath = $"/{provisioningScope}" ?? "/"
            });

            app.UseOpenIdConnectAuthentication(
                new OpenIdConnectAuthenticationOptions
            {
                ClientId    = clientId,
                Authority   = authority,
                RedirectUri = ConfigurationManager.AppSettings["ida:AppUrl"],
                TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters
                {
                    // instead of using the default validation (validating against a single issuer value, as we do in line of business apps),
                    // we inject our own multitenant validation logic
                    ValidateIssuer = false,
                },
                Notifications = new OpenIdConnectAuthenticationNotifications()
                {
                    SecurityTokenValidated = (context) =>
                    {
                        return(Task.FromResult(0));
                    },
                    AuthorizationCodeReceived = async(context) =>
                    {
                        var code = context.Code;

                        // We need to retrieve the RefreshToken manually
                        using (var client = new HttpClient())
                        {
                            // Prepare the AAD OAuth request URI
                            var tokenUri = new Uri($"{authority}/oauth2/token");

                            // Prepare the OAuth 2.0 request for an Access Token with Authorization Code
                            var content = new FormUrlEncodedContent(new[]
                            {
                                new KeyValuePair <string, string>("grant_type", "authorization_code"),
                                new KeyValuePair <string, string>("redirect_uri", ConfigurationManager.AppSettings["ida:AppUrl"]),
                                new KeyValuePair <string, string>("client_id", clientId),
                                new KeyValuePair <string, string>("client_secret", appKey),
                                new KeyValuePair <string, string>("code", code),
                                new KeyValuePair <string, string>("resource", graphResourceID),
                            });

                            // Make the HTTP request
                            var result       = await client.PostAsync(tokenUri, content);
                            string jsonToken = await result.Content.ReadAsStringAsync();

                            // Get back the OAuth 2.0 response
                            var token = JsonConvert.DeserializeObject <OAuthTokenResponse>(jsonToken);

                            // Retrieve and deserialize into a JWT token the Access Token
                            var jwtAccessToken = new System.IdentityModel.Tokens.Jwt.JwtSecurityToken(token.AccessToken);

                            // Read the currently connected User Principal Name (UPN)
                            var upnClaim = jwtAccessToken.Claims.FirstOrDefault(c => c.Type == "upn");
                            if (upnClaim != null && !String.IsNullOrEmpty(upnClaim.Value))
                            {
                                System.Threading.Thread.CurrentPrincipal = new System.Security.Claims.ClaimsPrincipal(
                                    new System.Security.Claims.ClaimsIdentity(jwtAccessToken.Claims));
                            }

                            // Read the currently connected Tenant ID (TID)
                            var tenandIdClaim = jwtAccessToken.Claims.FirstOrDefault(c => c.Type == "tid");

                            // Store the Refresh Token in the Azure Key Vault
                            if (tenandIdClaim != null && !String.IsNullOrEmpty(tenandIdClaim.Value))
                            {
                                String tokenId = $"{tenandIdClaim.Value}-{upnClaim.Value.GetHashCode()}-{provisioningScope}-{provisioningEnvironment}";
                                await ProvisioningAppManager.AccessTokenProvider.WriteRefreshTokenAsync(tokenId, token.RefreshToken);
                            }

                            //context.AuthenticationTicket.Identity.AddClaims(
                            //    ((System.Security.Claims.ClaimsIdentity)System.Threading.Thread.CurrentPrincipal.Identity).Claims);
                        }
                    },
                    AuthenticationFailed = (context) =>
                    {
                        var httpContext = (HttpContextBase)context.OwinContext.Environment["System.Web.HttpContextBase"];

                        var routeData = new RouteData();
                        routeData.Values["controller"] = "Home";
                        routeData.Values["action"]     = "Error";
                        routeData.Values["exception"]  = context.Exception;

                        IController errorController = DependencyResolver.Current.GetService <HomeController>();
                        var requestContext          = new RequestContext(httpContext, routeData);
                        errorController.Execute(requestContext);

                        // context.OwinContext.Response.Redirect("/Home/Error");
                        context.HandleResponse();     // Suppress the exception
                        //context.OwinContext.Response.Write(context.Exception.ToString());
                        return(Task.FromResult(0));
                    }
                }
            });
        }
Example #42
0
 public StandardItemRenderer(IController hud)
 {
     Hud          = hud;
     QuantityFont = Hud.Render.CreateFont("tahoma", 8, 255, 200, 200, 200, false, false, false);
     QuantityFont.SetShadowBrush(128, 0, 0, 0, true);
 }
Example #43
0
 public bool Is_2_button2(IController c)
 {
     return(Port2.Is_2_button(c));
 }
Example #44
0
 public void LatchInputFromPlayer(IController source)
 {
     MovieControllerAdapter.LatchFromSource(source);
 }
Example #45
0
 public byte ReadFire1(IController c)
 {
     return(Port1.ReadFire(c));
 }
Example #46
0
 public bool Is_LightGun1(IController c, out float lightgun_x, out float lightgun_y)
 {
     return(Port1.Is_LightGun(c, out lightgun_x, out lightgun_y));
 }
Example #47
0
 // View will set the associated controller, this is how view is linked to the controller.
 public void setController(IController cont)
 {
     controller = cont;
 }
Example #48
0
 public byte ReadFire2_2x(IController c)
 {
     return(Port2.ReadFire2x(c));
 }
 public AgentInfo(IController controller)
 {
     agent = controller;
 }
Example #50
0
 public byte ReadPort2(IController c)
 {
     return(Port2.Read(c));
 }
Example #51
0
 public void BuildGraphMenu(ZedGraphControl zedGraphControl, ContextMenuStrip menuStrip, Point mousePt, IController controller)
 {
 }
Example #52
0
        public EstimationResult Estimate(System.Collections.Generic.List <object> marketData, IEstimationSettings settings = null, IController controller = null, System.Collections.Generic.Dictionary <string, object> properties = null)
        {
            CurveMarketData     discountingCurve = (CurveMarketData)marketData[0];
            CallPriceMarketData Hdataset         = (CallPriceMarketData)marketData[1];

            //gets the settings
            calibrationSettings = settings as DupireCalibrationSettings;


            //return this.FairmatEstimate(discountingCurve, Hdataset);
            // Removed quantlib estimate, it does not work correctly
            switch (calibrationSettings.LocalVolatilityCalculation)
            {
            case LocalVolatilityCalculation.Method1:
                return(this.FairmatEstimate(discountingCurve, Hdataset));

            case LocalVolatilityCalculation.QuantLib:
                return(QuantLibEstimate(discountingCurve, Hdataset));

            default:
                throw new NotImplementedException("Method not implemented");
            }
        }
        public override void Configure(IController hud)
        {
            var Hud = hud;

            // Ramalandi
            Hud.RunOnPlugin <Jack.Alerts.PlayerTopAlertListPlugin>(plugin =>
            {
                var itemsIds = new HashSet <uint>()
                {
                    1844495708
                };
                plugin.AlertList.Alerts.Add(new Jack.Alerts.Alert(Hud)
                {
                    MessageFormat = "\uD83C\uDF81 {0} \uD83C\uDF81",
                    AlertTextFunc = (id) =>
                    {
                        var items = Hud.Game.Items.Where(item => item.Location == ItemLocation.Floor && item.Unidentified && itemsIds.Contains(item.SnoItem.Sno));

                        if (items.Count() > 1)
                        {
                            return(string.Join(", ", items.GroupBy(k => k.FullNameLocalized).Select(item => string.Format(CultureInfo.InvariantCulture, "{0} {1}", item.Count(), item.Key))));
                        }

                        return(items.Count() == 1 ? items.First().FullNameLocalized : string.Empty);
                    },
                    Rule =
                    {
                        ShowInTown       = true,
                        VisibleCondition = (player) => Hud.Game.Items.Any(item => item.Location == ItemLocation.Floor && item.Unidentified && itemsIds.Contains(item.SnoItem.Sno)),
                    }
                });
            });

            // dh free vault with shadow set
            Hud.RunOnPlugin <Jack.Alerts.PlayerTopAlertListPlugin>(plugin =>
            {
                plugin.AlertList.Alerts.Add(new Jack.Alerts.Alert(Hud)
                {
                    MessageFormat = "\uD83C\uDF81 {0} \uD83C\uDF81",
                    AlertTextFunc = (id) =>
                    {
                        return("!! Free vault !!");
                    },
                    Rule =
                    {
                        ShowInTown  = true,
                        ActiveBuffs = new SnoPowerId[] { new SnoPowerId(445266, 1), }
                    }
                });
            });

            //Hud.RunOnPlugin<Jack.Alerts.PlayerTopAlertListPlugin>(plugin =>
            //{
            //    plugin.AlertList.Alerts.Add(new Jack.Alerts.Alert(Hud)
            //    {
            //        //TextSnoId = Hud.Sno.SnoPowers.LegacyOfNightmares2().Sno,
            //        MessageFormat = "{0} !",
            //        AlertTextFunc = (id) =>
            //        {
            //            return Hud.GuessLocalizedName(3758303663);
            //        },
            //        Rule =
            //        {
            //            ShowInTown = true,
            //            VisibleCondition = (player) => player.Powers.LegacyOfNightmares2() != null,
            //        }
            //    });
            //});

            //Hud.RunOnPlugin<Jack.Alerts.PlayerLeftAlertListPlugin>(plugin =>
            //{
            //    plugin.AlertList.VerticalCenter = false;
            //    plugin.AlertList.RatioSpacerY = 0;

            //    plugin.AlertList.Alerts.Add(new Jack.Alerts.Alert(Hud)
            //    {
            //        MultiLine = true,
            //        LinesFunc = () =>
            //        {
            //            var gems = Hud.Game.Me.Powers.UsedLegendaryPowers.EquippedLegendaryGemsBuffs();

            //            return gems.Where(x => x.Active).Select(buff => string.Format(CultureInfo.InvariantCulture, "{0} : {1}", buff.SnoPower.Sno, buff.SnoPower.Code));
            //        },
            //        Label =
            //        {
            //            TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 0, 170, 0, false, false, true),
            //        },
            //        Rule =
            //        {
            //            ShowInTown = true,
            //        }
            //    });
            //});


            // Loot list near Minimap
            Hud.RunOnPlugin <Jack.Alerts.MinimapLeftAlertListPlugin>(plugin =>
            {
                var ancientRank = -1;
                plugin.AlertList.VerticalCenter = false;
                plugin.AlertList.RatioSpacerY   = 0;

                // Set
                plugin.AlertList.Alerts.Add(new Jack.Alerts.Alert(Hud)
                {
                    MultiLine = true,
                    LinesFunc = () =>
                    {
                        return(Hud.Game.Items
                               .Where(item => item.Location == ItemLocation.Floor && item.Unidentified && item.SetSno != uint.MaxValue && item.AncientRank > ancientRank)
                               .Select(item => string.Format(CultureInfo.InvariantCulture, "\u2731{1}{0}{1}\u2731", item.SnoItem.NameLocalized, item.AncientRank > 0 ? " \uD83E\uDC1D " : " ")));
                    },
                    Label =
                    {
                        TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 0, 170, 0, false, false, true),
                    },
                    Rule =
                    {
                        ShowInTown       = true,
                        VisibleCondition = (player) => Hud.Game.Items.Any(item => item.Location == ItemLocation.Floor && item.Unidentified && item.SetSno != uint.MaxValue && item.AncientRank > ancientRank),
                    }
                });

                // Legendary
                plugin.AlertList.Alerts.Add(new Jack.Alerts.Alert(Hud)
                {
                    MultiLine = true,
                    LinesFunc = () =>
                    {
                        return(Hud.Game.Items
                               .Where(item => item.Location == ItemLocation.Floor && item.Unidentified && item.SetSno == uint.MaxValue && item.AncientRank > ancientRank)
                               .Select(item => string.Format(CultureInfo.InvariantCulture, "\u2605{1}{0}{1}\u2605", item.SnoItem.NameLocalized, item.AncientRank > 0 ? " \uD83E\uDC1D " : " ")));
                    },
                    Label =
                    {
                        TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 235, 120, 0, false, false, true),
                    },
                    Rule =
                    {
                        ShowInTown       = true,
                        VisibleCondition = (player) => Hud.Game.Items.Any(item => item.Location == ItemLocation.Floor && item.Unidentified && item.SetSno == uint.MaxValue && item.AncientRank > ancientRank),
                    }
                });
            });

            /* show all buffs */
            Hud.RunOnPlugin <Jack.Alerts.PlayerLeftAlertListPlugin>(plugin =>
            {
                plugin.AlertList.Up             = false;
                plugin.AlertList.RatioX         = 0.02f;
                plugin.AlertList.RatioY         = 0.1f;
                plugin.AlertList.VerticalCenter = false;
                plugin.AlertList.TextAlign      = HorizontalAlign.Left;
                plugin.AlertList.RatioSpacerY   = 0;

                plugin.AlertList.Alerts.Add(new Jack.Alerts.Alert(Hud)
                {
                    MultiLine = true,
                    LinesFunc = () =>
                    {
                        return
                        (Hud.Game.Me.Powers.AllBuffs
                         .Where(buff => buff != null && buff.SnoPower != null && !string.IsNullOrEmpty(buff.SnoPower.NameEnglish))
                         .OrderBy(buff => buff.SnoPower.Sno)
                         .Select(buff => string.Join(
                                     " | ",
                                     buff.SnoPower.NameEnglish,
                                     buff.SnoPower.Sno.ToString(),
                                     buff.SnoPower.Code,
                                     buff.Active,
                                     //string.Format("{0:0.#}", buff.TimeLeft()),
                                     string.Join(", ", buff.IconCounts.Select(i => string.Format("{0:0.#}", i))),
                                     string.Join(", ", buff.TimeLeftSeconds.Select(t => string.Format("{0:0.#}", t)))
                                     )));
                    },
                    Label =
                    {
                        TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 0, 170, 0, false, false, true),
                    },
                    Rule =
                    {
                        ShowInTown       = true,
                        VisibleCondition = (player) => /*Hud.Game.IsInTown &&*/ Hud.Input.IsKeyDown(Keys.B),
                    }
                });

                plugin.AlertList.Alerts.Add(new Jack.Alerts.Alert(Hud)
                {
                    MultiLine = true,
                    LinesFunc = () =>
                    {
                        return
                        (Hud.Game.Me.Powers.AllBuffs
                         .Where(buff => buff != null && buff.SnoPower != null && /*buff.SnoPower.Sno == 430674 &&*/ string.IsNullOrEmpty(buff.SnoPower.NameEnglish))
                         .OrderBy(buff => buff.SnoPower.Sno)
                         .Select(buff => string.Join(
                                     " | ",
                                     buff.SnoPower.Sno.ToString(),
                                     buff.SnoPower.Code,
                                     buff.Active,
                                     //string.Format("{0:0.#}", buff.TimeLeft()),
                                     string.Join(", ", buff.IconCounts.Select(i => string.Format("{0:0.#}", i))),
                                     string.Join(", ", buff.TimeLeftSeconds.Select(t => string.Format("{0:0.#}", t)))
                                     )));
                    },
                    Label =
                    {
                        TextFont = Hud.Render.CreateFont("tahoma", 7, 255, 0, 170, 0, false, false, true),
                    },
                    Rule =
                    {
                        ShowInTown       = true,
                        VisibleCondition = (player) => /*Hud.Game.IsInTown &&*/ Hud.Input.IsKeyDown(Keys.B),
                    }
                });
            });/*end*/
        }
Example #54
0
        public GraphSummary(GraphTypeSummary type, IDocumentUIContainer documentUIContainer, IController controller, int targetResultsIndex, int originalIndex = -1)
        {
            _targetResultsIndex   = targetResultsIndex;
            _originalResultsIndex = originalIndex;
            InitializeComponent();

            Icon = Resources.SkylineData;

            graphControl.MasterPane.Border.IsVisible = false;

            _controller = controller;
            _controller.GraphSummary = this;

            _documentContainer = documentUIContainer;
            _documentContainer.ListenUI(OnDocumentUIChanged);
            _stateProvider = documentUIContainer as IStateProvider ??
                             new DefaultStateProvider();

            Type = type;
            Text = Controller.Text + @" - " + Type.CustomToString();
            Helpers.PeptideToMoleculeTextMapper.TranslateForm(this, _documentContainer.Document.DocumentType); // Use terminology like "Molecule Comparison" instead of "Peptide Comparison" as appropriate

            UpdateUI();
        }
Example #55
0
 public void Strobe(StrobeInfo s, IController c)
 {
     Player1.Strobe(s, Player1U.UnMerge(c));
     Player2.Strobe(s, Player2U.UnMerge(c));
     Player3.Strobe(s, Player3U.UnMerge(c));
 }
Example #56
0
        public static void CreateThingsTopology()
        {
            IPoint p1 = context.Create <IPoint>(new Uri(clientURI + "#temp1"));

            p1.Name = "Point1";
            p1.UID  = "point1-111";
            p1.Unit = "DegreeC";
            p1.Type = "Temperature";

            IPoint p2 = context.Create <IPoint>(new Uri(clientURI + "#temp2"));

            p2.Name = "Point2";
            p2.UID  = "point2-222";
            p2.Unit = "DegreeC";
            p2.Type = "Temperature";

            IController c1 = context.Create <IController>(new Uri(clientURI + "#c1"));

            c1.Name = "Controller1";
            c1.UID  = "Controller1-111";

            c1.HasPoints.Add(p1);
            c1.HasPoints.Add(p2);

            //==========================//

            IPoint p3 = context.Create <IPoint>(new Uri(clientURI + "#energy3"));

            p3.Name = "Point3";
            p3.UID  = "point3-333";
            p3.Unit = "Wh";
            p3.Type = "Energy";

            IPoint p4 = context.Create <IPoint>(new Uri(clientURI + "#energy4"));

            p4.Name = "Point4";
            p4.UID  = "point4-444";
            p4.Unit = "Wh";
            p4.Type = "Energy";

            IController c2 = context.Create <IController>(new Uri(clientURI + "#c2"));

            c2.Name = "Controller2";
            c2.UID  = "Controller2-222";
            c2.HasPoints.Add(p3);
            c2.HasPoints.Add(p4);

            //==========================//

            IPoint p5 = context.Create <IPoint>(new Uri(clientURI + "#temp5"));

            p5.Name = "Point5";
            p5.UID  = "point5-555";
            p5.Unit = "DegreeC";
            p5.Type = "Temperature";

            IPoint p6 = context.Create <IPoint>(new Uri(clientURI + "#temp6"));

            p6.Name = "Point6";
            p6.Unit = "DegreeC";
            p6.Type = "Temperature";

            IController c3 = context.Create <IController>(new Uri(clientURI + "#c3"));

            c3.Name = "Controller3";
            c3.UID  = "Controller3-333";
            c3.HasPoints.Add(p5);
            c3.HasPoints.Add(p6);

            //==========================//

            IPoint p7 = context.Create <IPoint>(new Uri(clientURI + "#energy7"));

            p7.Name = "Point7";
            p7.UID  = "point7-777";
            p7.Unit = "Wh";
            p7.Type = "Energy";

            IPoint p8 = context.Create <IPoint>(new Uri(clientURI + "#energy8"));

            p8.Name = "Point8";
            p8.UID  = "point8-888";
            p8.Unit = "Wh";
            p8.Type = "Energy";

            IController c4 = context.Create <IController>(new Uri(clientURI + "#c4"));

            c4.Name = "Controller4";
            c4.UID  = "Controller4-444";
            c4.HasPoints.Add(p7);
            c4.HasPoints.Add(p8);

            //==========================//

            IAS as1 = context.Create <IAS>(new Uri(clientURI + "#as1"));

            as1.Name = "AutomationServer1";
            as1.UID  = "AutomationServer1-123";
            as1.Controls.Add(c1);
            as1.Controls.Add(c2);

            IAS as2 = context.Create <IAS>(new Uri(clientURI + "#as2"));

            as2.Name = "AutomationServer2";
            as2.UID  = "AutomationServer2-123";
            as2.Controls.Add(c3);
            as2.Controls.Add(c4);

            IES es = context.Create <IES>(new Uri(clientURI + "#es1"));

            es.Name = "EnterpriseServer1";
            es.UID  = "EnterpriseServer1-123";
            es.Monitors.Add(as1);
            es.Monitors.Add(as2);

            // commit data to store
            context.Commit();
        }
Example #57
0
 // famicom expansion hookups
 public byte ReadA(IController c)
 {
     return(0);
 }
Example #58
0
 public byte ReadA(IController c)
 {
     return(c.IsPressed("0Fire") ? (byte)0x02 : (byte)0x00);
 }
Example #59
0
 public void Strobe(StrobeInfo s, IController c)
 {
 }
Example #60
0
 public byte ReadB(IController c)
 {
     return(Read(c));
 }