Esempio n. 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates a new instance of the main X window
        /// </summary>
        /// <param name="progressDlg">The progress dialog to use, if needed (can be null).</param>
        /// <param name="isNewCache">Flag indicating whether one-time, application-specific
        /// initialization should be done for this cache.</param>
        /// <param name="wndCopyFrom">Must be null for creating the original app window.
        /// Otherwise, a reference to the main window whose settings we are copying.</param>
        /// <param name="fOpeningNewProject"><c>true</c> if opening a brand spankin' new
        /// project</param>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        public override Form NewMainAppWnd(IProgress progressDlg, bool isNewCache,
                                           Form wndCopyFrom, bool fOpeningNewProject)
        {
            if (isNewCache)
            {
                // TODO: Do any needed initialization here.
            }
            Stream iconStream = ApplicationIconStream;

            Debug.Assert(iconStream != null, "Couldn't find the specified application icon as a resource.");
            string configFile;

            if (m_appArgs.ConfigFile != string.Empty)
            {
                configFile = m_appArgs.ConfigFile;
            }
            else
            {
                configFile = DirectoryFinder.GetFWCodeFile(DefaultConfigurationPathname);
                //					configFile = (string)SettingsKey.GetValue("LatestConfigurationFile",
                //						Path.Combine(DirectoryFinder.FWCodeDirectory,
                //						DefaultConfigurationPathname));
                if (!File.Exists(configFile))
                {
                    configFile = null;
                }
            }
            if (configFile == null)             // try to load from stream
            {
                return(new FwXWindow(this, wndCopyFrom, iconStream, ConfigurationStream));
            }

            // We pass a copy of the link information because it doesn't get used until after the following line
            // removes the information we need.
            FwXWindow result = new FwXWindow(this, wndCopyFrom, iconStream, configFile,
                                             m_appArgs.HasLinkInformation ? m_appArgs.CopyLinkArgs() : null, false);

            m_appArgs.ClearLinkInformation();             // Make sure the next window that is opened doesn't default to the same place
            return(result);
        }