public virtual void Initialize(object sender) { { if (IsInitialized) { return; } ConsoleForm = new frmConsole(this); ConsoleForm.Show(); ConsoleForm.Activate(); InitializedBy = (sender as IIdeComponent)?.ParentIDE.Machine ?? sender; IsInitialized = true; ConsoleForm.Text = Title; ConsoleForm.Display.SelectionColor = System.Drawing.Color.White; } }
public virtual void Reinitialize(object sender, bool saveData = true) { if (!(IsInitialized && ConsoleForm != null)) { return; } if (saveData) { string rtfText = ""; Hashtable dataClients = null; List <Color> dataClientsColors = null; if (ConsoleForm != null && !ConsoleForm.IsDisposed) { rtfText = ConsoleForm.GetDisplayRTFtext(); dataClients = ConsoleForm.DataClients; dataClientsColors = ConsoleForm.DataClientsColors; } frmConsole oldConsole = ConsoleForm; ConsoleForm = new frmConsole(this); ConsoleForm.Show(); ConsoleForm.Activate(); InitializedBy = sender is IInputPort ? (sender as IInputPort).ParentIDE.Machine : sender is IOutputPort ? (sender as IOutputPort).ParentIDE.Machine : sender; IsInitialized = true; ConsoleForm.Text = Title; ConsoleForm.Display.Rtf = rtfText; ConsoleForm.DataClients = dataClients; ConsoleForm.DataClientsColors = dataClientsColors; oldConsole?.DisposeAsync(); oldConsole = null; } else { Dispose(); Initialize(sender); } }