Esempio n. 1
0
        private void btnAddAdvertisement_Click(object sender, EventArgs e)
        {
            AdSettings adSettings = new AdSettings();

            AdSettingsContainer.Ads.Add(adSettings);
            AdSettingsContainer.Save();

            AdConfigItemCtrl itemCtrl = CreateAdConfigItemControl(adSettings);

            pnlConfigItems.Controls.Add(itemCtrl);
        }
Esempio n. 2
0
        private AdConfigItemCtrl CreateAdConfigItemControl(AdSettings adSettings)
        {
            AdConfigItemCtrl itemCtrl = new AdConfigItemCtrl();

            itemCtrl.AdSettings = adSettings;
            itemCtrl.LoadValues();
            itemCtrl.ConfigItemSelected += new EventHandler(itemCtrl_ConfigItemSelected);
            itemCtrl.UpClicked          += new EventHandler(itemCtrl_UpClicked);
            itemCtrl.DownClicked        += new EventHandler(itemCtrl_DownClicked);
            itemCtrl.DeleteClicked      += new EventHandler(itemCtrl_DeleteClicked);
            itemCtrl.ValueUpdated       += new EventHandler(itemCtrl_ValueUpdated);
            return(itemCtrl);
        }
Esempio n. 3
0
        private void ChangeOrder(AdConfigItemCtrl ctrl, int moveIndex)
        {
            AdSettings adSettings = ctrl.AdSettings;

            if (AdSettingsContainer.Ads.Contains(adSettings))
            {
                int index    = AdSettingsContainer.Ads.IndexOf(adSettings);
                int newIndex = index + moveIndex;
                AdSettingsContainer.Ads.Remove(adSettings);
                AdSettingsContainer.Ads.Insert(newIndex, adSettings);

                AdSettingsContainer.Save();
            }
        }
Esempio n. 4
0
        void itemCtrl_ConfigItemSelected(object sender, EventArgs e)
        {
            AdConfigItemCtrl itemCtrl = (AdConfigItemCtrl)sender;

            foreach (Control ctrl in pnlConfigItems.Controls)
            {
                if (ctrl is AdConfigItemCtrl)
                {
                    ((AdConfigItemCtrl)ctrl).IsSelected = (ctrl == itemCtrl);
                }
            }
            string filename = Globals.SettingsResourceDir + itemCtrl.AdSettings.FileName;

            pbSelectedImage.Image = ImageLoader.GetImageFromFile(filename, pbSelectedImage.Width, pbSelectedImage.Height);
        }
Esempio n. 5
0
        public void LoadControl()
        {
            AdSettingsContainer.Load();

            pnlConfigItems.Controls.Clear();
            foreach (AdSettings adSettings in AdSettingsContainer.Ads)
            {
                AdConfigItemCtrl ctrl = CreateAdConfigItemControl(adSettings);
                pnlConfigItems.Controls.Add(ctrl);
            }

            if (pnlConfigItems.Controls.Count > 0)
            {
                ((AdConfigItemCtrl)pnlConfigItems.Controls[0]).SelectControl();
            }
            else
            {
                pbSelectedImage.Image = null;
            }
        }