public DashboardViewModel(IViewModelResolver viewModelResolver, IElementsProvider elementsProvider)
            : base(viewModelResolver)
        {
            _elementsProvider = elementsProvider;

            Elements = new BindableCollection<ToDoTask>();
        }
        public WaiterTabViewModel(IViewModelResolver viewModelResolver)
            : base(viewModelResolver)
        {
            DisplayName = "Waiters";

            Get<WaiterListViewModel>().ShowOn(this);
        }
        public MainWindowViewModel(IViewModelResolver viewModelResolver)
            : base(viewModelResolver)
        {
            DisplayName = "Table application";

            Get<AccessViewModel>().ShowOn(this);
        }
Example #4
0
 public XpmRenderer(IViewModel model, IXpmMarkupService service, IViewModelResolver resolver, IReflectionHelper reflectionHelper)
 {
     if (model == null)
     {
         throw new ArgumentNullException("model");
     }
     if (service == null)
     {
         throw new ArgumentNullException("service");
     }
     if (resolver == null)
     {
         throw new ArgumentNullException("resolver");
     }
     if (reflectionHelper == null)
     {
         throw new ArgumentNullException("reflectionHelper");
     }
     this.model = model;
     if (model.ModelData is IModel)
     {
         contentModel = model.ModelData as IModel;
     }
     //if (model.ModelData is IComponentPresentation)
     //{
     //    contentData = model.ModelData as IComponentPresentation;
     //}
     this.reflectionHelper = reflectionHelper;
     this.xpmMarkupService = service;
     this.resolver         = resolver;
 }
 public XamarinFormsPageEventsEmulatedNavigation(
     IViewModelResolver viewModelResolver,
     IStack stack,
     IViewModelLifeCycleHandler viewModelLifeCycleHandler)
     : this(viewModelResolver, new HistoryStack.HistoryStack(stack), viewModelLifeCycleHandler)
 {
 }
Example #6
0
 public ConfigurationPageViewModel(IViewModelResolver viewModelResolver, ICatchableButtonFactory buttonFactory)
     : base("Install", "Back")
 {
     this.viewModelResolver = viewModelResolver;
     InstallLocalUser       = buttonFactory.CreateCatchableButton(InstallLocalUserFunc);
     InstallAdmin           = buttonFactory.CreateCatchableButton(InstallAdminFunc);
 }
        public TableTabViewModel(IViewModelResolver viewModelResolver)
            : base(viewModelResolver)
        {
            DisplayName = "Tables";

            Get<TableListViewModel>().ShowOn(this);
        }
        public static IViewModelResolver UseDefaultConfigure(this IViewModelResolver @this) => @this
            .IfInheritsFrom<ViewModelBase>((view, viewModel) =>
            {
                viewModel.Dispatcher = view.Dispatcher;
            })
            .IfInheritsFrom<ILocalizable>((view, viewModel) =>
            {
                viewModel.I18nManager = I18nManager.Instance;
                view.Loaded += (sender, args) => I18nManager.Instance.CurrentUICultureChanged += viewModel.OnCurrentUICultureChanged;
                view.Unloaded += (sender, args) => I18nManager.Instance.CurrentUICultureChanged -= viewModel.OnCurrentUICultureChanged;
            })
            .IfInheritsFrom<IViewLoadedAndUnloadedAware>((view, viewModel) =>
            {
                view.Loaded += (sender, e) => viewModel.OnLoaded();
                view.Unloaded += (sender, e) => viewModel.OnUnloaded();
            })
            .IfInheritsFrom(typeof(IViewLoadedAndUnloadedAware<>), (view, viewModel, interfaceInstance) =>
            {
                var viewType = view.GetType();
                if (interfaceInstance.GenericArguments.Single() != viewType)
                {
                    throw new InvalidOperationException();
                }

                var onLoadedMethod = interfaceInstance.GetMethod<Action<object>>("OnLoaded", viewType);
                var onUnloadedMethod = interfaceInstance.GetMethod<Action<object>>("OnUnloaded", viewType);

                view.Loaded += (sender, args) => onLoadedMethod(sender);
                view.Unloaded += (sender, args) => onUnloadedMethod(sender);
            })
            .IfInheritsFrom<INotificable>((view, viewModel, container) =>
            {
                viewModel.GlobalMessageQueue = container.Resolve<ISnackbarMessageQueue>();
            });
        public MenuTabViewModel(IViewModelResolver viewModelResolver)
            : base(viewModelResolver)
        {
            DisplayName = "Menu";

            Get<MenuListViewModel>().ShowOn(this);
        }
Example #10
0
        public MainWindowViewModel(IViewModelResolver viewModelResolver)
            : base(viewModelResolver)
        {
            DisplayName = "Table application";

            Get <AccessViewModel>().ShowOn(this);
        }
Example #11
0
        public WaiterTabViewModel(IViewModelResolver viewModelResolver)
            : base(viewModelResolver)
        {
            DisplayName = "Waiters";

            Get <WaiterListViewModel>().ShowOn(this);
        }
Example #12
0
 public AccessViewModel(IViewModelResolver viewModelResolver, IAccessProvider accessProvider, IWaiterConnectionProvider waiterConnectionProvider)
     : base(viewModelResolver)
 {
     _accessProvider           = accessProvider;
     _waiterConnectionProvider = waiterConnectionProvider;
     _wrongUsernameOrPassword  = Visibility.Hidden;
     _connectionError          = Visibility.Hidden;
 }
Example #13
0
        public MenuListViewModel(IViewModelResolver viewModelResolver, IViewProvider viewProvider, ICommandBus commandBus)
            : base(viewModelResolver)
        {
            _viewProvider = viewProvider;
            _commandBus   = commandBus;

            Elements = new BindableCollection <MenuItemView>();
        }
        public MenuListViewModel(IViewModelResolver viewModelResolver, IViewProvider viewProvider, ICommandBus commandBus)
            : base(viewModelResolver)
        {
            _viewProvider = viewProvider;
            _commandBus = commandBus;

            Elements = new BindableCollection<MenuItemView>();
        }
        public AddMenuItemViewModel(IViewModelResolver viewModelResolver, IViewProvider viewProvider, ICommandBus commandBus)
            : base(viewModelResolver)
        {
            _viewProvider = viewProvider;
            _commandBus = commandBus;

            Categories = new BindableCollection<CategoryView>();
        }
        public AddWaiterViewModel(IViewModelResolver viewModelResolver, ICommandBus commandBus)
            : base(viewModelResolver)
        {
            if (commandBus == null)
                throw new ArgumentNullException("commandBus");

            _commandBus = commandBus;
        }
        public static IViewModelResolver IfInheritsFrom(this IViewModelResolver @this, Type genericInterfaceType, Action<FrameworkElement, object, IGenericInterface> configuration)
        {
            Guards.ThrowIfNull(@this, configuration);

            return @this.IfInheritsFrom<FrameworkElement>(
                genericInterfaceType,
                (view, viewModel, interfaceInstance, container) => configuration(view, viewModel, interfaceInstance));
        }
Example #18
0
        public AddMenuItemViewModel(IViewModelResolver viewModelResolver, IViewProvider viewProvider, ICommandBus commandBus)
            : base(viewModelResolver)
        {
            _viewProvider = viewProvider;
            _commandBus   = commandBus;

            Categories = new BindableCollection <CategoryView>();
        }
Example #19
0
 public EmployerViewModelsFactory(
     IViewModelResolver viewModelResolver,
     EmployerFacade employerFacade
     )
 {
     _viewModelResolver = viewModelResolver;
     _employerFacade    = employerFacade;
 }
Example #20
0
 public BindingContainer(IViewModelResolver resolver, IReflectionHelper helper, params IBindingModule[] modules)
 {
     this.resolver = resolver;
     foreach (var module in modules)
     {
         module.OnLoad(resolver, helper);
         Load(module);
     }
 }
        public MainWindowViewModel(IViewModelResolver viewModelResolver)
            : base(viewModelResolver)
        {
            DisplayName = "Waiter manager";

            Items.Add(Get<TableTabViewModel>());
            Items.Add(Get<MenuTabViewModel>());
            Items.Add(Get<WaiterTabViewModel>());
        }
Example #22
0
 public Navigation(
     IViewModelResolver viewModelResolver,
     IHistoryStack historyStack,
     IViewModelLifeCycleHandler viewModelLifeCycle)
 {
     _viewModelResolver  = viewModelResolver;
     _historyStack       = historyStack;
     _viewModelLifeCycle = viewModelLifeCycle;
 }
        public CategoryListViewModel(IViewModelResolver viewModelResolver, IViewProvider viewProvider, ICommandBus commandBus)
            : base(viewModelResolver)
        {
            _viewProvider = viewProvider;
            _commandBus = commandBus;

            Elements = new BindableCollection<CategoryView>();
            IsBusy = true;
        }
 private XamarinFormsPageEventsEmulatedNavigation(
     IViewModelResolver viewModelResolver,
     IHistoryStack historyStack,
     IViewModelLifeCycleHandler viewModelLifeCycleHandler)
     : base(viewModelResolver, historyStack, viewModelLifeCycleHandler)
 {
     HistoryStack = historyStack;
     ViewModelLifeCycleHandler = viewModelLifeCycleHandler;
 }
Example #25
0
        public CategoryListViewModel(IViewModelResolver viewModelResolver, IViewProvider viewProvider, ICommandBus commandBus)
            : base(viewModelResolver)
        {
            _viewProvider = viewProvider;
            _commandBus   = commandBus;

            Elements = new BindableCollection <CategoryView>();
            IsBusy   = true;
        }
        public MainWindowViewModel(IViewModelResolver viewModelResolver)
            : base(viewModelResolver)
        {
            DisplayName = "Waiter manager";

            Items.Add(Get <TableTabViewModel>());
            Items.Add(Get <MenuTabViewModel>());
            Items.Add(Get <WaiterTabViewModel>());
        }
        public DeprecatedOsPageViewModel(IViewModelResolver viewModelResolver)
            : base("I Understand", "")
        {
            this.viewModelResolver = viewModelResolver;
            var version = Environment.OSVersion;
            var bitness = IntPtr.Size == 8 ? "64 Bit" : "32 Bit";

            CurrentSystem = $"Detected {version.VersionString} {bitness}";
        }
Example #28
0
        public EditWaiterViewModel(IViewModelResolver viewModelResolver, ICommandBus commandBus)
            : base(viewModelResolver)
        {
            if (commandBus == null)
            {
                throw new ArgumentNullException("commandBus");
            }

            _commandBus = commandBus;
        }
		public TableListViewModel(IViewModelResolver viewModelResolver, IViewProvider viewProvider, ICommandBus commandBus)
			: base(viewModelResolver)
		{
			_viewProvider = viewProvider;
			_commandBus = commandBus;
			DisplayName = "Tables";

			Elements = new BindableCollection<TableView>();
			IsBusy = true;
		}
        public TableListViewModel(IViewModelResolver viewModelResolver, IViewProvider viewProvider, ICommandBus commandBus)
            : base(viewModelResolver)
        {
            _viewProvider = viewProvider;
            _commandBus   = commandBus;
            DisplayName   = "Tables";

            Elements = new BindableCollection <TableView>();
            IsBusy   = true;
        }
Example #31
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NavigationManager{TPageIdentifier}"/> class.
        /// To gather page definitions it searches for classes marked with <see cref="NavigationPageAttribute"/> from <see cref="Assembly.GetCallingAssembly"/>
        /// </summary>
        /// <param name="fragmentManager">Fragment manager of main activity.</param>
        /// <param name="rootFrame">The view which will be used as the one being replaced with new Views</param>
        /// <param name="viewModelResolver">Class used to resolve ViewModels for pages derived from <see cref="FragmentBase{TViewModel}"/></param>
        /// <param name="stackResolver">Class allowing to differentiate to which stack given indentigier belongs.</param>
        /// <param name="interceptTransaction">Delegate allowing to modify <see cref="FragmentTransaction"/> before commiting.</param>
        public NavigationManager(
            FragmentManager fragmentManager,
            ViewGroup rootFrame,
            IViewModelResolver viewModelResolver = null,
            IStackResolver <NavigationFragmentBase, TPageIdentifier> stackResolver = null,
            Action <FragmentTransaction> interceptTransaction = null)
            : base(stackResolver)
        {
            _fragmentManager      = fragmentManager;
            _rootFrame            = rootFrame;
            _interceptTransaction = interceptTransaction;

            NavigationFragmentBase.ViewModelResolver = viewModelResolver;

            var types = Assembly.GetCallingAssembly().GetTypes();

            foreach (var type in types)
            {
                var attr = type.GetTypeInfo().GetCustomAttribute <NavigationPageAttribute>();

                if (attr != null)
                {
                    IPageProvider <NavigationFragmentBase> provider = null;

                    switch (attr.PageProviderType)
                    {
                    case NavigationPageAttribute.PageProvider.Cached:
                        provider = ObtainProviderFromType(typeof(CachedPageProvider <>));
                        break;

                    case NavigationPageAttribute.PageProvider.Oneshot:
                        provider = ObtainProviderFromType(typeof(OneshotPageProvider <>));
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }

                    PageDefinitions.Add((TPageIdentifier)(object)attr.Page, provider);
                }

                IPageProvider <NavigationFragmentBase> ObtainProviderFromType(Type providerType)
                {
                    return((IPageProvider <NavigationFragmentBase>)providerType.MakeGenericType(type)
                           .GetConstructor(new Type[] { })
                           .Invoke(null));
                }
            }

            foreach (var pageDefinition in PageDefinitions)
            {
                pageDefinition.Value.PageIdentifier = pageDefinition.Key;
            }
        }
Example #32
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NavigationManager{TPageIdentifier}"/> class.
        /// </summary>
        /// <param name="navigationController">Root navigation controller.</param>
        /// <param name="pageDefinitions">The dictionary defining pages.</param>
        /// <param name="viewModelResolver">Class used to resolve ViewModels for pages like <see cref="ViewControllerBase{TViewModel}"/> and <see cref="TabBarViewControllerBase{TViewModel}"/></param>
        /// <param name="stackResolver">Class allowing to differentiate to which stack given indentigier belongs.</param>
        public NavigationManager(
            UINavigationController navigationController,
            Dictionary <TPageIdentifier, IPageProvider <INavigationPage> > pageDefinitions,
            IViewModelResolver viewModelResolver,
            IStackResolver <INavigationPage, TPageIdentifier> stackResolver = null)
            : base(pageDefinitions, stackResolver)
        {
            _navigationController = navigationController;

            ArgumentNavigationViewControler.ViewModelResolver        = viewModelResolver;
            ArgumentNavigationTabBarViewController.ViewModelResolver = viewModelResolver;
        }
        public MainViewModel(
            IEventAggregator eventAggregator,
            IViewModelResolver <IViewModel> viewModelResolver
            )
        {
            _viewModels        = new Dictionary <string, IViewModel>();
            _viewModelResolver = viewModelResolver;

            // zaregistrujeme třídu do EventAggregatoru, aby naslouchala konkrétním příchozím zprávám
            // Hlavní okno bude naslouchat zprávám ChangeViewMessage (Proto je implementováno rozhraní IHandle<ChangeViewMessage>)
            eventAggregator.Subscribe(this);
        }
Example #34
0
        public OrderViewModel(IViewModelResolver viewModelResolver, ITableConnectionProvider tableConnectionProvider, ITableAppSubscriber tableAppSubscriber) : base(viewModelResolver)
        {
            _tableConnectionProvider = tableConnectionProvider;

            tableAppSubscriber.NotifyEvent                    += (sender, message) => Application.Current.Dispatcher.Invoke(() => Message = message);
            tableAppSubscriber.NotifyOrderEndedEvent          += TableAppSubscriber_NotifyOrderEndedEvent;
            tableAppSubscriber.OrderItemStateChangedEvent     += TableAppSubscriber_OrderItemStateChangedEvent;
            tableAppSubscriber.ReservationOrderScheduledEvent += TableAppSubscriberOnReservationOrderScheduledEvent;

            Elements      = new BindableCollection <MenuItemView>();
            AddedElements = new BindableCollection <OrderMenuItemModel>();
        }
 /// <summary>
 /// New View Model Builder
 /// </summary>
 /// <param name="keyProvider">A View Model Key provider</param>
 public ViewModelFactory(IViewModelKeyProvider keyProvider, IViewModelResolver resolver)
 {
     if (keyProvider == null)
     {
         throw new ArgumentNullException("keyProvider");
     }
     if (resolver == null)
     {
         throw new ArgumentNullException("resolver");
     }
     this.keyProvider = keyProvider;
     this.resolver    = resolver;
 }
        public OrderViewModel(IViewModelResolver viewModelResolver, ITableConnectionProvider tableConnectionProvider, ITableAppSubscriber tableAppSubscriber)
            : base(viewModelResolver)
        {
            _tableConnectionProvider = tableConnectionProvider;

            tableAppSubscriber.NotifyEvent += (sender, message) => Application.Current.Dispatcher.Invoke(() => Message = message);
            tableAppSubscriber.NotifyOrderEndedEvent += TableAppSubscriber_NotifyOrderEndedEvent;
            tableAppSubscriber.OrderItemStateChangedEvent += TableAppSubscriber_OrderItemStateChangedEvent;
            tableAppSubscriber.ReservationOrderScheduledEvent += TableAppSubscriberOnReservationOrderScheduledEvent;

            Elements = new BindableCollection<MenuItemView>();
            AddedElements = new BindableCollection<OrderMenuItemModel>();
        }
Example #37
0
 public void OnLoad(IViewModelResolver resolver, IReflectionHelper helper)
 {
     if (resolver == null)
     {
         throw new ArgumentNullException("resolver");
     }
     if (helper == null)
     {
         throw new ArgumentNullException("helper");
     }
     this.resolver = resolver;
     this.helper   = helper;
     ModelMappings = new Dictionary <Type, IList <IPropertyMapping> >();
 }
Example #38
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NavigationManager{TPageIdentifier}"/> class.
        /// </summary>
        /// <param name="fragmentManager">Fragment manager of main activity.</param>
        /// <param name="rootFrame">The view which will be used as the one being replaced with new Views</param>
        /// <param name="pageDefinitions">The dictionary defining pages.</param>
        /// <param name="viewModelResolver">Class used to resolve ViewModels for pages derived from <see cref="FragmentBase{TViewModel}"/></param>
        /// <param name="stackResolver">Class allowing to differentiate to which stack given indentigier belongs.</param>
        /// <param name="interceptTransaction">Delegate allowing to modify <see cref="FragmentTransaction"/> before commiting.</param>
        public NavigationManager(
            FragmentManager fragmentManager,
            ViewGroup rootFrame,
            Dictionary <TPageIdentifier, IPageProvider <NavigationFragmentBase> > pageDefinitions,
            IViewModelResolver viewModelResolver = null,
            IStackResolver <NavigationFragmentBase, TPageIdentifier> stackResolver = null,
            Action <FragmentTransaction> interceptTransaction = null)
            : base(pageDefinitions, stackResolver)
        {
            _fragmentManager      = fragmentManager;
            _rootFrame            = rootFrame;
            _interceptTransaction = interceptTransaction;

            NavigationFragmentBase.ViewModelResolver = viewModelResolver;
        }
    public WaiterListViewModel(IViewModelResolver viewModelResolver, IViewProvider viewProvider, ICommandBus commandBus)
      : base(viewModelResolver)
    {
      if (viewProvider == null)
        throw new ArgumentNullException(nameof(viewProvider));
      if (commandBus == null)
        throw new ArgumentNullException(nameof(commandBus));

      _viewProvider = viewProvider;
      _commandBus = commandBus;

      DisplayName = "Waiters";
      Elements = new BindableCollection<WaiterView>();
      IsBusy = true;
    }
Example #40
0
 public DefaultModelMapping(IViewModelResolver resolver, IReflectionHelper helper, Type modelType)
 {
     if (helper == null)
     {
         throw new ArgumentNullException("helper");
     }
     if (resolver == null)
     {
         throw new ArgumentNullException("resolver");
     }
     if (modelType == null)
     {
         throw new ArgumentNullException("modelType");
     }
     this.helper    = helper;
     this.resolver  = resolver;
     this.ModelType = modelType;
 }
Example #41
0
 public ModelBinding(IBindingModule module, IViewModelResolver resolver, IReflectionHelper helper)
 {
     if (module == null)
     {
         throw new ArgumentNullException("module");
     }
     if (resolver == null)
     {
         throw new ArgumentNullException("resolver");
     }
     if (helper == null)
     {
         throw new ArgumentNullException("helper");
     }
     this.module   = module;
     this.resolver = resolver;
     this.helper   = helper;
 }
Example #42
0
 public PropertyBinding(PropertyInfo propInfo, IBindingModule module, IViewModelResolver resolver)
 {
     if (propInfo == null)
     {
         throw new ArgumentNullException("propInfo");
     }
     if (module == null)
     {
         throw new ArgumentNullException("module");
     }
     if (resolver == null)
     {
         throw new ArgumentNullException("resolver");
     }
     this.module   = module;
     this.propInfo = propInfo;
     this.resolver = resolver;
     modelType     = typeof(TModel);
 }
Example #43
0
        public WaiterListViewModel(IViewModelResolver viewModelResolver, IViewProvider viewProvider, ICommandBus commandBus)
            : base(viewModelResolver)
        {
            if (viewProvider == null)
            {
                throw new ArgumentNullException(nameof(viewProvider));
            }
            if (commandBus == null)
            {
                throw new ArgumentNullException(nameof(commandBus));
            }

            _viewProvider = viewProvider;
            _commandBus   = commandBus;

            DisplayName = "Waiters";
            Elements    = new BindableCollection <WaiterView>();
            IsBusy      = true;
        }
		public AccessViewModel(IViewModelResolver viewModelResolver, IAccessProvider accessProvider, ITableConnectionProvider tableConnectionProvider)
			: base(viewModelResolver)
		{
			_accessProvider = accessProvider;
			_tableConnectionProvider = tableConnectionProvider;
			_wrongUsernameOrPassword = Visibility.Hidden;
			_connectionError = Visibility.Hidden;
		}
 public ConcreteTestingParentViewModelBase(IViewModelResolver viewModelResolver)
     : base(viewModelResolver)
 {
 }
 public ChangePasswordViewModel(IViewModelResolver viewModelResolver, ICommandBus commandBus)
     : base(viewModelResolver)
 {
     _commandBus = commandBus;
 }
Example #47
0
 public NewTaskParentViewModel(IViewModelResolver viewModelResolver, ICommandBus commandBus, AddTaskCommand addTaskCommand)
     : base(viewModelResolver)
 {
     _commandBus = commandBus;
     _addTaskCommand = addTaskCommand;
 }
 public MainWindowViewModel(IViewModelResolver viewModelResolver)
     : base(viewModelResolver)
 {
     Get<IDashboardViewModel>().ShowOn(this);
 }
 protected ParentViewModelBase(IViewModelResolver viewModelResolver)
     : base(viewModelResolver)
 {
     _activatedItems = new Stack<IViewModel>();
 }
 public AddTableViewModel(IViewModelResolver viewModelResolver, ICommandBus commandBus)
     : base(viewModelResolver)
 {
     _commandBus = commandBus;
 }
 public AddCategoryViewModel(IViewModelResolver viewModelResolver, ICommandBus commandBus)
     : base(viewModelResolver)
 {
     _commandBus = commandBus;
 }