private void BannerThreadLoop() { bannersSystem = MainClass.BannersSystem; bool play = true; bool isBussy = false; int bnrIndex = 2; try { while (play) { if (!isBussy) { isBussy = true; Banner bnr = bannersSystem.GetBanner(bnrIndex); //Banner bnr = bannersSystem.NextBanner(); if((bnr != null) && (bnr.BannerPixbuf != null)){ Gtk.Application.Invoke(delegate{ bannerImage.ImageIcon = bnr.BannerPixbufResized400; bannerImage.LinkUrl = bnr.Url; }); } else { //Console.WriteLine("Banner is NULL"); } if(bnrIndex< bannersSystem.GetCount-1) bnrIndex++; else bnrIndex=0; isBussy = false; } Thread.Sleep (15002); } }catch(ThreadAbortException tae){ Thread.ResetAbort (); Logger.Error("ERROR - Cannot run banner thread."); Logger.Error(tae.Message); LoadDefaultBanner(); } }
private void BannerThreadLoop() { if((MainClass.Settings.Account != null) && (!String.IsNullOrEmpty(MainClass.Settings.Account.Token))){ LoggUser lu = new LoggUser(); if(!lu.Ping(MainClass.Settings.Account.Token)) { llcLogin.UnLogin(); Gtk.Application.Invoke(delegate{ LoginRegisterDialog ld = new LoginRegisterDialog(null); ld.Run(); ld.Destroy(); }); } } MainClass.LicencesSystem.LoadFromWeb(); bannersSystem = MainClass.BannersSystem; bool play = true; bool isBussy = false; try { while (play) { if (!isBussy) { isBussy = true; Banner bnr = bannersSystem.NextBanner(); if((bnr != null) && (bnr.BannerPixbuf != null)){ Gtk.Application.Invoke(delegate{ bannerImage.ImageIcon = bnr.BannerPixbufResized200; bannerImage.LinkUrl = bnr.Url; /*bannerButton.ImageIcon = bnr.BannerPixbuf; bannerButton.LinkUrl = bnr.Url; bannerButton.ShowAll();*/ //while (Gtk.Application.EventsPending ()) // Gtk.Application.RunIteration (); }); } else { //Console.WriteLine("Banner is NULL"); } isBussy = false; } Thread.Sleep (15001); } }catch(ThreadAbortException tae){ Thread.ResetAbort (); Logger.Error("ERROR - Cannot run banner thread."); Logger.Error(tae.Message); LoadDefaultBanner(); }finally{ } }