private void App_OnStartup(object sender, StartupEventArgs e) { if (!Mutex.WaitOne(TimeSpan.Zero, true)) { MessageBoxHelper.ShowInfoMessage("Application is already open."); return; } try { InitializeComponent(); AppDomain.CurrentDomain.UnhandledException += UnhandledException; AutoMapperInitializer.Initialize(); SqlIoC.InitializeBaseContainer(); container = SqlIoC.GetNestedContainer(); privateCertRepository = container.GetInstance <IPrivateCertRepository>(); var page = container.GetInstance <MainWindow>(); page.ShowInTaskbar = true; page.InitializeComponent(); page.Show(); } finally { Mutex.ReleaseMutex(); } }
private static void ShowPage <T>(bool dialog = false, string failureMessage = null, bool exitIfFailure = false) where T : BaseWindow, IComponentConnector { var container = SqlIoC.GetNestedContainer(); var page = container.GetInstance <T>(); page.IoCContainer = container; page.InitializeComponent(); page.ShowInTaskbar = false; page.Owner = Application.Current.MainWindow; if (dialog) { var sucess = page.ShowDialog(); if (exitIfFailure && (!sucess.HasValue || !sucess.Value)) { MessageBoxHelper.ShowInfoMessage(failureMessage); Application.Current.Shutdown(0); } } else { page.Show(); } }
public MainTabItem() { tabHeader = new CloseableHeader(); Header = tabHeader; tabHeader.btnClose.MouseEnter += BtnClose_MouseEnter; tabHeader.btnClose.MouseLeave += BtnClose_MouseLeave; tabHeader.btnClose.Click += BtnClose_Click; tabHeader.lblTitle.SizeChanged += LblTitle_SizeChanged; ioCContainer = SqlIoC.GetNestedContainer(); var baseUserControl = ioCContainer.GetInstance <T>(); baseUserControl.InitializeComponent(); Content = baseUserControl; }