Beispiel #1
0
        /// <summary>
        /// Sets the title string to an appropriate default when nothing is specified in the xml configuration for the view
        /// </summary>
        protected virtual void SetInfoBarText()
        {
            if (m_informationBar == null)
            {
                return;
            }
            string className = StringTable.Table.GetString("No Record", "Misc");

            if (Clerk.CurrentObject != null)
            {
                using (var uiObj = CmObjectUi.MakeUi(Clerk.CurrentObject))
                    className = uiObj.DisplayNameOfClass;
            }
            else
            {
                string emptyTitleId = XmlUtils.GetAttributeValue(m_configurationParameters, "emptyTitleId");
                if (!String.IsNullOrEmpty(emptyTitleId))
                {
                    string titleStr;
                    XmlViewsUtils.TryFindString("EmptyTitles", emptyTitleId, out titleStr);
                    if (titleStr != "*" + emptyTitleId + "*")
                    {
                        className = titleStr;
                    }
                    Clerk.UpdateStatusBarRecordNumber(titleStr);
                }
            }
            // This code:  ((IPaneBar)m_informationBar).Text = className;
            // causes about 47 of the following exceptions when executed in Flex.
            // First-chance exception at 0x4ed9b280 in Flex.exe: 0xC0000005: Access violation writing location 0x00f90004.
            // The following code doesn't cause the exception, but neither one actually sets the Text to className,
            // so something needs to be changed somewhere. It doesn't enter "override string Text" in PaneBar.cs
            ((IPaneBar)m_informationBar).Text = className;
        }
Beispiel #2
0
        protected virtual void SetInfoBarText()
        {
            if (m_informationBar == null)
            {
                return;
            }
            string className = StringTbl.GetString("No Record", "Misc");

            if (Clerk.CurrentObject != null)
            {
                string typeName = Clerk.CurrentObject.GetType().Name;
                if (Clerk.CurrentObject is ICmPossibility)
                {
                    var possibility = Clerk.CurrentObject as ICmPossibility;
                    className = possibility.ItemTypeName(StringTbl);
                }
                else
                {
                    className = StringTbl.GetString(typeName, "ClassNames");
                }
                if (className == "*" + typeName + "*")
                {
                    className = typeName;
                }
            }
            else
            {
                string emptyTitleId = XmlUtils.GetAttributeValue(m_configurationParameters, "emptyTitleId");
                if (!String.IsNullOrEmpty(emptyTitleId))
                {
                    string titleStr;
                    XmlViewsUtils.TryFindString(StringTbl, "EmptyTitles", emptyTitleId, out titleStr);
                    if (titleStr != "*" + emptyTitleId + "*")
                    {
                        className = titleStr;
                    }
                    Clerk.UpdateStatusBarRecordNumber(titleStr);
                }
            }
            // This code:  ((IPaneBar)m_informationBar).Text = className;
            // causes about 47 of the following exceptions when executed in Flex.
            // First-chance exception at 0x4ed9b280 in Flex.exe: 0xC0000005: Access violation writing location 0x00f90004.
            // The following code doesn't cause the exception, but neither one actually sets the Text to className,
            // so something needs to be changed somewhere. It doesn't enter "override string Text" in PaneBar.cs
            (m_informationBar as IPaneBar).Text = className;
        }
Beispiel #3
0
        private void SetInfoBarText(XmlNode handlerNode, PaneBar infoBar)
        {
            var titleStr = string.Empty;
            // See if we have an AlternativeTitle string table id for an alternate title.
            var titleId = XmlUtils.GetAttributeValue(handlerNode, "altTitleId");

            if (titleId != null)
            {
                XmlViewsUtils.TryFindString("AlternativeTitles", titleId, out titleStr);
                // if they specified an altTitleId, but it wasn't found, they need to do something,
                // so just return *titleId*
                if (titleStr == null)
                {
                    titleStr = titleId;
                }
            }
            infoBar.Text = titleStr;
        }
Beispiel #4
0
        protected override void SetInfoBarText()
        {
            if (m_informationBar == null)
            {
                return;
            }

            string titleStr = "";
            // See if we have an AlternativeTitle string table id for an alternate title.
            string titleId = XmlUtils.GetAttributeValue(m_configurationParameters,
                                                        "altTitleId");

            if (titleId != null)
            {
                XmlViewsUtils.TryFindString("AlternativeTitles", titleId, out titleStr);
                // if they specified an altTitleId, but it wasn't found, they need to do something,
                // so just return *titleId*
                if (Clerk.OwningObject != null && titleId.StartsWith("Reversal") &&
                    XmlUtils.GetBooleanAttributeValue(m_configurationParameters, "ShowOwnerShortname"))
                {
                    // Originally this option was added to enable Bulk Edit Reversal Entries title bar to show
                    // which reversal index was being shown. If the 'titleId.StartsWith("Reversal")' in the 'if'
                    // above is removed then the Word List Concordance shows the word being concorded in the
                    // right pane title bar.
                    titleStr = string.Format(xWorksStrings.ksXReversalIndex, Clerk.OwningObject.ShortName, titleStr);
                }
            }
            else if (Clerk.OwningObject != null)
            {
                if (XmlUtils.GetBooleanAttributeValue(m_configurationParameters,
                                                      "ShowOwnerShortname"))
                {
                    titleStr = Clerk.OwningObject.ShortName;
                }
            }
            if (String.IsNullOrEmpty(titleStr))
            {
                XmlViewsUtils.TryFindPluralFormFromFlid(Clerk.VirtualListPublisher.MetaDataCache,
                                                        Clerk.OwningFlid, out titleStr);
            }

            bool fBaseCalled = false;

            if (String.IsNullOrEmpty(titleStr))
            {
                base.SetInfoBarText();
                fBaseCalled = true;
//				titleStr = ((IPaneBar)m_informationBar).Text;	// can't get to work.
                // (EricP) For some reason I can't provide an IPaneBar get-accessor to return
                // the new Text value. If it's desirable to allow TitleFormat to apply to
                // Clerk.CurrentObject, then we either have to duplicate what the
                // base.SetInfoBarText() does here, or get the string set by the base.
                // for now, let's just return.
                if (string.IsNullOrEmpty(titleStr))
                {
                    return;
                }
            }

            // If we have a format attribute, format the title accordingly.
            string sFmt = XmlUtils.GetAttributeValue(m_configurationParameters,
                                                     "TitleFormat");

            if (sFmt != null)
            {
                titleStr = String.Format(sFmt, titleStr);
            }

            // if we haven't already set the text through the base,
            // or if we had some formatting to do, then set the infoBar text.
            if (!fBaseCalled || sFmt != null)
            {
                ((IPaneBar)m_informationBar).Text = titleStr;
            }
        }
Beispiel #5
0
        protected override void SetInfoBarText()
        {
            if (m_informationBar == null)
            {
                return;
            }

            string titleStr = "";
            // See if we have an AlternativeTitle string table id for an alternate title.
            string titleId = XmlUtils.GetAttributeValue(m_configurationParameters,
                                                        "altTitleId");

            if (titleId != null)
            {
                XmlViewsUtils.TryFindString(StringTbl, "AlternativeTitles", titleId, out titleStr);
                // if they specified an altTitleId, but it wasn't found, they need to do something,
                // so just return *titleId*
            }
            else if (Clerk.OwningObject != null)
            {
                if (XmlUtils.GetBooleanAttributeValue(m_configurationParameters,
                                                      "ShowOwnerShortname"))
                {
                    titleStr = Clerk.OwningObject.ShortName;
                }
            }
            if (String.IsNullOrEmpty(titleStr))
            {
                XmlViewsUtils.TryFindPluralFormFromFlid(Cache, StringTbl, (uint)Clerk.OwningFlid, out titleStr);
            }

            bool fBaseCalled = false;

            if (titleStr == string.Empty)
            {
                base.SetInfoBarText();
                fBaseCalled = true;
//				titleStr = ((IPaneBar)m_informationBar).Text;	// can't get to work.
                // (EricP) For some reason I can't provide an IPaneBar get-accessor to return
                // the new Text value. If it's desirable to allow TitleFormat to apply to
                // Clerk.CurrentObject, then we either have to duplicate what the
                // base.SetInfoBarText() does here, or get the string set by the base.
                // for now, let's just return.
                if (titleStr == null || titleStr == string.Empty)
                {
                    return;
                }
            }

            // If we have a format attribute, format the title accordingly.
            string sFmt = XmlUtils.GetAttributeValue(m_configurationParameters,
                                                     "TitleFormat");

            if (sFmt != null)
            {
                titleStr = String.Format(sFmt, titleStr);
            }

            // if we haven't already set the text through the base,
            // or if we had some formatting to do, then set the infoBar text.
            if (!fBaseCalled || sFmt != null)
            {
                ((IPaneBar)m_informationBar).Text = titleStr;
            }
        }