private void OBackgroundWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) { MainRibbonWindow oMainRibbonWindow = new MainRibbonWindow(); System.Threading.Thread oThread = new System.Threading.Thread(new System.Threading.ThreadStart(delegate() { System.Windows.Threading.DispatcherOperation oDispatcherOperation = oMainRibbonWindow.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new System.Action(delegate() { DAL.UnitOfWork oUnitOfWork = new DAL.UnitOfWork(); Utility.CurrentUser = oUnitOfWork.UserRepository .GetById(Utility.CurrentUser.Id); oMainRibbonWindow.Show(); oMainRibbonWindow.WindowState = System.Windows.WindowState.Maximized; this.Hide(); })); })); oThread.SetApartmentState(System.Threading.ApartmentState.STA); oThread.Start(); }
private void OnMainRibbonWindow_Click(object sender, RoutedEventArgs e) { MainRibbonWindow win1 = new MainRibbonWindow(); win1.Show(); }