Exemplo n.º 1
0
        private void enterBtn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.searchControl.Text) ||
                this._competitors == null ||
                this._competitors.CompetitorDatas == null ||
                this._competitors.CompetitorDatas.Count <= 0)
            {
                return;
            }

            var selectedCompotitor = this._competitors.CompetitorDatas.FirstOrDefault(p => p.Bib == this.listView1.SelectedItems[0].Text);

            this._bib_text.Text = selectedCompotitor.Bib;

            this._currentEzd.Image = ReopositoryEzdFile.UpdateEzdApi(selectedCompotitor, this._currentEzd.Width, this._currentEzd.Height);
        }
        private async void OkSimpleButton_Click(object sender, EventArgs e)
        {
            try
            {
                var task = await Queries.GetRequestAsync(
                    $@"http://openeventor.ru/api/event/{CurrentApiData.Token}/get_competitor/bib/{this.searchTextEdit.Text}");

                this._competitor = JsonConvert.DeserializeObject <Competitor>(task);

                string filesPath = Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName) + @"\files\";

                ReopositoryEzdFile.LoadImage($@"{filesPath}{this._currentEzd.Properties.NullText}");

                this._currentEzd.Image = ReopositoryEzdFile.UpdateEzdApi(_competitor.CompetitorData, this._currentEzd.Width, this._currentEzd.Height);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("Данные с этим номером не найдены", "Information", MessageBoxButtons.OK);
            }
        }