База ответов ИНТУИТ

Практикум прикладного программирования на C# в среде VS.NET 2008

<<- Назад к вопросам

Пример кода:
 time = COUNT_TIME * 60;   // Секунды        }            public void Start()        {            timer.Stop();            timer.Start();        }            public void Restart()        {            time = COUNT_TIME * 60;   // Секунды            timer.Stop();            timer.Start();        }            public void StopResult()        {            timer.Stop();            if (StopDigitalClock != null)                StopDigitalClock(this, EventArgs.Empty);        }            public void Stop()        {            timer.Stop();        }
демонстрирует:

(Отметьте один правильный вариант ответа.)

Варианты ответа
как остановить таймер
как запустить таймер
как задать начальное значение таймера (Верный ответ)
Похожие вопросы
Пример кода:
{        void timer_Tick(object sender, EventArgs e)                    if (PropertyChanged != null)                PropertyChanged(this, new PropertyChangedEventArgs("Time"));                if (minutes <= 0 && seconds <= 0)            {                timer.Stop();                if (StopDigitalClock != null)                    StopDigitalClock(this, EventArgs.Empty);            }   }
демонстрирует:
Пример кода:
public void Start(){    clock.Start();}public void Restart(){    clock.Restart();}public void StopResult(){    clock.StopResult();}public void Stop(){    clock.Stop();}
демонстрирует:
Пример кода:
timer = new DispatcherTimer();            timer.Tick += new EventHandler(timer_Tick);            timer.Interval = TimeSpan.FromSeconds(1);
демонстрирует:

Пример кода:

DispatcherTimer timer;public DigitalClock()
демонстрирует:
Пример кода:
public event EventHandler StopDigitalClock;
демонстрирует:
Пример кода:
 int minutes, seconds, time;                 public TextBlock Time        {            get            {                minutes = time / 60;                seconds = time % 60;                this.Text = String.Format("{0:00}:{1:D2}", minutes, seconds);                if (time > 0)                    time -= 1;                return this;            }        }
демонстрирует:
Фрагмент кода:
using System.Runtime.Serialization;...[Serializable]public class OrderEntity : ISerializable{  void ISerializable.GetObjectData(SerializationInfo info, StreamingContextctxt)  {    info.AddValue("OrderID", orderID);  }deserialization  public OrderEntity(SerializationInfo info, StreamingContext ctxt)  {        orderID = (int)info.GetValue("OrderID", typeof(int));  }}    
демонстрирует пример:
Пример кода:
private void button1_Click(object sender, System.EventArgs e){ manualresetevent=new ManualResetEvent(false); Thread thread1 = new Thread(new ThreadStart(AsynchronProcess1)); //Процесс 1 стартует первым thread1.Start(); Thread thread2 = new Thread(new ThreadStart(AsynchronProcess2)); thread2.Start();Функция AsynchronProcess1
показывает, что:
Рассмотрим пример кода:struct Situation { //Наш поток public FileStream filestream; //Здесь будем хранить данные public byte [] bText; //Размер буфера public long bufSize;public MaualResetEvent manualresetevent;}static void EndAsingRead(IAsyncResult iasyncresult){Situation situation = (Situation)iasyncresult.AsyncState; int readCount = situation.filestream.EndRead(iasyncresult); situation.filestream.Close();situation.manualresetevent.Set(); situation.manualresetevent.Close();}Если в приведенном выше коде закоментировать строку situation.manualresetevent.Set(), то в этом случае:
Пример кода:
namespace WpfControlLibrary{    public partial class Clock : UserControl    {        public Clock()        {            InitializeComponent();
демонстрирует: