コード例 #1
0
#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));
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        protected virtual void OnContext(ParserContext context)
        {
            var e = new ContextChangedEventArgs(context);

            //Console.WriteLine(e.ToString());
            ContextChanged?.Invoke(this, e);
        }
コード例 #5
0
        public void Release()
        {
            if (CurrentContext == this && !_context.IsDisposed && _context.IsCurrent)
            {
                CurrentContext = null;
                _context.MakeCurrent(null);

                ContextChanged?.Invoke(false);
            }
        }
コード例 #6
0
        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));
        }
コード例 #7
0
        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);
                }
            }
        }
コード例 #8
0
        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);
            }
        }
コード例 #9
0
ファイル: ContextWrapper{T}.cs プロジェクト: Bery0za/Ariadne
        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();
                    }
                }
            }
        }
コード例 #10
0
 public void Show(PopupModel popupModel)
 {
     ContextChanged?.Invoke(this, popupModel);
 }
コード例 #11
0
        public void ReissueContextChanged()
        {
            ContextChanged?.Invoke(current_context_word, current_context_backward, current_context_surround);

            CitationClusterChanged?.Invoke(current_context_citation_cluster);
        }
コード例 #12
0
        private async Task OnContextChangedAsync(ContextChangeKind kind)
        {
            await _joinableTaskContext.Factory.SwitchToMainThreadAsync();

            ContextChanged?.Invoke(this, new ContextChangeEventArgs(kind));
        }
コード例 #13
0
 public void NotifyContextChanged(object context)
 {
     ContextChanged?.Invoke(this, context);
 }
コード例 #14
0
 public static void AddContext(CommandContextIds id)
 {
     ContextChanged?.Invoke();
     CurrentContext |= id;
 }
        private void OnContextChanged(ContextChangeKind kind)
        {
            _foregroundDispatcher.AssertForegroundThread();

            ContextChanged?.Invoke(this, new ContextChangeEventArgs(kind));
        }
コード例 #16
0
 // ProjectList Changed
 protected void OnChanged(
     ProjectData project)
 {
     ContextChanged?.Invoke(project);
 }
コード例 #17
0
 public void Hide()
 {
     ContextChanged?.Invoke(this, null);
 }