Ejemplo n.º 1
0
        public SeoqwipoForm()
        {
            InitializeComponent();

            IList <Site> result = SeogwipoHttpClientManager.GetSites();

            cbSite.DataSource    = result;
            cbSite.ValueMember   = "SiteNumber";
            cbSite.DisplayMember = "SiteName";

            _worker.ProgressChanged    += worker_ProgressChanged;
            _worker.RunWorkerCompleted += worker_RunWorkerCompleted;
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!_isRunReservation)
            {
                var sites = SeogwipoHttpClientManager.GetSites();
                if (chbAll.Checked)
                {
                    _worker.Sites = string.IsNullOrWhiteSpace(txtFilter.Text)
                        ? sites
                        : sites.Where(x => x.SiteName.Contains(txtFilter.Text)).ToList();
                }
                else
                {
                    _worker.Sites = new List <Site> {
                        (Site)cbSite.SelectedItem
                    };
                }

                _worker.Interval = Convert.ToInt16(udDelay.Value);
                _worker.Booking  = new Booking
                {
                    Address   = txtAddress.Text,
                    Name      = txtName.Text,
                    People    = (int)numCount.Value,
                    StartDate = dateTimePicker1.Value,
                    EndDate   = dateTimePicker2.Value,
                    Tel       = txtTel.Text
                };

                _worker.RunWorkerAsync();

                _isRunReservation   = !_isRunReservation;
                btnReservation.Text = @"예약취소";
                gbSetting.Enabled   = false;
            }
            else
            {
                _worker.CancelAsync();
                _worker.IsSuccess = true;

                _isRunReservation   = !_isRunReservation;
                btnReservation.Text = @"예약걸기";
                gbSetting.Enabled   = true;
            }
        }