Пример #1
0
 private void GameStarted(object sender, ElapsedEventArgs e, PlayerInfo user, System.Timers.Timer countDown)
 {
     countDown.Stop();
     countDown.Dispose();
     startGame(user);
     Clients.Group(user.GroupId).gameIsStarting(user.GroupId);
 }
Пример #2
0
 public void Dispose()
 {
     Program.OnOptionsChanged            -= this.ProgramOnOnOptionsChanged;
     Program.LobbyClient.OnDataReceived  -= LobbyClientOnDataReceived;
     Program.LobbyClient.OnLoginComplete -= LobbyClientOnOnLoginComplete;
     Program.LobbyClient.OnDisconnect    -= LobbyClientOnOnDisconnect;
     this.Loaded -= OnLoaded;
     this.userRefreshTimer.Dispose();
     this.AutoCompleteCollection.CollectionChanged -= this.AutoCompleteCollectionOnCollectionChanged;
     whisperContextMenuItem.Click            -= this.WhisperOnClick;
     addFriendContextMenuItem.Click          -= this.AddFriendOnClick;
     inviteToGameContextMenuItem.Click       -= this.InviteToGameContextOnClick;
     profileContextMenuItem.Click            -= this.ProfileOnClick;
     removeFriendContextMenuItem.Click       -= this.RemoveFriendOnClick;
     friendProfileContextMenuItem.Click      -= this.ProfileOnClick;
     friendWhisperContextMenuItem.Click      -= this.WhisperOnClick;
     friendInviteToGameContextMenuItem.Click -= this.InviteToGameContextOnClick;
     ignoreUserContextMenuItem.Click         -= this.IgnoreOnclick;
     unignoreUserContextMenuItem.Click       -= this.UnignoreOnclick;
     if (ScrollDownTimer != null)
     {
         ScrollDownTimer.Stop();
         ScrollDownTimer.Dispose();
     }
     if (this.room != null)
     {
         this.room.OnMessageReceived -= this.RoomOnMessageReceived;
         this.room.OnUserListChange  -= RoomOnOnUserListChange;
         this.room.OnStateChanged    -= this.RoomOnOnStateChanged;
     }
 }
Пример #3
0
        private void FetchTimer(int ms)
        {
            // Check if the timer is running, if yes stop it and start new with the ms giving in the parameter
            try
            {
                _timerFetcher.Dispose();
            }
            catch (Exception ex)
            {
                Logger.LogExc(ex);
            }

            _timerFetcher          = new System.Timers.Timer();
            _timerFetcher.Elapsed += OnTimedEvent;
            _timerFetcher.Interval = ms;
            _timerFetcher.Enabled  = true;
        }
Пример #4
0
    /// <summary>
    /// 延迟执行操作
    /// </summary>
    /// <typeparam name="T">类型</typeparam>
    /// <param name="o">操作对象</param>
    /// <param name="延迟毫秒数">延迟毫秒数</param>
    /// <param name="执行内容">执行内容</param>
    public static void DelayRun <T>(this T o, int 延迟毫秒数, Action <T> 执行内容)
    {
        //Timer t = new Timer(r => { 执行内容(o); }, null, 延迟毫秒数, Timeout.Infinite);

        System.Timers.Timer t = new System.Timers.Timer();
        t.Interval = 延迟毫秒数;
        t.Elapsed += (sender, e) =>
        {
            执行内容(o);
            t.Dispose();
        };
        t.Enabled = true;

        //定时器 d = new 定时器(延迟毫秒数);
        //d.执行完毕事件 += (s, op, b) => { 执行内容(o); d.Dispose(); };
        //d.执行(null);
    }
Пример #5
0
 public void Dispose()
 {
     _timer.Dispose();
 }