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; }
public EditOfferViewModel(ICanService canService, IWantService wantService, ICategoryService categoryService, IDialogService dialogService, IMessengerService messenger) : base(canService, wantService, categoryService, dialogService, messenger) { }
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(); }
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(); }
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 }; }
public MyCansViewModel(ICanService CanService) { _canService = CanService; Task.Run(LoadData); }
public AllCansViewModel(ICanService canService) { _canService = canService; Task.Run(LoadData); }