コード例 #1
0
        private void placementChangedNoticeClicked(object sender, EventArgs e)
        {
            NotifyIcon   notifyIcon = sender as NotifyIcon;
            List <Offer> offers     = OfferHandler.LoadOffers();

            foreach (Offer offer in offers)
            {
                if (offer.name == notifyIcon.Tag.ToString())
                {
                    offer.closedPlacementChangedNotice = true;
                    OfferHandler.SaveOffers(offers);
                    notifyIcon.Visible = false;
                    // notifyIcon.Dispose(); // Don't dispose, because this might be reused.
                    tabControl.SelectTab(activeOffersTabPage);
                    ShowOrActivate();
                    break;
                }
            }
        }
コード例 #2
0
        private void updateOffers()
        {
            List <Offer> allOffers      = OfferHandler.LoadOffers();
            List <Offer> activeOffers   = new List <Offer>();
            List <Offer> inactiveOffers = new List <Offer>();

            foreach (Offer offer in allOffers)
            {
                if (offer.isActive)
                {
                    activeOffers.Add(offer);
                }
                else
                {
                    inactiveOffers.Add(offer);
                }
            }
            if (!offerListsAreEqual(activeOffers, activeOffersLoaded))       // TODO: Should work with List.Equals
            {
                activeOffersFlowLayout.Controls.Clear();
                foreach (Offer offer in activeOffers)
                {
                    ActiveOffer activeOffer = new ActiveOffer(offer);
                    AddActiveOfferToFlowLayoutPanel(activeOffer, activeOffersFlowLayout);
                }
                activeOffersLoaded = activeOffers;
            }
            if (!offerListsAreEqual(inactiveOffers, inactiveOffersLoaded))       // TODO: Should work with List.Equals
            {
                inactiveOffersFlowLayout.Controls.Clear();
                foreach (Offer offer in inactiveOffers)
                {
                    InactiveOffer inactiveOffer = new InactiveOffer(offer);
                    AddInactiveOfferToFlowLayoutPanel(inactiveOffer, inactiveOffersFlowLayout);
                }
                inactiveOffersLoaded = inactiveOffers;
            }
            updateOffersPadding();
            updateNewOfferNotifyIcons();
            updateCanReplyNotifyIcons();
            updateActiveChangedNotifyIcons();
            updatePlacementChangedNotifyIcons();
        }
コード例 #3
0
        private void activeChangedNoticeClicked(object sender, EventArgs e)
        {
            NotifyIcon   notifyIcon = sender as NotifyIcon;
            List <Offer> offers     = OfferHandler.LoadOffers();

            foreach (Offer offer in offers)
            {
                if (offer.name == notifyIcon.Tag.ToString())
                {
                    offer.closedActiveChangedNotice = true;
                    OfferHandler.SaveOffers(offers);
                    notifyIcon.Visible = false;
                    notifyIcon.Dispose();
                    tabControl.SelectTab(inactiveOffersTabPage);
                    ShowOrActivate();
                    break;
                }
            }
        }
コード例 #4
0
        void extractQueuePlacingsData()
        {
            updateStatus(ProgressId.extractQueueDataAttempt, webBrowser.Url.ToString());
            HtmlElementCollection documentDivs    = currentDocument.GetElementsByTagName("div");
            HtmlElement           offersContainer = HtmlHelper.GetDescendantElement(documentDivs, "div", queuePlacingsLoadedClassName);
            List <Offer>          currentOffers   = getOffersFromOffersContainer(offersContainer);

            OfferHandler.updateOffersWithNewOffers(currentOffers);
            mainForm.UpdateUI();

            if (offersContainer == null)
            {
                System.Timers.Timer retryTimer = new System.Timers.Timer(1000.0);
                retryTimer.Elapsed += retryExtractQueuePlacingsData;
                retryTimer.Start();
            }
            else
            {
                updateStatus(ProgressId.done);
            }
        }