예제 #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
        public void TestMethod1()
        {
            ProxyGeneratorBuilder proxyGeneratorBuilder = new ProxyGeneratorBuilder();
            IProxyGenerator       proxyGenerator        = proxyGeneratorBuilder.Build();
            //创建ICanService的代理类  CreateInterfaceProxy<T> 只会mock接口  不会调用PeopleCanServcie的方法
            //                        CreateInterfaceProxy<Tinterface,TImplate> 会模拟接口也会调用PeopleCanService的方法
            ICanService canServiceProxy = proxyGenerator.CreateInterfaceProxy <ICanService, PeopleCanServcie>();

            Console.WriteLine(canServiceProxy.GetType().ToString());
            canServiceProxy.SayHello();
            canServiceProxy.SayBye();
        }
예제 #4
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();
        }
예제 #5
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
            };
        }
예제 #6
0
        public MyCansViewModel(ICanService CanService)
        {
            _canService = CanService;

            Task.Run(LoadData);
        }
예제 #7
0
        public AllCansViewModel(ICanService canService)
        {
            _canService = canService;

            Task.Run(LoadData);
        }