private void EditResourceToolStripMenuItem_Click( object sender, EventArgs e) { ResourceSelect dlg = new ResourceSelect(); dlg.Text = "Edit Resource"; if (dlg.ShowDialog() == DialogResult.OK) { // get the resource id ShowEditResource(dlg.ResourceId); } }
private void DeleteResourceToolStripMenuItem_Click( object sender, EventArgs e) { ResourceSelect dlg = new ResourceSelect(); dlg.Text = "Delete Resource"; if (dlg.ShowDialog() == DialogResult.OK) { // get the resource id int resourceId = dlg.ResourceId; if (MessageBox.Show("Are you sure?", "Delete resource", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { using (StatusBusy busy = new StatusBusy("Deleting resource...")) { try { ProjectTracker.Library.ResourceEdit.DeleteResourceEdit(resourceId); } catch (Csla.DataPortalException ex) { MessageBox.Show(ex.BusinessException.ToString(), "Error deleting", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error deleting", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }
private void AssignButton_Click(object sender, EventArgs e) { using (ResourceSelect dlg = new ResourceSelect()) { if (dlg.ShowDialog() == DialogResult.OK) { try { Project.Resources.Assign(dlg.ResourceId); } catch (InvalidOperationException ex) { MessageBox.Show(ex.Message, "Error Assigning", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error Assigning", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }