#pragma warning disable VSTHRD100 // Avoid async void methods private async void OnContextChanged(ContextChangeKind kind) #pragma warning restore VSTHRD100 // Avoid async void methods { await _joinableTaskContext.Factory.SwitchToMainThreadAsync(); ContextChanged?.Invoke(this, new ContextChangeEventArgs(kind)); }
public void Capture(bool force = false) { try { //Only proceed if this window is not already current if (force || CurrentContext != this) { //Release the current context if it exists CurrentContext?.Release(); //Make this context the current one CurrentContext = this; if (!_context.IsCurrent) { _context.MakeCurrent(WindowInfo); } ContextChanged?.Invoke(true); } } catch //(Exception x) { //MessageBox.Show(x.ToString()); Reset(); } }
/// <summary> /// Called when context gets changed. Updates current context and UI. Updates the current context based on the first element in teh stack. /// </summary> protected virtual void OnContextChanged() { var context = ContextStack.Count > 0 ? ContextStack.Peek() : null; _context = context; if (ContextStack.Count == 0) { _root = null; } // Update root control linkage if (_rootControl != null) { _rootControl.Parent = null; } if (context != null) { _rootControl = _context.RootControl; _rootControl.Parent = this; } else { _rootControl = null; } ContextChanged?.Invoke(_context); }
protected virtual void OnContext(ParserContext context) { var e = new ContextChangedEventArgs(context); //Console.WriteLine(e.ToString()); ContextChanged?.Invoke(this, e); }
public void Release() { if (CurrentContext == this && !_context.IsDisposed && _context.IsCurrent) { CurrentContext = null; _context.MakeCurrent(null); ContextChanged?.Invoke(false); } }
private void OnUiContextChanged(object sender, UIContextChangedEventArgs e) { var context = sender as UIContext; Guid contextId = GetId(context); _contexts.TryGetValue(contextId, out string contextName); _logger?.LogEventMessage($"Context: {contextName}, Id: {contextId:D}, Activated: {e.Activated}"); ContextChanged?.Invoke(this, new UiContextChangedEventArgs(contextId, e.Activated)); }
private void Listen() { var foldersList = new List <Folder>(); var fs = new FoldersService(); while (true) { Thread.Sleep(ServerSettings.TimeOutMilliseconds); var list = fs.GetAllFolders().Result.ToList(); if (list != foldersList) { ContextChanged?.Invoke(null); } } }
private void CheckForChangedContexts(string context_word, string context_backward, string context_surround, CitationCluster context_citation_cluster) { // Has text context changed? if (context_word != current_context_word || context_backward != current_context_backward || context_surround != current_context_surround) { current_context_word = context_word; current_context_backward = context_backward; current_context_surround = context_surround; ContextChanged?.Invoke(current_context_word, current_context_backward, current_context_surround); } // Has citation context changed? if ((context_citation_cluster == null ? null : context_citation_cluster.cluster_id) != (current_context_citation_cluster == null ? null : current_context_citation_cluster.cluster_id)) { current_context_citation_cluster = context_citation_cluster; CitationClusterChanged?.Invoke(current_context_citation_cluster); } }
public override void Set(T value, bool raiseEvent = true) { if (_value == null || !EqualityComparer <T> .Default.Equals(_value, value)) { T prevValue = _value; _value = value; if (raiseEvent) { RisePropertyChanged(prevValue); } ContextChanged?.Invoke(); if (!EqualityComparer <T> .Default.Equals(prevValue, default)) { foreach (IContext context in DefineChildren(prevValue, Children)) { context.DestroyWithChildren(); } } } }
public void Show(PopupModel popupModel) { ContextChanged?.Invoke(this, popupModel); }
public void ReissueContextChanged() { ContextChanged?.Invoke(current_context_word, current_context_backward, current_context_surround); CitationClusterChanged?.Invoke(current_context_citation_cluster); }
private async Task OnContextChangedAsync(ContextChangeKind kind) { await _joinableTaskContext.Factory.SwitchToMainThreadAsync(); ContextChanged?.Invoke(this, new ContextChangeEventArgs(kind)); }
public void NotifyContextChanged(object context) { ContextChanged?.Invoke(this, context); }
public static void AddContext(CommandContextIds id) { ContextChanged?.Invoke(); CurrentContext |= id; }
private void OnContextChanged(ContextChangeKind kind) { _foregroundDispatcher.AssertForegroundThread(); ContextChanged?.Invoke(this, new ContextChangeEventArgs(kind)); }
// ProjectList Changed protected void OnChanged( ProjectData project) { ContextChanged?.Invoke(project); }
public void Hide() { ContextChanged?.Invoke(this, null); }