public frmToolSchedule_new(UserInformation userInformation, WPF.MDI.MdiChild mdiChild, string partNo) { try { Progress.ProcessingText = PDMsg.Load; Progress.Start(); CultureInfo ci = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.Name); ci.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy"; ci.DateTimeFormat.DateSeparator = "/"; Thread.CurrentThread.CurrentCulture = ci; InitializeComponent(); tsmvm = new ViewModel.ToolScheduleViewModel(userInformation, mdiChild); this.DataContext = tsmvm; this.me = mdiChild; this.me.Closing += tsmvm.CloseMethod; tsmvm.CmbSubHeadingCombo = cmbSeqHeading; tsmvm.DgvToolSchedule = dgvToolSchedule; tsmvm.DgvAuxTools = dgvAuxTools; tsmvm.DgvToolsScheduleRev = dgvToolsScheduleRev; Progress.End(); if (tsmvm.CloseAction == null) { tsmvm.CloseAction = new Action(() => mdiChild.Close()); } } catch (Exception ex) { throw ex.LogException(); } }
private void UserControl_Unloaded(object sender, RoutedEventArgs e) { try { tsmvm = null; } catch (Exception ex) { ex.LogException(); } }