private void SaveObject() { DatabaseError e = obj.Insert(); if (e != DatabaseError.NoError) { CRichMsgBox.Show("An error has occured while saving the object to the database. See below for more details.", "Error", e.ToDescriptionString(), MessageBoxButtons.OK, Resources.error_64x64); return; } StatusUpdate?.Invoke(this, new StatusArgs($"{entity} {obj} created successfully.")); CheckForAssociation(); if (CMessageBox.Show("Create another?", "", MessageBoxButtons.YesNo, Resources.info_64x64) == DialogResult.Yes) { Clear(); } else { if (RuntimeVars.Instance.MainForm.DockingWorkspace.DockingManager.FindDockingFloating("Floating") .DockingManager.ContainsPage(RuntimeVars.Instance.SelectedPageUniqueName)) { RuntimeVars.Instance.MainForm.DockingWorkspace.DockingManager.FindDockingFloating("Floating") .DockingManager.RemovePage(RuntimeVars.Instance.SelectedPageUniqueName, true); } else { RuntimeVars.Instance.MainForm.DockingWorkspace.RemovePage(RuntimeVars.Instance.SelectedPageUniqueName, true); } } }
private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { lbFileNames.Items.AddRange(filesToAdd.ToArray()); lblFileSize.Text = "Total File Size For This Job: " + Utility.FormatSize(lbFileNames.Items.Cast <CFile>().Sum(e => e.Contents.Length)); if (bldr.Length != 0) { CRichMsgBox.Show("The following files were either too big to be added to the database or an error occured while reading them:", "File Error", bldr.ToString(), MessageBoxButtons.OK, Resources.error_64x64); } StatusUpdate?.Invoke(this, new StatusArgs($"{filesToAdd.Count} files pending upload.")); progressBar.Value = 0; tblProgress.Visible = false; JobHandler.Instance.UpdateSavePending(true); }