Exemple #1
0
        static void Main()
        {
            IAutoFactory autoFactory = LoadFactory();
            IAuto        car         = autoFactory.CreateAutomobile();

            car.Start();
            car.Stop();
        }
        private static void Main(string[] args)
        {
            IAutoFactory autoFactory = LoadFactory();
            IAuto        car         = autoFactory.CreateAutoMobile();

            car.Start();
            car.Stop();

            Console.ReadKey();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            var   autoRep = new AutoRepository();
            IAuto auto1   = autoRep.Find(1);

            auto1.Start();
            auto1.Stop();

            Console.WriteLine("Hello World!");
            Console.ReadKey();
        }
        private void BtnStart_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var count = Convert.ToInt32(textBoxTotal.Text);
                if (count > MAX_OP || count < MIN_OP || count % 5 != 0)
                {
                    throw new Exception();
                }

                count /= ONE_THROW_COST;
                auto.Start(count, UpdateProgressBar);
                progressBar.Maximum = count;
            }
            catch (Exception)
            {
                auto.Stop();
                MessageBox.Show("Введите корректное количесто ОР.");
                return;
            }

            btnStart.IsEnabled = false;
            progressBar.Value  = progressBar.Minimum;
        }