Inheritance: IFWDisposable
Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="featSys"></param>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        /// <param name="launchedFromInsertMenu"></param>
        public void SetDlginfo(IFsFeatureSystem featSys, Mediator mediator, XCore.PropertyTable propertyTable, bool launchedFromInsertMenu)
        {
            // default to inflection features
            string sXmlFile = Path.Combine(FwDirectoryFinder.CodeDirectory, String.Format("Language Explorer{0}MGA{0}GlossLists{0}EticGlossList.xml", Path.DirectorySeparatorChar));

            SetDlginfo(featSys, mediator, propertyTable, launchedFromInsertMenu, "masterInflFeatListDlg", sXmlFile);
        }
Beispiel #2
0
 private void Init(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable, ICmPossibilityList list, int ws, bool useAbbr, Form parent)
 {
     m_mediator      = mediator;
     m_propertyTable = propertyTable;
     if (parent == null)
     {
         if (m_propertyTable != null)
         {
             IApp app = m_propertyTable.GetValue <IApp>("App");
             if (app != null)
             {
                 parent = app.ActiveMainWindow;
             }
             if (parent == null)
             {
                 parent = m_propertyTable.GetValue <Form>("window");
             }
         }
         if (parent == null)
         {
             parent = Form.ActiveForm;                     // desperate for something...
         }
     }
     m_cache   = cache;
     m_useAbbr = useAbbr;
     m_parent  = parent;
     m_list    = list;
     m_ws      = ws;
 }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="featSys"></param>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        /// <param name="launchedFromInsertMenu"></param>
        /// <param name="sWindowKey">used to store location and size of dialog window</param>
        /// <param name="sXmlFile">file containing the XML form of the gloss list</param>
        public void SetDlginfo(IFsFeatureSystem featSys, Mediator mediator, XCore.PropertyTable propertyTable, bool launchedFromInsertMenu, string sWindowKey, string sXmlFile)
        {
            CheckDisposed();

            m_featureSystem          = featSys;
            m_featureList            = featSys.FeaturesOC;
            m_launchedFromInsertMenu = launchedFromInsertMenu;
            m_mediator      = mediator;
            m_propertyTable = propertyTable;
            if (m_propertyTable != null)
            {
                m_sWindowKeyLocation = sWindowKey + "Location";
                m_sWindowKeySize     = sWindowKey + "Size";

                ResetWindowLocationAndSize();

                m_helpTopicProvider        = m_propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");
                helpProvider               = new HelpProvider();
                helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
                helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(s_helpTopic));
                helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
            }
            m_cache = featSys.Cache;
            LoadMasterFeatures(sXmlFile);
            m_tvMasterList.Cache = m_cache;
        }
Beispiel #4
0
        /// <summary>
        /// Set up the dlg in preparation to showing it.
        /// </summary>
        /// <param name="cache">FDO cache.</param>
        /// <param name="propertyTable"></param>
        /// <param name="wp">Strings used for various items in this dialog.</param>
        /// <param name="mediator"></param>
        /// <param name="mainObj"></param>
        /// <param name="mergeCandidates"></param>
        /// <param name="guiControl"></param>
        /// <param name="helpTopic"></param>
        public void SetDlgInfo(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable, WindowParams wp, DummyCmObject mainObj, List <DummyCmObject> mergeCandidates,
                               string guiControl, string helpTopic)
        {
            CheckDisposed();

            Debug.Assert(cache != null);

            m_mediator      = mediator;
            m_propertyTable = propertyTable;
            m_cache         = cache;
            m_mainObj       = mainObj;

            m_fwTextBoxBottomMsg.WritingSystemFactory = m_cache.WritingSystemFactory;
            m_fwTextBoxBottomMsg.WritingSystemCode    = m_cache.WritingSystemFactory.UserWs;

            InitBrowseView(guiControl, mergeCandidates);

            Text        = wp.m_title;
            label2.Text = wp.m_label;

            m_helpTopic = helpTopic;

            if (m_helpTopic != null && m_helpTopicProvider != null)            // m_helpTopicProvider could be null for testing
            {
                helpProvider = new HelpProvider();
                helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
                helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(m_helpTopic));
                helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
            }

            MoveWindowToPreviousPosition();
        }
Beispiel #5
0
        /// <summary>
        /// Initialize the control.
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="mediator"></param>
        /// <param name="ctrlAssistant"></param>
        /// <param name="parentForm"></param>
        /// <param name="propertyTable"></param>
        public void Initialize(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable, Control ctrlAssistant, Form parentForm)
        {
            CheckDisposed();

            Debug.Assert(ctrlAssistant != null);
            m_ctrlAssistant = ctrlAssistant;
            Initialize(cache, mediator, propertyTable, parentForm, new SandboxGenericMSA());
        }
Beispiel #6
0
        /// <summary>
        /// Init the dialog with an existing context.
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        /// <param name="rule"></param>
        /// <param name="ctxt"></param>
        public void SetDlgInfo(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable, IPhRegularRule rule, IPhSimpleContextNC ctxt)
        {
            CheckDisposed();

            IFsFeatStruc fs = ((IPhNCFeatures)ctxt.FeatureStructureRA).FeaturesOA;

            SetDlgInfo(cache, mediator, propertyTable, ctxt.FeatureStructureRA.Hvo, PhNCFeaturesTags.kflidFeatures, fs, rule, ctxt);
        }
 /// <summary>
 /// Restore any appropriate settings which have values in the property table
 /// </summary>
 public static void RestoreSettings(IFdoServiceLocator services, PropertyTable propertyTable)
 {
     var hcSettings = propertyTable.GetStringProperty(khomographconfiguration, null);
     if (hcSettings != null)
     {
         var hc = services.GetInstance<HomographConfiguration>();
         hc.PersistData = hcSettings;
     }
 }
Beispiel #8
0
        void IFwExtension.Init(LcmCache cache, Mediator mediator, PropertyTable propertyTable)
        {
            m_mediator          = mediator;
            m_propertyTable     = propertyTable;
            m_cache             = cache;
            m_helpTopicProvider = m_propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");
            m_sUserWs           = m_cache.ServiceLocator.WritingSystemManager.UserWritingSystem.Id;
            m_sNewUserWs        = m_sUserWs;
            m_userInterfaceChooser.Init(m_sUserWs);

            // Populate Plugins tab page list.
            var baseConfigPath = FwDirectoryFinder.GetCodeSubDirectory(
                Path.Combine("Language Explorer", "Configuration"));
            string basePluginPath = Path.Combine(baseConfigPath, "Available Plugins");
            // The extension XML files should be stored in the data area, not in the code area.
            // This reduces the need for users to have administrative privileges.
            string baseExtensionPath = Path.Combine(FwDirectoryFinder.DataDirectory,
                                                    Path.Combine("Language Explorer", "Configuration"));

            foreach (string dir in Directory.GetDirectories(basePluginPath))
            {
                Debug.WriteLine(dir);
                // Currently not offering Concorder plugin in FW7, therefore, we
                // can remove the feature until we need to implement. (FWNX-755)
                if (Platform.IsUnix && dir == Path.Combine(basePluginPath, "Concorder"))
                {
                    continue;
                }
                string managerPath = Path.Combine(dir, "ExtensionManager.xml");
                if (File.Exists(managerPath))
                {
                    XmlDocument managerDoc = new XmlDocument();
                    managerDoc.Load(managerPath);
                    XmlNode managerNode = managerDoc.SelectSingleNode("/manager");
                    m_lvPlugins.SuspendLayout();
                    ListViewItem lvi = new ListViewItem();
                    lvi.Tag  = managerDoc;
                    lvi.Text = managerNode.Attributes["name"].Value;
                    lvi.SubItems.Add(managerNode.Attributes["description"].Value);
                    // See if it is installed and check the lvi if it is.
                    XmlNode configfilesNode = managerNode.SelectSingleNode("configfiles");
                    string  extensionPath   = Path.Combine(baseExtensionPath, configfilesNode.Attributes["targetdir"].Value);
                    lvi.Checked = Directory.Exists(extensionPath);
                    m_plugins.Add(lvi.Text, lvi.Checked);                     // Remember original installed state.
                    m_lvPlugins.Items.Add(lvi);
                    m_lvPlugins.ResumeLayout();
                }
            }

            if (m_helpTopicProvider != null)             // Will be null when running tests
            {
                helpProvider = new HelpProvider();
                helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
                helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(s_helpTopic));
                helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
            }
        }
Beispiel #9
0
        /// <summary>
        /// Set up the dlg in preparation to showing it.
        /// </summary>
        /// <param name="cache">FDO cache.</param>
        /// <param name="mediator">Mediator used to restore saved siz and location info.</param>
        /// <param name="propertyTable"></param>
        /// <param name="startingEntry">Entry that cannot be used as a match in this dlg.</param>
        public void SetDlgInfo(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable, ILexEntry startingEntry)
        {
            CheckDisposed();

            Debug.Assert(startingEntry != null);
            m_startingEntry = startingEntry;

            SetDlgInfo(cache, null, mediator, propertyTable);
        }
		public InterestingTextList(PropertyTable propertyTable, ITextRepository repo,
			IStTextRepository stTextRepo, bool includeScripture)
		{
			m_textRepository = repo;
			m_propertyTable = propertyTable;
			m_stTextRepository = stTextRepo;
			CoreTexts = GetCoreTexts();
			m_scriptureTexts = GetScriptureTexts();
			IncludeScripture = includeScripture;
			GetCache();
		}
Beispiel #11
0
        /// <summary>
        /// Init the dialog with an existing FS. Warning: the fs passed in
        /// might get deleted if it proves to be a duplicate. Retrieve the new FS after running it.
        /// This constructor is used in MsaInflectionFeatureListDlgLauncher.HandleChooser.
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        /// <param name="fs"></param>
        /// <param name="owningFlid"></param>
        public void SetDlgInfo(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable, IFsFeatStruc fs, int owningFlid)
        {
            CheckDisposed();

            m_fs            = fs;
            m_propertyTable = propertyTable;
            Mediator        = mediator;
            m_cache         = cache;
            m_owningFlid    = owningFlid;
            LoadInflFeats(fs);
            EnableLink();
        }
Beispiel #12
0
        /// <summary>
        /// Init the dialog with an MSA and flid that does not yet contain a feature structure.
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        /// <param name="cobj"></param>
        /// <param name="owningFlid"></param>
        public void SetDlgInfo(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable, ICmObject cobj, int owningFlid)
        {
            CheckDisposed();

            m_fs            = null;
            m_owningFlid    = owningFlid;
            m_hvoOwner      = cobj.Hvo;
            m_propertyTable = propertyTable;
            Mediator        = mediator;
            m_cache         = cache;
            LoadInflFeats(cobj, owningFlid);
            EnableLink();
        }
Beispiel #13
0
        public MasterCategoryListChooserLauncher(Form popupMgrParent, Mediator mediator, XCore.PropertyTable propertyTable,
                                                 ICmPossibilityList possibilityList, string fieldName, ILexSense sense)
        {
            m_parentOfPopupMgr = popupMgrParent;
            m_mediator         = mediator;
            m_propertyTable    = propertyTable;
            CategoryList       = possibilityList;
            m_sense            = sense;
            FieldName          = fieldName;
            Cache = m_sense.Cache;

            Application.Idle += new EventHandler(LaunchChooseFromMasterCategoryListOnIdle);
        }
Beispiel #14
0
        /// <summary/>
        public void SetDlginfo(ICmPossibilityList posList, Mediator mediator, XCore.PropertyTable propertyTable, bool launchedFromInsertMenu, IPartOfSpeech subItemOwner)
        {
            CheckDisposed();

            m_subItemOwner           = subItemOwner;   // May be null, which is fine.
            m_posList                = posList;
            m_launchedFromInsertMenu = launchedFromInsertMenu;
            m_mediator               = mediator;
            m_propertyTable          = propertyTable;
            if (m_propertyTable != null)
            {
                // Reset window location.
                // Get location to the stored values, if any.
                if (m_propertyTable.PropertyExists("masterCatListDlgLocation") &&
                    m_propertyTable.PropertyExists("masterCatListDlgSize"))
                {
                    var       locWnd = m_propertyTable.GetValue <Point>("masterCatListDlgLocation");
                    var       szWnd  = m_propertyTable.GetValue <Size>("masterCatListDlgSize");
                    Rectangle rect   = new Rectangle(locWnd, szWnd);
                    ScreenHelper.EnsureVisibleRect(ref rect);
                    DesktopBounds = rect;
                    StartPosition = FormStartPosition.Manual;
                }
                m_helpTopicProvider = m_propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");
                if (m_helpTopicProvider != null)
                {
                    helpProvider = new HelpProvider();
                    helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
                    helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(s_helpTopic));
                    helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
                }
            }
            m_bnHelp.Enabled = (m_helpTopicProvider != null);

            Debug.Assert(posList != null);
            m_cache = posList.Cache;
            var posSet = new HashSet <IPartOfSpeech>();

            foreach (IPartOfSpeech pos in posList.ReallyReallyAllPossibilities)
            {
                posSet.Add(pos);
            }
            LoadMasterCategories(posSet);
        }
Beispiel #15
0
        /// <summary>
        /// Set up the dlg in preparation to showing it.
        /// </summary>
        /// <param name="cache">FDO cache.</param>
        /// <param name="wp">Strings used for various items in this dialog.</param>
        /// <param name="mediator">The mediator.</param>
        /// <param name="propertyTable"></param>
        /// <param name="tssform">The form.</param>
        /// <param name="hvoType">The HVO of the type.</param>
        public void SetDlgInfo(LcmCache cache, WindowParams wp, Mediator mediator, XCore.PropertyTable propertyTable, ITsString tssform, int hvoType)
        {
            CheckDisposed();

            SetDlgInfo(cache, wp, mediator, propertyTable, tssform);

            m_formOrig = m_tbForm.Text;
            m_hvoType  = hvoType;

            // JohnT: a prior call to SetForm should have established whether this button
            // is enabled...and it should NOT be, if there are no entries selected,
            // typically because none at all match the form.
            //btnOK.Enabled = true;
            m_btnOK.Width    += 30;
            m_btnOK.Left     += 90;
            m_btnClose.Width += 30;                     // for balance...

            ShowControlsBasedOnPanel1Position();
        }
Beispiel #16
0
        private void SetDlgInfo(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable, int hvoOwner, int owningFlid, IFsFeatStruc fs, IPhRegularRule rule, IPhSimpleContextNC ctxt)
        {
            m_fs            = fs;
            m_owningFlid    = owningFlid;
            m_hvoOwner      = hvoOwner;
            m_rule          = rule;
            m_ctxt          = ctxt;
            m_mediator      = mediator;
            m_propertyTable = propertyTable;
            if (m_propertyTable != null)
            {
                // Reset window location.
                // Get location to the stored values, if any.
                if (m_propertyTable.PropertyExists("phonFeatListDlgLocation") &&
                    m_propertyTable.PropertyExists("phonFeatListDlgSize"))
                {
                    var locWnd = m_propertyTable.GetValue <Point>("phonFeatListDlgLocation");
                    var szWnd  = m_propertyTable.GetValue <Size>("phonFeatListDlgSize");
                    var rect   = new Rectangle(locWnd, szWnd);
                    ScreenHelper.EnsureVisibleRect(ref rect);
                    DesktopBounds = rect;
                    StartPosition = FormStartPosition.Manual;
                }

                var helpTopicProvider = (m_propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider"));
                if (helpTopicProvider != null)                 // Will be null when running tests
                {
                    m_helpProvider.HelpNamespace = helpTopicProvider.HelpFile;
                    m_helpProvider.SetHelpKeyword(this, helpTopicProvider.GetHelpString(m_helpTopic));
                    m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
                }
            }
            m_cache = cache;
            m_valuesCombo.WritingSystemFactory = m_cache.LanguageWritingSystemFactoryAccessor;
            m_valuesCombo.StyleSheet           = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable);

            LoadPhonFeats(m_fs);
            BuildInitialBrowseView();
        }
Beispiel #17
0
        /// <summary>
        /// From IFwExtension
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        void IFwExtension.Init(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable)
        {
            m_cache         = cache;
            m_mediator      = mediator;
            m_propertyTable = propertyTable;
            string sPrevFile = m_propertyTable.GetStringProperty(FilePropertyName, null);

            if (!String.IsNullOrEmpty(sPrevFile))
            {
                tbPath.Text = sPrevFile;
                UpdateButtons();
            }
            string sMergeStyle = m_propertyTable.GetStringProperty(MergeStylePropertyName, null);

            if (!String.IsNullOrEmpty(sMergeStyle))
            {
                m_msImport = (FlexLiftMerger.MergeStyle)Enum.Parse(typeof(FlexLiftMerger.MergeStyle), sMergeStyle, true);
                switch (m_msImport)
                {
                case FlexLiftMerger.MergeStyle.MsKeepOld:
                    m_rbKeepCurrent.Checked = true;
                    break;

                case FlexLiftMerger.MergeStyle.MsKeepNew:
                    m_rbKeepNew.Checked = true;
                    break;

                case FlexLiftMerger.MergeStyle.MsKeepBoth:
                    m_rbKeepBoth.Checked = true;
                    break;

                default:
                    m_rbKeepCurrent.Checked = true;
                    break;
                }
            }
        }
Beispiel #18
0
        public void SetDlgInfo(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable, ICmObject owner)
        {
            CheckDisposed();

            m_cache = cache;
            m_owner = owner;

            m_helpTopic = "khtpDataNotebook-InsertRecordDlg";

            m_helpTopicProvider = propertyTable.GetValue <IHelpTopicProvider>("HelpTopicProvider");
            if (m_helpTopicProvider != null)             // Will be null when running tests
            {
                m_helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
                m_helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(m_helpTopic));
                m_helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
            }

            IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromPropertyTable(propertyTable);

            m_titleTextBox.StyleSheet           = stylesheet;
            m_titleTextBox.WritingSystemFactory = m_cache.WritingSystemFactory;
            m_titleTextBox.WritingSystemCode    = m_cache.DefaultAnalWs;
            AdjustControlAndDialogHeight(m_titleTextBox, m_titleTextBox.PreferredHeight);

            m_typeCombo.StyleSheet           = stylesheet;
            m_typeCombo.WritingSystemFactory = m_cache.WritingSystemFactory;
            m_typeCombo.WritingSystemCode    = m_cache.DefaultAnalWs;
            AdjustControlAndDialogHeight(m_typeCombo, m_typeCombo.PreferredHeight);

            ICmPossibilityList recTypes = m_cache.LanguageProject.ResearchNotebookOA.RecTypesOA;

            m_typePopupTreeManager = new PossibilityListPopupTreeManager(m_typeCombo, m_cache, mediator, propertyTable,
                                                                         recTypes, cache.DefaultAnalWs, false, this);
            m_typePopupTreeManager.LoadPopupTree(m_cache.ServiceLocator.GetObject(RnResearchNbkTags.kguidRecObservation).Hvo);
            // Ensure that we start out focused in the Title text box.  See FWR-2731.
            m_titleTextBox.Select();
        }
Beispiel #19
0
        /// <summary>
        /// set the value of a property to a node of a list. Also sets the corresponding parameters property.
        /// </summary>
        /// <remarks> this is static so that it can be called by the XCore initializationcode and set from the contents of the XML configuration file</remarks>
        /// <param name="mediator"></param>
        /// <param name="choice"></param>
        /// <param name="propertyName"></param>
        public static void ChooseSinglePropertyAtomicValue(Mediator mediator, string choiceValue,
			XmlNode choiceParameters,string propertyName, PropertyTable.SettingsGroup settingsGroup)
        {
            //a hack (that may be we could live with)
            //	if(choiceParameters !=null)
            //	{
            mediator.PropertyTable.SetProperty(propertyName+"Parameters", choiceParameters, settingsGroup);
            //it is possible that we would like to persist these parameters
            //however, as a practical matter, you cannot have XmlNodes witch do not belong to a document.
            //therefore, they could not be deserialize if we did save them.
            //unless, of course, we convert them to a string before serializing.
            //However, when de-serializing, what document would we attach the new xmlnode to?
            mediator.PropertyTable.SetPropertyPersistence(propertyName+"Parameters", false, settingsGroup);
            //}

            //remember, each of these calls to SetProperty() generate a broadcast, so the order of these two calls
            //is relevant.
            mediator.PropertyTable.SetProperty(propertyName, choiceValue, settingsGroup);

            if (choiceParameters != null)
            {
                //since we cannot persist the parameters, it's safer to not persist the choice either.
                mediator.PropertyTable.SetPropertyPersistence(propertyName, false, settingsGroup);
            }
        }
Beispiel #20
0
 public ChoiceBase(Mediator mediator, PropertyTable propertyTable, XmlNode configurationNode, IUIAdapter adapter, ChoiceGroup parent)
     : base(mediator, propertyTable, adapter, configurationNode)
 {
     m_parent = parent;
 }
Beispiel #21
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public POSPopupTreeManager(TreeCombo treeCombo, LcmCache cache, ICmPossibilityList list, int ws, bool useAbbr, Mediator mediator, XCore.PropertyTable propertyTable, Form parent)
     : base(treeCombo, cache, mediator, propertyTable, list, ws, useAbbr, parent)
 {
 }
Beispiel #22
0
		/// <summary>
		/// </summary>
		public void LoadSettings(PropertyTable pt)
		{
			if (pt == null || !NeedToReloadSettings)
				return;
			ResetOwningObj();
			string sHvos = GetPropertyTableValue(pt);
			m_ids = PropertyTableList(sHvos);
			m_fNeedToReloadSettings = false;
		}
 /// <summary>
 /// Save any appropriate settings to the property table
 /// </summary>
 public static void SaveSettings(IFdoServiceLocator services, PropertyTable propertyTable)
 {
     var hc = services.GetInstance<HomographConfiguration>();
     propertyTable.SetProperty(khomographconfiguration, hc.PersistData);
 }
Beispiel #24
0
 ///  <summary>
 ///
 ///  </summary>
 ///  <param name="mediator"></param>
 /// <param name="propertyTable"></param>
 /// <param name="configurationNode"></param>
 ///  <param name="adapter"></param>
 ///  <param name="parent"></param>
 public CommandChoice(Mediator mediator, PropertyTable propertyTable, XmlNode configurationNode, IUIAdapter adapter, ChoiceGroup parent)
     : base(mediator, propertyTable, configurationNode, adapter, parent)
 {
     m_idOfCorrespondingCommand = XmlUtils.GetAttributeValue(m_configurationNode, "command");
     m_defaultLabelOverride     = XmlUtils.GetLocalizedAttributeValue(m_configurationNode, "label", null);
 }
		public InterestingTextList(PropertyTable propertyTable, ITextRepository repo, IStTextRepository stTextRepo)
			: this(propertyTable, repo, stTextRepo, true)
		{
		}
Beispiel #26
0
        /// <summary>
        /// Executes in two distinct scenarios.
        ///
        /// 1. If disposing is true, the method has been called directly
        /// or indirectly by a user's code via the Dispose method.
        /// Both managed and unmanaged resources can be disposed.
        ///
        /// 2. If disposing is false, the method has been called by the
        /// runtime from inside the finalizer and you should not reference (access)
        /// other managed objects, as they already have been garbage collected.
        /// Only unmanaged resources can be disposed.
        /// </summary>
        /// <param name="disposing"></param>
        /// <remarks>
        /// If any exceptions are thrown, that is fine.
        /// If the method is being done in a finalizer, it will be ignored.
        /// If it is thrown by client code calling Dispose,
        /// it needs to be handled by fixing the bug.
        ///
        /// If subclasses override this method, they should call the base implementation.
        /// </remarks>
        protected override void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Can be called more than once, but not run more than once.
            if (m_isDisposed)
                return;

            if (disposing)
            {
                // Dispose managed resources here.

                // Use a copy of the m_colleagues Set,
                // since the Dispose methods on the colleague should remove itself from m_colleagues,
                // which will cause an exception to be throw (list changed while spinning through it.
                Set<IxCoreColleague> copyOfColleagues = new Set<IxCoreColleague>(m_colleagues.ToArray());
                m_colleagues.Clear(); // Just get rid of them now.
                foreach (IxCoreColleague icc in copyOfColleagues)
                {
                    if (icc is IDisposable)
                    {
                        // Is the class marked with [XCore.MediatorDispose],
                        // or is it in the temporary colleague holder?
                        object[] attrs = icc.GetType().GetCustomAttributes(typeof(MediatorDisposeAttribute), true);
                        if ((attrs != null && attrs.Length > 0)
                            || m_temporaryColleague == icc)
                        {
                            (icc as IDisposable).Dispose();
                        }
                    }
                }
                copyOfColleagues.Clear();
                if (m_propertyTable != null)
                    m_propertyTable.Dispose();
                if (m_commandSet != null)
                    m_commandSet.Dispose();
                if (m_pathVariables != null)
                    m_pathVariables.Clear();
                if (m_disposedColleagues != null)
                    m_disposedColleagues.Clear();
                if (m_jobs != null)
                    m_jobs.Clear();
                if (m_pendingjobs != null)
                    m_pendingjobs.Clear();
                if (m_MethodsOnAnyColleague != null)
                    m_MethodsOnAnyColleague.Clear();

                m_idleQueue.Dispose();
            }

            // Dispose unmanaged resources here, whether disposing is true or false.
            m_mainWndPtr = IntPtr.Zero;
            m_MethodsOnAnyColleague = null;
            m_pendingjobs = null;
            m_jobs = null;
            m_disposedColleagues = null;
            m_temporaryColleague = null;
            m_propertyTable = null;
            m_commandSet = null;
            m_colleagues = null;
            m_pathVariables = null;
            /* It is illegal to try to access managed stuff in this part of the Dispose method.
            #if DEBUG
            //DebugMsg("-- Number of calls to the InvokeRecursively method = " + m_invokeCount.ToString());
            DebugMsg("-- Number of saved calls to Type.GetMethod = " + m_SavedCalls.ToString());
            DebugMsg("-- Mediator MsgHash info: count=" + m_MethodsNOTonColleagues.Count + " mx depth=" + m_MethodsCount);
            DebugMsg("-- Mediator  - Calls to check for method on colleague: " + m_MethodChecks);
            #endif
            */
            m_isDisposed = true;

            base.Dispose(disposing);
        }
Beispiel #27
0
		/// <summary>
		/// Store this virtual property's settings to the property table so they can be persisted in local settings.
		/// </summary>
		/// <param name="pt"></param>
		internal void StoreSettings(PropertyTable pt)
		{
			if (pt == null)
				return;
			pt.SetProperty(m_propertyTableKey, GetPropertyTableValue(), true, PropertyTable.SettingsGroup.LocalSettings);
		}
Beispiel #28
0
 /// <summary>
 /// Sets the DLG info.
 /// </summary>
 /// <param name="cache">The cache.</param>
 /// <param name="mediator">The mediator.</param>
 /// <param name="propertyTable"></param>
 /// <param name="tssVariantLexemeForm">The variant lexeme form.</param>
 public void SetDlgInfo(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable, ITsString tssVariantLexemeForm)
 {
     m_tssVariantLexemeForm = tssVariantLexemeForm;
     base.SetDlgInfo(cache, mediator, propertyTable, null);
 }
Beispiel #29
0
 public void Init(Mediator mediator, PropertyTable propertyTable, XmlNode configurationParameters)
 {
 }
Beispiel #30
0
		private void ResetPropertyTable()
		{
			m_mediator = new Mediator();
			m_settings = m_mediator.PropertyTable;
		}
Beispiel #31
0
 public SeparatorChoice(Mediator mediator, PropertyTable propertyTable, XmlNode configurationNode, IUIAdapter adapter, ChoiceGroup parent)
     : base(mediator, propertyTable, configurationNode, adapter, parent)
 {
 }
Beispiel #32
0
        static bool m_fHandlingClick = false;           // prevent multiple simultaneous OnClick operations.
        #endregion

        public ListPropertyChoice(Mediator mediator, PropertyTable propertyTable, ListItem listItem, IUIAdapter adapter, ChoiceGroup parent)
            : base(mediator, propertyTable, adapter, parent)
        {
            m_listItem = listItem;
        }
Beispiel #33
0
        public static void ChooseSinglePropertySequenceValue(Mediator mediator, string choiceValue,
			XmlNode choiceParameterNode, string propertyName, bool fEmptyAllowed, PropertyTable.SettingsGroup settingsGroup)
        {
            mediator.PropertyTable.SetProperty(propertyName + "Parameters", choiceParameterNode, settingsGroup);
            mediator.PropertyTable.SetPropertyPersistence(propertyName + "Parameters", false, settingsGroup);
            string sValue = mediator.PropertyTable.GetStringProperty(propertyName, "", settingsGroup);
            string[] rgsValues = sValue.Split(',');
            int idx = -1;
            if (sValue == choiceValue)
            {
                if (fEmptyAllowed)
                    sValue = "";
            }
            else if ((idx = IndexOf(rgsValues, choiceValue)) != -1)
            {
                // remove the choiceValue from the string.
                Debug.Assert(rgsValues.Length > 1);
                System.Text.StringBuilder sbValues = new System.Text.StringBuilder(sValue.Length);
                for (int i = 0; i < rgsValues.Length; ++i)
                {
                    if (idx != i)
                    {
                        if (sbValues.Length > 0)
                            sbValues.Append(",");
                        sbValues.Append(rgsValues[i]);
                    }
                }
                sValue = sbValues.ToString();
            }
            else
            {
                if (sValue.Length == 0)
                    sValue = choiceValue;
                else
                    sValue = sValue + "," + choiceValue;
            }
            mediator.PropertyTable.SetProperty(propertyName, sValue, settingsGroup);
            mediator.PropertyTable.SetPropertyPersistence(propertyName, false, settingsGroup);
        }
Beispiel #34
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public InflectionFeaturePopupTreeManager(TreeCombo treeCombo, LcmCache cache, bool useAbbr, Mediator mediator, XCore.PropertyTable propertyTable, Form parent, int wsDisplay)
     : base(treeCombo, cache, mediator, propertyTable, cache.LanguageProject.PartsOfSpeechOA, wsDisplay, useAbbr, parent)
 {
 }
Beispiel #35
0
 public static PropertyTable.SettingsGroup GetSettingsGroup(XmlNode configurationNode, PropertyTable.SettingsGroup defaultSettings)
 {
     string settingsGroupValue = XmlUtils.GetAttributeValue(configurationNode, "settingsGroup");
     if (String.IsNullOrEmpty(settingsGroupValue))
         return defaultSettings;
     switch (settingsGroupValue)
     {
         case "local":
             return PropertyTable.SettingsGroup.LocalSettings;
         case "global":
             return PropertyTable.SettingsGroup.GlobalSettings;
         default:
             throw new Exception(String.Format("GetSettingsGroup does not yet support {0} for 'settingsGroup' attribute.", settingsGroupValue));
     }
 }
Beispiel #36
0
 public ChoiceBase(Mediator mediator, PropertyTable propertyTable, IUIAdapter adapter, ChoiceGroup parent)
     : base(mediator, propertyTable, adapter, null)
 {
     m_parent = parent;
 }
Beispiel #37
0
        /// -----------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="Mediator"/> class.
        /// </summary>
        /// -----------------------------------------------------------------------------------
        public Mediator()
        {
            m_propertyTable = new PropertyTable(this);
            m_MethodsOnAnyColleague = new Set<string>();
            //			m_allowCommandsToExecute = false;

            // NOTE: to set the trace level, create a config file like the following and set
            // it there. Values are: Off=0, Error=1, Warning=2, Info=3, Verbose=4.
            // <configuration>
            //	<system.diagnostics>
            //	   <switches>
            //		  <add name="Mediator" value="3" />
            //	   </switches>
            //	</system.diagnostics>
            // </configuration>

            // OR you can temporarily uncomment one of the following:

            //invokeSwitch.Level = TraceLevel.Info;	//some output. Will tell you what methods are being invoke, on whom.

            //NB: To make this much use, you'll need to disable the IDLE processing in XWindow.
            //otherwise, XCore will spend all of its time tracing things here during idle time
            //	and you won't be able to find the bug You are seeking.

            /* -----------------------------------------------------------------
             * TraceLevel.Verbose will show something like this (BUT SO MUCH IT'S HARDLY USEABLE):

              Looking for listeners for Msg: DisplayWritingSystemList
                [XCore.MockupDialogLauncher
                    {XCore.MockupDialogLauncher
                        Checking : XCore.MockupDialogLauncher
                    }
                ]
                [SIL.FieldWorks.WordWorks.Parser.ParserListener
                    {SIL.FieldWorks.WordWorks.Parser.ParserListener
                        Checking : SIL.FieldWorks.WordWorks.Parser.ParserListener
                    }
                ]

                [SIL.FieldWorks.XWorks.WritingSystemListHandler
                    {SIL.FieldWorks.XWorks.WritingSystemListHandler
                        Checking : SIL.FieldWorks.XWorks.WritingSystemListHandler
                        Invoking method: SIL.FieldWorks.XWorks.WritingSystemListHandler
                        Invoking Method: OnDisplayWritingSystemList on SIL.FieldWorks.XWorks.WritingSystemListHandler
                    }
                ]
            */
        }
		/// <summary>
		/// create a PersistenceProvider which uses the XCore PropertyTable.
		/// </summary>
		/// <param name="propertyTable"></param>
		public PersistenceProvider(PropertyTable propertyTable)
		{
			m_contextString= "Default";
			m_propertyTable = propertyTable;
		}
Beispiel #39
0
        /// <summary>
        /// Common init of the dialog, whether or not we have a starting lex entry.
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="wp"></param>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        public override void SetDlgInfo(LcmCache cache, WindowParams wp, Mediator mediator, XCore.PropertyTable propertyTable)
        {
            CheckDisposed();

            base.SetDlgInfo(cache, wp, mediator, propertyTable);
            // This is needed to make the replacement MatchingEntriesBrowser visible:
            Controls.SetChildIndex(m_matchingObjectsBrowser, 0);

            m_fwcbAllomorphs.WritingSystemFactory = cache.WritingSystemFactory;
            m_fwcbAllomorphs.WritingSystemCode    = cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.Handle;
            // For a resizeable dialog, we don't want AdjustForStylesheet to really change its size,
            // because then it ends up growing every time it launches!
            int oldHeight = Height;

            m_fwcbAllomorphs.AdjustForStyleSheet(this, grplbl, propertyTable);
            Height = oldHeight;
        }
Beispiel #40
0
 /// <summary>
 /// Init the dialog with a POS.
 /// If a new feature structure is created, it will currently be in the ReferenceForms of the POS.
 /// Eventually we want to make a new field for this purpose. (This is used by bulk edit
 /// to store previously used feature structures.)
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="mediator"></param>
 /// <param name="propertyTable"></param>
 /// <param name="pos"></param>
 public void SetDlgInfo(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable, IPartOfSpeech pos)
 {
     SetDlgInfo(cache, mediator, propertyTable, pos, PartOfSpeechTags.kflidReferenceForms);
 }
		/// <summary>
		/// Store in the property table what needs to be there so that we will use the specified set of scripture
		/// texts as 'interesting'.
		/// </summary>
		/// <param name="propertyTable"></param>
		public static void SetScriptureTextsInPropertyTable(PropertyTable propertyTable, IEnumerable<IStText> texts)
		{
			propertyTable.SetProperty(PersistPropertyName, MakeIdList(texts.Cast<ICmObject>()));
		}
		/// <summary>
		/// create a PersistenceProvider which uses the XCore PropertyTable.
		/// </summary>
		/// <param name="context">used to provide persistence and access to settings
		/// limited to a particular context. For example, if they control is used in
		/// three different places, we don't necessarily want to control to use the
		/// same settings each time. So each case would need its own context string.</param>
		/// <param name="propertyTable"></param>
		public PersistenceProvider(string context, PropertyTable propertyTable)
		{
			m_contextString= context;
			m_propertyTable = propertyTable;
		}
Beispiel #43
0
		/// <summary>
		/// get the value for our virtual handler from the property table.
		/// </summary>
		/// <param name="pt"></param>
		/// <returns></returns>
		private string GetPropertyTableValue(PropertyTable pt)
		{
			if (pt == null)
				return null;
			return pt.GetStringProperty(m_propertyTableKey, null);
		}
Beispiel #44
0
 public override void SetDlgInfo(LcmCache cache, WindowParams wp, Mediator mediator, XCore.PropertyTable propertyTable, string form)
 {
     SetDlgInfo(cache, wp, mediator, propertyTable, form, cache.DefaultAnalWs);
 }
Beispiel #45
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public MSAPopupTreeManager(PopupTree popupTree, LcmCache cache, ICmPossibilityList list,
                            int ws, bool useAbbr, Mediator mediator, XCore.PropertyTable propertyTable, Form parent)
     : base(popupTree, cache, mediator, propertyTable, list, ws, useAbbr, parent)
 {
     LoadStrings();
 }
Beispiel #46
0
        /// <summary>
        /// when calling the dialog from an "Insert Variant" context this
        /// constructor is used to indicate that m_startingEntry is a componentLexeme
        /// rather than the variant
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        /// <param name="componentLexeme">the entry we wish to find or create a variant for.</param>
        protected void SetDlgInfoForComponentLexeme(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable, IVariantComponentLexeme componentLexeme)
        {
            m_fBackRefToVariant = true;
            ILexEntry startingEntry;

            if (componentLexeme.ClassID == LexEntryTags.kClassId)
            {
                startingEntry = componentLexeme as ILexEntry;
            }
            else
            {
                startingEntry = componentLexeme.Owner as ILexEntry;
            }
            SetDlgInfo(cache, mediator, propertyTable, startingEntry);
            // we are looking for an existing variant form
            // so hide the Entry/Sense radio group box.
            grplbl.Visible = false;
            // also hide variant type.
            tcVariantTypes.Visible = false;
            lblVariantType.Visible = false;
            m_fGetVariantEntryTypeFromTreeCombo = false;
            lblCreateEntry.Visible = false;

            // The dialog title and other labels need to reflect "Insert Variant" context.
            m_formLabel.Text = LexTextControls.ks_Variant;
            Text             = LexTextControls.ksFindVariant;
            m_btnInsert.Text = LexTextControls.ks_Create;
            // We disable the "Create" button when we don't have text in the Find textbox.
            UpdateButtonCreateNew();
        }