static void ProxyStop(IntPtr h) { LogSharp.Debug("ProxyStop"); UrhoPlatformInitializer.Initialized = false; var context = Current.Context; var app = GetApp(h); app.IsClosed = true; app.UnsubscribeFromAppEvents(); app.Stop(); LogSharp.Debug("ProxyStop: Runtime.Cleanup"); Runtime.Cleanup(); LogSharp.Debug("ProxyStop: Releasing context"); #if ANDROID if (context.Refs() > 0) { context.ReleaseRef(); } #endif LogSharp.Debug("ProxyStop: Disposing context"); context.Dispose(); Current = null; Stoped?.Invoke(); LogSharp.Debug("ProxyStop: end"); exitTask?.TrySetResult(true); }
/// <summary> /// 停止监听 /// </summary> public void Stop() { if (!Running) { Log.Error(">未开始监听,无需停止"); return; } #if NETDNX AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit; #else AppDomain.CurrentDomain.DomainUnload -= CurrentDomain_DomainUnload; #endif Log.Info(">准备停止监听"); Stopping?.Invoke(this, EventArgs.Empty); if (RunningV4) { if (Stop_IPv4()) { System.Threading.Interlocked.CompareExchange(ref _running_v4, 0, 1); } } if (RunningV6) { if (Stop_IPv6()) { System.Threading.Interlocked.CompareExchange(ref _running_v6, 0, 1); } } Log.Info(">停止监听完成"); Stoped?.Invoke(this, EventArgs.Empty); _endTime = System.DateTime.Now; }
public void Stop() { cts?.Cancel(); cts = null; try { stream.Close(); } catch { } try { tcpClient.Close(); } catch { } Stoped?.Invoke(this, EventArgs.Empty); }
static void ProxyStop(IntPtr h) { UrhoPlatformInitializer.Initialized = false; var context = Current.Context; GetApp(h).Stop(); Runtime.Cleanup(); if (context.Refs() > 0) { context.ReleaseRef(); } context.Dispose(); Current = null; Stoped?.Invoke(); }
void fireStopedEvent() { try { Task t = new Task(() => { if (Stoped != null) { try { Stoped.Invoke(this, null); } catch (Exception) { } } }); t.Start(); } catch (Exception) { } }
static async void ProxyStop(IntPtr h) { Current.ActionManager.CancelActiveActions(); LogSharp.Debug("ProxyStop"); UrhoPlatformInitializer.Initialized = false; var context = Current.Context; var app = GetApp(h); app.IsClosed = true; app.UnsubscribeFromAppEvents(); app.Stop(); LogSharp.Debug("ProxyStop: Runtime.Cleanup"); Runtime.Cleanup(); LogSharp.Debug("ProxyStop: Disposing context"); context.Dispose(); Current = null; Stoped?.Invoke(); LogSharp.Debug("ProxyStop: end"); exitTask?.TrySetResult(true); }
public void Stop() { try { MyProcess p = _process; if (p != null) { _process = null; KillProcess(p); p.Dispose(); Console.WriteLine("kcptun stoped - " + p.server.FriendlyName()); if (Stoped != null) { Stoped.Invoke(this, new EventArgs()); } } } catch (Exception e) { Logging.LogUsefulException(e); } }
public View3D( ) { InitializeComponent(); Loaded += UserControl_Loaded; _cameraFront = new Tuple <Vector3D, Point3D>(Camera.LookDirection, Camera.Position); _cameraSide = new Tuple <Vector3D, Point3D>(new Vector3D(20.066, 0, -5.976), new Point3D(-17.066, 0, 20.976)); //viewMover.Click += ( s, e ) => //{ // viewMover.Content = _watchAtSide ? "Вид сбоку" : "Вид сзади"; // _watchAtSide = !_watchAtSide; // if(_watchAtSide) // { // Camera.Position = _cameraSide.Item2; // Camera.LookDirection = _cameraSide.Item1; // } // else // { // Camera.Position = _cameraFront.Item2; // Camera.LookDirection = _cameraFront.Item1; // } //}; try { var path = ResourceFiles.GetFile(Config.Get().BoardBackImagePath); LayoutRoot.Background = new ImageBrush(new BitmapImage(new Uri(path))); } catch { } cancelButton.Click += async(s, e) => { var cur = await Task <bool> .Run(() => { if (_state.Moves.Count < 1) { return(false); } var res = CancelLastMove?.Invoke(); return(res.HasValue && res.Value); }); if (cur) { var move = _state.Moves[_state.Moves.Count - 1]; MovePiece(new Point(move.Item2.Column + 1, 8 - move.Item2.Row), new Point(move.Item1.Column + 1, 8 - move.Item1.Row)); } }; resignButton.Click += (s, e) => { MainPresenter.Get().ShowQuestion("Хотите сдаться?", (val) => { if (val) { Stoped?.Invoke(); GameLose(); } }); }; Border1.Fill = Border2.Fill = Border3.Fill = Border4.Fill = SystemColors.ControlTextBrush; BoardPositions = new ChessPiece[8, 8]; SetupButtons(); #region [Setup all fields] _piecesReg = new List <Tuple <Model.Game.Chess.Figure, ChessPiece> > { new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackBishop, BBishop1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackBishop, BBishop2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackKnight, BKnight1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackKnight, BKnight2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackRook, BRook1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackRook, BRook2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackKing, BKing), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackQueen, BQueen), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteBishop, WBishop1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteBishop, WBishop2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteKnight, WKnight1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteKnight, WKnight2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteRook, WRook1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteRook, WRook2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteKing, WKing), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhiteQueen, WQueen), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn3), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn4), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn5), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn6), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn7), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.BlackPawn, BPawn8), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn1), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn2), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn3), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn4), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn5), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn6), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn7), new Tuple <Model.Game.Chess.Figure, ChessPiece> (Model.Game.Chess.Figure.WhitePawn, WPawn8), }; #endregion }
/// <summary> /// Calling the <c>Stoped</c> event /// </summary> protected virtual void OnStop() { Stoped?.Invoke(this, EventArgs.Empty); }
private void Stop_Click(object sender, EventArgs e) { Stoped.Invoke(sender, e); }
public virtual void OnStop(Action baseOnStop) { baseOnStop(); Stoped?.Invoke(Target, EventArgs.Empty); }
public void OnDisconnected() { Log.Debug(TAG, "OnDisconnected"); Stoped?.Invoke(this, EventArgs.Empty); }