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