Пример #1
0
        private void Delete(object sender, EventArgs e)
        {
            if (((MainForm)this.MdiParent).ActiveMdiChild == this)
            {
                try
                {
                    string prog_id = dataGridViewControl1.GetCheckIDs("PROG_ID");

                    if (string.IsNullOrEmpty(prog_id))
                    {
                        return;
                    }

                    if (programService.DeleteProgram(prog_id))
                    {
                        MessageBox.Show("정상적으로 삭제되었습니다.");
                        LoadData();
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show(err.Message);
                }
            }
        }
        /// <summary>
        /// Deletes specified program and position data.
        /// </summary>
        /// <param name="obj">The object.</param>
        private async void Delete(object obj)
        {
            DialogHostIsOpen = true;
            var host   = CreateDialogHost(true, $"Deleting {SelectedRemoteProgram.Name}");
            var result = await programService.DeleteProgram(SelectedRemoteProgram.Name, host.CancellationToken);

            if (!result)
            {
                return;
            }
            await Task.Delay(2000);

            Refresh(null);
        }