SIL.FieldWorks.FieldWorks.CreateAndInitNewMainWindow C# (CSharp) Метод

CreateAndInitNewMainWindow() статический приватный Метод

Creates a new main window and initializes it. The specified App is responsible for creating the proper main window type.
static private CreateAndInitNewMainWindow ( FwApp app, bool fNewCache, Form wndCopyFrom, bool fOpeningNewProject ) : bool
app SIL.FieldWorks.Common.Framework.FwApp The app
fNewCache bool true if we didn't reuse an existing cache
wndCopyFrom System.Windows.Forms.Form The window to copy from (optional).
fOpeningNewProject bool true if opening a new project
Результат bool
		internal static bool CreateAndInitNewMainWindow(FwApp app, bool fNewCache, Form wndCopyFrom,
			bool fOpeningNewProject)
		{
			Debug.Assert(app == s_flexApp || app == s_teApp);

			WriteSplashScreen(app.GetResourceString("kstidInitWindow"));

			Form fwMainWindow;
			try
			{
				// Construct the new window, of the proper derived type
				fwMainWindow = app.NewMainAppWnd(s_splashScreen, fNewCache, wndCopyFrom, fOpeningNewProject);

				// Let the application do its initialization of the new window
				using (new DataUpdateMonitor(fwMainWindow, "Creating new main window"))
					app.InitAndShowMainWindow(fwMainWindow, wndCopyFrom);
				// It seems to get activated before we connect the Activate event. But it IS active by now;
				// so just record it now as the active one.
				s_activeMainWnd = (IFwMainWnd)fwMainWindow;
			}
			catch (StartupException ex)
			{
				// REVIEW: Can this actually happen when just creating a new main window?
				CloseSplashScreen();
				MessageBox.Show(ex.Message, Properties.Resources.ksErrorCaption,
					MessageBoxButtons.OK, MessageBoxIcon.Error);
				return false;
			}

			CloseSplashScreen();

			if (!((IFwMainWnd)fwMainWindow).OnFinishedInit())
				return false;	// did not initialize properly!

			fwMainWindow.Activated += FwMainWindowActivated;
			fwMainWindow.Closing += FwMainWindowClosing;
			return true;
		}
FieldWorks