示例#1
0
        //informaton about what button called the eventlistener to open this form
        public OfferForm(OfferButton senderInfo)
        {
            InitializeComponent();

            //populate form
            title_txt.Text = senderInfo.ParsedObject.headline;
            description_txt.Text = senderInfo.ParsedObject.description_text;
            created_txt.Text = senderInfo.ParsedObject.created_date;
            rent_txt.Text = senderInfo.ParsedObject.rent;
            rooms_txt.Text = senderInfo.ParsedObject.m2;
            url = senderInfo.ParsedObject.url;
        }
示例#2
0
        private void CreateButtons()
        {
            int btn_height = 25;
            int btn_width = 300;
            int offsetX = 20;
            int offsetY = 20;
            int spacinngY = 5;

            //create buttons
            foreach(Offer offer in Request.offer_cache){
                //implements an inherited button, to add a custome attribute
                OfferButton offerBtn = new OfferButton();
                offerBtn.Click += offerBtnClick;
                offerBtn.Name = "an_offer_btn";
                offerBtn.Width = btn_width;
                offerBtn.Height = btn_height;
                offerBtn.Text = offer.headline;
                offerBtn.Top = offsetY;
                offerBtn.Left = offsetX;
                offerBtn.ParsedObject = offer;

                if (offer.new_offer)
                {
                    //if new, add label
                    Label newLabel = new Label();
                    newLabel.Text = "new";
                    newLabel.Width = 100;
                    newLabel.Height = 20;
                    newLabel.Top = offsetY;
                    newLabel.Left = offsetX + offerBtn.Width + offsetX;
                    offer_groupbox.Invoke(new MethodInvoker(delegate { offer_groupbox.Controls.Add(newLabel); }));
                }

                //add control element from worker thread
                offer_groupbox.Invoke(new MethodInvoker(delegate { offer_groupbox.Controls.Add(offerBtn); }));

                offsetY += btn_height + spacinngY;
            }
        }