Пример #1
0
        public void Prepare()
        {
            if (m_Contestants.Count > 1 && HaveUnoccupiedArena())
            {
                foreach (Teams team in m_Contestants)
                {
                    if (m_Tournament.Supplied)
                    {
                        foreach (Mobile m in team.getOwners())
                        {
                            Manager.ItemsToBank((PlayerMobile)m);
                        }
                    }

                    MoveTeam(team, m_NextArena.Map, m_NextArena.HoldingArea, "Entering the tournament grounds.", false);
                }
                // Broadcast "The tournament has begun." at the beginning of the tournament
                if (!m_TournamentStarted)
                {
                    World.Broadcast(0x35, true, String.Format("The {0} tournament has begun.", m_Tournament.TeamSize));

                    m_TournamentStarted = true;
                }

                m_Matches = m_Bracket.SEGetRound(m_CurrentRound);
                DelayTimer delay = new DelayTimer(this, m_DelayStart);
                delay.Start();
            }
            else
            {
                World.Broadcast(0x35, true, String.Format("The {0} tournament has been canceled due to lack of participants.", m_Tournament.TeamSize));
            }
        }
        private void DurationTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            // Dispose previous
            DurationTimer.Dispose();
            DurationTimer = null;

            // Wait for another ad
            DelayTimer.Start();
        }
Пример #3
0
        /// <summary>
        /// Handle the update of the text for the control from any source,
        /// including the TextBox part and the Text dependency property.
        /// </summary>
        /// <param name="newText">The new text.</param>
        /// <param name="userInitiated">A value indicating whether the update
        /// is a user-initiated action. This should be a True value when the
        /// TextUpdated method is called from a TextBox event handler.</param>
        private void TextUpdated(string newText, bool userInitiated)
        {
            // Only process this event if it is coming from someone outside
            // setting the Text dependency property directly.
            if (IgnoreTextPropertyChange > 0)
            {
                IgnoreTextPropertyChange--;
                return;
            }

            if (newText == null)
            {
                newText = string.Empty;
            }

            // The TextBox.TextChanged event was not firing immediately and
            // was causing an immediate update, even with wrapping. If there is
            // a selection currently, no update should happen.
            if (IsTextCompletionEnabled && TextBox != null && TextBox.SelectionLength > 0 &&
                TextBox.SelectionStart != TextBox.Text.Length)
            {
                return;
            }

            // Evaluate the conditions needed for completion.
            // 1. Minimum prefix length
            // 2. If a delay timer is in use, use it
            bool populateReady = newText.Length >= MinimumPrefixLength && MinimumPrefixLength >= 0;

            UserCalledPopulate = populateReady ? userInitiated : false;

            // Update the interface and values only as necessary
            UpdateTextValue(newText, userInitiated);

            if (populateReady)
            {
                IgnoreTextSelectionChange = true;

                if (DelayTimer != null)
                {
                    DelayTimer.Start();
                }
                else
                {
                    PopulateDropDown(this, EventArgs.Empty);
                }
            }
            else
            {
                SearchText   = null;
                SelectedItem = null;
                if (IsDropDownOpen)
                {
                    IsDropDownOpen = false;
                }
            }
        }
Пример #4
0
        private void ShowCopiedTextLabel(object sender, EventArgs e)
        {
            copiedAlertLabel.Visible   = true;
            copiedAlertLabel.ForeColor = Color.Green;
            copiedAlertLabel.Text      = "Copied!";
            var t = new DelayTimer();

            t.Interval = 5000; // it will Tick in 5 seconds
            t.Elapsed += this.HideInFiveSeconds;

            t.Start();
        }
Пример #5
0
 public void Roll(Mobile from)
 {
     if (!m_Table.Contains(from))
     {
         PublicOverheadMessage(MessageType.Emote, 34, false,
                               string.Format("*{0} rolls {1}, {2}*", from.Name, Utility.Random(1, 6),
                                             Utility.Random(1, 6)));
         Timer t = new DelayTimer(from);
         m_Table[from] = t;
         t.Start();
     }
     else
         from.SendAsciiMessage("You cannot use this again so soon");
 }
Пример #6
0
 private void FullScreen_Click(object sender, EventArgs e)
 {
     StopPlaying();
     delay = (int)tfDelay.Value;
     InstrumentoPreview.Dock     = DockStyle.Fill;
     InstrumentoPreview.Location = new Point((Width - InstrumentoPreview.Width) / 2, (Height - InstrumentoPreview.Height) / 2);
     FormBorderStyle             = FormBorderStyle.None;
     WindowState        = FormWindowState.Maximized;
     DelayLabel.Text    = tfDelay.Text;
     DelayLabel.Visible = true;
     DelayTimer.Start();
     labelTransposicao.Visible = false;
     TransSemitones.Visible    = false;
 }
Пример #7
0
 public void Roll(Mobile from)
 {
     if (!m_Table.Contains(from))
     {
         PublicOverheadMessage(MessageType.Emote, 34, false,
                               string.Format("*{0} rolls {1}, {2}*", from.Name, Utility.Random(1, 6),
                                             Utility.Random(1, 6)));
         Timer t = new DelayTimer(from);
         m_Table[from] = t;
         t.Start();
     }
     else
     {
         from.SendAsciiMessage("You cannot use this again so soon");
     }
 }
Пример #8
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.InRange(GetWorldLocation(), 2))
            {
                if (!m_Table.Contains(from))
                {
                    PublicOverheadMessage(MessageType.Emote, 34, false,
                                          string.Format("*{0} rolls a {1}*", from.Name, Utility.Random(1, 3)));
                    Timer t = new DelayTimer(from);
                    m_Table[from] = t;
                    t.Start();
                }
                else
                    from.SendAsciiMessage("You cannot use this again so soon");
            }
            else
                from.SendAsciiMessage("You are to far away to use that!");

        }
Пример #9
0
 public override void OnDoubleClick(Mobile from)
 {
     if (from.InRange(GetWorldLocation(), 2))
     {
         if (!m_Table.Contains(from))
         {
             PublicOverheadMessage(MessageType.Emote, 34, false,
                                   string.Format("*{0} rolls a {1}*", from.Name, Utility.Random(1, 3)));
             Timer t = new DelayTimer(from);
             m_Table[from] = t;
             t.Start();
         }
         else
         {
             from.SendAsciiMessage("You cannot use this again so soon");
         }
     }
     else
     {
         from.SendAsciiMessage("You are to far away to use that!");
     }
 }
Пример #10
0
        private void pictureBox_Click(object sender, EventArgs e)
        {
            PictureBox send = (PictureBox)sender;
            Card       card = (Card)send.Tag;

            card.Flip();
            send.Image = card.CurrentImage;
            if (card1 == null)
            {
                picBox1 = send;
                card1   = card;
            }
            else
            {
                foreach (PictureBox box in boxes)
                {
                    box.Enabled = false;
                }
                DelayTimer.Start();
                picBox2 = send;
                card2   = card;
            }
        }
Пример #11
0
            public MephitisCocoon( PlayerMobile target )
                : base(0x10da)
            {
                Weight = 1.0;
                int nCocoonID = (int) ( 3 * Utility.RandomDouble() );
                ItemID = 4314 + nCocoonID; // is this correct itemid?

                target.Frozen = true;
                target.Hidden = true;

                target.SendLocalizedMessage( 1042555 ); // You become entangled in the spider web.

                m_Timer = new DelayTimer( this, target );
                m_Timer.Start();
            }
Пример #12
0
        public void Prepare()
        {
            if (m_Contestants.Count > 1 && HaveUnoccupiedArena())
            {
                foreach (Teams team in m_Contestants)
                {
                    if (m_Tournament.Supplied)
                        foreach (Mobile m in team.getOwners())
                            Manager.ItemsToBank((PlayerMobile)m);

                    MoveTeam(team, m_NextArena.Map, m_NextArena.HoldingArea, "Entering the tournament grounds.", false);
                }
                // Broadcast "The tournament has begun." at the beginning of the tournament
                if (!m_TournamentStarted)
                {
                    World.Broadcast(0x35, true, String.Format("The {0} tournament has begun.", m_Tournament.TeamSize));

                    m_TournamentStarted = true;
                }

                m_Matches = m_Bracket.SEGetRound(m_CurrentRound);
                DelayTimer delay = new DelayTimer(this, m_DelayStart);
                delay.Start();
            }
            else
                World.Broadcast(0x35, true, String.Format("The {0} tournament has been canceled due to lack of participants.", m_Tournament.TeamSize));
        }
Пример #13
0
 private void Delay_StartApp(int Seconds)
 {
     DelayTimer.Interval = Seconds * 1000;
     DelayTimer.Start();
 }
Пример #14
0
        protected void GenerateDynamicData()
        {
            Random    r  = new Random((int)DateTime.Now.Ticks);
            LineChart lc = (LineChart)chartView.Chart;

            int ticks = (int)(250 * TimeSpan.TicksPerMillisecond);

            var series = lc.Series;

            int rMax = (int)(lc.MinValue + (lc.MaxValue - lc.MinValue) * 0.66f);
            int rMin = (int)(lc.MinValue + (lc.MaxValue - lc.MinValue) * 0.33f);

            foreach (var s in series)
            {
                int        count = s.Entries.Count();
                DelayTimer timer = Timer.Create() as DelayTimer;
                timer.Start(new TimeSpan(ticks), () =>
                {
                    Device.InvokeOnMainThreadAsync(() =>
                    {
                        var label = DateTime.Now.ToString("mm:ss");

                        int idx = 0;
                        foreach (var curSeries in series)
                        {
                            var entries   = curSeries.Entries.ToList();
                            bool addLabel = (entries.Count % 1000) == 0;

                            if (s == curSeries)
                            {
                                var entry = Data.GenerateTimeSeriesEntry(r, idx, 1);
                                if (!addLabel)
                                {
                                    entry.First().Label = null;
                                }

                                entries.AddRange(entry);

                                if (entries.Count() > count * 1.5)
                                {
                                    entries.RemoveAt(0);
                                }
                            }
                            else
                            {
                                var entry = new ChartEntry(null)
                                {
                                    ValueLabel = null, Label = label
                                };
                                if (!addLabel)
                                {
                                    entry.Label = null;
                                }

                                entries.Add(entry);
                                if (entries.Count() > count * 1.5)
                                {
                                    entries.RemoveAt(0);
                                }
                            }

                            curSeries.Entries = entries;
                            idx++;
                        }

                        if (!lc.IsAnimating)
                        {
                            lc.IsAnimated = false;
                            lc.Series     = series;
                            if (!IsDrawing)
                            {
                                IsDrawing = true;
                                chartView.InvalidateSurface();
                            }
                        }
                    }).ContinueWith(t => {
                        if (t.IsFaulted)
                        {
                            Console.WriteLine(t.Exception);
                        }
                    });
                    return(Running);
                });
                ticks += (int)(250 * TimeSpan.TicksPerMillisecond);
            }
        }