Пример #1
0
 /// <summary>
 /// Shows the record.
 /// </summary>
 /// <param name="rni">The record navigation info.</param>
 protected virtual void ShowRecord(RecordNavigationInfo rni)
 {
     if (!rni.SkipShowRecord)
     {
         ShowRecord();
     }
 }
Пример #2
0
        public override bool OnRecordNavigation(object argument)
        {
            CheckDisposed();

            if (!m_fullyInitialized)
            {
                return(false);
            }
            if (RecordNavigationInfo.GetSendingClerk(argument) != Clerk)
            {
                return(false);
            }

            // persist Clerk's CurrentIndex in a db specific way
            string propName = Clerk.PersistedIndexProperty;

            m_mediator.PropertyTable.SetProperty(propName, Clerk.CurrentIndex, PropertyTable.SettingsGroup.LocalSettings);
            m_mediator.PropertyTable.SetPropertyPersistence(propName, true, PropertyTable.SettingsGroup.LocalSettings);
            var window = (XWindow)m_mediator.PropertyTable.GetValue("window");

            try
            {
                window.SuspendIdleProcessing();
                ShowRecord(argument as RecordNavigationInfo);
            }
            finally
            {
                window.ResumeIdleProcessing();
            }
            return(true);               //we handled this.
        }
Пример #3
0
        public virtual bool OnRecordNavigation(object argument)
        {
            CheckDisposed();

            if (!m_fullyInitialized ||
                RecordNavigationInfo.GetSendingClerk(argument) != Clerk)                    // Don't pretend to have handled it if it isn't our clerk.
            {
                return(false);
            }

            // persist Clerk's CurrentIndex in a db specific way
            string propName = Clerk.PersistedIndexProperty;

            m_mediator.PropertyTable.SetProperty(propName, Clerk.CurrentIndex, PropertyTable.SettingsGroup.LocalSettings);
            m_mediator.PropertyTable.SetPropertyPersistence(propName, true, PropertyTable.SettingsGroup.LocalSettings);

            Clerk.SuppressSaveOnChangeRecord = (argument as RecordNavigationInfo).SuppressSaveOnChangeRecord;
            using (WaitCursor wc = new WaitCursor(this))
            {
                //DateTime dt0 = DateTime.Now;
                try
                {
                    ShowRecord();
                }
                finally
                {
                    Clerk.SuppressSaveOnChangeRecord = false;
                }
                //DateTime dt1 = DateTime.Now;
                //TimeSpan ts = TimeSpan.FromTicks(dt1.Ticks - dt0.Ticks);
                //Debug.WriteLine("XmlDocView.OnRecordNavigation(): ShowRecord() took " + ts.ToString() + " at " + dt1.ToString());
            }
            return(true);               //we handled this.
        }
Пример #4
0
        public virtual bool OnRecordNavigation(object argument)
        {
            CheckDisposed();

            if (!m_fullyInitialized)
            {
                return(false);
            }
            // If it's not from our clerk, we may be intercepting a message intended for another pane.
            if (RecordNavigationInfo.GetSendingClerk(argument) != Clerk)
            {
                return(false);
            }

            Clerk.SuppressSaveOnChangeRecord = (argument as RecordNavigationInfo).SuppressSaveOnChangeRecord;
            try
            {
                ShowRecord(argument as RecordNavigationInfo);
            }
            finally
            {
                Clerk.SuppressSaveOnChangeRecord = false;
            }
            return(true);               //we handled this.
        }
Пример #5
0
 /// <summary>
 /// Schedules the record to be shown when the application is idle.
 /// </summary>
 /// <param name="rni">The record navigation info.</param>
 protected override void ShowRecord(RecordNavigationInfo rni)
 {
     if (!rni.SkipShowRecord)
     {
         m_mediator.IdleQueue.Add(IdleQueuePriority.High, ShowRecordOnIdle, rni);
     }
 }
Пример #6
0
        /// <summary>
        /// Record browse view implements ShowRecord by scrolling to show the current record. However,
        /// that may well not be all the response to selecting that record in the Clerk: for example,
        /// another pane may show a more detailed view of the selected record. Therefore, RecordBrowseView
        /// never claims to have 'handled' this event.
        /// </summary>
        /// <param name="argument"></param>
        /// <returns>
        /// false; we didn't fully handle it, even though we may have done something.
        /// </returns>
        public override bool OnRecordNavigation(object argument)
        {
            CheckDisposed();

            // Can't do anything if it isn't fully initialized,
            // and we don't want to do anything, if we are told not to.
            if (!m_fullyInitialized || m_suppressRecordNavigation)
            {
                return(false);
            }
            Debug.Assert(m_browseViewer != null, "RecordBrowseView.SetupDataContext() has to be called before RecordBrowseView.OnRecordNavigation().");

            if (m_browseViewer == null || m_browseViewer.BrowseView == null || m_browseViewer.BrowseView.RootBox == null)
            {
                return(false);                // can't do anything useful without a root box to select in.
            }
            var rni = (RecordNavigationInfo)argument;

            m_suppressShowRecord       = rni.SkipShowRecord;
            m_suppressRecordNavigation = rni.SuppressSaveOnChangeRecord;
            bool bvEnabled = m_browseViewer.Enabled;

            if (rni.SuppressFocusChange && bvEnabled)
            {
                m_browseViewer.Enabled = false;
            }
            try
            {
                RecordClerk clerk        = Clerk;
                RecordClerk sendingClerk = RecordNavigationInfo.GetSendingClerk(argument);
                // NOTE: If the clerk's current index is less than zero,
                // or greater than the number of objects in the vector,
                // SelectedIndex will assert in a debug build,
                // and throw an exception in a release build.
                if (clerk != null && sendingClerk == clerk && clerk.IsActiveInGui)
                {
                    m_browseViewer.SelectedIndex = clerk.CurrentIndex;
                    // go ahead and SetInfoBarText even if we didn't change indices
                    // we may have changed objects or root object classes (from Entries to Senses)
                    SetInfoBarText();
                }
                //base.OnRecordNavigation(argument);
            }
            finally
            {
                m_suppressShowRecord       = false;
                m_suppressRecordNavigation = false;
                if (rni.SuppressFocusChange && bvEnabled)
                {
                    m_browseViewer.Enabled = true;
                }
            }

            return(false);
        }
Пример #7
0
 /// <summary>
 /// Schedules the record to be shown when the application is idle.
 /// </summary>
 /// <param name="rni">The record navigation info.</param>
 protected override void ShowRecord(RecordNavigationInfo rni)
 {
     if (!rni.SkipShowRecord)
     {
         if (m_mediator.PropertyTable.GetBoolProperty("DoingAutomatedTest", false))
         {
             ShowRecordOnIdle(rni.SuppressSaveOnChangeRecord);
         }
         else
         {
             m_mediator.IdleQueue.Add(IdleQueuePriority.High, ShowRecordOnIdle, rni);
         }
     }
 }
Пример #8
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="argument"></param>
            /// <returns>
            /// true; we fully handled it.
            /// </returns>
            public bool OnRecordNavigation(object argument)
            {
                RecordNavigationInfo rni   = argument as RecordNavigationInfo;
                RecordClerk          clerk = rni.Clerk;
                string clerkId             = clerk.Id;
                string myClerkId           = m_configurationNode.SelectSingleNode("parameters").Attributes["clerk"].Value;

                if (clerk.Id == myClerkId)
                {
                    MainControl.SelectedFinder = rni.Clerk.CurrentObject;

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
Пример #9
0
        protected void  SetInitialWord()
        {
            SetFontInfo();

            string sCurrentControl = m_mediator.PropertyTable.GetStringProperty("currentContentControl", null);

            if (sCurrentControl != null)
            {
                if (sCurrentControl != "Analyses" && sCurrentControl != "wordListConcordance")
                {
                    // use the last wordform used in Try A Word if we're not in a control that lists out wordforms
                    GetLastWordUsed();
                    return;
                }
            }
            // we are in a control that lists out wordforms; try to get that wordform
            Object x = m_mediator.PropertyTable.GetValue("concordanceWords-selected");

            if (x == null)
            {
                // nothing set or no wordforms to use yet
                GetLastWordUsed();
                return;
            }

            WfiWordform          wordform = null;
            RecordNavigationInfo info     = x as RecordNavigationInfo;

            if (info != null)
            {
                wordform = info.Clerk.CurrentObject as WfiWordform;
            }
            if (wordform == null)
            {
                // can't find the selected wordform
                GetLastWordUsed();
                return;
            }
            SetWordToUse(wordform.Form.VernacularDefaultWritingSystem);
        }
Пример #10
0
        public virtual bool OnRecordNavigation(object argument)
        {
            CheckDisposed();

            if (!m_fullyInitialized)
            {
                return(false);
            }
            // If it's not from our clerk, we may be intercepting a message intended for another pane.
            if (RecordNavigationInfo.GetSendingClerk(argument) != Clerk)
            {
                return(false);
            }

            var rni     = argument as RecordNavigationInfo;
            var options = new RecordClerk.ListUpdateHelper.ListUpdateHelperOptions();

            options.SuppressSaveOnChangeRecord = rni.SuppressSaveOnChangeRecord;
            using (new RecordClerk.ListUpdateHelper(Clerk, options))
                ShowRecord(rni);
            return(true);               //we handled this.
        }
Пример #11
0
 /// <summary>
 /// If this is not the focused pane in a multipane suppress, or if the navigation info requested
 /// a suppression of the focus change then return true (suppress)
 /// </summary>
 /// <param name="rni"></param>
 /// <returns></returns>
 private bool ShouldSuppressFocusChange(RecordNavigationInfo rni)
 {
     return(!IsFocusedPane || rni.SuppressFocusChange);
 }