Exemple #1
0
        /// <summary>
        /// Asynchronously fires the specified event using specific sender.
        /// </summary>
        public async Task FireEventAsync(object sender, ViewEvent evt, CancellationToken token = default)
        {
            var tasks = AsyncViewEvents?.GetInvocationList()?.Select(d => (Task)d.DynamicInvoke(sender, evt, token));

            if (tasks != null)
            {
                await Task.WhenAll(tasks);
            }
        }
Exemple #2
0
        void ThrowEvent(string eventID, bool disableNextRoundButton)
        {
            eventPopup.Visibility = Visibility.Visible;
            ViewEvent viewEvent = new ViewEvent(configPath, eventID, this);

            eventStackPanel.Children.Clear();
            eventStackPanel.Children.Add(viewEvent);
            nextRound.IsEnabled = !disableNextRoundButton;
        }
Exemple #3
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            var addPerson        = new FormAddPerson(this);
            var addListPresenter = new AddPersonPresenter(addPerson);

            addPerson.ShowDialog();

            ViewEvent?.Invoke(this, EventArgs.Empty);
        }
Exemple #4
0
        /// <summary>
        /// Handles child closing or change to refresh the list.
        /// </summary>
        /// <param name="childViewModel">Child view model that fired the original event</param>
        /// <param name="e">Event object</param>
        protected override void OnChildEvent(object childViewModel, ViewEvent e)
        {
            UpdateDetailsSelection(childViewModel as DetailsViewModel, e);
            if (e.IsSaved(false) || e.IsDeleted(false))
            {
                Search(true);
            }

            base.OnChildEvent(childViewModel, e);
        }
Exemple #5
0
        /// <summary>
        /// Handles child closing or change to refresh the list.
        /// </summary>
        /// <param name="childViewModel">Child view model that fired the original event</param>
        /// <param name="e">Event object</param>
        /// <param name="token">Cancellation token.</param>
        protected override async Task OnChildEventAsync(object childViewModel, ViewEvent e, CancellationToken token = default)
        {
            UpdateDetailsSelection(childViewModel as DetailsViewModel, e);
            if (e.IsSaved(false) || e.IsDeleted(false))
            {
                await SearchAsync(true, token);
            }

            await base.OnChildEventAsync(childViewModel, e, token);
        }
Exemple #6
0
        private void listViewNames_MouseDoubleClick(object sender, EventArgs e)
        {
            if (listViewNames.SelectedItems.Count > 0)
            {
                var formAllInfo = new FormAllInfo(listViewNames.SelectedIndices[0]);
                formAllInfo.ShowDialog();
            }

            ViewEvent?.Invoke(this, EventArgs.Empty);
        }
Exemple #7
0
 private void listBoxUsers_MouseDoubleClick(object sender, EventArgs e)
 {
     if (listBoxUsers.SelectedItems.Count > 0)
     {
         var fullUserInfoForm      = new FullUserInfoForm(listBoxUsers.SelectedIndex);
         var fullUserListPresenter = new FullUserListPresenter(fullUserInfoForm);
         fullUserInfoForm.ShowDialog();
         ViewEvent?.Invoke(this, EventArgs.Empty);
         FillListBox();
     }
 }
Exemple #8
0
        public void ViewEvent_MatchesReferenceJson()
        {
            var viewEvent = new ViewEvent {
                Actor      = TestEntities.User554433,
                Object     = TestEntities.EpubVolume43,
                Target     = TestEntities.EpubSubChap431_Frame,
                EventTime  = TestEntities.DefaultStartedAtTime,
                EdApp      = TestEntities.EpubViewerApp,
                Group      = TestEntities.AmRev101_Group001,
                Membership = TestEntities.User554433_AmRev101_CourseSection001_Membership
            };

            JsonAssertions.AssertSameObjectJson(viewEvent, "caliperViewEvent");
        }
Exemple #9
0
        /// <summary>
        /// Handles child closing or change to refresh the list.
        /// </summary>
        /// <param name="childViewModel">Child view model that fired the original event</param>
        /// <param name="e">Event object</param>
        protected override void OnChildEvent(object childViewModel, ViewEvent e)
        {
            if (e.IsClosed() && List != null)
            {
                List.ClearSelectedRows();
                List.FireCollectionChanged();
            }
            if (e.IsSaved() || e.IsDeleted())
            {
                Search(true);
            }

            base.OnChildEvent(childViewModel, e);
        }
Exemple #10
0
 public Button(
     string text,
     SpriteFont font,
     Vector2 position,
     Color color,
     Color activeColor,
     ViewEvent viewEvent,
     Align align = Align.Left)
     : base(text, font, position, color, align)
 {
     this.activeColor = activeColor;
     boundingBox      = new Rectangle(this.position.ToPoint(), font.MeasureString(text).ToPoint());
     this.viewEvent   = viewEvent;
 }
        public void On(ViewEvent evt, Action <ScriptView> action)
        {
            if (_data == null)
            {
                _data = new Dictionary <ViewEvent, ScriptView>();
            }
            ScriptView view = null;

            if (!_data.TryGetValue(evt, out view))
            {
                view = new ScriptView();
                _data.Add(evt, view);
            }
            action(view);
        }
Exemple #12
0
        protected override void OnChildEvent(object sender, ViewEvent e)
        {
            ViewSelectionEvent selEvt = e as ViewSelectionEvent;
            ViewModel          child  = sender as ViewModel;

            if (selEvt != null && child != null && child.Params[ViewParams.QuerySource] == "lnkCustomerLookupLookUp")
            {
                lnkCustomerLookupLookUp_HandleResult(sender, selEvt.SelectedRows);
            }
            if (e.IsClosed() && child != null && child.Params[ViewParams.QuerySource] == "lnkDetailDetails")
            {
                this.obj.DetailList.ClearSelectedRows();
            }
            base.OnChildEvent(sender, e);
        }
Exemple #13
0
        protected override void OnPageEvent(int key, params object[] args)
        {
            base.OnPageEvent(key, args);
            ViewEvent e = (ViewEvent)args[0];

            switch (e)
            {
            case ViewEvent.Action_ClosePanel:
                UIMgr.S.ClosePanel(this);
                break;

            case ViewEvent.Action_HidePanel:
                UIMgr.S.HidePanel(this);
                break;
            }
        }
Exemple #14
0
        protected override async Task OnViewEventsAsync(object sender, ViewEvent e, CancellationToken token = default)
        {
            await base.OnViewEventsAsync(sender, e, token);

            if (e.IsSaved())
            {
                ClaimsIdentity ci = null;
                if (VM?.MainObj?.EmailProperty?.Value != null)
                {
                    PersonInfo userInfo = (await personService.ReadAsync(VM.MainObj.EmailProperty.Value)).Result;
                    ci = SecurityManager.CreateIdentity(CookieAuthenticationDefaults.AuthenticationScheme, userInfo);
                }
                var    principal = new ClaimsPrincipal(ci);
                string ticket    = signInManager.GetSignInTicket(principal);
                Navigation.NavigateTo("/SignIn?ticket=" + ticket, true);
            }
        }
Exemple #15
0
        protected void OnParentPanelEvent(int key, params object[] args)
        {
            if (args == null || args.Length <= 0)
            {
                return;
            }

            ViewEvent e = (ViewEvent)args[0];

            //默认事件已经处理了
            switch (e)
            {
            case ViewEvent.OnPanelClose:
                ClosePage();
                break;

            case ViewEvent.OnPanelOpen:
                OpenPage();
                break;

            case ViewEvent.OnParamUpdate:
                ERunner.Run(OnParamUpdate);
                break;

            case ViewEvent.OnSortingLayerUpdate:
                ERunner.Run(OnSortingLayerUpdate);
                break;

            default:
                break;
            }

            object[] newArgs = null;

            if (args.Length > 1)
            {
                newArgs = new object[args.Length - 1];
                for (int i = 0; i < newArgs.Length; ++i)
                {
                    newArgs[i] = args[i + 1];
                }
            }

            ERunner.Run(OnViewEvent, e, newArgs);
        }
Exemple #16
0
        private static void HandleViewEvent(ViewEvent viewEvent)
        {
            var manager = GlobalManager.GetManager <ViewManager>();

            switch ((ViewEvent.Events)viewEvent.Action)
            {
            case ViewEvent.Events.ShowWindow:
                manager.ShowWindow((EventShowWindow)viewEvent);
                break;

            case ViewEvent.Events.ShowDialog:
                manager.ShowDialog((EventShowDialog)viewEvent);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemple #17
0
    void addViewEvent(ViewEvent v)
    {
        //Debug.Log("add");
        int index = 0;

        while (index < incomingViews.Count)
        {
            if (incomingViews[index].serverTimestamp > v.serverTimestamp)
            {
                break;
            }
            if (incomingViews[index].serverTimestamp == v.serverTimestamp && v.type != ViewType.objDeath && index != 0)
            {
                break;
            }
            index++;
        }
        incomingViews.Insert(index, v);
    }
Exemple #18
0
        public IActionResult ViewActivity(int id)
        {
            int UserId = LoggedIn.GetUserID(HttpContext);

            if (UserId == 0)
            {
                return(RedirectToAction("Index", "Login"));
            }

            User  user    = GetCurrentUser(UserId);
            Event Current = dbContext.Events
                            .Where(e => e.EventId == id)
                            .Include(evt => evt.Participants)
                            .ThenInclude(p => p.User)
                            .FirstOrDefault();

            ViewEvent ToView = new ViewEvent(user, Current);

            return(View(ToView));
        }
Exemple #19
0
    public void OnEvent(ViewEvent evt)
    {
        // special event for object creating.
        if (evt.EventType == ViewEventType.Init)
        {
            InitNewObject(evt.Source);
        }

        // handle events
        var obj3D = GetView(evt.Source);

        if (obj3D != null)
        {
            obj3D.OnViewEvent(evt);

            if (evt.EventType == ViewEventType.End)
            {
                obj3D.Deactivate();
            }
        }
    }
Exemple #20
0
        public void PresenterEventHandler(Object sender, ViewEvent e)
        {
            switch (e._eventFired)
            {
            case "Water":
                _wateringScheduler.Water();
                break;

            case "GetSensorDataList":
                _mainView.OpenHistoricalDataView(_sensorDataServices.RetrieveAllData());
                break;

            case "ShowWateringSchedule":
                // TODO
                //_wateringScheduler.
                break;

            default:
                Console.WriteLine("Unhandled event in MainPresenter");
                break;
            }
        }
Exemple #21
0
        /// <summary>
        /// 事件模型
        /// </summary>
        /// <param name="xml"></param>
        /// <returns></returns>
        private EventBase GetEventModel(XmlUtils xml)
        {
            string    eventType = xml.GetValue("/xml/Event").ToLower();
            EventBase message   = null;

            switch (eventType)
            {
            case "unsubscribe":
                message = new UnsubscribeEvent();
                break;

            case "subscribe":
                message = new SubscribeEvent();
                break;

            case "scan":
                message = new ScanEvent();
                break;

            case "location":
                message = new LocationEvent();
                break;

            case "click":
                message = new ClickEvent();
                break;

            case "view":
                message = new ViewEvent();
                break;

            default:
                return(null);
            }

            return(message);
        }
        protected override async Task OnViewEventsAsync(object sender, ViewEvent e, CancellationToken token = default)
        {
            await base.OnViewEventsAsync(sender, e, token);

            if (e.IsSaved()) // authenticated successfully
            {
                ClaimsIdentity ci = null;
                if (VM?.MainObj?.EmailProperty?.Value != null)
                {
                    var        personService = ServiceProvider.GetService <IPersonService>();
                    PersonInfo userInfo      = (await personService.ReadAsync(VM.MainObj.EmailProperty.Value)).Result;
                    ci = SecurityManager.CreateIdentity(CookieAuthenticationDefaults.AuthenticationType, userInfo);
                }
                if (ci != null)
                {
                    HttpContext.Current.GetOwinContext().Authentication.SignIn(ci);
                    string url = HttpContext.Current.Request.QueryString[CookieAuthenticationDefaults.ReturnUrlParameter];
                    if (url != null)
                    {
                        HttpContext.Current.Response.Redirect(url, false);
                    }
                }
            }
        }
Exemple #23
0
        protected void OnParentPanelEvent(int key, params object[] args)
        {
            Debug.LogError("OnParentPanelEvent");
            if (args == null || args.Length <= 0)
            {
                return;
            }

            ViewEvent e = (ViewEvent)args[0];

            switch (e)
            {
            case ViewEvent.OnPanelClose:
                ClosePage();
                break;

            case ViewEvent.OnPanelOpen:
                OpenPage();
                break;

            case ViewEvent.OnParamUpdate:
                //ERunner.Run(OnParamUpdate);
                OnParamUpdate();
                break;

            case ViewEvent.OnSortingLayerUpdate:
                //ERunner.Run(OnSortingLayerUpdate);
                OnSortingLayerUpdate();
                break;

            default:
                break;
            }

            OnViewEvent(e, args);
        }
 // Constructors
 public ViewEventArgs(ViewEvent eventType, DesignerRegion region, System.EventArgs eventArgs)
 {
 }
 protected virtual void OnViewEvent(ViewEvent e, object[] args)
 {
 }
 public void SendViewEvent(ViewEvent key, params object[] args)
 {
     UIMgr.Instance.uiEventSystem.Send(GetParentPanelID(), key, args);
 }
Exemple #27
0
 public void ViewChange(IView view, ViewEvent e)
 {
     _model.AddStr(e._str);
 }
 // Constructors
 public ViewEventArgs(ViewEvent eventType, DesignerRegion region, System.EventArgs eventArgs)
 {
 }
Exemple #29
0
 private void FullUserInfoForm_Load(object sender, EventArgs e)
 {
     ViewEvent?.Invoke(_index);
 }
Exemple #30
0
 public void TargetAddViewEvent(NetworkConnection conn, ViewEvent v)
 {
     addViewEvent(v);
 }
Exemple #31
0
 public void RpcAddViewEvent(ViewEvent v)
 {
     addViewEvent(v);
 }