Пример #1
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;
     }
 }
Пример #2
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);
 }
Пример #3
0
        private void FetchSpotifyWeb()
        {
            SongFetcher sf   = new SongFetcher();
            TrackInfo   info = sf.FetchSpotifyWeb();

            if (info != null)
            {
                if (!info.isPlaying)
                {
                    if (Settings.CustomPauseTextEnabled)
                    {
                        WriteSong("", "", "");
                    }
                    return;
                }

                string albumUrl = null;

                if (info.albums.Count != 0)
                {
                    albumUrl = info.albums[0].Url;
                }

                if (info.DurationMS > 2000)
                {
                    if (!_songTimer.Enabled)
                    {
                        _songTimer.Enabled = true;
                    }
                    _songTimer.Stop();
                    _songTimer.Interval = info.DurationMS + 400;
                    _songTimer.Start();
                }

                WriteSong(info.Artists, info.Title, "", albumUrl, false, info.SongID, info.url);
            }
            else
            {
                if (!_songTimer.Enabled)
                {
                    _songTimer.Enabled = true;
                }
                _songTimer.Stop();
                _songTimer.Interval = 1000;
                _songTimer.Start();
            }
        }
Пример #4
0
        public void Stop()
        {
            if (_timer == null)
            {
                return;
            }

            _timer.Stop();
            _timer.Elapsed -= TimerOnElapsed;
            _timer          = null;
        }
Пример #5
0
        static public void ScheduleTask(TimeSpan TimeSpan, Action action)
        {
            var timer = new System.Timers.Timer(TimeSpan.TotalMilliseconds);

            timer.Elapsed += (sender, args) =>
            {
                timer.Stop();
                action();
            };
            timer.Start();
        }
Пример #6
0
 private void buttonStop_Click(object sender, EventArgs e)
 {
     if (worker != null)
     {
         if (worker.IsAlive)
         {
             worker.Abort();
         }
     }
     fakeMove.Stop();
     fakeMove.Enabled = false;
     Bot.Log("Bot stopped.");
     Client.running = false;
 }
Пример #7
0
        static public void Run()
        {
            //setup
            Moveables      = new List <IMoveable>();
            BeginEndPoints = new List <Node>();
            listOfNodes    = new List <Node>();
            pedestrians    = new List <Pedestrian>();
            GetNodes();
            FillEndPoints();
            AssignPoints();


            CreatePedestrians();
            _pedestrianTimer.Elapsed += TimedPedestriansEvent;
            _pedestrianTimer.Interval = 150;
            _pedestrianTimer.Start();

            while (!ShouldStop)
            {
                CreateMovables();
                MoveMoveables();
                Refresh();
            }
            try
            {
                Moveables.Clear();
                _pedestrianTimer.Stop();
                foreach (Crossroad cross in grid.Controls)
                {
                    cross.KillTrafficTimer();
                }
                f1.Invoke((MethodInvoker) delegate {
                    f1.stopRunning();
                });
                f1.Invoke((MethodInvoker) delegate { Refresh(); });
            }
            catch (Exception)
            {
            }
        }
Пример #8
0
        private void ButtonStart_Click(object sender, EventArgs e)
        {
            double restartInterval = (double)numericUpDownRestart.Value * 60 * 60 * 3600;

            System.Timers.Timer restartTimer = new System.Timers.Timer(restartInterval);
            if (fakeMove == null)
            {
                fakeMove = new System.Timers.Timer(6 * 1000); //one hour in millisecond
            }
            restartTimer.Elapsed += RestartTimer_Elapsed;

            if (buttonStart.Text == "Start")
            {
                if (!Client.ready)
                {
                    Bot.Log("Please wait until game loads.");
                    return;
                }

                Client.manuelStart = true;
                if (restartInterval > 0)
                {
                    restartTimer.Start();
                }
                BootstrapClient();
            }
            else if (buttonStart.Text == "Stop")
            {
                restartTimer.Stop();
                restartTimer.Close();
                buttonStart.Text = "Start";
                browser.Reload();
                Client.collecting  = false;
                Client.manuelStart = false;
            }
        }
Пример #9
0
    public override void ResetTimers()
    {
        if (AutoChecksAllowed == false)
        {
            return;
        }

        discoveryTimer.Stop();
        heartbeatTimer.Stop();
        ResettingTimers = true;

        Task.Delay((int)Id * Constants.ONE_MINUTE_IN_MILLISECONDS / Constants.TimeScale).ContinueWith(delegate
        {
            discoveryTimer.Interval = Constants.NODES_PER_CYCLE * Constants.ONE_MINUTE_IN_MILLISECONDS / Constants.TimeScale;
            discoveryTimer.Start();
        });

        Task.Delay((int)Id * Constants.ONE_MINUTE_IN_MILLISECONDS / Constants.TimeScale).ContinueWith(delegate
        {
            heartbeatTimer.Interval = Constants.NODES_PER_CYCLE * Constants.ONE_MINUTE_IN_MILLISECONDS / Constants.TimeScale;
            heartbeatTimer.Start();
            ResettingTimers = false;
        });
    }
Пример #10
0
 private void OnClosing(object sender, CancelEventArgs e)
 {
     _timer.Stop();
     _timer.Elapsed -= OnTimer;
 }