示例#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);
        }
示例#2
0
        public void LoadControl()
        {
            if (AdSettingsContainer.IsLoaded == false)
            {
                AdSettingsContainer.Load();// NOTE: dont reload again and again. Because new instance created when loaded everytime
            }

            logoViewCtrl1.UpdateControl();

            imageThread = new Thread(new ThreadStart(Thread_Worker));
            imageThread.IsBackground = true;
            imageThread.Start();
        }
示例#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();
            }
        }
示例#4
0
        void itemCtrl_DeleteClicked(object sender, EventArgs e)
        {
            // delete file
            AdSettings settings = ((AdConfigItemCtrl)sender).AdSettings;

            IOSupport.DeleteFile(Globals.SettingsResourceDir + settings.FileName);

            // remove from the list and save
            AdSettingsContainer.Ads.Remove(settings);
            AdSettingsContainer.Save();

            // Load all settings control again and notify
            LoadControl();

            NotifyAdSettingsChanged();
        }
示例#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;
            }
        }
示例#6
0
        void itemCtrl_ValueUpdated(object sender, EventArgs e)
        {
            AdSettingsContainer.Save();

            NotifyAdSettingsChanged();
        }