void PersistControlData(CommonBaseControl control, Component containingComponent) { control.SaveState(); Point?location = null; Size? size = null; if (containingComponent == null) { return; } // Since this info will be cleared on next line, store here for reference. bool isChecked = control.PersistenceData.ContainsValue("combinedContainer.Checked") && control.PersistenceData.GetBoolean("combinedContainer.Checked"); // Clear all previous persistence info related to "combinedContainer". control.PersistenceData.ClearByNamePart("combinedContainer."); if (containingComponent is ToolStripButton || control == _checkedControl) { control.PersistenceData.AddValue("combinedContainer.Tabbed", true); control.PersistenceData.AddValue("combinedContainer.Checked", isChecked); control.PersistenceData.AddValue("combinedContainer.TabIndex", toolStripMain.Items.IndexOf((ToolStripButton)containingComponent)); } else if (containingComponent is CombinedHostingForm) { location = ((CombinedHostingForm)containingComponent).Location; size = ((CombinedHostingForm)containingComponent).Size; control.PersistenceData.AddValue("combinedContainer.Floating", true); } else if (containingComponent is DragControl) { control.PersistenceData.AddValue("combinedContainer.Docked", true); control.PersistenceData.AddValue("combinedContainer.Guid", ((DragControl)containingComponent).Guid); } else { SystemMonitor.Warning("Unrecognized case."); return; } if (location.HasValue) { control.PersistenceData.AddValue("combinedContainer.Location", location.Value); } if (size.HasValue) { control.PersistenceData.AddValue("combinedContainer.Size", size.Value); } }
void PersistControlData(CommonBaseControl control, Component containingComponent) { control.SaveState(); Point? location = null; Size? size = null; if (containingComponent == null) { return; } // Since this info will be cleared on next line, store here for reference. bool isChecked = control.PersistenceData.ContainsValue("combinedContainer.Checked") && control.PersistenceData.GetBoolean("combinedContainer.Checked"); // Clear all previous persistence info related to "combinedContainer". control.PersistenceData.ClearByNamePart("combinedContainer."); if (containingComponent is ToolStripButton || control == _checkedControl) { control.PersistenceData.AddValue("combinedContainer.Tabbed", true); control.PersistenceData.AddValue("combinedContainer.Checked", isChecked); control.PersistenceData.AddValue("combinedContainer.TabIndex", toolStripMain.Items.IndexOf((ToolStripButton)containingComponent)); } else if (containingComponent is CombinedHostingForm) { location = ((CombinedHostingForm)containingComponent).Location; size = ((CombinedHostingForm)containingComponent).Size; control.PersistenceData.AddValue("combinedContainer.Floating", true); } else if (containingComponent is DragControl) { control.PersistenceData.AddValue("combinedContainer.Docked", true); control.PersistenceData.AddValue("combinedContainer.Guid", ((DragControl)containingComponent).Guid); } else { SystemMonitor.Warning("Unrecognized case."); return; } if (location.HasValue) { control.PersistenceData.AddValue("combinedContainer.Location", location.Value); } if (size.HasValue) { control.PersistenceData.AddValue("combinedContainer.Size", size.Value); } }