Beispiel #1
0
        public static Listing MapHeatingAndFeaturesToListingModel(ListingViewModel model)
        {
            foreach (var heatType in model.HeatingListToSelect)
            {
                if (heatType.Selected)
                {
                    model.InputModel.Heating.Add(new Heating()
                    {
                        ID          = Convert.ToInt32(heatType.Value),
                        HeatingType = heatType.Text
                    });
                }
            }

            foreach (var feature in model.FeaturesListToSelect)
            {
                if (feature.Selected)
                {
                    model.InputModel.Features.Add(new PropertyFeatures()
                    {
                        ID          = Convert.ToInt32(feature.Value),
                        FeatureName = feature.Text
                    });
                }
            }



            return(model.InputModel);
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("listingId,listingName,listItemCondition,isShipping,listingBuyOutPrice,lisingStartingPrice,listingPostDate,listingEndDate,listingDescription,listingCategory,listingImageURL")] ListingViewModel listingViewModel)
        {
            if (id != listingViewModel.listingId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(listingViewModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ListingViewModelExists(listingViewModel.listingId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(listingViewModel));
        }
Beispiel #3
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var viewModel = new ListingViewModel
            {
                CategoriesWithSubCategories = new Dictionary <CategoryViewModel, List <SubCategoryViewModel> >()
            };

            var categories = categoryService.GetAll();

            foreach (var category in categories)
            {
                var subCategories = await subCategoryService
                                    .GetAllByCategoryId(category.Id)
                                    .OrderBy(s => s.Name)
                                    .Select(s => new SubCategoryViewModel
                {
                    Name = s.Name,
                    Id   = s.Id
                })
                                    .ToListAsync();

                viewModel.CategoriesWithSubCategories
                .Add(new CategoryViewModel {
                    Name = category.Name, Id = category.Id, CssIconClass = category.CssIconClass
                }, subCategories);
            }

            return(View(viewModel));
        }
Beispiel #4
0
        public async Task TestListingValidId()
        {
            // Arrange
            var viewModel = new ListingViewModel {
                Id = 1
            };

            var mockService = new Mock <IListingService>();

            mockService
            .Setup(x => x.GetListingViewModelByIdAsync(It.IsAny <int>()))
            .ReturnsAsync(viewModel)
            .Verifiable();

            var controller = new HomeController(mockService.Object);

            // Act
            var result = await controller.Listing(1);

            // Assert
            var viewResult = Assert.IsAssignableFrom <ViewResult>(result);

            Assert.IsAssignableFrom <ListingViewModel>(viewResult.Model);

            mockService
            .Verify(x => x.GetListingViewModelByIdAsync(It.IsAny <int>()), Times.Once);
        }
        public ActionResult MyListings()
        {
            string userID = User.Identity.GetUserId();
            Seller seller = db.Sellers.Where(x => x.ASPUserId.Contains(userID)).First();


            List <ListingViewModel> listingViewModels = new List <ListingViewModel>();

            try
            {
                List <Listing> listings = db.Listings.Where(x => x.SellerId.Contains(seller.SellerId)).ToList();
                for (int i = 0; i < listings.Count; i++)
                {
                    ListingViewModel lo = new ListingViewModel();
                    lo.Listing = listings.ElementAt(i);

                    string  productId = listings.ElementAt(i).ProductId.Trim();
                    string  listingId = lo.Listing.ListingId.Trim();
                    Product product   = db.Products.Where(x => x.ProductId.Contains(productId)).First();
                    lo.Offers  = db.Offers.Where(x => x.ListingId.Contains(listingId)).ToList();
                    lo.Product = product;
                    lo.Seller  = seller;
                    listingViewModels.Add(lo);
                }
                return(View(listingViewModels));
            }
            catch (Exception e)
            {
                return(View(listingViewModels));
            }

            return(View(listingViewModels));
        }
Beispiel #6
0
        /// <summary>
        /// Returns a listing of blog posts
        /// </summary>
        /// <param name="posts">Posts to be displayed</param>
        /// <param name="count">Number of posts being displayed</param>
        /// <param name="page">Page number of the current page</param>
        /// <param name="viewName">Name of the view to render</param>
        /// <param name="viewModel">View model to pass to the view</param>
        /// <returns>Post listing</returns>
        private ActionResult Listing(IEnumerable <PostModel> posts, int count, int page, string viewName = null, ListingViewModel viewModel = null)
        {
            if (viewName == null)
            {
                viewName = "Index";
            }

            if (viewModel == null)
            {
                viewModel = new ListingViewModel();
            }

            var pages = (int)Math.Ceiling((double)count / ITEMS_PER_PAGE);

            if (page > pages)
            {
                return(NotFound());
            }

            viewModel.Posts = posts.Select(post => new PostViewModel
            {
                Post           = post,
                ShortUrl       = ShortUrl(post),
                SocialNetworks = GetSocialNetworks(post)
            });
            viewModel.TotalCount = count;
            viewModel.Page       = page;
            viewModel.TotalPages = pages;
            return(View(viewName, viewModel));
        }
        public async Task <IActionResult> Index()
        {
            var brewersResponse = await _deliveryClient.GetItemsAsync <Brewer>(
                new EqualsFilter("system.type", "brewer"),
                new EqualsFilter("system.language", CultureInfo.CurrentCulture.Name), // disable language fallback
                new LanguageParameter(CultureInfo.CurrentCulture.Name)
                );

            var brewers = brewersResponse.Items;

            var brewersContentResponse = await _deliveryClient.GetItemAsync <ListingPageContent>("brewers_listing_page",
                                                                                                 new LanguageParameter(CultureInfo.CurrentCulture.Name)
                                                                                                 );

            if (brewers.Count() > 0)
            {
                var brewerListing = new ListingViewModel
                {
                    Content      = brewersContentResponse.Item,
                    RelatedItems = brewers
                };

                return(View(brewerListing));
            }
            else
            {
                return(RedirectToAction("NotFound", "Errors"));
            }
        }
Beispiel #8
0
        // GET: Listings/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var listing = await AuctionContext.Listings.SingleOrDefaultAsync(m => m.Id == id);

            if (listing == null)
            {
                return(NotFound());
            }

            var itemName    = AuctionContext.Items.SingleOrDefault(item => item.Id == listing.AuctionId).Name;
            var auctionName = AuctionContext.Auctions.SingleOrDefault(auction => auction.Id == listing.AuctionId).Name;
            var viewModel   = new ListingViewModel
            {
                Id         = listing.Id,
                Item       = itemName,
                Auction    = auctionName,
                Increment  = listing.Increment.ToThaiCurrencyDisplayString(),
                MinimumBid = listing.MinimumBid.ToThaiCurrencyDisplayString()
            };

            viewModel.Auctions = new SelectList(AuctionContext.Auctions, "Id", "Name", viewModel.Auction);
            viewModel.Items    = new SelectList(AuctionContext.Items, "Id", "Name", viewModel.Item);
            return(View(viewModel));
        }
Beispiel #9
0
        // GET: Listings/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Listing listing = db.Listings.Find(id);

            if (listing == null)
            {
                return(HttpNotFound());
            }

            var pickupLocationsForGrower = db.PickupLocations.Where(m => m.Grower.Id == listing.Grower.Id);

            ViewBag.locationsList = new SelectList(pickupLocationsForGrower, "id", "name", listing.PickupLocation.id);

            ListingViewModel listingViewModel = new ListingViewModel(db, listing.Grower);

            listingViewModel.id = Convert.ToInt32(id);
            listingViewModel.PopulatePickupLocations(db);
            listingViewModel.product        = listing.product;
            listingViewModel.qtyOffered     = listing.qtyOffered;
            listingViewModel.qtyLabel       = listing.qtyLabel;
            listingViewModel.harvested_date = listing.harvested_date;
            listingViewModel.expire_date    = listing.expire_date;
            listingViewModel.cost           = listing.cost;
            listingViewModel.available      = listing.available;
            listingViewModel.comments       = listing.comments;

            return(View(listingViewModel));
        }
Beispiel #10
0
        public HttpResponseMessage Add(HttpRequestMessage request, ListingViewModel listingViewModel)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                if (!ModelState.IsValid)
                {
                    response = request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    listingViewModel.DateEdit = listingViewModel.Date;
                    var newListing = Mapper.Map <ListingViewModel, Listing>(listingViewModel);
                    _listingRepository.Add(newListing);

                    _unitOfWork.Commit();

                    // Update view model
                    listingViewModel = Mapper.Map <Listing, ListingViewModel>(newListing);
                    response = request.CreateResponse <ListingViewModel>(HttpStatusCode.Created, listingViewModel);
                }

                return response;
            }));
        }
Beispiel #11
0
 public ListingView(User user)
 {
     InitializeComponent();
     _user          = user;
     ViewModel      = new ListingViewModel();
     BindingContext = ViewModel;
 }
Beispiel #12
0
        public ActionResult Edit(ListingViewModel listingViewModel)
        {
            listingViewModel.PopulatePickupLocations(db);
            listingViewModel.PopulatePickupLocation(db);

            var saveListing = (from b in db.Listings where b.id == listingViewModel.id select b).FirstOrDefault();

            var pickupLocationsForGrower = db.PickupLocations.Where(m => m.Grower.Id == saveListing.Grower.Id);

            ViewBag.locationsList = new SelectList(pickupLocationsForGrower, "id", "name", saveListing.PickupLocation.id);

            saveListing.product        = listingViewModel.product;
            saveListing.qtyOffered     = listingViewModel.qtyOffered;
            saveListing.qtyLabel       = listingViewModel.qtyLabel;
            saveListing.harvested_date = listingViewModel.harvested_date;
            saveListing.expire_date    = listingViewModel.expire_date;
            saveListing.cost           = listingViewModel.cost;
            saveListing.available      = listingViewModel.available;
            saveListing.comments       = listingViewModel.comments;
            saveListing.PickupLocation = listingViewModel.PickupLocation;

            CheckListingForErrors(saveListing);

            if (ModelState.IsValid)
            {
                db.Entry(saveListing).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View(listingViewModel));
        }
        public IActionResult SearchFilter(ListingViewModel model)
        {
            var result = this.listingService.GetSearchReFilterResults(model);

            this.ViewBag.FilterActivated = true;
            result.FiltersViewModels     = result.FiltersViewModels.OrderBy(x => x.SortOrder).ToList();
            if (!string.IsNullOrEmpty(model.SearchTermViewModel.StartDate))
            {
                this.TempData["StartDate"] = DateTime.ParseExact(model.SearchTermViewModel.StartDate, "dd/MM/yyyy", null);
            }
            else
            {
                this.TempData["StartDate"] = null;
            }

            if (!string.IsNullOrEmpty(model.SearchTermViewModel.EndDate))
            {
                this.TempData["EndDate"] = DateTime.ParseExact(model.SearchTermViewModel.EndDate, "dd/MM/yyyy", null);
            }
            else
            {
                this.TempData["EndDate"] = null;
            }

            this.ModelState.Clear();
            return(this.View("Search", result));
        }
Beispiel #14
0
        public ActionResult MyListings()
        {
            string userID = User.Identity.GetUserId();
            Seller seller = db.Sellers.Where(x => x.ASPUserId == userID).First();

            List <Listing> listings = db.Listings.Where(x => x.SellerId == seller.SellerId).ToList();

            List <ListingViewModel> listingViewModels = new List <ListingViewModel>();



            for (int i = 0; i < listings.Count; i++)
            {
                ListingViewModel lo = new ListingViewModel();
                lo.Listing = listings.ElementAt(i);

                string productId = listings.ElementAt(i).ProductId;

                Product product = db.Products.Where(x => x.ProductId == productId).First();


                lo.UnitPriceKG = lo.Listing.UnitPriceKG;
                lo.UnitsKG     = lo.Listing.UnitsKG;
                lo.Product     = product;
                lo.Seller      = seller;
                listingViewModels.Add(lo);
            }


            return(View(listingViewModels));
        }
Beispiel #15
0
        public async Task <ListingViewModel> GetDefaultViewModelEntry()
        {
            var viewModel = new ListingViewModel();

            var heatingDbList      = _listingRepo.GetAllHeating();
            var propFeaturesDbList = _listingRepo.GetAllFeatures();
            var customersDbList    = _customerRepo.GetAll();
            var agentsDbList       = _userRepo.GetAllByRole(RoleNames.AGENT);


            await Task.WhenAll(heatingDbList, propFeaturesDbList,
                               customersDbList, agentsDbList);


            viewModel.HeatingListToSelect = ListingViewHelperUtilites.
                                            GetHeatingTypesToListItems(heatingDbList.Result);

            viewModel.FeaturesListToSelect = ListingViewHelperUtilites.
                                             GetPropertyFeaturesToListItems(propFeaturesDbList.Result);

            viewModel.Agents = agentsDbList.Result;

            viewModel.Customers = customersDbList.Result;

            return(viewModel);
        }
Beispiel #16
0
        /// <summary>
        /// Returns a listing of blog posts
        /// </summary>
        /// <param name="posts">Posts to be displayed</param>
        /// <param name="count">Number of posts being displayed</param>
        /// <param name="page">Page number of the current page</param>
        /// <param name="viewName">Name of the view to render</param>
        /// <param name="viewModel">View model to pass to the view</param>
        /// <returns>Post listing</returns>
        private ActionResult Listing(IEnumerable <PostModel> posts, int count, int page, string viewName = null, ListingViewModel viewModel = null)
        {
            if (viewName == null)
            {
                viewName = Views.Index;
            }

            if (viewModel == null)
            {
                viewModel = new ListingViewModel();
            }

            var pages = (int)Math.Ceiling((double)count / ITEMS_PER_PAGE);

            if (page > pages)
            {
                return(HttpNotFound(string.Format("Requested page number ({0}) is greater than page count ({1})", page, count)));
            }

            using (_profiler.Step("Building post ViewModels"))
            {
                viewModel.Posts = posts.Select(post => new PostViewModel
                {
                    Post           = post,
                    ShortUrl       = ShortUrl(post),
                    SocialNetworks = GetSocialNetworks(post)
                });
            }
            viewModel.TotalCount = count;
            viewModel.Page       = page;
            viewModel.TotalPages = pages;
            return(View(viewName, viewModel));
        }
Beispiel #17
0
 public ListingView(User user)
 {
     InitializeComponent();
     this.ViewModel      = new ListingViewModel();
     this.user           = user;
     this.BindingContext = this.ViewModel;
 }
Beispiel #18
0
        // GET: Listings/Create
        public IActionResult Create()
        {
            var viewModel = new ListingViewModel();

            viewModel.Auctions = new SelectList(AuctionContext.Auctions, "Id", "Name", viewModel.Auction);
            viewModel.Items    = new SelectList(AuctionContext.Items, "Id", "Name", viewModel.Item);
            return(View(viewModel));
        }
        public static Listing MapHeatingAndFeaturesToListingModel
            (ListingViewModel model)
        {
            model.InputModel.Heating  = GetHeatingListFromListItems(model.HeatingListToSelect);
            model.InputModel.Features = GetFeaturesFromListItems(model.FeaturesListToSelect);

            return(model.InputModel);
        }
        public async Task <Response <ListingViewModel> > GetSearchResults(ListingViewModel listingViewModel)
        {
            var result = this.listingService.GetSearchResults(listingViewModel);

            return(new Response <ListingViewModel>()
            {
                ResultType = ResultType.Success, Result = listingViewModel
            });
        }
Beispiel #21
0
 public ListingOperationsController
     (IOperatingUserRepo userRepo, ICustomerRepo customerRepo
     , IListingRepo listingRepo, ListingViewModel listingVM, IListingImageHelper imageHelper)
 {
     _userRepo     = userRepo;
     _customerRepo = customerRepo;
     _listingRepo  = listingRepo;
     model         = listingVM;
     _imageHelper  = imageHelper;
 }
 public void SetView(Assembly assembly, Address address)
 {
     if (viewModel == null || viewModel.Image != assembly.GetImage())
     {
         this.DataContext = null;
         this.viewModel = new ListingViewModel(assembly, address.Segment);
         this.DataContext = viewModel;
     }
     GoToAddress(address.Offset);
 }
Beispiel #23
0
        public async Task <ActionResult> Index(int page = 1)
        {
            ListingViewModel <TEntity> model = new ListingViewModel <TEntity>
            {
                Data   = await Manager.GetEntitiesAsync((page - 1) *Constants.RecordPerPage, Constants.RecordPerPage),
                Paging = new PagingModel(page, Constants.RecordPerPage, await Manager.GetCountAsync())
            };

            return(View(model));
        }
Beispiel #24
0
 public void mapModel(ListingViewModel list)
 {
     ListingId   = list.ListingId;
     CategoryId  = list.CategoryId;
     Title       = list.Title;
     Description = list.Description;
     Price       = list.Price;
     Town        = list.Town;
     Status      = list.Status;
 }
Beispiel #25
0
        // GET: Listings/Create
        public ActionResult Create()
        {
            var registeredUserService = new RegisteredUserService();
            var user = registeredUserService.GetRegisteredUser(this.User);

            var grower = db.Growers.Where(g => g.Id == user.GrowerId).FirstOrDefault();
            ListingViewModel listingViewModel = new ListingViewModel(db, grower);

            return(View(listingViewModel));
        }
Beispiel #26
0
        public async Task <ActionResult> Index(string textFilter)
        {
            var buildings = await this._buildingService.GetAllBuildings(textFilter);

            ListingViewModel model = new ListingViewModel();

            model.TextFilter = textFilter;
            model.Results    = buildings;

            return(View(model));
        }
Beispiel #27
0
        public ActionResult ProductAndListings(string id)
        {
            Product        product  = db.Products.FirstOrDefault(x => x.ProductId == id);
            List <Listing> listings = db.Listings.Where(x => x.ProductId == id).ToList();



            listingViewModels = new List <ListingViewModel>();



            for (int i = 0; i < listings.Count; i++)
            {
                ListingViewModel lo = new ListingViewModel();
                lo.Listing = listings.ElementAt(i);
                string listingId = lo.Listing.ListingId;
                string sellerId  = listings.ElementAt(i).SellerId;
                lo.Offers = db.Offers.Where(x => x.ListingId == lo.Listing.ListingId).ToList();
                Seller seller = db.Sellers.Where(x => x.SellerId == sellerId).First();


                lo.Product = product;
                lo.Seller  = seller;
                //lo.ProcessingOption = db
                listingViewModels.Add(lo);
            }

            List <string>           tags = new List <string>();
            ProductAndListingsModel pm   = new ProductAndListingsModel(); pm.ProductTags = new List <Tag>();

            pm.ListingViewModels = listingViewModels;
            pm.TagCategories     = db.TagCategories.ToList();
            string productId = product.ProductId;
            List <TagAssociation> associations = db.TagAssociations.Where(x => x.ProductId.Contains(productId)).ToList();

            foreach (var item in associations)
            {
                if (!tags.Contains(item.TagId))
                {
                    tags.Add(item.TagId);
                    string tagId = item.TagId;
                    Tag    t     = db.Tags.Where(x => x.TagId.Contains(tagId)).First();
                    pm.ProductTags.Add(t);
                }
            }

            ListingTagCategory category = db.ListingTagCategories.Where(x => x.Name.Contains("Processing Options")).FirstOrDefault();
            string             processingOptionsTagCategory = category.ListingTagCategoryId.Trim();

            pm.processingOptions = db.ListingTags.Where(x => x.ListingTagCategoryId.Contains(processingOptionsTagCategory)).ToList();
            pm.Product           = product;

            return(View(pm));
        }
Beispiel #28
0
        public async Task <IActionResult> Create([Bind("listingId,listingName,listingAuthor,listItemCondition,isShipping,listingBuyOutPrice,lisingStartingPrice,listingPostDate,listingEndDate,listingDescription,listingCategory,listingImageURL")] ListingViewModel listingViewModel)
        {
            if (ModelState.IsValid)
            {
                listingViewModel.listingAuthor = User.Identity.Name;
                _context.Add(listingViewModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(listingViewModel));
        }
Beispiel #29
0
        private async Task <ProfileViewModel> GetProfileViewModelAsync(User user, int lastPage, int adsCount, string orderBy = "dateDesc", int page = 1)
        {
            var ads = await advertisementService.GetByUserIdAsync(user.Id, page, GlobalConstants.AdsOnPageCount, orderBy);

            ads = OrderAds(ads, orderBy);

            var viewModel = new ProfileViewModel
            {
                UserId                   = user.Id,
                Username                 = user.UserName,
                CurrentPage              = page,
                LastPage                 = lastPage,
                TotalAdsCount            = adsCount,
                OrderParam               = "orderBy=" + orderBy,
                PageParam                = "id=" + user.Id,
                Advertisements           = new List <ListingViewModel>(),
                IsFollowedByLoggedInUser = await userService.IsFollowedByUser(User.FindFirstValue(ClaimTypes.NameIdentifier), user.Id)
            };

            foreach (var ad in ads)
            {
                var category = await categoryService.GetByIdAsync(ad.CategoryId);

                string subCategoryName = null;

                if (await subCategoryService.ContainsByIdAsync(ad.SubCategoryId))
                {
                    var subCategory = await subCategoryService.GetByIdAsync(ad.SubCategoryId);

                    subCategoryName = subCategory.Name;
                }

                var town = await townService.GetByIdAsync(ad.TownId);

                var adViewModel = new ListingViewModel
                {
                    Address         = ad.Address,
                    CategoryName    = category.Name,
                    CreatedOn       = ad.CreatedOn.ToString(GlobalConstants.DateTimeFormat),
                    Id              = ad.Id,
                    Name            = ad.Name,
                    Price           = ad.Price,
                    SubCategoryName = subCategoryName,
                    TownName        = town.Name,
                    Image           = ad.Images.FirstOrDefault()
                };

                viewModel.Advertisements.Add(adViewModel);
            }

            return(viewModel);
        }
Beispiel #30
0
        public ActionResult AddListing()
        {
            ListingViewModel vm = new ListingViewModel();

            vm.ListingTagCategories = db.ListingTagCategories.OrderBy(x => x.Name).ToList();
            vm.ListingTags          = db.ListingTags.OrderBy(x => x.ListingTagType).ToList();
            vm.NewOffer             = new Offer();

            vm.Products = db.Products.OrderBy(x => x.ProductType).ToList();


            return(View(vm));
        }
Beispiel #31
0
        public async Task <ActionResult> Create()
        {
            try
            {
                model = await GetDefaultViewModelEntry();
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, ex.Message);
            }

            return(View(model));
        }
        private void UpdateUI()
        {
            dataGridView1.DataSource = null;

            lvListing.SetWindowTheme("explorer");
            lvListing.VirtualListSize = 0;
            viewModel = null;
            if (document == null)
                return;

            // Listen to navigation events.
            document.Navigator.LocationChanged += navigator_LocationChanged;

            // Create the view model.
            viewModel = new ListingViewModel(document.Image);
            //dataGridView1.Columns.Clear();
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.Font = new System.Drawing.Font(FontFamily.GenericMonospace, this.Font.Size);
            dataGridView1.DataSource = null;
            dataGridView1.DataSource = viewModel.Rows;
            dataGridView1.Refresh();

            // Fill the procedure window.
            cbProcedures.Items.Clear();
            cbProcedures.Items.AddRange(viewModel.ProcedureItems.ToArray());

            // Fill the segment window.
            cbSegments.Items.Clear();
            cbSegments.Items.AddRange(viewModel.SegmentItems.ToArray());

            // Display the listing rows.
            //scope = ListingScope.Procedure;
            scope = ListingScope.Executable; // should rename to Image
            UpdateScope();
        }
Beispiel #33
0
        public void UpdateUI()
        {
            // This routine is a huge memory eater.
            return;
            #if false
            richTextBox1.Clear();
            if (document == null)
                return;

            listingView = new ListingViewModel(document.Disassembler);

            StringBuilder sb = new StringBuilder();
            int rowCount = listingView.Rows.Count;
            int[] rowStart = new int[rowCount + 1];
            for (int i = 0; i < rowCount; i++)
            {
                ListingRow row = listingView.Rows[i];
                rowStart[i] = sb.Length;
                sb.AppendFormat("{0} {1}\n", row.Location, row.Text);
            }
            rowStart[rowCount] = sb.Length;
            richTextBox1.Text = sb.ToString();
            return;
            #if false
            #if false
            //richTextBox1.Test();
            #else
            // Format the text.
            //richTextBox1.Visible = false;
            ITextDocument textDocument = richTextBox1.GetTextDocument();
            //textDocument.Freeze();
            int nUndoLimit = richTextBox1.SetUndoLimit(0);
            //textDocument.BeginEditCollection(); -- not implemented
            #if false
            richTextBox1.SelectAll();
            richTextBox1.SelectionColor = Color.Blue;
            richTextBox1.DeselectAll();
            #else
            //richTextBox1.SelectedRtf
            System.Diagnostics.Debug.WriteLine("Formatting " + rowCount + " lines...");
            for (int i = rowCount - 1; i >= 0; i--)
            {
                richTextBox1.Select(rowStart[i], 9);
                //richTextBox1.SelectionColor = Color.Blue;
                richTextBox1.SelectedText = "NEW";
            }
            #endif
            //richTextBox1.Visible = true;
            //textDocument.Unfreeze();
            //textDocument.EndEditCollection();
            #endif
            #endif
            #endif
        }