Пример #1
0
        public EventPanelContainerViewmodel(IEvent ev, EventPanelViewmodelBase parent) : base(ev, parent)
        {
            if (ev.EventType != TEventType.Container)
            {
                throw new ApplicationException($"Invalid panel type:{GetType()} for event type:{ev.EventType}");
            }
            _isVisible = !HiddenEventsStorage.Contains(ev);

            CommandHide          = new UiCommand(o => IsVisible = false, o => _isVisible);
            CommandShow          = new UiCommand(o => IsVisible = true, o => !_isVisible);
            CommandAddSubRundown = new UiCommand(_addSubRundown, o => Event.HaveRight(EventRight.Create));
            ev.SubEventChanged  += SubEventChanged;
        }
        public EventPanelContainerViewmodel(IEvent ev, EventPanelViewmodelBase parent) : base(ev, parent)
        {
            if (ev.EventType != TEventType.Container)
            {
                throw new ApplicationException($"Invalid panel type:{GetType()} for event type:{ev.EventType}");
            }
            _isVisible = !HiddenEventsStorage.Contains(ev);

            CommandHide = new UICommand {
                ExecuteDelegate = o => IsVisible = false, CanExecuteDelegate = o => _isVisible
            };
            CommandShow = new UICommand {
                ExecuteDelegate = o => IsVisible = true, CanExecuteDelegate = o => !_isVisible
            };
            CommandAddSubRundown = new UICommand {
                ExecuteDelegate = _addSubRundown
            };
        }