Ejemplo n.º 1
0
        private void SetNewStatus(IWfiAnalysis anal, int newStatus)
        {
            int currentStatus = anal.ApprovalStatusIcon;

            if (currentStatus == newStatus)
            {
                return;
            }

            UndoableUnitOfWorkHelper.Do(MEStrings.ksUndoChangingApprovalStatus,
                                        MEStrings.ksRedoChangingApprovalStatus, Cache.ActionHandlerAccessor,
                                        () =>
            {
                if (currentStatus == 1)
                {
                    anal.MoveConcAnnotationsToWordform();
                }
                anal.ApprovalStatusIcon = newStatus;
                if (newStatus == 1)
                {
                    // make sure default senses are set to be real values,
                    // since the user has seen the defaults, and approved the analysis based on them.
                    foreach (var mb in anal.MorphBundlesOS)
                    {
                        var currentSense = mb.SenseRA;
                        if (currentSense == null)
                        {
                            mb.SenseRA = mb.DefaultSense;
                        }
                    }
                }
            });

            // Wipe all of the old slices out, so we get new numbers and newly placed objects.
            // This fixes LT-5935. Also removes the need to somehow make the virtual properties like HumanApprovedAnalyses update.
            m_dataEntryForm.RefreshList(true);
        }
Ejemplo n.º 2
0
		private void SetNewStatus(IWfiAnalysis anal, int newStatus)
		{
			int currentStatus = anal.ApprovalStatusIcon;
			if (currentStatus == newStatus)
				return;

			UndoableUnitOfWorkHelper.Do(MEStrings.ksUndoChangingApprovalStatus,
				MEStrings.ksRedoChangingApprovalStatus, Cache.ActionHandlerAccessor,
				() =>
					{
						if (currentStatus == 1)
							anal.MoveConcAnnotationsToWordform();
						anal.ApprovalStatusIcon = newStatus;
						if (newStatus == 1)
						{
							// make sure default senses are set to be real values,
							// since the user has seen the defaults, and approved the analysis based on them.
							foreach (var mb in anal.MorphBundlesOS)
							{
								var currentSense = mb.SenseRA;
								if (currentSense == null)
									mb.SenseRA = mb.DefaultSense;
							}
						}
					});

			// Wipe all of the old slices out, so we get new numbers and newly placed objects.
			// This fixes LT-5935. Also removes the need to somehow make the virtual properties like HumanApprovedAnalyses update.
			m_dataEntryForm.RefreshList(true);
		}
Ejemplo n.º 3
0
		private void SetNewStatus(IWfiAnalysis anal, int newStatus)
		{
			// Getting the wordform's hvo here fixes: LT-5990 and its twin LT-5988.
			int wordformHvo = anal.OwnerHVO;
			int currentStatus = anal.ApprovalStatusIcon;
			if (currentStatus == newStatus)
				return;

			Cache.BeginUndoTask(MEStrings.ksUndoChangingApprovalStatus,
				MEStrings.ksRedoChangingApprovalStatus);
			if (currentStatus == 1)
				anal.MoveConcAnnotationsToWordform();
			anal.ApprovalStatusIcon = newStatus;
			if (newStatus == 1)
			{
				// make sure default senses are set to be real values,
				// since the user has seen the defaults, and approved the analysis based on them.
				foreach (IWfiMorphBundle mb in anal.MorphBundlesOS)
				{
					int currentSense = mb.SenseRAHvo;
					int defaultSense = mb.DefaultSense;
					if (currentSense == 0 && defaultSense > 0)
						mb.SenseRAHvo = defaultSense;
				}
			}
			Cache.EndUndoTask();

			// Remove it from the old virtual property.
			int oldVFlid = 0;
			switch (currentStatus)
			{
				case 0: // Unknown.
					oldVFlid = BaseVirtualHandler.GetInstalledHandlerTag(Cache, "WfiWordform", "HumanNoOpinionParses");
					break;
				case 1: // Approve.
					oldVFlid = BaseVirtualHandler.GetInstalledHandlerTag(Cache, "WfiWordform", "HumanApprovedAnalyses");
					break;
				case 2: // Disapprove.
					oldVFlid = BaseVirtualHandler.GetInstalledHandlerTag(Cache, "WfiWordform", "HumanDisapprovedParses");
					break;
			}
			Debug.Assert(oldVFlid != 0);
			Cache.PropChanged(null, PropChangeType.kpctNotifyAll, wordformHvo, oldVFlid, 0, 0, 1);

			// Add it to the new virtual property.
			int newVFlid = 0;
			switch (newStatus)
			{
				case 0: // Unknown.
					newVFlid = BaseVirtualHandler.GetInstalledHandlerTag(Cache, "WfiWordform", "HumanNoOpinionParses");
					break;
				case 1: // Approve.
					newVFlid = BaseVirtualHandler.GetInstalledHandlerTag(Cache, "WfiWordform", "HumanApprovedAnalyses");
					break;
				case 2: // Disapprove.
					newVFlid = BaseVirtualHandler.GetInstalledHandlerTag(Cache, "WfiWordform", "HumanDisapprovedParses");
					break;
			}
			Debug.Assert(newVFlid != 0);
			Cache.PropChanged(null, PropChangeType.kpctNotifyAll, wordformHvo, newVFlid, 0, 1, 0);

			// No need to do a PropChanged on "WfiWordform"-"UserCount" here,
			// since it gets done in ApprovalStatusIcon in FDO.

			// Wipe all of the old slices out,
			// so we get new numbers.
			// This fixes LT-5935.
			m_dataEntryForm.RefreshList(true);
		}
Ejemplo n.º 4
0
        private void SetNewStatus(IWfiAnalysis anal, int newStatus)
        {
            // Getting the wordform's hvo here fixes: LT-5990 and its twin LT-5988.
            int wordformHvo   = anal.OwnerHVO;
            int currentStatus = anal.ApprovalStatusIcon;

            if (currentStatus == newStatus)
            {
                return;
            }

            Cache.BeginUndoTask(MEStrings.ksUndoChangingApprovalStatus,
                                MEStrings.ksRedoChangingApprovalStatus);
            if (currentStatus == 1)
            {
                anal.MoveConcAnnotationsToWordform();
            }
            anal.ApprovalStatusIcon = newStatus;
            if (newStatus == 1)
            {
                // make sure default senses are set to be real values,
                // since the user has seen the defaults, and approved the analysis based on them.
                foreach (IWfiMorphBundle mb in anal.MorphBundlesOS)
                {
                    int currentSense = mb.SenseRAHvo;
                    int defaultSense = mb.DefaultSense;
                    if (currentSense == 0 && defaultSense > 0)
                    {
                        mb.SenseRAHvo = defaultSense;
                    }
                }
            }
            Cache.EndUndoTask();

            // Remove it from the old virtual property.
            int oldVFlid = 0;

            switch (currentStatus)
            {
            case 0:                     // Unknown.
                oldVFlid = BaseVirtualHandler.GetInstalledHandlerTag(Cache, "WfiWordform", "HumanNoOpinionParses");
                break;

            case 1:                     // Approve.
                oldVFlid = BaseVirtualHandler.GetInstalledHandlerTag(Cache, "WfiWordform", "HumanApprovedAnalyses");
                break;

            case 2:                     // Disapprove.
                oldVFlid = BaseVirtualHandler.GetInstalledHandlerTag(Cache, "WfiWordform", "HumanDisapprovedParses");
                break;
            }
            Debug.Assert(oldVFlid != 0);
            Cache.PropChanged(null, PropChangeType.kpctNotifyAll, wordformHvo, oldVFlid, 0, 0, 1);

            // Add it to the new virtual property.
            int newVFlid = 0;

            switch (newStatus)
            {
            case 0:                     // Unknown.
                newVFlid = BaseVirtualHandler.GetInstalledHandlerTag(Cache, "WfiWordform", "HumanNoOpinionParses");
                break;

            case 1:                     // Approve.
                newVFlid = BaseVirtualHandler.GetInstalledHandlerTag(Cache, "WfiWordform", "HumanApprovedAnalyses");
                break;

            case 2:                     // Disapprove.
                newVFlid = BaseVirtualHandler.GetInstalledHandlerTag(Cache, "WfiWordform", "HumanDisapprovedParses");
                break;
            }
            Debug.Assert(newVFlid != 0);
            Cache.PropChanged(null, PropChangeType.kpctNotifyAll, wordformHvo, newVFlid, 0, 1, 0);

            // No need to do a PropChanged on "WfiWordform"-"UserCount" here,
            // since it gets done in ApprovalStatusIcon in FDO.

            // Wipe all of the old slices out,
            // so we get new numbers.
            // This fixes LT-5935.
            m_dataEntryForm.RefreshList(true);
        }