Пример #1
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();
            }
        }
Пример #2
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);
        }
Пример #3
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));
        }
Пример #4
0
        protected virtual void OnContext(ParserContext context)
        {
            var e = new ContextChangedEventArgs(context);

            //Console.WriteLine(e.ToString());
            ContextChanged?.Invoke(this, e);
        }
        private async Task OnCancelClick(MouseEventArgs e)
        {
            // Change state
            _listVisible = false;

            // Reset List
            Context = null;
            await ContextChanged.InvokeAsync(Context);
        }
Пример #6
0
        public void Release()
        {
            if (CurrentContext == this && !_context.IsDisposed && _context.IsCurrent)
            {
                CurrentContext = null;
                _context.MakeCurrent(null);

                ContextChanged?.Invoke(false);
            }
        }
Пример #7
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));
        }
Пример #8
0
        internal void wrapper_NetworkPeerContextChanged(object sender, NetworkPeerContextEventArgs e)
        {
            if (InvokeRequired)
            {
                ContextChanged d = new ContextChanged(wrapper_NetworkPeerContextChanged);
                ((MasterForm)d.Target).Invoke(d, new object[] { sender, e });
                return;
            }
            Wrapper wrapper = (Wrapper)sender;

            LOGGER.Info("NetworkPeerContextChanged, HostId: " + wrapper.NetworkManager.Localhost.Id + ", RemotePeer: " + e.NetworkPeer.Id);
        }
Пример #9
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);
                }
            }
        }
        private async Task OnInput(ChangeEventArgs e)
        {
            // Stop timer
            _timer.Stop();

            // Change term
            Term = e.Value.ToString();

            // Reset context
            Context = null;
            await ContextChanged.InvokeAsync(Context);

            // Change state
            _listVisible = true;
            _loading     = true;

            // Start timer
            _timer.Start();
        }
Пример #11
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);
            }
        }
Пример #12
0
        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();
                    }
                }
            }
        }
Пример #13
0
 public void Show(PopupModel popupModel)
 {
     ContextChanged?.Invoke(this, popupModel);
 }
Пример #14
0
        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));
        }
Пример #16
0
 public static void AddContext(CommandContextIds id)
 {
     ContextChanged?.Invoke();
     CurrentContext |= id;
 }
Пример #17
0
 public void NotifyContextChanged(object context)
 {
     ContextChanged?.Invoke(this, context);
 }
        private void OnContextChanged(ContextChangeKind kind)
        {
            _foregroundDispatcher.AssertForegroundThread();

            ContextChanged?.Invoke(this, new ContextChangeEventArgs(kind));
        }
Пример #19
0
 // ProjectList Changed
 protected void OnChanged(
     ProjectData project)
 {
     ContextChanged?.Invoke(project);
 }
Пример #20
0
 public void Hide()
 {
     ContextChanged?.Invoke(this, null);
 }