Пример #1
0
        /// <summary>
        /// Handles the DoWork event of the BackgroundWorker control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.ComponentModel.DoWorkEventArgs"/> instance containing the event data.</param>
        private void BackgroundWorker_DoWorkRemoveMediaPath(object sender, DoWorkEventArgs e)
        {
            var removeModels = (List <MediaPathModel>)e.Argument;

            foreach (var model in removeModels)
            {
                MediaPathDBFactory.RemoveFromDatabase(model);
            }
        }
Пример #2
0
        /// <summary>
        /// Handles the Click event of the BtnDelete control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            DialogResult result = XtraMessageBox.Show(
                this,
                string.Format(
                    "Are you sure you wish to delete the selected {0} media path(s)?",
                    this.grdViewMain.SelectedRowsCount),
                "Are you sure?",
                MessageBoxButtons.YesNo,
                MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                foreach (int v in this.grdViewMain.GetSelectedRows())
                {
                    var row = this.grdViewMain.GetRow(v) as MediaPathModel;

                    MediaPathDBFactory.RemoveFromDatabase(row);
                }
            }
        }