Ejemplo n.º 1
0
 protected virtual void OnOpened()
 {
     if (Opened != null)
     {
         Opened.Invoke(this, EventArgs.Empty);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Shows the context menu.
        /// </summary>
        public void Show()
        {
            lock (Lockobj)
            {
                IsOpen = true;

                InitializePopup();

                if (_deferredShowToLoaded)
                {
                    return;
                }

                if (!IsBackKeyOverride)
                {
                    Page.BackKeyPress += OnBackKeyPress;
                }

                Page.NavigationService.Navigated += OnNavigated;

                RunShowStoryboard(_childPanel, AnimationType);
                RunShowStoryboard(_overlay, AnimationTypes.Fade);

                if (Opened != null)
                {
                    Opened.Invoke(this, null);
                }
            }
        }
Ejemplo n.º 3
0
 public void Show()
 {
     this.Visibility = Visibility.Visible;
     if (Opened != null)
     {
         Opened.Invoke(this, null);
     }
 }
Ejemplo n.º 4
0
        int IVsRunningDocTableEvents.OnAfterFirstDocumentLock(uint docCookie, uint dwRDTLockType, uint dwReadLocksRemaining, uint dwEditLocksRemaining)
        {
            if (Opened != null)
            {
                string file = _rdt.GetDocumentInfo(docCookie).Moniker;
                Opened.Invoke(file);
            }

            return(VSConstants.S_OK);
        }
Ejemplo n.º 5
0
        async Task InternalOpenAsync(TimeSpan timeout)
        {
            State = CommunicationState.Opening;
            if (Opening != null)
            {
                Opening.Invoke(this, EventArgs.Empty);
            }
            await OpenAsync(timeout);

            State = CommunicationState.Opened;
            if (Opened != null)
            {
                Opened.Invoke(this, EventArgs.Empty);
            }
        }
Ejemplo n.º 6
0
 public void Open()
 {
     if (BackupDistance == 0)
     {
         BackupDistance = 100;
     }
     if (SplitterDistance == BackupDistance)
     {
         return;
     }
     SplitterDistance = BackupDistance;
     if (Opened != null)
     {
         Opened.Invoke();
     }
 }
        int IVsRunningDocTableEvents.OnAfterFirstDocumentLock(uint docCookie, uint dwRDTLockType, uint dwReadLocksRemaining, uint dwEditLocksRemaining)
        {
            // Please note that this event is called multiple times when a document
            // is opened for editing.
            // This code tries to only call the Open Event once
            //
            if (dwEditLocksRemaining == 1 && dwReadLocksRemaining == 0)
            {
                if (Opened != null)
                {
                    string file = _rdt.GetDocumentInfo(docCookie).Moniker;
                    Opened.Invoke(file);
                }
            }

            return(VSConstants.S_OK);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Shows the context menu.
        /// </summary>
        public void Show()
        {
            lock (Lockobj)
            {
#if WINDOWS_PHONE_APP
                Windows.Phone.UI.Input.HardwareButtons.BackPressed -= OnBackKeyPress;
#elif WINDOWS_PHONE
                Page.BackKeyPress -= OnBackKeyPress;
#endif

                IsOpen = true;

                InitializePopup();

                if (_deferredShowToLoaded)
                {
                    return;
                }

                if (!IsBackKeyOverride)
                {
#if WINDOWS_PHONE_APP
                    Windows.Phone.UI.Input.HardwareButtons.BackPressed += OnBackKeyPress;
#elif WINDOWS_PHONE
                    Page.BackKeyPress += OnBackKeyPress;
#endif
                }

#if WINDOWS_STORE || WINDOWS_PHONE_APP
                RootFrame.Navigated += OnNavigated;
#elif WINDOWS_PHONE
                Page.NavigationService.Navigated += OnNavigated;
#endif

                RunShowStoryboard(_overlay, AnimationTypes.Fade);
                RunShowStoryboard(_childPanel, AnimationType, MainBodyDelay);

                if (Opened != null)
                {
                    Opened.Invoke(this, null);
                }
            }
        }
Ejemplo n.º 9
0
        public void Show()
        {
            IsOpen = true;

            InitializePopup();

            if (_deferredShowToLoaded)
            {
                return;
            }

            IsDialogShow = true;
            RunShowStoryboard(_childPanel, AnimationType, TimeSpan.Zero, () =>
            {
                if (Opened != null)
                {
                    Opened.Invoke(this, null);
                }
            });

            HardwareButtons.BackPressed += BackKeyPress;
        }
Ejemplo n.º 10
0
 public void Open() // открыли дверцу холодильника
 {
     if (StatusOpen == false)
     {
         StatusOpen = true;
         if (Opened != null)
         {
             Opened.Invoke("Открыли дверцу холодильника");
         }
         lamp = true;
         if (Temperature >= 2 && Temperature <= 6)
         {
             System.Threading.Thread.Sleep(10000);
             for (int i = 0; Temperature < 8; i++)
             {
                 Temperature += 0.5;
             }
         }
         if (Temperature <= 8)
         {
             beep = true;
         }
     }
 }
Ejemplo n.º 11
0
 public virtual void Open()
 {
     gameObject.SetActive(true);
     isOpen = true;
     Opened.Invoke();
 }
Ejemplo n.º 12
0
 protected virtual void OnOpened() => Opened?.Invoke(this, null);
Ejemplo n.º 13
0
 private void DoSetIsOpened()
 {
     Opened?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 14
0
 /// <summary>
 ///     Handles the Opened event of the Solution control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="SolutionEventArgs" /> instance containing the event data.</param>
 private void Solution_Opened(object sender, SolutionEventArgs e)
 {
     Opened?.Invoke(this, e);
 }
Ejemplo n.º 15
0
 private void _ws_Opened(object sender, EventArgs e)
 {
     Opened?.Invoke(this, e);
 }
Ejemplo n.º 16
0
 private void Websocket_Opened(object sender, EventArgs e)
 {
     Opened?.Invoke(this, e);
 }
Ejemplo n.º 17
0
 public virtual void Open()
 {
     Show();
     Opened.Invoke();
 }
Ejemplo n.º 18
0
 public void Open()
 {
     Opened?.Invoke(this, System.EventArgs.Empty);
 }
Ejemplo n.º 19
0
        public Task ReceiveAsync(string url, List<KeyValuePair<string, string>> cookies, string userAgent, string origin)
        {
            if (_ws != null)
                throw new InvalidOperationException("_ws is not null");

            var tcs = new TaskCompletionSource<object>();
            var subProtocol = "";
            _ws = new WebSocket4Net.WebSocket(url, subProtocol, cookies, null, userAgent, origin, WebSocket4Net.WebSocketVersion.Rfc6455)
            {
                EnableAutoSendPing = false,
                AutoSendPingInterval = 0,
                ReceiveBufferSize = 8192,
                NoDelay = true
            };
            _ws.MessageReceived += (s, e) =>
            {
                Log("_ws.MessageReceived: " + e.Message);
                Received?.Invoke(this, e.Message);
            };
            _ws.DataReceived += (s, e) =>
            {
                //ここに来たことは今のところ一度もない。
                Debug.WriteLine("Dataが送られてきた");
            };
            _ws.Opened += (s, e) =>
            {
                Log("_ws.Opend");
                Opened?.Invoke(this, EventArgs.Empty);
            };
            _ws.Closed += (s, e) =>
            {
                Log("_ws.Closed");
                try
                {
                    tcs.TrySetResult(null);
                }
                finally
                {
                    if (_ws != null)
                    {
                        _ws.Dispose();
                        _ws = null;
                    }
                }
            };
            _ws.Error += (s, e) =>
            {
                Log("_ws.Error");
                try
                {
                    tcs.SetException(e.Exception);
                }
                finally
                {
                    if (_ws != null)
                    {
                        _ws.Dispose();
                        _ws = null;
                    }
                }
            };
            _ws.Open();
            return tcs.Task;
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Invokes the opened event
 /// </summary>
 protected void OnOpened(EventArgs args)
 {
     Opened?.Invoke(this, args);
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Raises the Opened event.
 /// </summary>
 /// <param name="e">An EventArgs containing the event data.</param>
 protected virtual void OnOpened(EventArgs e)
 {
     Opened?.Invoke(this, e);
 }
Ejemplo n.º 22
0
 protected virtual void OnOpened()
 {
     Opened?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 23
0
 void onOpened(object s, StateChangedEventArgs e) => Opened?.Invoke(s, e);
Ejemplo n.º 24
0
        /// <summary>打开</summary>
        /// <returns>是否成功</returns>
        public virtual Boolean Open()
        {
            if (Disposed)
            {
                throw new ObjectDisposedException(GetType().Name);
            }

            if (Active)
            {
                return(true);
            }
            lock (this)
            {
                if (Active)
                {
                    return(true);
                }

                LogPrefix = "{0}.".F((Name + "").TrimEnd("Server", "Session", "Client"));

                BufferSize = Setting.Current.BufferSize;

                // 估算完成时间,执行过长时提示
                using (var tc = new TimeCost(GetType().Name + ".Open", 1500))
                {
                    tc.Log = Log;

                    _RecvCount = 0;
                    var rs = OnOpen();
                    if (!rs)
                    {
                        return(false);
                    }

                    var timeout = Timeout;
                    if (timeout > 0)
                    {
                        Client.SendTimeout    = timeout;
                        Client.ReceiveTimeout = timeout;
                    }

                    if (!Local.IsUdp)
                    {
                        // 管道
                        var pp = Pipeline;
                        pp?.Open(CreateContext(this));
                    }
                }
                Active = true;

                // 统计
                if (StatSend == null)
                {
                    StatSend = new PerfCounter();
                }
                if (StatReceive == null)
                {
                    StatReceive = new PerfCounter();
                }

                ReceiveAsync();

                // 触发打开完成的事件
                Opened?.Invoke(this, EventArgs.Empty);
            }

            return(true);
        }