FinishInit() public method

Call this on initialization when all properties (e.g., ConfigurationNode) are set. The purpose is when reusing the slice, when we may have to reconstruct the root box.
public FinishInit ( ) : void
return void
Example #1
0
        public void InnerViewRefreshesWhenRefreshIsPending()
        {
            ILexEntry entry = null;
            int       flid  = 5035001;      // MoForm flid

            NonUndoableUnitOfWorkHelper.Do(Cache.ActionHandlerAccessor, () =>
            {
                entry = Cache.ServiceLocator.GetInstance <ILexEntryFactory>().Create();
                IMoStemAllomorph morph = Cache.ServiceLocator.GetInstance <IMoStemAllomorphFactory>().Create();
                entry.LexemeFormOA     = morph;
            });

            Form dummyForm = new Form();
            LabeledMultiStringView view = new LabeledMultiStringView(entry.LexemeFormOA.Hvo, flid, WritingSystemServices.kwsVern, false, true);

            dummyForm.Controls.Add(view);
            InnerLabeledMultiStringView innerView = view.InnerView;

            view.FinishInit();
            innerView.Cache = Cache;

            // Access the Handle of the innerView to construct the RootBox.
            var handle = innerView.Handle;

            Assert.IsFalse(innerView.Visible);
            Assert.IsFalse(innerView.RefreshPending);
            view.WritingSystemsToDisplay =
                WritingSystemServices.GetWritingSystemList(Cache, WritingSystemServices.kwsVern, false);
            view.RefreshDisplay();
            // The flag gets set because the view is not yet visible, so the display cannot refresh.
            Assert.IsTrue(innerView.RefreshPending);
            // Trigger the display to refresh by making the form visible.
            dummyForm.Visible = true;
            Assert.IsFalse(innerView.RefreshPending);
            view.Dispose();
            NonUndoableUnitOfWorkHelper.Do(Cache.ActionHandlerAccessor, () => entry.Delete());
        }