private void CloseTab(TabPage tabToBeClosed) { if (tabToBeClosed.Disposing || tabToBeClosed.IsDisposed) { return; } if (TabController.InvokeRequired) { CloseTabDelegate s = CloseTab; try { TabController.Invoke(s, tabToBeClosed); } catch (COMException) { TabController.Invoke(s, tabToBeClosed); } catch (Exception ex) { Runtime.MessageCollector.AddExceptionMessage("Couldn't close tab", ex); } } else { try { TabController.TabPages.Remove(tabToBeClosed); _ignoreChangeSelectedTabClick = false; } catch (COMException) { CloseTab(tabToBeClosed); } catch (Exception ex) { Runtime.MessageCollector.AddExceptionMessage("Couldn't close tab", ex); } if (TabController.TabPages.Count == 0) { Close(); } } }
private void CloseTab(TabPage tabToBeClosed) { if (TabController.InvokeRequired) { CloseTabDelegate s = CloseTab; try { TabController.Invoke(s, tabToBeClosed); } catch (COMException) { TabController.Invoke(s, tabToBeClosed); } catch (Exception ex) { Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "Couldn\'t close tab" + Environment.NewLine + ex.Message, true); } } else { try { TabController.TabPages.Remove(tabToBeClosed); _ignoreChangeSelectedTabClick = false; } catch (COMException) { CloseTab(tabToBeClosed); } catch (Exception ex) { Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "Couldn\'t close tab" + Environment.NewLine + ex.Message, true); } if (TabController.TabPages.Count == 0) { Close(); } } }
private void CloseTab(Crownwood.Magic.Controls.TabPage TabToBeClosed) { if (TabController.InvokeRequired) { CloseTabCB s = CloseTab; try { TabController.Invoke(s, TabToBeClosed); } catch (System.Runtime.InteropServices.COMException) { TabController.Invoke(s, TabToBeClosed); } catch (Exception ex) { Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t close tab" + Environment.NewLine + ex.Message, true); } } else { try { TabController.TabPages.Remove(TabToBeClosed); _ignoreChangeSelectedTabClick = false; } catch (System.Runtime.InteropServices.COMException) { CloseTab(TabToBeClosed); } catch (Exception ex) { Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "Couldn\'t close tab" + Environment.NewLine + ex.Message, true); } if (TabController.TabPages.Count == 0) { Close(); } } }