/// <summary> /// Anzeige des Formulares /// Wenn kein Template geladen wurde, dann den SimpleEditor laden /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void ShortNotesForm_Shown(object sender, EventArgs e) { if (ucEditor != null && (!ucEditor.IsDisposed || !ucEditor.Disposing)) { tsContainer.ContentPanel.Controls.Remove(ucEditor); ucEditor.Dispose(); templateLoaded = false; } if (ucEditor == null || ucEditor.IsDisposed) { ucEditor = new cptShortNote_SimpleText(); tsContainer.ContentPanel.Controls.Add(ucEditor); if (ucEditor.Tag.ToString() != string.Empty) { currentTemplateName = ucEditor.Tag.ToString().Split('|')[0] ?? ""; this.Text = frmTitel + " " + ucEditor.Tag.ToString().Split('|')[1] ?? ""; } templateLoaded = true; // ucEditor. // emailToolStripButton.Enabled = ucEditor.canSendMail; } }
private void itemTypeToolStripMenuItem_Click(object sender, EventArgs e) { controlContent.Dispose(); controlContent = new ConfigTypeItem(); panel1.Controls.Add(controlContent); // controlContent.Show(); }
private void rdbTable_Click(object sender, EventArgs e) { uc.Dispose(); uc = new ConfigTable(); pnlConfig.Controls.Add(uc); uc.Show(); }
/// <summary> /// Gets the smart part. /// </summary> /// <param name="formId">The form id.</param> /// <param name="optionalParameter">The optional parameter.</param> /// <param name="parentWorkItem">The parent work item.</param> /// <returns>The generated smartpart.</returns> public UserControl GetSmartPart(int formId, object[] optionalParameter, WorkItem parentWorkItem) { string currentWorkItemName = string.Empty; UserControl currentSmartPart = new UserControl(); WorkItem currentWorkItem = new WorkItem(); //// get the form information like formFile,permissions etc.. FormInfo formInfo = TerraScanCommon.GetFormInfo(formId); if (!string.IsNullOrEmpty(formInfo.formFile)) { currentWorkItemName = formInfo.formFile.Trim() + "WorkItem"; //// check for the parent workitem contains the current workitem if (!parentWorkItem.Items.Contains(currentWorkItemName)) { ////create the instance of current smartpart. currentSmartPart = CreateSmartPartInstance(formInfo.formFile, optionalParameter, currentWorkItemName, parentWorkItem); } else { currentWorkItem = (WorkItem)parentWorkItem.Items.Get(currentWorkItemName); currentSmartPart = (UserControl)currentWorkItem.Items.Get(formInfo.formFile); currentWorkItem.Terminate(); currentSmartPart.Dispose(); currentSmartPart = CreateSmartPartInstance(formInfo.formFile, optionalParameter, currentWorkItemName, parentWorkItem); } return(currentSmartPart); } else { ErrorEngine.ShowForm((int)TerraScanCommon.ErrorEngineType.Six); return(null); } }
//method for customer id agency private void _idTypeCombobox_SelectedIndexChanged(object sender, EventArgs e) { if (_idAgentUsercontrol != null) { _idAgentUsercontrol.Dispose(); } switch (_idTypeCombobox.SelectedItem.ToString()) { //add State user Control case StateIdTypeDescription.CW: case StateIdTypeDescription.DRIVER_LIC: case StateIdTypeDescription.STATE_ID: _idAgentUsercontrol = new State(); break; default: _idAgentUsercontrol = new Country(); break; } _idAgentUsercontrol.Top = _idTypeCombobox.Top; _idAgentUsercontrol.Left = _idTypeCombobox.Left + _idTypeCombobox.Width + 10; _cboTemp.Visible = false; this.Controls.Add(_idAgentUsercontrol); //position the textbox _idValueTextbox.Location = new Point(_idAgentUsercontrol.Top, _idAgentUsercontrol.Left + _idAgentUsercontrol.Width + 10); _idValueTextbox.Top = _idAgentUsercontrol.Top; _idValueTextbox.Left = _idAgentUsercontrol.Left + _idAgentUsercontrol.Width + 10; }
private void TabCreating(DevExpress.XtraTab.XtraTabControl tabControl, string Text, string Name, UserControl uc, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { int index = CheckTabExits(tabControl, Name); if (index >= 0) { tabControl.TabPages[index].PageVisible = true; tabControl.SelectedTabPage = tabControl.TabPages[index]; tabControl.SelectedTabPage.Text = Text; uc.Dispose(); uc = null; } else { DevExpress.XtraTab.XtraTabPage tabpage = new DevExpress.XtraTab.XtraTabPage { Text = Text, Name = Name, ImageIndex = 0 }; tabpage.Image = e.Link.Item.SmallImage; tabControl.TabPages.Add(tabpage); tabControl.SelectedTabPage = tabpage; //uc.TopLevel = false; uc.Parent = tabpage; uc.Show(); uc.Dock = DockStyle.Fill; } }
private void UpdateSpecificInfo(DlcItem dlc) { if (specificControl != null) { this.Controls.Remove(specificControl); specificControl.Dispose(); specificControl = null; } switch (dlc.Tab) { case DlcType.Alchemy: specificControl = new AlchemyInfoControl(dlc); break; case DlcType.Item: specificControl = new ItemInfoControl(dlc); break; case DlcType.Subquest: specificControl = new SubquestInfoControl(dlc); break; } if (specificControl != null) { specificControl.Location = new Point(224, 104); this.Controls.Add(specificControl); } }
protected void CopyLayout(Type alternativeLayout) { if (!IsInDesignMode && this.Owner == null) { throw new InvalidOperationException("Must have an owning EditorWindow in order to copy the layout"); } if (typeof(AlternativeLayoutUserControl).IsAssignableFrom(alternativeLayout)) { SuspendLayoutDraw(this); // remove group boxes in this control, but dump their child controls // back into the form (we don't want them gone) UnwindGroupBoxes(); // initialize instance of alternative layout UserControl control = (UserControl)Activator.CreateInstance(alternativeLayout); Size = control.Size; // copy controls over CopyLayoutControls(control.Controls); PerformLayout(); ResumeLayoutDraw(this); control.Dispose(); } else { throw new InvalidLayoutException(Name + " is trying to copy its layout from a control " + "that is not an alternative layout control. Please check the code of " + Name + " to make sure they are copying from the correct class."); } }
public void ChangeView <T>(params object[] args) where T : UserControl { if (_currentView != null) { _currentView.Dispose(); } var settings = GetService <SettingsService>().GetSettings(); var view = Activator.CreateInstance(typeof(T), this, args) as T; view.Location = new Point(0, 0); //view.Dock = DockStyle.Fill; //Назначим на форму фон: создадим PictureBox, назначим ему масштабирование и фон, добавим в список контролов var pb = new PictureBox(); pb.Location = new Point(0, 0); pb.Image = settings.ProgramBackground; pb.SizeMode = PictureBoxSizeMode.StretchImage; pb.Dock = DockStyle.Fill; pb.Name = "pbFormBacground"; view.Controls.Add(pb); Controls.Add(view); _currentView = view; }
internal void empManControl_Load(UserControl oldControl) { EmpManControl empManageControl = new EmpManControl(this); mainWindow(empManageControl); oldControl.Dispose(); }
private void btn_operation_Click(object sender, EventArgs e) { try { if (Status != 0) { MessageBox.Show("作业中不可切换界面"); return; } this.panel_mainArea.Controls.Remove(UserControl); if (OperationForm == null) { OperationForm = new OperationForm(); } if (UserControl != null && UserControl.Name != "OperationForm") { UserControl.Dispose(); } UserControl = OperationForm; this.panel_mainArea.Controls.Add(UserControl); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
//for controls internal void homeControl_Load(UserControl oldControl) { HomeControl homeControl = new HomeControl(this); mainWindow(homeControl); oldControl.Dispose(); }
public void Dispose() { if (current != null && current.Control != null && current.Control is IDeactivate) { ((IDeactivate)(current.Control)).Deactivate(); } foreach (var item in screens) { try { Console.WriteLine("MainSwitcher dispose " + item.Name); if (item != null && item.Control != null) { item.Control.Close(); item.Control.Dispose(); } } catch { } } MainControl.Dispose(); GC.SuppressFinalize(this); }
public void Dispose() { if (_userControl != null) { _userControl.Dispose(); } }
private void DeleteLane(int Id, UserControl lane) { _lanesDatabaseService.Delete(Id); LanesCollection.Remove(LanesCollection.Find(x => x.Id == Id)); _layoutPanel.Controls.Remove((UserControl)lane); lane.Dispose(); }
public void disposeFunc(UserControl u) //This function helps us to provide memory leak. { /*It won't throw exception even panel disposed once. * Function Dispose() releases memory for current item. * Which means when user changed panel previous panel will dispose * so it won't use memory anymore.*/ u.Dispose(); }
private void CloseUC() { if (ctrl.Panel1.Controls.Count > 0) { UserControl uc = (UserControl)ctrl.Panel1.Controls[0]; uc.Dispose(); } }
private void btnStorage_Click(object sender, EventArgs e) { ctrlMain.Dispose(); ctrlMain = new ctrlStorageItem(); pnlMainScreen.Controls.Add(ctrlMain); ctrlMain.Show(); }
private void ClearSignaturePanel() { if (signatureCtrl != null && !signatureCtrl.IsDisposed) { settingsPanel.Controls.Remove(signatureCtrl); signatureCtrl.Hide(); signatureCtrl.Dispose(); } }
public void FillContent(UserControl NewContent, Home HomePage) { if (HomePage.ContentPanel.Controls.Count > 0) { UserControl CurrentControl = HomePage.ContentPanel.Controls[0] as UserControl; CurrentControl.Dispose(); } HomePage.ContentPanel.Controls.Add(NewContent); }
public void Dispose() { if (userControl == null) { throw new InvalidOperationException("No screen to dispose"); } userControl.Dispose(); }
UserControl m_lastfrm = null; //Interfaz actual /// <summary>LoadPage /// </summary> /// <param name="frm"></param> private void LoadPage(UserControl frm) { UserControl tmpC = m_lastfrm; m_lastfrm = frm; this.scMain.Panel1.Controls.Clear(); m_lastfrm.Parent = this.scMain.Panel1; m_lastfrm.Dock = DockStyle.Fill; m_lastfrm.Show(); if (tmpC != null) { try { try { #region Dispose by reflect FieldInfo[] fieldInfoArray = tmpC.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); foreach (FieldInfo fi in fieldInfoArray) { if (fi.FieldType == typeof(Control)) { Control ctrl = (Control)fi.GetValue(tmpC); DisposeUC(ctrl); } else if (fi.FieldType == typeof(ToolStrip)) //RedGate it, find it to GC { ToolStrip toolStrip = (ToolStrip)fi.GetValue(tmpC); toolStrip.Dispose(); } } #endregion } catch { } tmpC.Parent = null; tmpC.Dispose(); } catch { } tmpC = null; } if (DateTime.Now > m_lastCollect.AddMinutes(1)) { m_lastCollect = DateTime.Now; try { GC.Collect(); } catch { } } }
private void Setting_CheckedChanged(object sender, EventArgs e) { RadioButton rbtn = sender as RadioButton; if (rbtn.Checked == true) { if (m_LastSettingPage != null) { this.tlpSettingBase.Controls.RemoveAt(2); m_LastSettingPage.Dispose(); m_LastSettingPage = null; } switch (rbtn.Name) { case string rbtnName when rbtnMachine.Name == rbtnName: PageMachine pMachine = new PageMachine(); pMachine.Setup(); m_LastSettingPage = pMachine; break; case string rbtnName when rbtnCar.Name == rbtnName: PageCars pCars = new PageCars(); pCars.Setup(); m_LastSettingPage = pCars; break; case string rbtnName when rbtnUser.Name == rbtnName: PageUser pUser = new PageUser(); pUser.Setup(); m_LastSettingPage = pUser; break; case string rbtnName when rbtnBackup.Name == rbtnName: PageBackup pBackup = new PageBackup(); pBackup.Setup(); m_LastSettingPage = pBackup; break; case string rbtnName when rbtnReport.Name == rbtnName: PageReport pReport = new PageReport(m_Machine); pReport.Setup(); m_LastSettingPage = pReport; break; case string rbtnName when rbtnPrinter.Name == rbtnName: PagePrinterSetting pPrinter = new PagePrinterSetting(); pPrinter.Setup(); m_LastSettingPage = pPrinter; break; } tlpSettingBase.Controls.Add(m_LastSettingPage, 2, 0); m_LastSettingPage.Dock = DockStyle.Fill; } }
private void CleanupButton(UserControl button) { button.Parent = null; button.MouseDown -= new MouseEventHandler(button_MouseDown); button.MouseMove -= new MouseEventHandler(button_MouseMove); button.MouseUp -= new MouseEventHandler(button_MouseUp); Controls.Remove(button); button.Dispose(); }
/// <summary> /// Initialize multi-choice buttons. /// </summary> /// <param name="choices"></param> private void InitializeMultiChoice(IList <string> choices) { if (_choiceControl != null) { choicePanel.Controls.Remove(_choiceControl); _choiceControl.Dispose(); } var control = new MultiChooseControl(choices) { Dock = DockStyle.Fill }; control.Chosen += (sender, s) => OnChoice(s); control.Dock = DockStyle.Fill; choicePanel.Controls.Add(control); _choiceControl = control; }
public void TogglePanel(UserControl newPanel) { if (currentPanel != null) { panelBody.Controls.Remove(currentPanel); currentPanel.Dispose(); } currentPanel = newPanel; panelBody.Controls.Add(newPanel); }
public override void Unload() { base.Unload(); imageTexture.Dispose(); imagePanel.Dispose(); imagePanel = null; statusStrip = null; visualizerCanvas = null; imageTexture = null; }
protected virtual void Dispose(bool disposing) { if (disposing) { if (UserControl != null) { UserControl.Dispose(); } } }
/// <summary> /// Changes the displaying screen and deletes the last screen /// </summary> /// <param name="remove"></param> /// <param name="add"></param> public void ChangeScreen(UserControl remove, UserControl add) { ConfigScreen(ref add); Controls.Add(add); Controls.Remove(remove); if (remove != null) { remove.Dispose(); } }
private void ClearPropsPage() { if (_usedConnectionProps != null) { _wizardPageMetadataOpts.panelMetadataOpts.Controls.Remove(_usedConnectionProps); _usedConnectionProps.Dispose(); _usedConnectionProps = null; } SetShown(ShowLoadOpts, false); }