コード例 #1
0
        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();
            }
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
ファイル: MainTabItem.cs プロジェクト: lulzzz/PCA
        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;
        }