public Form1() { InitializeComponent(); _filesForm = new FilesForm(); _filesForm.FileSelectionChanged += _filesForm_FileSelectionChanged; _filesForm.Show(dockPanel1); _explorer = new FolderExplorer(); _explorer.FolderLocationChanged += explorer_FolderLocationChanged; _explorer.Show(dockPanel1, DockState.DockLeft); _errors = new ErrorsForm(); _errors.Show(dockPanel1, DockState.DockBottom); _descriptionForm = new DescriptionForm(); _descriptionForm.Show(dockPanel1, DockState.DockRight); var dirToOpen = Settings.Default.LastViewedDirectory; if (String.IsNullOrEmpty(dirToOpen)) { dirToOpen = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); } OpenDirectory(dirToOpen); Descriptors = new List <IDescriptor>(); LoadDescriptors(); }
//process all of the updates private void btnUpdate_Click(object sender, System.EventArgs e) { OrdersService.RemotingOrders OrdersService; // Stop any current edits. this.BindingContext[_dsOrders, "Orders"].EndCurrentEdit(); this.BindingContext[_dsOrders, "Orders.CustOrders"].EndCurrentEdit(); // Check to see if any changes have been made. if (_dsOrders.HasChanges()) { DataSet dsUpdate; DataSet dsChanges; // Clear all old errors in the Customers table before // we attempt to save ClearAllErrors(); // Get the changes that have been made to the main dataset. dsChanges = _dsOrders.GetChanges(); if (dsChanges != null) { // update the data source OrdersService = new OrdersService.RemotingOrders(); dsUpdate = OrdersService.UpdateOrders(_CustID, dsChanges); // clear the current data // it will be reloaded with the full data returned from the web service _dsOrders.Clear(); // merge the changed rows back into the original data _dsOrders.Merge(dsUpdate, false); // If there are errors show the error form if (_dsOrders.HasErrors) { ErrorsForm f = new ErrorsForm(_CustID, dsUpdate, _dsLookups); this.AddOwnedForm(f); f.Show(); // add a handler so that we know when the error form has been closed f.Closed += new EventHandler(ErrorFormClosed); } else { // no errors, so just accept the changes _dsOrders.AcceptChanges(); } } } }
private void ErrorsToolStripMenuItemClick(object sender, EventArgs e) { ErrorsDisplayForm = new ErrorsForm(); ErrorsDisplayForm.errorWebBrowser.DocumentText = RenderedErrorText; ErrorsDisplayForm.Show(); }