private void Collected(object sender, RoutedEventArgs e)
        {
            if (!UserManagement.GetInstance().returnMain)
            {
                return;
            }
            //查找该项目的位置
            var instance = SampleDataService.GetInstance();
            int pos      = 0;;
            int id       = MasterMenuItem.OrderId;

            for (int i = 0; i < instance.allItems.Count; i++)
            {
                if (id == instance.allItems[i].OrderId)
                {
                    pos = i;
                    break;
                }
            }
            //赞+1并添加到数据库。新建实例以防止Ordered变量被修改
            instance.allItems[pos].Collected++;
            SampleOrder newOne = instance.allItems[pos];

            newOne.Ordered = 0;
            SampleOrderSQLManagement.GetInstance().update(newOne);
            //防止重复点赞
            UserManagement.GetInstance().returnMain = false;
        }
Ejemplo n.º 2
0
        public async Task EnsureSampleDataServiceReturnsContentGridDataAsync()
        {
            var dataService = new SampleDataService();
            var actual      = await dataService.GetContentGridDataAsync();

            Assert.NotEmpty(actual);
        }
        public void Initialize(long orderId)
        {
            // TODO WTS: Replace this with your actual data
            var data = SampleDataService.GetContentGridData();

            Item = data.First(i => i.OrderId == orderId);
        }
        public async void EnsureSampleDataServiceReturnsChartDataAsync()
        {
            var dataService = new SampleDataService();
            var actual      = await dataService.GetChartDataAsync();

            Assert.AreNotEqual(0, actual.Count());
        }
Ejemplo n.º 5
0
        public async Task EnsureSampleDataServiceReturnsImageGalleryDataAsync()
        {
            var dataService = new SampleDataService();
            var actual      = await dataService.GetImageGalleryDataAsync("ms-appx:///Assets");

            Assert.AreNotEqual(0, actual.Count());
        }
Ejemplo n.º 6
0
        public async Task EnsureSampleDataServiceReturnsTreeViewDataAsync()
        {
            var dataService = new SampleDataService();
            var actual      = await dataService.GetTreeViewDataAsync();

            Assert.NotEmpty(actual);
        }
Ejemplo n.º 7
0
        public void EnsureSampleDataServiceReturnsGalleryData()
        {
            var dataService = new SampleDataService();
            var actual      = dataService.GetGallerySampleData();

            Assert.AreNotEqual(0, actual.Count);
        }
        public async void EnsureSampleDataServiceReturnsImageGalleryDataAsync()
        {
            var dataService = new SampleDataService();
            var actual      = await dataService.GetImageGalleryDataAsync("ms-appx:///Assets");

            Assert.NotEmpty(actual);
        }
Ejemplo n.º 9
0
 public ChartViewModel()
 {
     foreach (var item in SampleDataService.GetChartSampleData())
     {
         Source.Add(item);
     }
 }
Ejemplo n.º 10
0
        public void EnsureSampleDataServiceReturnsContentGridData()
        {
            var dataService = new SampleDataService();
            var actual      = dataService.GetContentGridData();

            Assert.NotEmpty(actual);
        }
Ejemplo n.º 11
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            // TODO WTS: Replace this with your actual data
            Source.AddRange(SampleDataService.GetGallerySampleData());
        }
Ejemplo n.º 12
0
        private async void Init()
        {
            //((INotifyCollectionChanged)Articles).CollectionChanged += FeedViewModel_CollectionChanged;
            Link = new Uri("https://kaki104.tistory.com/rss");

            if (IsInDesignMode)
            {
                Name     = "Future Of DotNet";
                Articles = SampleDataService.GetRss();
            }
            else
            {
                RSSChannel feed;
                feed = await RssService.GetFeedAsync(Link);

                LastSyncDateTime = DateTime.Now;
                Name             = string.IsNullOrEmpty(Name) ? feed.Title : Name;
                Description      = feed.Description;
                Articles         = feed.Items;
            }

            IsInError    = false;
            ErrorMessage = null;

            Messenger.Default.Register <string>(this, ReceivedString, false);

            //IEnumerable<SampleOrder> datas = await SampleDataService.GetContentGridDataAsync();
            //foreach (SampleOrder item in datas)
            //{
            //    Source.Add(item);
            //}
        }
        public async void EnsureSampleDataServiceReturnsChartDataAsync()
        {
            var dataService = new SampleDataService();
            var actual      = await dataService.GetChartDataAsync();

            Assert.NotEmpty(actual);
        }
Ejemplo n.º 14
0
        private async Task InitializeAsync()
        {
            SampleDataService.Initialize("ms-appx:///Assets");
            await Singleton <BackgroundTaskService> .Instance.RegisterBackgroundTasksAsync();

            await ThemeSelectorService.InitializeAsync();
        }
Ejemplo n.º 15
0
        public async Task EnsureSampleDataServiceReturnsListDetailsDataAsync()
        {
            var dataService = new SampleDataService();
            var actual      = await dataService.GetListDetailsDataAsync();

            Assert.NotEmpty(actual);
        }
Ejemplo n.º 16
0
        public void EnsureSampleDataServiceReturnsChartData()
        {
            var dataService = new SampleDataService();
            var actual      = dataService.GetChartSampleData();

            Assert.IsNotEmpty(actual);
        }
Ejemplo n.º 17
0
 public ItemRepository()
 {
     foreach (var company in SampleDataService.GetWebApiSampleDataAsync().Result)
     {
         items.TryAdd(company.CompanyID, company);
     }
 }
Ejemplo n.º 18
0
        public async Task EnsureSampleDataServiceReturnsListDetailsDataAsync()
        {
            var dataService = new SampleDataService();
            var actual      = await dataService.GetListDetailsDataAsync();

            Assert.AreNotEqual(0, actual.Count());
        }
        public void EnsureSampleDataServiceReturnsContentGridData()
        {
            var dataService = new SampleDataService();
            var actual      = dataService.GetContentGridData();

            Assert.AreNotEqual(0, actual.Count);
        }
Ejemplo n.º 20
0
        public async Task EnsureSampleDataServiceReturnsContentGridDataAsync()
        {
            var dataService = new SampleDataService();
            var actual      = await dataService.GetContentGridDataAsync();

            Assert.AreNotEqual(0, actual.Count());
        }
        public async Task InitializeAsync(long orderID)
        {
            // TODO WTS: Replace this with your actual data
            var data = await SampleDataService.GetContentGridDataAsync();

            Item = data.First(i => i.OrderID == orderID);
        }
Ejemplo n.º 22
0
        public void EnsureSampleDataServiceReturnsGalleryData()
        {
            var dataService = new SampleDataService();
            var actual      = dataService.GetGallerySampleData();

            Assert.NotEmpty(actual);
        }
Ejemplo n.º 23
0
        public async Task EnsureSampleDataServiceReturnsGridDataAsync()
        {
            var sampleDataService = new SampleDataService();

            var data = await sampleDataService.GetGridDataAsync();

            Assert.IsTrue(data.Any());
        }
Ejemplo n.º 24
0
        protected override async void OnInitialize()
        {
            base.OnInitialize();
            Source.Clear();

            // TODO WTS: Replace this with your actual data
            Source.AddRange(await SampleDataService.GetImageGalleryDataAsync("ms-appx:///Assets"));
        }
Ejemplo n.º 25
0
        public async Task EnsureSampleDataServiceReturnsListDetailsDataAsync()
        {
            var sampleDataService = new SampleDataService();

            var data = await sampleDataService.GetListDetailsDataAsync();

            Assert.True(data.Any());
        }
        public async Task LoadDataAsync()
        {
            Items.Clear();

            var data = await SampleDataService.GetSampleModelDataAsync();

            Items.AddRange(data.Select(d => new MasterDetailViewDetailViewModel(d)));
        }
Ejemplo n.º 27
0
        public WatchItemNamePage()
        {
            InitializeComponent();

            // Initialize sample data and set ItemsSource in ListView.
            // TODO: Change ItemsSource with your own data.
            listView.ItemsSource = SampleDataService.AllColors();
        }
Ejemplo n.º 28
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     if (e.Parameter is long orderId)
     {
         var data = SampleDataService.GetContentGridData();
         Item = data.First(i => i.OrderId == orderId);
     }
 }
Ejemplo n.º 29
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            var data = await SampleDataService.GetTreeViewDataAsync();

            foreach (var item in data)
            {
                SampleItems.Add(item);
            }
        }
Ejemplo n.º 30
0
 public ItemRepository()
 {
     Task.Run(async() =>
     {
         foreach (var company in await SampleDataService.GetWebApiSampleDataAsync())
         {
             items.TryAdd(company.CompanyID, company);
         }
     });
 }
        //
        // GET: /SampleData/
        public ActionResult Index(int? page = 1)
        {
            IPagedList<SampleDataViewModel> pagedList = null;

            using (ModelRepository db = new ModelRepository(this._factory.GetDatabaseObject()))
            {
                SampleDataService service = new SampleDataService(db);
                pagedList = service.GetPagedList(this._toViewModel, page ?? 1);
            }

            return View(pagedList);
        }
        //
        // GET: /SampleData/Edit
        public ActionResult Edit(long? id)
        {
            if (id == null)
            {
                return RedirectToAction("Index");
            }

            var viewModel = new SampleDataViewModel();

            using (ModelRepository db = new ModelRepository(this._factory.GetDatabaseObject()))
            {
                SampleDataService service = new SampleDataService(db);
                var model = service.GetObjectList(x => x.Id == id).FirstOrDefault();

                if (model == null)
                {
                    return RedirectToAction("Index");
                }

                viewModel = this._toViewModel(model);
            }

            return View(viewModel);
        }
        public ActionResult Create(SampleDataViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return View(viewModel);
            }

            using (ModelRepository db = new ModelRepository(this._factory.GetDatabaseObject()))
            {
                SampleDataService service = new SampleDataService(db);
                service.Add(this._toBusinessModel(viewModel));
                db.SaveChanges();
            }

            return RedirectToAction("Index");
        }
        public ActionResult Edit(SampleDataViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return View(viewModel);
            }

            using (ModelRepository db = new ModelRepository(this._factory.GetDatabaseObject()))
            {
                SampleDataService service = new SampleDataService(db);
                var model = service.GetObjectList(x => x.Id == viewModel.Id).FirstOrDefault();

                if (model == null)
                {
                    return RedirectToAction("Index");
                }

                service.Update(this._toBusinessModel(viewModel));

                db.SaveChanges();
            }

            return RedirectToAction("Index");
        }