/// <summary> /// Select an existing language project. /// </summary> /// <param name="activeWindow"></param> public void ChooseLangProject(FwXWindow activeWindow) { CheckDisposed(); Debug.Assert(activeWindow != null); FdoCache cache = activeWindow.Cache; Debug.Assert(cache != null); // Results parms for the dlg. bool fHaveProject; int hvoProj; string sProject; Guid guid; bool fHaveSubitem; int hvoSubitem; string sUserWs = cache.LanguageWritingSystemFactoryAccessor.GetStrFromWs(cache.DefaultUserWs); //"en"; string sName; string sServer = (cache != null) ? cache.ServerName : MiscUtils.LocalServerName; string sDatabase; IOpenFWProjectDlg dlg = OpenFWProjectDlgClass.Create(); dlg.WritingSystemFactory = cache.LanguageWritingSystemFactoryAccessor; uint hwnd = activeWindow == null ? 0 : (uint)activeWindow.Handle.ToInt32(); dlg.Show(Logger.Stream, sServer, MiscUtils.LocalServerName, sUserWs, hwnd, false, 0, FwApp.App.HelpFile + "::/" + FwApp.App.GetHelpString("khtpFWOpenProject", 0)); dlg.GetResults(out fHaveProject, out hvoProj, out sProject, out sDatabase, out sServer, out guid, out fHaveSubitem, out hvoSubitem, out sName); System.Runtime.InteropServices.Marshal.ReleaseComObject(dlg); if (fHaveProject) { // make sure the server ends in "\\SILFW" // Note lowercase of SILFW in Turkish is not silfw. if (sServer !=null && sServer.ToLowerInvariant().EndsWith("\\silfw") == false) sServer += "\\SILFW"; // append it // The GetCache call will switch the 'cache' var to an extant FdoCache, // if the app already has a connection on open on that server and DB. if (CheckDbVerCompatibility(sServer, sDatabase)) { bool isNewCache = GetCache(sServer, sDatabase, out cache); // save the local and global settings for windows sharing this cache. if (!isNewCache) { foreach (IFwMainWnd mainWindow in m_rgMainWindows) { if (mainWindow.Cache == cache && mainWindow is FwXWindow && mainWindow != activeWindow) { (mainWindow as FwXWindow).SaveSettings(); } } } // save the settings for activeWindow last. activeWindow.SaveSettings(); Form fwMainWindow = NewMainAppWnd(cache, isNewCache, null, false); m_rgMainWindows.Add((IFwMainWnd)fwMainWindow); AdjustNewWindowPosition(fwMainWindow, activeWindow); fwMainWindow.Show(); ((IFwMainWnd)fwMainWindow).InitAndShowClient(); } } }