예제 #1
0
        public CreateOfferViewModel(ICanService canService,
                                    IWantService wantService,
                                    ICategoryService categoryService,
                                    IDialogService dialogService,
                                    IMessengerService messenger)
            : base(canService, wantService, categoryService, dialogService, messenger)
        {
            Offer = new OfferModel();

            if (Categories == null || Categories.Count == 0)
            {
                var mtDispatcher = Mvx.Resolve <IMvxMainThreadDispatcher>();
                mtDispatcher.RequestMainThreadAction(() =>
                {
                    DialogService.Alert(
                        Constants.DialogNoNetwork,
                        Constants.DialogTitleError,
                        Constants.DialogButtonOk,
                        () => Close(this));
                });
                return;
            }

            Category = -1;
        }
예제 #2
0
 public EditOfferViewModel(ICanService canService,
                           IWantService wantService,
                           ICategoryService categoryService,
                           IDialogService dialogService,
                           IMessengerService messenger)
     : base(canService, wantService, categoryService, dialogService, messenger)
 {
 }
예제 #3
0
        protected BaseEditOfferViewModel(ICanService canService,
                                         IWantService wantService,
                                         ICategoryService categoryService,
                                         IDialogService dialogService,
                                         IMessengerService messenger)
        {
            CanService      = canService;
            WantService     = wantService;
            CategoryService = categoryService;
            DialogService   = dialogService;
            Messenger       = messenger;

            Categories = categoryService.GetCategoryList();
        }
예제 #4
0
        private async void LoadData(string user)
        {
            User = user.Deserialize <UserModel>();

            if (User == null)
            {
                return;
            }
            Contacts = new List <ContactsEntry>
            {
                new ContactsEntry(ContactType.Phone, User.phone),
                new ContactsEntry(ContactType.Email, User.email),
                new ContactsEntry(ContactType.VkLink, User.vkLink)
            };


            ICanService  canService  = Mvx.Resolve <ICanService>();
            IWantService wantService = Mvx.Resolve <IWantService>();

            var canList = new OfferersOfferList {
                Header = "Может"
            };
            var userCans = await canService.GetCanListByUser(User.id);

            canList.AddRange(userCans);

            var wantList = new OfferersOfferList {
                Header = "Хочет"
            };
            var userWants = await wantService.GetWantListByUser(User.id);

            wantList.AddRange(userWants);

            Offers = new List <OfferersOfferList>
            {
                canList,
                wantList
            };
        }
예제 #5
0
 public AddProductManager(IAddProductDal addProductDal, IProductService productService, IWantService wantService)
 {
     _addProductDal  = addProductDal;
     _productService = productService;
     _wantService    = wantService;
 }
예제 #6
0
        public AllWantsViewModel(IWantService wantService)
        {
            _wantService = wantService;

            Task.Run(LoadData);
        }