BeginInit() публичный Метод

Notifies the object that initialization is beginning and tells it to stand by.

public BeginInit ( ) : void
Результат void
Пример #1
0
        public AlertBox(Alert A)
        {
            InitializeComponent();
            Invalidate();
            try
            {
                using (MemoryStream memory = new MemoryStream())
                {
                    A.GetIcon().Save(memory, ImageFormat.Png);
                    memory.Position = 0;
                    BitmapImage i = new BitmapImage();
                    i.BeginInit();
                    i.StreamSource = memory;
                    i.CacheOption = BitmapCacheOption.OnLoad;
                    i.EndInit();
                    A_ICON.Source = i;
                }

                using (MemoryStream memory = new MemoryStream())
                {
                    global::Warmon.Properties.Resources.credits.Save(memory, ImageFormat.Png);
                    memory.Position = 0;
                    BitmapImage i = new BitmapImage();
                    i.BeginInit();
                    i.StreamSource = memory;
                    i.CacheOption = BitmapCacheOption.OnLoad;
                    i.EndInit();
                    A_CRED.Source = i;
                }

                turner = A;

                A_CREDITS.Content = A.GetCredits();
                A_REMAIN.Content = A.GetTimeOverdue();
                A_TITLE.Content = A.GetTitle();
                A_LOC.Content = A.GetMission() + " - " + A.GetPlanet();
                System.Collections.IEnumerator en = A.GetRewards().GetEnumerator();
                while (en.MoveNext())
                {
                    A_REWARDS.Content += en.Current + "\n";
                }

                timmy = new Timer();
                timmy.BeginInit();
                timmy.Interval = 250;
                timmy.Elapsed += delegate(object sender, ElapsedEventArgs e)
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Background, new MainWindow.PrimeDelegate(UpdateTime));
                };
                timmy.EndInit();
                timmy.Start();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Пример #2
0
        private void timer(object sender, EventArgs e)
        {
            lock (Jogo._lock)
            {
                if (Jogo.partidaIniciada)
                {
                    tempo.Start();

                    Console.CursorVisible = false;
                    desenhar(x, y, ' ');

                    x += 2 * direcaoX;
                    y += 1 * direcaoY;

                    if ((y >= Console.WindowHeight - 1) || (y <= Console.WindowTop + 4))
                    {
                        direcaoY *= -1;
                    }

                    if (colisaoPlayer() || (x >= Console.WindowWidth - 1) || (x <= Console.WindowLeft + 1))
                    {
                        direcaoX *= -1;
                    }

                    desenhar(x, y, bola);
                    if (tempo.Interval > 50)
                    {
                        tempo.Interval -= 1;
                    }
                }
                else
                {
                    tempo.BeginInit();
                }
            }
        }
Пример #3
0
		private void CommonTests (Timer t)
		{
			Assert.IsTrue (t.AutoReset, "AutoReset");
			t.AutoReset = false;
			Assert.IsFalse (t.Enabled, "Enabled");
			t.Enabled = true;
			Assert.IsNull (t.Site, "Site");
			t.Site = null;
			Assert.IsNull (t.SynchronizingObject, "SynchronizingObject");
			t.SynchronizingObject = new TestSyncInvoke ();

			t.Elapsed += new ElapsedEventHandler (Callback);
			t.Elapsed -= new ElapsedEventHandler (Callback);

			t.BeginInit ();
			t.EndInit ();
			t.Start ();
			t.Stop ();
			t.Close ();

			(t as IDisposable).Dispose ();
		}
Пример #4
0
 public void PostInit()
 {
     bw.RunWorkerAsync();
     vicky = new Timer();
     vicky.BeginInit();
     vicky.Interval = 60000; //one minute
     vicky.Elapsed += delegate(object s, ElapsedEventArgs e)
     {
         Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Background, new PrimeDelegate(bw.RunWorkerAsync));
     };
     vicky.EndInit();
     vicky.Start();
 }
Пример #5
0
		private void InitRxTools()
		{
			_rxTimeout = new Timer();
			_rxTimeout.BeginInit();
			_rxTimeout.Elapsed += RxTimeoutElapsed;
			_rxTimeout.Interval = Base.Options.InterpreterOptions.PacketSegmentReciveTimeOut.TotalMilliseconds;
			_rxTimeout.AutoReset = false;
			_rxTimeout.EndInit();
		}