internal static void ExecuteCycle(Clock clock, float deltaTime = 0f) { if (clock != null) { var currentMsUpdate = clock.GetElapsedSeconds(); if (currentMsUpdate == 0) { Thread.Sleep(1); currentMsUpdate = clock.GetElapsedSeconds(); } Script.DeltaTime = (float)currentMsUpdate; clock.Reset(); } else { Script.DeltaTime = deltaTime; } lock (RtUpdate) { RtUpdate?.Invoke(); } lock (Updating) { Updating?.Invoke(); } lock (Destroying) { Destroying?.Invoke(); } }
IEnumerator CaptureControls() { yield return(new WaitForSeconds(2)); while (true) { if (Input.GetKey(KeyCode.I)) { transform.position += transform.forward * ZoomSpeed; } else if (Input.GetKey(KeyCode.O)) { transform.position -= transform.forward * ZoomSpeed; } if (Input.GetMouseButton(1)) { RightButtonHolding(); } Updating?.Invoke(); yield return(null); } }
private void OnUpdating(Object dataObject) { if (Updating != null) { Updating.Invoke(dataObject, EventArgs.Empty); } }
public void ClearAllObjects() { Initialize(); Updating?.Invoke(this, EventArgs.Empty); lock (_lockObject) { using (var analyzer = new StandardAnalyzer(LuceneDefaults.Version)) { using (var writer = new IndexWriter(_indexDirectory, CreateIndexWriterConfig(analyzer))) { _indexedObjects.Clear(); _searchableMetadata.Clear(); writer.DeleteAll(); writer.PrepareCommit(); writer.Commit(); } } } Updated?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Обращение к API Raspberry Pi /// </summary> private static ApiResponce ApiRequest(string request, Method method, object postdata = null) { if (CheckForPi()) { Updating?.Invoke(null, new EventArgs()); var req = new RestRequest(request, method); if (postdata != null) { req.AddHeader("Content-type", "application/json"); req.AddJsonBody(postdata); } var resp = RestClient.Execute(req); if (resp.ContentType != "application/json") { return(new ApiResponce(resp, null)); } try { var json = JObject.Parse(resp.Content); return(new ApiResponce(resp, json)); } catch (JsonReaderException e) { return(new ApiResponce(ApiStatus.JsonParsingError)); } } return(new ApiResponce(ApiStatus.PiNotFound)); }
private void Update() { isNotUpdating.Reset(); Updating?.Invoke(this, EventArgs.Empty); isNotUpdating.Set(); }
/// <summary> /// Handles the needed event-calls before updating. /// </summary> private void OnUpdating(IUpdateTrigger trigger, CustomUpdateData customData) { try { double deltaTime = _deltaTimeCounter.Elapsed.TotalSeconds; _deltaTimeCounter.Restart(); Updating?.Invoke(new UpdatingEventArgs(deltaTime, trigger, customData)); } catch { /* Well ... that's not my fault */ } }
/// <summary> /// Handles the needed event-calls before updating. /// </summary> private void OnUpdating() { try { long lastUpdateTicks = _lastUpdate.Ticks; _lastUpdate = DateTime.Now; Updating?.Invoke(new UpdatingEventArgs((DateTime.Now.Ticks - lastUpdateTicks) / 10000000.0)); } catch { /* Well ... that's not my fault */ } }
public virtual void AddObjects(IEnumerable <ISearchable> searchables) { Initialize(); Updating?.Invoke(this, EventArgs.Empty); lock (_lockObject) { using (var analyzer = new StandardAnalyzer(LuceneDefaults.Version)) { using (var writer = new IndexWriter(_indexDirectory, CreateIndexWriterConfig(analyzer))) { foreach (var searchable in searchables) { var index = _currentIndex++; _indexedObjects.Add(index, searchable); _searchableIndexes.Add(searchable, index); var document = new Document(); var indexField = new StringField(IndexId, index.ToString(), Field.Store.YES); document.Add(indexField); var metadata = searchable.MetadataCollection; var searchableMetadatas = metadata.All.OfType <ISearchableMetadata>(); foreach (var searchableMetadata in searchableMetadatas) { if (searchableMetadata.GetValue <object>(searchable.Instance, out var searchableMetadataValue)) { var searchableMetadataValueAsString = ObjectToStringHelper.ToString(searchableMetadataValue); var field = new TextField(searchableMetadata.SearchName, searchableMetadataValueAsString, Field.Store.YES); document.Add(field); if (!_searchableMetadata.ContainsKey(searchableMetadata.SearchName)) { _searchableMetadata.Add(searchableMetadata.SearchName, searchableMetadata); } } } writer.AddDocument(document); } writer.PrepareCommit(); writer.Commit(); } } } Updated?.Invoke(this, EventArgs.Empty); }
/// <inheritdoc/> public void Update(UltravioletTime time) { Contract.EnsureNotDisposed(this, Disposed); this.keyboard.Update(time); this.mouse.Update(time); this.gamePadInfo.Update(time); this.touchInfo.Update(time); Updating?.Invoke(this, time); }
/// <summary> /// Handles the needed event-calls before updating. /// </summary> protected virtual void OnUpdating() { try { long lastUpdateTicks = _lastUpdate.Ticks; _lastUpdate = DateTime.Now; Updating?.Invoke(this, new UpdatingEventArgs((DateTime.Now.Ticks - lastUpdateTicks) / 10000000f)); } catch { // Well ... that's not my fault } }
public void ApplySettings(IActivityMonitor m) { if (!_f.EnsureDirectory(m)) { return; } var s = _driver.GetSolution(m, allowInvalidSolution: true); if (s == null) { return; } if (_driver.BuildRequiredSecrets.Count == 0) { m.Warn("No build secrets collected for this solution. Skipping KeyVault configuration."); return; } var passPhrase = _secretStore.GetSecretKey(m, SolutionDriver.CODECAKEBUILDER_SECRET_KEY, true); // Opens the actual current vault: if more secrets are defined we keep them. Dictionary <string, string> current = KeyVault.DecryptValues(TextContent, passPhrase); current.Clear(); // The central CICDKeyVault is protected with the same CODECAKEBUILDER_SECRET_KEY secret. Dictionary <string, string> centralized = KeyVault.DecryptValues(_sharedState.CICDKeyVault, passPhrase); bool complete = true; foreach (var name in _driver.BuildRequiredSecrets.Select(x => x.SecretKeyName)) { if (!centralized.TryGetValue(name, out var secret)) { m.Error($"Missing required build secret '{name}' in central CICDKeyVault. It must be added."); complete = false; } else { current[name] = secret; } } if (complete) { Updating?.Invoke(this, new CodeCakeBuilderKeyVaultUpdatingArgs(m, _solutionSpec, s, current)); string result = KeyVault.EncryptValuesToString(current, passPhrase); CreateOrUpdate(m, result); } }
/// <inheritdoc/> public void Update(UltravioletTime time) { Contract.EnsureNotDisposed(this, Disposed); var result = default(FMOD_RESULT); result = FMOD_System_Update(system); if (result != FMOD_OK) { throw new FMODException(result); } UpdateAudioDevices(); Updating?.Invoke(this, time); }
private void RaiseUpdatingHelper(float delta) { if (Current.Active) { Command.ResetConsumedCommands(); CommandQueue.Instance.IssueCommands(); try { Updating?.Invoke(delta); CommandHandlerList.Global.ProcessCommands(); } finally { Application.MainMenu?.Refresh(); } } else { Updating?.Invoke(delta); } }
protected override void Update(double dt) { t += dt; if (t >= Duration) { OnCompleted(); if (repeat) { t = 0; } else { this.Destroy(); } } else { Updating?.Invoke(t); } }
public virtual void RemoveObjects(IEnumerable <ISearchable> searchables) { Initialize(); lock (_lockObject) { Updating?.Invoke(this, EventArgs.Empty); using (var analyzer = new StandardAnalyzer(LuceneDefaults.Version)) { using (var writer = new IndexWriter(_indexDirectory, CreateIndexWriterConfig(analyzer))) { foreach (var searchable in searchables) { int index; if (!_searchableIndexes.TryGetValue(searchable, out index)) { continue; } var queryAsText = $"{IndexId}:{index}"; var parser = new QueryParser(LuceneDefaults.Version, string.Empty, analyzer); var query = parser.Parse(queryAsText); writer.DeleteDocuments(query); _searchableIndexes.Remove(searchable); _indexedObjects.Remove(index); } writer.PrepareCommit(); writer.Commit(); } } Updated?.Invoke(this, EventArgs.Empty); } }
public virtual void OnUpdating(EntityReplyEventArgs <TModel> e) { Updating?.Invoke(this, e); }
protected virtual void OnUpdating(EntityEventArgs <TModel> e) { Updating?.Invoke(this, e); }
void IUpdater.Update(float delta) { Updating?.Invoke(delta); }
private void Update() { Updating?.Invoke(); }
public override void Update(IRawUseItem raw, DateTimeOffset timeStamp) { Updating?.Invoke(this, raw, timeStamp); using (var scope = EnterBatchNotifyScope()) UpdateProps(raw, timeStamp); }
private void Update() { Updating?.Invoke(gameObject); }
/// <summary> /// Called when the tab page's content is updating. /// </summary> public virtual void Update() { Updating?.Invoke(this, EventArgs.Empty); }
public async Task <ICommandResult <TEntity> > UpdateAsync(TEntity model) { var result = new CommandResult <TEntity>(); // Validate if (model.Id <= 0) { throw new ArgumentOutOfRangeException(nameof(model.Id)); } if (model.FeatureId <= 0) { throw new ArgumentOutOfRangeException(nameof(model.FeatureId)); } if (String.IsNullOrWhiteSpace(model.Title)) { throw new ArgumentNullException(nameof(model.Title)); } if (String.IsNullOrWhiteSpace(model.Message)) { throw new ArgumentNullException(nameof(model.Message)); } if (model.ModifiedDate == null) { throw new ArgumentNullException(nameof(model.ModifiedDate)); } // Parse Html and message abstract model.Html = await ParseEntityHtml(model.Message); model.Abstract = await ParseEntityAbstract(model.Message); model.Urls = await ParseEntityUrls(model.Html); model.Alias = await ParseEntityAlias(model.Title); // Parse totals model.TotalWords = model.Message.TotalWords(); // Raise Updating event Updating?.Invoke(this, new EntityEventArgs <TEntity>(model)); // Invoke EntityUpdating subscriptions foreach (var handler in _broker.Pub <TEntity>(this, "EntityUpdating")) { model = await handler.Invoke(new Message <TEntity>(model, this)); } var entity = await _entityStore.UpdateAsync(model); if (entity != null) { // Raise Updated event Updated?.Invoke(this, new EntityEventArgs <TEntity>(entity)); // Invoke EntityUpdated subscriptions foreach (var handler in _broker.Pub <TEntity>(this, "EntityUpdated")) { entity = await handler.Invoke(new Message <TEntity>(entity, this)); } return(result.Success(entity)); } return(result.Failed(new CommandError("An unknown error occurred whilst attempting to create an eneity."))); }
/// <summary> /// Will update the object in order to allow editing of the collision vertexes /// Can be replaced in the inheritting class. It only needs called if the vertex editing is /// needed feature, otherwise it can be skipped. /// /// The return value must retain the purpose described here. The ObjectManager and /// Particle engines will attempt to purge this object if it returns false. /// </summary> /// <param name="CurrTime"></param> /// <returns>True indicates the object still exists, false means the update decided the /// object can be removed</returns> public virtual bool Update(GameTime CurrTime) { Rectangle Handle; int nVertCtr; Vector2 vVertPos; MouseState CurrMouse = Mouse.GetState(); if (cbVertexEdits == true) { if ((CurrMouse.LeftButton == ButtonState.Pressed) && (cnMouseVertex >= 0)) { //User is draging a vertex around vVertPos.X = CurrMouse.X; vVertPos.Y = CurrMouse.Y; cPolyGon.UpdateVertex(cnMouseVertex, vVertPos); CenterPoint = CenterPoint; } if ((CurrMouse.LeftButton == ButtonState.Pressed) && (cPriorMouse.LeftButton == ButtonState.Released)) { //User just clicked, see if they got a polygon vertex List <CollisionRegion> CollList = new List <CollisionRegion>(cPolyGon.GetCollisionRegions()); Handle.Width = nHandleWidth; Handle.Height = nHandleWidth; nVertCtr = 0; foreach (Vector2 vCurrVert in CollList[0].Vertexes) { Handle.X = (int)(vCurrVert.X - (nHandleWidth / 2)); Handle.Y = (int)(vCurrVert.Y - (nHandleWidth / 2)); if (MGMath.IsPointInRect(CurrMouse.Position, Handle) == true) { cnMouseVertex = nVertCtr; break; } nVertCtr += 1; } } if (CurrMouse.LeftButton == ButtonState.Released) { cnMouseVertex = -1; } } cPriorMouse = CurrMouse; //Raise the event handler for external logic if (Updating != null) { return(Updating.Invoke(this, CurrTime)); } else { return(true); //Returning true means the object should stick around } }
/// <summary> /// Richiamato prima dell'inizio dell'aggiornamento /// </summary> private void OnUpdating() { Updating?.Invoke(this, EventArgs.Empty); }
public static async void CheckOnline(bool showUpToDateMessage = false) { try { using (HttpClient client = new HttpClient()) { RegistryHelp.SetValue(RegistryHelp.ApplicationKey, "UpdateCheckLast", DateTime.Now.DayOfYear); client.DefaultRequestHeaders.Add("User-Agent", "MediaInfo.NET"); var response = await client.GetAsync("https://api.github.com/repos/stax76/MediaInfo.NET/releases/latest"); response.EnsureSuccessStatusCode(); string content = await response.Content.ReadAsStringAsync(); Match match = Regex.Match(content, @"""MediaInfo\.NET-([\d\.]+)\.zip"""); Version onlineVersion = Version.Parse(match.Groups[1].Value); Version currentVersion = Assembly.GetEntryAssembly()?.GetName().Version; if (onlineVersion <= currentVersion) { if (showUpToDateMessage) { Msg.Show($"{Application.ProductName} is up to date."); } return; } if ((RegistryHelp.GetString(RegistryHelp.ApplicationKey, "UpdateCheckVersion") != onlineVersion.ToString() || showUpToDateMessage) && Msg.ShowQuestion( $"New version {onlineVersion} is available, update now?") == MsgResult.OK) { string url = $"https://github.com/stax76/MediaInfo.NET/releases/download/{onlineVersion}/MediaInfo.NET-{onlineVersion}.zip"; using (Process proc = new Process()) { proc.StartInfo.UseShellExecute = true; proc.StartInfo.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); proc.StartInfo.FileName = "powershell.exe"; proc.StartInfo.Arguments = $"-NoLogo -NoExit -NoProfile -ExecutionPolicy Bypass -File \"{Application.StartupPath + @"\Update.ps1"}\" \"{url}\" \"{Application.StartupPath.TrimEnd('\\')}\""; if (Application.StartupPath.Contains("Program Files")) { proc.StartInfo.Verb = "runas"; } proc.Start(); } Updating?.Invoke(); } RegistryHelp.SetValue(RegistryHelp.ApplicationKey, "UpdateCheckVersion", onlineVersion.ToString()); } } catch (Exception ex) { if (showUpToDateMessage) { Msg.ShowException(ex); } } }
/// <summary> /// Raises the Updating event. /// </summary> /// <param name="time">Time elapsed since the last call to Update.</param> private void OnUpdating(UltravioletTime time) => Updating?.Invoke(this, time);
/// <inheritdoc/> public void Update(UltravioletTime time) { Contract.EnsureNotDisposed(this, Disposed); Updating?.Invoke(this, time); }
public async Task <ICommandResult <TReply> > UpdateAsync(TReply reply) { // Validate if (reply == null) { throw new ArgumentNullException(nameof(reply)); } if (reply.Id <= 0) { throw new ArgumentOutOfRangeException(nameof(reply.Id)); } if (reply.EntityId <= 0) { throw new ArgumentOutOfRangeException(nameof(reply.EntityId)); } if (String.IsNullOrWhiteSpace(reply.Message)) { throw new ArgumentNullException(nameof(reply.Message)); } //if (reply.ModifiedUserId <= 0) //{ // throw new ArgumentOutOfRangeException(nameof(reply.ModifiedUserId)); //} //if (reply.ModifiedDate == null) //{ // throw new ArgumentNullException(nameof(reply.ModifiedDate)); //} var result = new CommandResult <TReply>(); // Ensure entity exists var entity = await _entityStore.GetByIdAsync(reply.EntityId); if (entity == null) { return(result.Failed(new CommandError($"An entity with the Id '{reply.EntityId}' could not be found"))); } // Parse Html and message abstract reply.Html = await ParseEntityHtml(reply.Message); reply.Abstract = await ParseEntityAbstract(reply.Message); reply.Urls = await ParseEntityUrls(reply.Html); // Raise updating event Updating?.Invoke(this, new EntityReplyEventArgs <TReply>(entity, reply)); // Invoke EntityReplyUpdating subscriptions foreach (var handler in _broker.Pub <TReply>(this, "EntityReplyUpdating")) { reply = await handler.Invoke(new Message <TReply>(reply, this)); } var updatedReply = await _entityReplyStore.UpdateAsync(reply); if (updatedReply != null) { // Raise Updated event Updated?.Invoke(this, new EntityReplyEventArgs <TReply>(entity, updatedReply)); // Invoke EntityReplyUpdated subscriptions foreach (var handler in _broker.Pub <TReply>(this, "EntityReplyUpdated")) { updatedReply = await handler.Invoke(new Message <TReply>(updatedReply, this)); } return(result.Success(updatedReply)); } return(result.Failed(new CommandError("An unknown error occurred whilst attempting to update the reply."))); }