Exemplo n.º 1
0
        /// <summary>
        /// a slice filter is used to hide some slices.
        /// </summary>
        /// <remarks> this will set up a filter even if you do not specify a filter path, since
        /// some filtering is done by the FDO classes (CmObject.IsFieldRelevant)
        /// </remarks>
        /// <example>
        ///		to set up a slice filter,kids the relative path in the filterPath attribute of the parameters:
        ///		<control assemblyPath="xWorks.dll" class="SIL.FieldWorks.XWorks.RecordEditView">
        ///			<parameters field="Entries" templatePath="LexEd\XDEs" filterPath="LexEd\basicFilter.xml">
        ///			...
        ///</example>
        private void SetupSliceFilter()
        {
            try
            {
                string filterPath = XmlUtils.GetOptionalAttributeValue(m_configurationParameters, "filterPath");
                if (filterPath != null)
                {
#if __MonoCS__
                    // TODO-Linux: fix the data
                    filterPath = filterPath.Replace(@"\", "/");
#endif
                    var document = new XmlDocument();
                    document.Load(FwDirectoryFinder.GetCodeFile(filterPath));
                    m_dataEntryForm.SliceFilter = new SliceFilter(document);
                }
                else                 //just set up a minimal filter
                {
                    m_dataEntryForm.SliceFilter = new SliceFilter();
                }
            }
            catch (Exception e)
            {
                throw new ConfigurationException("Could not load the filter.", m_configurationParameters, e);
            }
        }
Exemplo n.º 2
0
        private static void EnsureWindowConfiguration(PropertyTable propertyTable)
        {
            XmlNode xnWindow = propertyTable.GetValue <XmlNode>("WindowConfiguration");

            if (xnWindow == null)
            {
                string configFile = FwDirectoryFinder.GetCodeFile("Language Explorer/Configuration/Main.xml");
                // This can be called from TE...in that case, we don't complain about missing include
                // files (true argument) but just trust that we put enough in the installer to make it work.
                XmlDocument configuration           = XWindow.LoadConfigurationWithIncludes(configFile, true);
                XmlNode     windowConfigurationNode = configuration.SelectSingleNode("window");
                propertyTable.SetProperty("WindowConfiguration", windowConfigurationNode, true);
                propertyTable.SetPropertyPersistence("WindowConfiguration", false);
            }
        }
Exemplo n.º 3
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 = FwDirectoryFinder.GetCodeFile(DefaultConfigurationPathname);
                //					configFile = (string)SettingsKey.GetValue("LatestConfigurationFile",
                //						Path.Combine(FwDirectoryFinder.CodeDirectory,
                //						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);

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