private static Future <IFuture> WaitForX(IEnumerable <IFuture> futures, int x) { if (futures == null) { throw new ArgumentException("Must specify at least one future to wait on", "futures"); } var f = new Future <IFuture>(); var h = new WaitHandler(); h.Composite = f; h.State.AddRange(futures); h.Trigger = x; OnComplete oc = h.OnComplete; OnDispose od = h.OnDispose; if (h.State.Count == 0) { throw new ArgumentException("Must specify at least one future to wait on", "futures"); } f.RegisterOnDispose(h.OnCompositeDispose); foreach (IFuture _ in futures) { _.RegisterOnComplete(oc); _.RegisterOnDispose(od); } return(f); }
protected override void ObservingThread() { while (true) { // Wait signal from timer WaitHandler.WaitOne(); // Check if there are any channels to check new content Program.Log(Tag, "Checking new videos on channels"); if (SettingsManager.Config.ChannelList.Count < 1) { Program.Log(Tag, "Nothing to check"); } foreach (var chatChannel in SettingsManager.Config.ChannelList) { try { // If chat muted, skip it if (SettingsManager.Config.MutedServers.Contains(chatChannel.DiscordChatId)) { continue; } //If not YotubeService, skip it if (chatChannel.ServiceType != typeof(YouTubeClient)) { continue; } var reflectionSingletonGetter = (IClient)chatChannel.ServiceType.GetMethod("GetInstance")?.Invoke(null, null); var youTubeTask = reflectionSingletonGetter?.GetLast(chatChannel.ServiceChannel); youTubeTask?.Wait(); var video = (Video)youTubeTask?.Result; // If video found and not already sent to text chat channel if (video != null && reflectionSingletonGetter.AddLast(chatChannel.DiscordChatId, chatChannel.ServiceChannel, video.Id)) { Task <DiscordChannel> discordChatTask = Program.Discord.GetChannelAsync(chatChannel.DiscordChatId); discordChatTask.Wait(); var notifyMessage = string.Format( Resources.Resource.ResourceManager.GetString("youtube-notify-text", discordChatTask.Result.GetCultureInfo()), video.Author, video.Id); Program.Discord.SendMessageAsync(discordChatTask.Result, notifyMessage); Program.Log(Tag, $"New video for YouTube channel <{video.Author}> found. Sending it to discord chat <{discordChatTask.Result.Name}>"); } else { Program.Log(Tag, video == null ? $"No video found or it's null" : $"New YouTube video skipped '{video.Title}'", LogLevel.Debug); } } catch (Exception ex) { Program.Log(Tag, ex, DSharpPlus.LogLevel.Error); } } Program.Log(Tag, $"All channels checked. \nNext check:{DateTime.Now.AddMilliseconds(SettingsManager.Config.ObserveCheckInterval)}"); } }
public GlideData(double framesleft, Vector2 perframe) : this() { this.perframe = perframe; this.framesleft = framesleft; waitHandle = new WaitHandler(); }
public SayData(string text, TimeSpan timeleft, Sprite value) : this() { this.text = text; this.timeleft = timeleft; waitHandle = new WaitHandler(); this.value = value; }
protected sealed override IResult Execute(CancellationToken cancellationToken) { Log.WriteInformation($"{DisplayName} listening"); WaitHandler.Wait(() => cancellationToken.IsCancellationRequested); return(Result.Success); }
public void WaitForKey() { if (Console.IsErrorRedirected || Console.IsOutputRedirected || Console.IsInputRedirected) { return; } WaitHandler.Wait(() => Console.KeyAvailable); Console.ReadKey(true); }
public void selectAndSearch() { driver.FindElement(searchBar).SendKeys(searchText); driver.FindElement(searchButton).Click(); //might need a wait here WaitHandler waitHandler = new WaitHandler(); waitHandler.ExecuteWait(driver, utilBarPrice); driver.FindElement(utilBarPrice).Click(); }
// Metodo que devuelva el proceso del login public SelectCompanyPage LoginAs(string mail, string password) { WaitHandler.ElementIsPresent(Driver, MailInput, 15); TypeMail(mail); WaitHandler.ElementIsPresent(Driver, PasswordInput, 15); TypePassword(password); WaitHandler.ElementIsPresent(Driver, SubmitButton, 15); ClickSubmitButton(); return(new SelectCompanyPage(Driver)); }
public static void Main() { { SimpleMind.SimpleMind Log = new SimpleMind.SimpleMind(); ServiceHost bone_server = IPCConnection.ServerConnect(); ServiceFisshBone.Init(); WaitHandler.Wait(); bone_server.Close(); Log.writeLog(SimpleMind.Loglevel.Debug, "FiSSHBoneMain", "FiSSHBone exit."); } }
public void UpdateValues() { framesleft--; if (framesleft <= 0.0) { if (waitHandle != null) { waitHandle.Set(); waitHandle = null; } } }
//Esperar que aparezcan el mail input y el botón de Create Account public bool WaitForCreateAccountElements() { WaitHandler searcher = new WaitHandler(); if (searcher.ElementAvailable(Driver, emailInput) & searcher.ElementAvailable(Driver, createAccountBtn)) { return(true); } else { return(false); } }
public void Cancel() { if (!IsRunning || mCancel == null) { return; } CancellingOverride(); mCancel?.Cancel(); WaitHandler.Wait(() => !IsRunning); mCancel?.Dispose(); mCancel = null; CancelOverride(); }
public UIItemContainer GetMdiWindowByAutomationId(string id) { UIItemContainer container = null; WaitHandler.WaitUntil(() => { try { var ele = window.GetElement(SearchCriteria.ByAutomationId(id)); container = new UIItemContainer(ele, HuxleyApplication.MainForm.window.ActionListener); return(true); } catch (Exception e) { return(false); } }, "cannot find element "); return(container); }
public void WaitForKey(ConsoleKey key, ConsoleModifiers modifiers = default(ConsoleModifiers)) { if (Console.IsErrorRedirected || Console.IsOutputRedirected || Console.IsInputRedirected) { return; } WaitHandler.Wait( () => { if (!Console.KeyAvailable) { return(false); } var interceptedKey = Console.ReadKey(true); return (interceptedKey.Key == key && interceptedKey.Modifiers == modifiers); }); }
public void Init(CommandDelegate command, TimeSpan delay) { Cancel(); if (delay != TimeSpan.MinValue) { Delay = delay; } _timer = new Timer(o => { if (IsRunning) { return; } TimerErrorException tex = null; try { WaitHandler.Reset(); IsRunning = true; command(); if (_period == infinity) { Cancel(); } } catch (Exception exc) { if (Error != null) { Error(this, tex = new TimerErrorException(exc)); } } finally { IsRunning = false; try { WaitHandler.Set(); } catch { } if (tex == null || !tex.CancelFinishedEvent) { RaiseFinished(); } } }, null, Delay, _period); }
protected override void JobThread(CancellationToken token) { var position = 0; while (_nextCheck.IsNext(position)) { token.ThrowIfCancellationRequested(); var readingPart = _queue.Next(); if (readingPart == null) { WaitHandler.WaitOne(); continue; } WaitHandler.Set(); var bytes = readingPart.Data; _writer.Write(bytes); position++; } }
protected override void JobThread(CancellationToken token) { var index = 0; while (Reader.LeftBytes > 0) { token.ThrowIfCancellationRequested(); if (_queue.Count() > Settings.ThreadPoolSize) { WaitHandler.WaitOne(); continue; } WaitHandler.Set(); var bytes = Read(); _queue.Add(index, bytes); index++; } _count = index; }
public void SetError(string error) { IsError = true; ErrorMessage = error; WaitHandler.Set(); }
public void SetResponse(object response) { Response = response; WaitHandler.Set(); }
protected sealed override IResult Execute(CancellationToken cancellationToken) { WaitHandler.Wait(() => cancellationToken.IsCancellationRequested); return(Result.Success); }
protected override void DoAck(RabbitMQ.Client.Events.BasicDeliverEventArgs basicDeliverEventArgs, IBasicConsumer subscriptionInfo) { base.DoAck(basicDeliverEventArgs, subscriptionInfo); WaitHandler.Set(); }
protected override void WhenChannelShutdown(object sender, ShutdownEventArgs reason) { base.WhenChannelShutdown(sender, reason); WaitHandler.Set(); }
private static async Task <bool> Main() { OracleFateManager.ForceUpdateGameCache(); if (OracleFateManager.FateDatabase == null) { await LoadOracleDatabase.Main(); } if (Poi.Current == null) { Poi.Current = new Poi(Vector3.Zero, PoiType.None); return(false); } if (Poi.Current.Type == PoiType.Death || Core.Player.IsDead) { if (Poi.Current.Type == PoiType.Death || Core.Player.IsDead) { Logger.SendLog("We died, attempting to recover."); } if (Poi.Current.Type != PoiType.Death) { Poi.Current = new Poi(Core.Player, PoiType.Death); } return(false); } await ChocoboHandler.HandleChocobo(); if (Poi.Current.Type == PoiType.Kill) { await CombatHandler.HandleCombat(); return(false); } if (OracleInventoryManager.ShouldRestockGreens()) { await RestockGysahlGreens.HandleRestockGyshalGreens(); return(false); } switch (ModeSettings.Instance.OracleOperationMode) { case OracleOperationMode.FateGrind: await FateGrind.HandleFateGrind(); break; case OracleOperationMode.LevelMode: await Levelling.HandleLevelling(); break; case OracleOperationMode.MultiLevelMode: await MultiLevelling.HandleMultiLevelling(); break; case OracleOperationMode.SpecificFates: await SpecificFates.HandleSpecificFates(); break; case OracleOperationMode.AtmaGrind: await AtmaGrind.HandleAtmaGrind(); break; case OracleOperationMode.AnimusGrind: await AnimusGrind.HandleAnimusGrind(); break; case OracleOperationMode.AnimaGrind: await AnimaGrind.HandleAnimaGrind(); break; case OracleOperationMode.YokaiWatchGrind: await YokaiWatchGrind.HandleYokaiWatchGrind(); break; default: throw new ArgumentOutOfRangeException(); } if (Poi.Current.Type == PoiType.Fate || OracleFateManager.CurrentFateId != 0) { await FateHandler.HandleFate(); return(false); } if (Poi.Current.Type == PoiType.Wait) { await WaitHandler.HandleWait(); } // Always return false to not block the tree. return(false); }
//Esperar que aparezcan el campo Username public bool WaitForUsernameBtn(String firstname, String lastname) { WaitHandler searcher = new WaitHandler(); return(searcher.ElementAvailable(Driver, By.LinkText(firstname + " " + lastname))); }
//Esperar que aparezcan el botón SignIn public bool WaitForSignOutBtn() { WaitHandler searcher = new WaitHandler(); return(searcher.ElementAvailable(Driver, SignOutBtn)); }
//Method to find the place to search on the page public void TypePlace(string place) { Driver.FindElement(PlaceInput).SendKeys(place); WaitHandler.ElementIsPresent(Driver, FirstElementPlace, new TimeSpan(0, 0, timeout)); Driver.FindElement(FirstElementPlace).Click(); }
internal protected override void DoAck(BasicDeliverEventArgs basicDeliverEventArgs, IBasicConsumer subscriptionInfo) { base.DoAck(basicDeliverEventArgs, subscriptionInfo); WaitHandler.Set(); }
void IOperation.Wait() { WaitHandler.Wait(() => IsRunning || IsCompleted); WaitHandler.Wait(() => !IsRunning); }
public HomePage SelectCompanyForLogin() { WaitHandler.ElementIsPresent(Driver, CompanyButton, 15); ClickCompanyButton(); return(new HomePage(Driver)); }
protected override void WhenChannelShutdown(IModel model, ShutdownEventArgs reason) { base.WhenChannelShutdown(model, reason); WaitHandler.Set(); }