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{ } }
private bool LogginAndVerification() { LoggUser vc = new LoggUser(); if((MainClass.User == null)||(string.IsNullOrEmpty(MainClass.User.Token))){ LoginRegisterDialog ld = new LoginRegisterDialog(this); int res = ld.Run(); if (res == (int)Gtk.ResponseType.Cancel){ ld.Destroy(); return false; } ld.Destroy(); } if(!vc.Ping(MainClass.User.Token)){ MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("invalid_login_f1"), "", Gtk.MessageType.Error,this); md.ShowDialog(); LoginRegisterDialog ld = new LoginRegisterDialog(this); int res = ld.Run(); if (res == (int)Gtk.ResponseType.Cancel){ ld.Destroy(); return false; }else if(res == (int)Gtk.ResponseType.Ok){ ld.Destroy(); return true; } } return true; }
protected virtual void OnButtonOkClicked(object sender, System.EventArgs e) { if (MainClass.Settings.ClearConsoleBeforRuning) MainClass.MainWindow.OutputConsole.Clear(); if(MainClass.Workspace.SignApp){ LoggUser vc = new LoggUser(); if((MainClass.User == null)||(string.IsNullOrEmpty(MainClass.User.Token))){ LoginRegisterDialog ld = new LoginRegisterDialog(this); int res = ld.Run(); if (res == (int)Gtk.ResponseType.Cancel){ ld.Destroy(); return; } ld.Destroy(); return; } if(!vc.Ping(MainClass.User.Token)){ MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("invalid_login_f1"), "", Gtk.MessageType.Error,this); md.ShowDialog(); LoginRegisterDialog ld = new LoginRegisterDialog(this); int res = ld.Run(); if (res == (int)Gtk.ResponseType.Cancel){ ld.Destroy(); return; } ld.Destroy(); return; } } List<CombinePublish> list =project.ProjectUserSetting.CombinePublish.FindAll(x=>x.IsSelected==true); if(list==null || list.Count<1){ MessageDialogs md = new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("pleas_select_application"), "", Gtk.MessageType.Error,this); md.ShowDialog(); return; } RunPublishTask(list); this.Respond(ResponseType.Ok); }