/// <summary>
 /// Initializes the view 
 /// </summary>
 /// <param name="_gameflowController">The gameflow controller.</param>
 public override void Initialize(BaseController _gameflowController)
 {
     m_gameflowController = (GameflowController)_gameflowController;
     m_gameflowController.OnDicesThrowed += OnDicesThrowed;
     m_gameflowController.GetModel().OnTurnChanged += OnTurnChanged;
     base.Initialize(_gameflowController);
 }
Exemplo n.º 2
0
        public static ActionResult DeleteTag(BaseController controller, int id, int? personId = null, int? showId = null)
        {
            if (id == Photo.NoPic)
            {
                controller.RollbackTransactionFast();
                return new HttpBadRequestResult("Cannot tag this photo.");
            }

            if (personId.HasValue)
            {
                // only delete the tag if the photo is not the Person's default photo
                controller.DatabaseSession.Execute(
                    "DELETE FROM PersonPhoto WHERE PhotoId = @PhotoId AND PersonId = @PersonId AND NOT EXISTS (SELECT * FROM Person WHERE PhotoId = @PhotoId AND PersonId = @PersonId)"
                    , new { PhotoId = id, PersonId = personId.Value });
            }

            if (showId.HasValue)
            {
                // only delete the tag if the photo is not the Show's default photo
                controller.DatabaseSession.Execute(
                    "DELETE FROM ShowPhoto WHERE PhotoId = @PhotoId AND ShowId = @ShowId AND NOT EXISTS (SELECT * FROM Show WHERE PhotoId = @PhotoId AND ShowId = @ShowId)"
                    , new { PhotoId = id, ShowId = showId.Value });
            }

            return null;
        }
 /// <summary>
 /// Initializes the view and suscribe for pause and unpause event
 /// </summary>
 /// <param name="_gameflowController">The gameflow controller.</param>
 public override void Initialize(BaseController _gameflowController)
 {
     m_gameflowController = (GameflowController)_gameflowController;
     base.Initialize(_gameflowController);
     m_gameflowController.GetModel().OnGamePaused += OnGamePaused;
     m_gameflowController.GetModel().OnGameUnpaused += OnGameUnpaused;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes the view and suscribe for turn changed event
 /// </summary>
 /// <param name="_gameflowController">The gameflow controller.</param>
 public override void Initialize(BaseController _gameflowController)
 {
     m_gameflowController = (GameflowController)_gameflowController;
     base.Initialize(_gameflowController);
     m_gameflowController.GetModel().OnTurnChanged += OnTurnChanged;
     m_animator = GetComponentInChildren<Animator>();
 }
Exemplo n.º 5
0
        public Workspace(BaseController controller, Uri resources, Action dispose)
        {
            Resources = resources;

            _controller = controller;
            _dispose = dispose;
        }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes the view and suscribe for second tick event
 /// </summary>
 /// <param name="_gameflowController">The _gameflow controller.</param>
 public override void Initialize(BaseController _gameflowController)
 {
     m_gameTimeText = GetComponent<Text>();
     m_gameflowController = (GameflowController)_gameflowController;
     base.Initialize(_gameflowController);
     m_gameflowController.GetModel().OnTimeTick += OnTimeTick;
 }
Exemplo n.º 7
0
 public static void SendNotifications(BaseController controller, Message message, SiteConfiguration config, ITopicsSubscriptionsService service)
 {
     if (!config.Notifications.Subscription.IsDefined)
     {
         return;
     }
     var threadUrl = controller.Domain;
     threadUrl += controller.Url.RouteUrl(new
     {
         controller = "Topics",
         action = "ShortUrl",
         id = message.Topic.Id
     });
     threadUrl += "#msg" + message.Id;
     //Build a generic url that can be replaced with the real values
     var unsubscribeUrl = controller.Domain + controller.Url.RouteUrl(new
     {
         controller = "TopicsSubscriptions",
         action = "Unsubscribe",
         uid = Int32.MaxValue,
         tid = message.Topic.Id,
         guid = Int64.MaxValue.ToString()
     });
     unsubscribeUrl = unsubscribeUrl.Replace(Int32.MaxValue.ToString(), "{0}");
     unsubscribeUrl = unsubscribeUrl.Replace(Int64.MaxValue.ToString(), "{1}");
     service.SendNotifications(message, controller.User.Id, threadUrl, unsubscribeUrl);
 }
Exemplo n.º 8
0
        public static ActionResult Delete(BaseController controller, int id)
        {
            if (id == Photo.NoPic)
            {
                controller.RollbackTransactionFast();
                return new HttpBadRequestResult("Cannot delete this photo.");
            }

            var photo = controller.DatabaseSession.Get<Photo>(id);
            if (photo == null)
            {
                return new HttpNotFoundResult("Photo not found");
            }

            // This is a hard delete.
            controller.DatabaseSession.Execute(@"
            UPDATE Person SET PhotoId = 1 WHERE PhotoId = @PhotoId;
            UPDATE Show SET PhotoId = 1 WHERE PhotoId = @PhotoId;
            DELETE FROM PersonPhoto WHERE PhotoId = @PhotoId;
            DELETE FROM ShowPhoto WHERE PhotoId = @PhotoId;
            DELETE FROM Photo WHERE PhotoId = @PhotoId;
            ", new { PhotoId = id });

            // TODO: delete blob

            return null;
        }
Exemplo n.º 9
0
 public override void Initialize(BaseController _tileController)
 {
     m_tileController = (TileController)_tileController;
     base.Initialize(_tileController);
     SetupWorldPosition(ReferencesHolder.Instance.GameConfigurationHolder.GetGameConfiguration().BoardConfiguration);
     SetupColor();
     SetupNumberText();
 }
Exemplo n.º 10
0
        protected RedirectToActionResult NotEmptyView(BaseController controller, Object model)
        {
            RedirectToActionResult result = new RedirectToActionResult(null, null, null);
            controller.When(sub => sub.NotEmptyView(model)).DoNotCallBase();
            controller.NotEmptyView(model).Returns(result);

            return result;
        }
Exemplo n.º 11
0
        protected RedirectToActionResult RedirectToNotFound(BaseController controller)
        {
            RedirectToActionResult result = new RedirectToActionResult(null, null, null);
            controller.When(sub => sub.RedirectToNotFound()).DoNotCallBase();
            controller.RedirectToNotFound().Returns(result);

            return result;
        }
Exemplo n.º 12
0
        protected RedirectToActionResult RedirectToAction(BaseController baseController, String action, String controller)
        {
            RedirectToActionResult result = new RedirectToActionResult(null, null, null);
            baseController.When(sub => sub.RedirectToAction(action, controller)).DoNotCallBase();
            baseController.RedirectToAction(action, controller).Returns(result);

            return result;
        }
Exemplo n.º 13
0
        protected RedirectToRouteResult RedirectToNotFound(BaseController controller)
        {
            RedirectToRouteResult result = new RedirectToRouteResult(new RouteValueDictionary());
            controller.When(sub => sub.RedirectToNotFound()).DoNotCallBase();
            controller.RedirectToNotFound().Returns(result);

            return result;
        }
Exemplo n.º 14
0
        protected RedirectToRouteResult NotEmptyView(BaseController controller, Object model)
        {
            RedirectToRouteResult result = new RedirectToRouteResult(new RouteValueDictionary());
            controller.When(sub => sub.NotEmptyView(model)).DoNotCallBase();
            controller.NotEmptyView(model).Returns(result);

            return result;
        }
Exemplo n.º 15
0
        protected RedirectToRouteResult RedirectIfAuthorized(BaseController controller, String actionName, String controllerName)
        {
            RedirectToRouteResult result = new RedirectToRouteResult(new RouteValueDictionary());
            controller.When(sub => sub.RedirectIfAuthorized(actionName, controllerName)).DoNotCallBase();
            controller.RedirectIfAuthorized(actionName, controllerName).Returns(result);

            return result;
        }
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state.
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     _animator = animator;
     gameObject = _animator.gameObject;
     transform = gameObject.transform;
     rigidbody = gameObject.GetComponent<Rigidbody> ();
     _controller = gameObject.GetComponent<BaseController> ();
 }
Exemplo n.º 17
0
 public override void Initialize(BaseController _tokenController)
 {
     m_tokenController = (TokenController)_tokenController;
     m_tokenController.GetModel().OnTokenMoved += OnTokenMoved;
     m_tokenController.GetModel().OnTokenTeleported += OnTokenTeleported;
     m_boardController = GameObject.FindObjectOfType<BoardController>();
     base.Initialize(_tokenController);
 }
 public InitializeBusinessRulesCommand(BaseController<Expense> expenseController,
     BaseController<Income> incomeController, BaseController<Account> accountController,
     ExpenseStatusService paymentStatusService)
 {
     _expenseController = expenseController;
     _incomeController = incomeController;
     _accountController = accountController;
     _paymentSvc = paymentStatusService;
 }
Exemplo n.º 19
0
 void Awake()
 {
     obj = new List<GameObject> () {null, null, null, null, null, null};
     Blue = GameObject.FindGameObjectWithTag ("BlueBase").GetComponent<BaseController> ();
     Red = GameObject.FindGameObjectWithTag ("RedBase").GetComponent<BaseController> ();
     for (int i = 0; i < 6; i++) {
         obj [i] = transform.GetChild (i).gameObject;
         obj [i].SetActive (false);
     }
 }
Exemplo n.º 20
0
    public void SetTarget(BaseController target)
    {
        if(target == null)
        {
            targetTransform = null;
            return;
        }

        SetTarget(target.transform);
    }
Exemplo n.º 21
0
        //Initialize the controller method with all the required parameters, caching expensive
        //things such as the parameters' info or the methodInfo object.
        internal ControllerMethod(RouteMask route, MethodInfo method, BaseController instance)
        {
            MethodInfo = method;
            ParameterInfo = MethodInfo.GetParameters();
            ReturnType = MethodInfo.ReturnType;

            Route = route;
            Name = method.Name;
            ControllerInstance = instance;
        }
Exemplo n.º 22
0
 public void AddAxisMap(BaseController.eAxisId axisId, string inputKey)
 {
     if (!m_AxixMaps.ContainsKey(axisId))
     {
         m_AxixMaps.Add(axisId, inputKey);
     }
     else
     {
         m_AxixMaps[axisId] = inputKey;
     }
 }
Exemplo n.º 23
0
 public override void Initialize(BaseController _boardController)
 {
     m_boardController = (BoardController)_boardController;
     m_TilesView = new List<TileView>();
     m_StairsView = new List<StairView>();
     m_slideView = new List<SlideView>();
     SetupAllTilesView();
     SetupAllStairsView();
     SetupAllSliderView();
     base.Initialize(_boardController);
 }
Exemplo n.º 24
0
    public override bool GetButtonUp(BaseController.eButtonId buttonId)
    {
        switch ((MouseController.eMouseButtonId)buttonId)
        {
        case MouseController.eMouseButtonId.LEFT_CLICK:
            return Input.GetMouseButtonUp(0);
        case MouseController.eMouseButtonId.RIGHT_CLICK:
            return Input.GetMouseButtonUp(1);
        }

        return base.GetButtonUp(buttonId);
    }
		public void ShouldReflectAbsenceOfConfigurationOnMetaDescriptor()
		{
			BaseController controller = new BaseController();
			ActionMetaDescriptor actionMeta = new ActionMetaDescriptor();

			ActionMethodExecutor executor = new ActionMethodExecutor(GetActionMethod(controller), actionMeta);

			Assert.IsFalse(executor.ShouldSkipAllFilters);
			Assert.IsFalse(executor.ShouldSkipRescues);
			Assert.IsFalse(executor.ShouldSkipFilter(typeof(DummyFilter)));
			Assert.IsNull(executor.LayoutOverride);
			Assert.AreEqual(0, executor.Resources.Length);
		}
Exemplo n.º 26
0
        public BaseControllerTests()
        {
            controller = Substitute.ForPartsOf<BaseController>();

            controller.Url = Substitute.For<IUrlHelper>();
            controller.ControllerContext.RouteData = new RouteData();
            controller.TempData = Substitute.For<ITempDataDictionary>();
            controller.ControllerContext.HttpContext = Substitute.For<HttpContext>();
            controller.HttpContext.RequestServices.GetService<IAuthorizationProvider>().Returns(Substitute.For<IAuthorizationProvider>());

            controllerName = controller.RouteData.Values["controller"] as String;
            areaName = controller.RouteData.Values["area"] as String;
        }
		public void ShouldReturnTrueToSkipSpecifiedFiltersReflectingMeta()
		{
			BaseController controller = new BaseController();
			ActionMetaDescriptor actionMeta = new ActionMetaDescriptor();
			actionMeta.SkipFilters.Add(new SkipFilterAttribute(typeof(DummyFilter)));

			ActionMethodExecutor executor = new ActionMethodExecutor(GetActionMethod(controller), actionMeta);

			Assert.IsTrue(executor.ShouldSkipFilter(typeof(DummyFilter)));
			Assert.IsFalse(executor.ShouldSkipRescues);
			Assert.IsFalse(executor.ShouldSkipAllFilters);
			Assert.IsNull(executor.LayoutOverride);
			Assert.AreEqual(0, executor.Resources.Length);
		}
Exemplo n.º 28
0
 public static bool HandleAppException(ApplicationException ex, bool clearError, HttpContext context, RouteData routeData, BaseController controller)
 {
     string rawUrl = context.Request.RawUrl;
     string url = context.Request.Url.ToString();
     if (Settings.AppLogSystemEventsToDb || Settings.AppLogSystemEventsToFile)
     {
         LogAppException(ex, context, routeData, controller);
     }
     if (Settings.AppUseFriendlyErrorPages)
     {
         ShowErrorPage(ErrorPage.Error_AppError, (int)HttpStatusCode.InternalServerError, ex, clearError, context, controller);
         return true;
     }
     return false;
 }
Exemplo n.º 29
0
 public static bool HandleDynamicPageNotFoundException(DynamicPageNotFoundException ex, bool clearError, HttpContext context, RouteData routeData, BaseController controller)
 {
     string rawUrl = context.Request.RawUrl;
     string url = context.Request.Url.ToString();
     if (Settings.AppLogSystemEventsToDb || Settings.AppLogSystemEventsToFile)
     {
         LogFileNotFound(ex, context, routeData, controller);
     }
     if (Settings.AppUseFriendlyErrorPages)
     {
         ShowErrorPage(ErrorPage.Error_NotFound, (int)HttpStatusCode.NotFound, ex, clearError, context, controller);
         return true;
     }
     return false;
 }
        public void TestSelectActionResult_Xml(string format)
        {
            //Arrange
            BaseController controller = new BaseController();
            var model = new {a = "1", b = 2};

            // Act
            ActionResult result = controller.SelectActionResult("testName", model, format);

            // Assert
            Assert.NotNull(result);
            Assert.IsInstanceOf<XmlResult>(result);

            XmlResult xmlResult = result as XmlResult;
            Assert.AreSame(model, xmlResult.Data);
        }
Exemplo n.º 31
0
 protected virtual void Awake()
 {
     Controller = GetComponent <BaseController>();
 }
Exemplo n.º 32
0
 public VBFunction(BaseController controller) : base(controller)
 {
 }
Exemplo n.º 33
0
 public VBFunction(BaseController controller, string functionName, DataType returnType, BaseParameter param) : base(controller, functionName, returnType, param)
 {
 }
Exemplo n.º 34
0
 public VBFunction(BaseController controller, string name) : base(controller, name)
 {
 }
Exemplo n.º 35
0
 public VBFunction(BaseController controller, string name, BaseDataType type) : base(controller, name, type)
 {
 }
Exemplo n.º 36
0
 public VBFunction(BaseController controller, BaseBaseConstruct parentObject, int nodeIndex) : base(controller, parentObject, nodeIndex)
 {
 }
Exemplo n.º 37
0
 public VBFunction(BaseController controller, BaseBaseConstruct parentObject) : base(controller, parentObject)
 {
 }
Exemplo n.º 38
0
 public RelationAjaxHandler(BaseController controller, SnsUser current) : base(controller, current)
 {
 }
Exemplo n.º 39
0
 public CustomerCLB(BaseController c) : base(c)
 {
 }
Exemplo n.º 40
0
        public ActionResult Search(string id, string search)
        {
            try
            {
                ItemWidgetArguments args = new ItemWidgetArguments(UserContext, GeminiContext, Cache, System.Web.HttpContext.Current.Request, CurrentIssue);

                TFSPicker tfsPicker = new TFSPicker();

                tfsPicker.AuthenticateUser(args);

                UserWidgetDataDetails loginDetails = tfsPicker.getLoginDetails();

                TFSPicker.ConnectByImplementingCredentialsProvider connect = new TFSPicker.ConnectByImplementingCredentialsProvider();

                ICredentials iCred = new NetworkCredential(loginDetails.Username, loginDetails.Password);

                connect.setLoginDetails(loginDetails.Username, loginDetails.Password, loginDetails.RepositoryUrl);

                connect.GetCredentials(new Uri(loginDetails.RepositoryUrl), iCred);

                TfsConfigurationServer configurationServer = TfsConfigurationServerFactory.GetConfigurationServer(new Uri(loginDetails.RepositoryUrl));

                configurationServer.Credentials = iCred;

                if (TFSPicker.IsBasicAuth)
                {
                    configurationServer.ClientCredentials = new TfsClientCredentials(new BasicAuthCredential(iCred));
                }
                else
                {
                    configurationServer.ClientCredentials = new TfsClientCredentials(new WindowsCredential(iCred));
                }

                try
                {
                    configurationServer.EnsureAuthenticated();
                }
                catch
                {
                    System.Threading.Thread.Sleep(1000);
                    configurationServer             = TfsConfigurationServerFactory.GetConfigurationServer(new Uri(loginDetails.RepositoryUrl));
                    configurationServer.Credentials = iCred;

                    if (TFSPicker.IsBasicAuth)
                    {
                        configurationServer.ClientCredentials = new TfsClientCredentials(new BasicAuthCredential(iCred));
                    }
                    else
                    {
                        configurationServer.ClientCredentials = new TfsClientCredentials(new WindowsCredential(iCred));
                    }
                    configurationServer.EnsureAuthenticated();
                }

                CatalogNode catalogNode = configurationServer.CatalogNode;

                ReadOnlyCollection <CatalogNode> tpcNodes = catalogNode.QueryChildren(new Guid[] { CatalogResourceTypes.ProjectCollection }, false, CatalogQueryOptions.None);

                string url = string.Empty;

                List <WorkItem2> queryResults = new List <WorkItem2>();

                TfsTeamProjectCollection tpc = null;

                string query = "Select [Id], [Work Item Type], [Title], [State] From WorkItems Where [Title] Contains '" + search + "' Order By [Id] Asc";

                if (search.Trim().Length == 0)
                {
                    query = "Select [Id], [Work Item Type], [Title], [Description] From WorkItems Order By [Id] Asc";
                }

                foreach (CatalogNode tpcNode in tpcNodes)
                {
                    tpc = configurationServer.GetTeamProjectCollection(new Guid(tpcNode.Resource.Properties["InstanceId"]));
                    //tpc = new TfsTeamProjectCollection(new Uri(string.Concat(loginDetails.RepositoryUrl, '/', tpcNode.Resource.DisplayName)), iCred);

                    if (TFSPicker.IsBasicAuth)
                    {
                        tpc.ClientCredentials = new TfsClientCredentials(new BasicAuthCredential(iCred));
                    }

                    WorkItemStore workItemStore = (WorkItemStore)tpc.GetService(typeof(WorkItemStore));

                    var result = workItemStore.Query(query);

                    if (result != null)
                    {
                        TswaClientHyperlinkService hyperlinkService = null;

                        try
                        {
                            hyperlinkService = ((TswaClientHyperlinkService)tpc.GetService(typeof(TswaClientHyperlinkService)));
                        }
                        catch
                        {
                        }

                        foreach (WorkItem res in result)
                        {
                            WorkItem2 item = new WorkItem2()
                            {
                                Item = res, BaseUrl = string.Concat(tpcNode.Resource.DisplayName, '/', res.AreaPath)
                            };

                            try
                            {
                                if (hyperlinkService != null)
                                {
                                    item.FullUrl = hyperlinkService.GetWorkItemEditorUrl(res.Id);
                                }
                            }
                            catch
                            {
                            }

                            queryResults.Add(item);
                        }
                    }
                }

                Dictionary <string, WorkItem> details = new Dictionary <string, WorkItem>();

                if (queryResults.Count > 0)
                {
                    IssueWidgetData <List <string> > data = GeminiContext.IssueWidgetStore.Get <List <string> >(id.ToInt(), Constants.AppId, Constants.ControlId);

                    if (data == null || data.Value == null)
                    {
                        data = new IssueWidgetData <List <string> >();

                        data.AppId = Constants.AppId;

                        data.ControlId = Constants.ControlId;

                        data.IssueId = id.ToInt();

                        data.Value = new List <string>();
                    }

                    foreach (WorkItem2 item in queryResults)
                    {
                        //check if we are not already there!
                        if (data.Value.Contains(item.Item.Id.ToString()))
                        {
                            continue;
                        }

                        /*if (isTfs2012)
                         * {*/
                        if (item.FullUrl != null && item.FullUrl.ToString().HasValue())
                        {
                            url = item.FullUrl.ToString();
                        }
                        else
                        {
                            url = string.Format("{0}/{1}/_workitems#_a=edit&id={2}", loginDetails.RepositoryUrl, item.BaseUrl, item.Item.Id);
                        }

                        details.Add(url, item.Item);
                    }
                }

                Dictionary <string, TfsPickerItem> tfsPickerModel = ConvertWorkItemsToTfsPickerItems(details);

                dataView = Content(BaseController.RenderPartialViewToString(this, AppManager.Instance.GetAppUrl("782D003D-D9F0-455F-AF09-74417D6DFD2B", "views/search.cshtml"), tfsPickerModel));
            }
            catch (Exception ex)
            {
                Pair <int, string> authenticationModel = new Pair <int, string>(CurrentIssue.Entity.Id, string.Concat(UserContext.Url, "/apps/tfspicker/authenticate/", CurrentIssue.Entity.Id));

                dataView = Content(BaseController.RenderPartialViewToString(this, AppManager.Instance.GetAppUrl("782D003D-D9F0-455F-AF09-74417D6DFD2B", "views/authenticationForm.cshtml"), authenticationModel));

                successView = false;

                messageView = ex.Message;

                GeminiApp.LogException(new Exception(ex.Message)
                {
                    Source = "TFS Picker"
                }, false);
            }

            return(JsonSuccess(new { success = successView, data = dataView, message = messageView }));
        }
Exemplo n.º 41
0
        public async Task <ActionResult <Respuesta> > PostAulaEvaluaciones([FromBody] AulaEvaluacionesRequest aulaEvaluacionesRequest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new Respuesta
                {
                    EsExitoso = false,
                    Mensaje = "Modelo incorrecto.",
                    Resultado = ModelState
                }));
            }

            var user = await this.context.Users.FindAsync("1");

            if (user == null)
            {
                return(BadRequest(new Respuesta
                {
                    EsExitoso = false,
                    Mensaje = "Usuario Invalido.",
                    Resultado = null
                }));
            }

            var Aula = await this.context.Aulas.FindAsync(aulaEvaluacionesRequest.AulaId);

            if (Aula == null)
            {
                return(BadRequest(new Respuesta
                {
                    EsExitoso = false,
                    Mensaje = "Aula no existe.",
                    Resultado = null
                }));
            }

            var entity = new AulaEvaluaciones
            {
                AulaId         = aulaEvaluacionesRequest.AulaId,
                Fecha          = aulaEvaluacionesRequest.Fecha,
                TipoEvaluacion = aulaEvaluacionesRequest.TipoEvaluacion,
                SePromedia     = aulaEvaluacionesRequest.SePromedia,
                Descripcion    = aulaEvaluacionesRequest.Descripcion,
                Usuario        = user,
            };

            BaseController.CompletaRegistro(entity, 1, "", user, false);

            await this.context.Set <AulaEvaluaciones>().AddAsync(entity);

            try
            {
                await this.context.SaveChangesAsync();
            }
            catch (Exception ee)
            {
                return(BadRequest(new Respuesta
                {
                    EsExitoso = false,
                    Mensaje = "Registro no grabado, controlar.",
                    Resultado = null
                }));
            }

            //return Ok(new Respuesta
            //{
            //    EsExitoso = true,
            //    Mensaje = "",
            //    Resultado = entity
            //});

            return(Ok(new Respuesta
            {
                EsExitoso = true,
                Mensaje = "",
                Resultado = new AulaEvaluacionesRespuesta

                {
                    AulaId = entity.Id,
                    Fecha = entity.Fecha,
                    TipoEvaluacion = entity.TipoEvaluacion,
                    SePromedia = entity.SePromedia,
                }
            }));
        }
Exemplo n.º 42
0
        private bool UpdateFrame()
        {
            if (!IsActive)
            {
                return(true);
            }

            if (IsStopped)
            {
                return(false);
            }

            HotkeyButtons     currentHotkeyButtons = 0;
            ControllerButtons currentButton        = 0;
            JoystickPosition  leftJoystick;
            JoystickPosition  rightJoystick;

            HLE.Input.Keyboard?hidKeyboard = null;

            int leftJoystickDx  = 0;
            int leftJoystickDy  = 0;
            int rightJoystickDx = 0;
            int rightJoystickDy = 0;

            // OpenTK always captures keyboard events, even if out of focus, so check if window is focused.
            if (IsFocused)
            {
                KeyboardState keyboard = OpenTK.Input.Keyboard.GetState();

                Gtk.Application.Invoke(delegate
                {
                    HandleScreenState(keyboard);
                });

                // Normal Input
                currentHotkeyButtons = KeyboardControls.GetHotkeyButtons(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
                currentButton        = KeyboardControls.GetButtons(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);

                if (ConfigurationState.Instance.Hid.EnableKeyboard)
                {
                    hidKeyboard = KeyboardControls.GetKeysDown(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
                }

                (leftJoystickDx, leftJoystickDy)   = KeyboardControls.GetLeftStick(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
                (rightJoystickDx, rightJoystickDy) = KeyboardControls.GetRightStick(ConfigurationState.Instance.Hid.KeyboardControls, keyboard);
            }

            if (!hidKeyboard.HasValue)
            {
                hidKeyboard = new HLE.Input.Keyboard
                {
                    Modifier = 0,
                    Keys     = new int[0x8]
                };
            }

            currentButton |= _primaryController.GetButtons();

            // Keyboard has priority stick-wise
            if (leftJoystickDx == 0 && leftJoystickDy == 0)
            {
                (leftJoystickDx, leftJoystickDy) = _primaryController.GetLeftStick();
            }

            if (rightJoystickDx == 0 && rightJoystickDy == 0)
            {
                (rightJoystickDx, rightJoystickDy) = _primaryController.GetRightStick();
            }

            leftJoystick = new JoystickPosition
            {
                Dx = leftJoystickDx,
                Dy = leftJoystickDy
            };

            rightJoystick = new JoystickPosition
            {
                Dx = rightJoystickDx,
                Dy = rightJoystickDy
            };

            currentButton |= _device.Hid.UpdateStickButtons(leftJoystick, rightJoystick);

            bool hasTouch = false;

            // Get screen touch position from left mouse click
            // OpenTK always captures mouse events, even if out of focus, so check if window is focused.
            if (IsFocused && _mousePressed)
            {
                int screenWidth  = AllocatedWidth;
                int screenHeight = AllocatedHeight;

                if (AllocatedWidth > (AllocatedHeight * TouchScreenWidth) / TouchScreenHeight)
                {
                    screenWidth = (AllocatedHeight * TouchScreenWidth) / TouchScreenHeight;
                }
                else
                {
                    screenHeight = (AllocatedWidth * TouchScreenHeight) / TouchScreenWidth;
                }

                int startX = (AllocatedWidth - screenWidth) >> 1;
                int startY = (AllocatedHeight - screenHeight) >> 1;

                int endX = startX + screenWidth;
                int endY = startY + screenHeight;


                if (_mouseX >= startX &&
                    _mouseY >= startY &&
                    _mouseX < endX &&
                    _mouseY < endY)
                {
                    int screenMouseX = (int)_mouseX - startX;
                    int screenMouseY = (int)_mouseY - startY;

                    int mX = (screenMouseX * TouchScreenWidth) / screenWidth;
                    int mY = (screenMouseY * TouchScreenHeight) / screenHeight;

                    TouchPoint currentPoint = new TouchPoint
                    {
                        X = mX,
                        Y = mY,

                        // Placeholder values till more data is acquired
                        DiameterX = 10,
                        DiameterY = 10,
                        Angle     = 90
                    };

                    hasTouch = true;

                    _device.Hid.SetTouchPoints(currentPoint);
                }
            }

            if (!hasTouch)
            {
                _device.Hid.SetTouchPoints();
            }

            if (ConfigurationState.Instance.Hid.EnableKeyboard && hidKeyboard.HasValue)
            {
                _device.Hid.WriteKeyboard(hidKeyboard.Value);
            }

            BaseController controller = _device.Hid.PrimaryController;

            controller.SendInput(currentButton, leftJoystick, rightJoystick);

            // Toggle vsync
            if (currentHotkeyButtons.HasFlag(HotkeyButtons.ToggleVSync) &&
                !_prevHotkeyButtons.HasFlag(HotkeyButtons.ToggleVSync))
            {
                _device.EnableDeviceVsync = !_device.EnableDeviceVsync;
            }

            _prevHotkeyButtons = currentHotkeyButtons;

            return(true);
        }
 private void ExecuteClientesFiscalLorenzonProcessController(BaseController controller)
 {
     controller.ExecuteAsynchronous(this);
 }
Exemplo n.º 44
0
 public virtual void InitView(BaseController controller)
 {
     this.controller = controller;
 }
Exemplo n.º 45
0
        public override void Modify(object sender, ModifyEventArgs eArgs)
        {
            var iRec = fDataOwner as GDMIndividualRecord;

            if (fBaseWin == null || fSheetList == null || iRec == null)
            {
                return;
            }

            GDMFamilyRecord family = eArgs.ItemData as GDMFamilyRecord;

            bool result = false;

            switch (eArgs.Action)
            {
            case RecordAction.raAdd:
                result = (BaseController.ModifyFamily(fBaseWin, ref family, TargetMode.tmSpouse, iRec));
                if (result)
                {
                    eArgs.ItemData = family;
                }
                break;

            case RecordAction.raEdit:
                result = (BaseController.ModifyFamily(fBaseWin, ref family, TargetMode.tmNone, null));
                break;

            case RecordAction.raDelete:
                if (family != null && AppHost.StdDialogs.ShowQuestionYN(LangMan.LS(LSID.LSID_DetachSpouseQuery)))
                {
                    result = fUndoman.DoOrdinaryOperation(OperationType.otFamilySpouseDetach, family, iRec);
                }
                break;

            case RecordAction.raMoveUp:
            case RecordAction.raMoveDown:
            {
                int idx = iRec.IndexOfSpouse(family);

                switch (eArgs.Action)
                {
                case RecordAction.raMoveUp:
                    iRec.ExchangeSpouses(idx - 1, idx);
                    break;

                case RecordAction.raMoveDown:
                    iRec.ExchangeSpouses(idx, idx + 1);
                    break;
                }

                result = true;
                break;
            }
            }

            if (result)
            {
                fBaseWin.Context.Modified = true;
                eArgs.IsChanged           = true;
            }
        }
 /// <summary>
 /// Connect user with default open id
 /// </summary>
 /// <param name="controller">Controller with session</param>
 /// <remarks>Just add informations about connected user in session</remarks>
 public static void ConnectUser(this BaseController controller)
 {
     controller.MemberInformations.OpenId = OpenId;
 }
Exemplo n.º 47
0
 private void View_ExitButtonClick(object sender, EventArgs e)
 {
     BaseController.GetController().SavePlayer();
     Application.Exit();
 }