Exemple #1
0
        /// <summary>
        /// Tworzy widok CarServicesCarList.
        /// </summary>
        /// <param name="parentView">Widok nadrzędny.</param>
        public CarServicesCarList(IBaseView parentView)
            : base(parentView)
        {
            InitializeComponent();
            AfterInitializeComponent();

            if (!VSDesignMode)
            {
                if (parentView != null)
                {
                    CarServiceDetails carServiceDetails = new CarServiceDetails();
                    if (parentView.GetType() == carServiceDetails.GetType())
                    {
                        this.CarService = (CarService)parentView.CurrentObject;
                    }
                }

                this.Presenter = new CarServicesCarListPresenter(this);

                this.SupportsShowDetails = false;
                this.SupportsDelete      = false;
                this.SupportsAddNew      = false;
                this.SupportsEdit        = false;
            }
        }
Exemple #2
0
        /// <summary>
        /// Tworzy widok CityList.
        /// </summary>
        /// <param name="parentView">Widok nadrzędny.</param>
        public CityList(IBaseView parentView)
            : base(parentView)
        {
            InitializeComponent();
            AfterInitializeComponent();
            SupportsShowSubElements = false;

            if (!VSDesignMode)
            {
                this.Presenter = new CityListPresenter(this);

                this.SupportsShowDetails = true;
                this.SupportsDelete      = true;
                this.SupportsAddNew      = true;
                this.SupportsEdit        = true;
            }

            if (parentView != null)
            {
                CountryList country = new CountryList();
                if (parentView.GetType() == country.GetType())
                {
                    country = (CountryList)parentView;
                    this.SetViewForOneCountryMode(country.CurrentCountry);
                }
            }
        }
        /// <summary>
        /// Tworzy widok CarProductList.
        /// </summary>
        /// <param name="parentView">Widok nadrzędny.</param>
        public CarProductList(IBaseView parentView)
            : base(parentView)
        {
            InitializeComponent();
            AfterInitializeComponent();
            SupportsShowSubElements = false;

            if (!VSDesignMode)
            {
                this.Presenter = new CarProductListPresenter(this);

                this.SupportsShowDetails = false;
                this.SupportsDelete      = false;
                this.SupportsAddNew      = false;
                this.SupportsEdit        = false;

                this.TopMost = true;
            }


            if (parentView != null)
            {
                FactoryList factory = new FactoryList();
                if (parentView.GetType() == factory.GetType())
                {
                    factory = (FactoryList)parentView;
                    this.SetViewForOneFactoryMode(factory.CurrentFactory);
                }
            }
        }
        protected virtual void OnMoveFocus(IBaseView currentView, IBaseView nextView)
        {
            Logger.Instance.Debug("BaseComplexView OnMoveFocus " + currentView.GetType().Name, Logger.Categories.UI);
            var nextDataGrid = nextView.GridView.dataGrid;

            nextDataGrid.FocusCell(
                nextDataGrid.Items.Count - 1,
                nextDataGrid.FindFirstEditableColumn());
        }
        protected virtual void OnMoveFocus(IBaseView currentView, IBaseView nextView)
        {
            _logger.LogDebug("BaseComplexView OnMoveFocus {0}", currentView.GetType().Name);
            var nextDataGrid = nextView.GridView.dataGrid;

            nextDataGrid.FocusCell(
                nextDataGrid.Items.Count - 1,
                nextDataGrid.FindFirstEditableColumn());
        }
Exemple #6
0
        public virtual void Setup(IBaseView <TModel> view)
        {
            View  = view;
            Model = view.GetModel();
            Model.Initialize();
            SubscribeEvents();
            IsAlreadySetup = true;
            var viewType = View.GetType();

            OnFieldWillUpdate = viewType.GetMethod(OnFieldWillUpdateViewMemberName, ViewEventsBindingFlags);
            OnFieldDidUpdate  = viewType.GetMethod(OnFieldDidUpdateViewMemberName, ViewEventsBindingFlags);
        }
        protected virtual void OnSelectedIndexChanged(IBaseView currentView, IBaseView nextView, object selectedValue)
        {
            Logger.Instance.Debug("BaseComplexView OnSelectedIndexChanged " + currentView.GetType().Name, Logger.Categories.UI);
            var viewModel      = currentView.ViewModel;
            var childViewModel = nextView.ViewModel;
            var filterProperty = BaseComplexView.GetFilterProperty(nextView as UIElement);
            var headerFilter   = childViewModel.HeaderFilters.First(p => p.PropertyName == filterProperty);

            childViewModel.ParentItem = viewModel.GetSelectedItem();
            if (selectedValue == null)
            {
                headerFilter.FilterValue = 0;
            }
            else
            {
                headerFilter.FilterValue = selectedValue;
            }
        }
Exemple #8
0
    private void wireMethod(IBaseView view, MemberInfo match, MethodInfo method)
    {
        var viewType      = view.GetType();
        var matchingEvent = viewType.GetEvent(match.Name);

        if (matchingEvent != null)
        {
            if (matchingEvent.EventHandlerType == typeof(EventHandler))
            {
                var eventHandler = EventHandler.CreateDelegate(typeof(EventHandler), this, method);
                matchingEvent.AddEventHandler(view, eventHandler);
            }
            if (matchingEvent.EventHandlerType == typeof(FormClosedEventHandler))
            {
                var eventHandler = FormClosedEventHandler.CreateDelegate(typeof(FormClosedEventHandler), this, method);
                matchingEvent.AddEventHandler(view, eventHandler);
            }
        }
    }
Exemple #9
0
        /// <summary>
        /// Tworzy widok CarServiceDetails.
        /// </summary>
        /// <param name="parentView">Widok nadrzędny.</param>
        public CarServiceDetails(IBaseView parentView)
            : base(parentView)
        {
            InitializeComponent();
            AfterInitializeComponent();
            if (!VSDesignMode)
            {
                this.Presenter = new CarServiceDetailsPresenter(this);
            }

            if (parentView != null)
            {
                CarServiceList carService = new CarServiceList();
                if (parentView.GetType() == carService.GetType())
                {
                    carService = (CarServiceList)parentView;
                    this.SetCurrentCarService(carService.CurrentCarServicesView);
                }
            }
        }
        /// <summary>
        /// Tworzy widok ManufactureList.
        /// </summary>
        /// <param name="parentView">Widok nadrzędny.</param>
        public ManufactureList(IBaseView parentView)
            : base(parentView)
        {
            InitializeComponent();
            AfterInitializeComponent();

            if (!VSDesignMode)
            {
                this.Presenter = new ManufactureListPresenter(this);

                this.SupportsShowDetails = false;
                this.SupportsDelete      = false;
                this.SupportsAddNew      = false;
                this.SupportsEdit        = false;
            }

            if (parentView != null)
            {
                if (parentView.GetType() == typeof(FactoryList))
                {
                    this.factoryList = (FactoryList)parentView;
                }
            }
        }
Exemple #11
0
    protected void wireEventsTo(IBaseView view)
    {
        Type presenterType = this.GetType();
        Type viewType      = view.GetType();

        foreach (var method in presenterType.GetMethods())
        {
            var methodName = method.Name;
            if (methodName.StartsWith("On"))
            {
                try
                {
                    var presenterMethodName = methodName.Substring(2);
                    var nameOfMemberToMatch = presenterMethodName.Replace("Changed", "");     //ListBoxes wiring
                    var matchingMember      = viewType.GetMember(nameOfMemberToMatch).FirstOrDefault();
                    if (matchingMember == null)
                    {
                        return;
                    }
                    if (matchingMember.MemberType == MemberTypes.Event)
                    {
                        wireMethod(view, matchingMember, method);
                    }

                    if (matchingMember.MemberType == MemberTypes.Property)
                    {
                        wireMember(view, matchingMember, method);
                    }
                }
                catch (Exception ex)
                {
                    continue;
                }
            }
        }
    }
Exemple #12
0
        public void PushSubView(IBaseView view)
        {
            Console.WriteLine("PlayerActivity - PushSubView view: {0}", view.GetType().FullName);
            _fragments.Add((Fragment)view);

            if (_viewPagerAdapter != null)
                _viewPagerAdapter.NotifyDataSetChanged();
        }
 protected virtual void OnAfterLoad(IBaseView previousView, IBaseView currentView, IBaseView nextView)
 {
     Logger.Instance.Debug("BaseComplexView OnAfterLoad " + currentView.GetType().Name, Logger.Categories.UI);
 }
 protected virtual void OnAfterLoad(IBaseView previousView, IBaseView currentView, IBaseView nextView)
 {
     _logger.LogDebug("BaseComplexView OnAfterLoad {0}", currentView.GetType().Name);
 }