Exemple #1
0
        //
        // Constructor
        //

        public AasPayloadStructuralChangeItem(
            ChangeReason reason,
            AdminShell.KeyList path = null)
        {
            Reason = reason;
            Path = path;
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChangeSet{TObject, TKey}"/> class.
 /// </summary>
 /// <param name="reason">The reason.</param>
 /// <param name="key">The key.</param>
 /// <param name="current">The current.</param>
 /// <param name="previous">The previous.</param>
 private ChangeSet(ChangeReason reason, TKey key, TObject current, Optional <TObject> previous)
 {
     Items = new List <Change <TObject, TKey> >
     {
         new Change <TObject, TKey>(reason, key, current, previous)
     };
 }
        /// <inheritdoc />
        public override void ReadPseudoEncoding(Stream transportStream, Rectangle rectangle)
        {
            // Did we just learn that the server supports this extension?
            if (!_state.ServerSupportsExtendedDesktopSize)
            {
                _logger.LogDebug("Server supports the extended desktop size extension.");

                // Mark the SetDesktopSize message as used
                _state.EnsureMessageTypeIsMarkedAsUsed <IOutgoingMessageType>(null, (byte)WellKnownOutgoingMessageType.SetDesktopSize);

                _state.ServerSupportsExtendedDesktopSize = true;
            }

            // Get the reason why this encoding type was received
            ChangeReason changeReason = rectangle.Position.X switch {
                1 => ChangeReason.ChangeByCurrentClient,
                2 => ChangeReason.ChangeByOtherClient,
                var _ => ChangeReason.ServerSideChangeOrStatusUpdate
            };

            // If the client previously requested a size change that failed, the y coordinate contains the status code
            int statusCode = rectangle.Position.Y;

            if (changeReason == ChangeReason.ChangeByCurrentClient && statusCode != 0)
            {
                _logger.LogWarning("Server responded to a previously requested desktop size change with an error: " + statusCode switch {
                    1 => "Resize is administratively prohibited",
                    2 => "Out of resources",
                    3 => "Invalid screen layout",
                    var _ => $"Unknown failure, status code: {statusCode}"
                });
Exemple #4
0
        public void _OnCloudChange(string[] changedKeys, ChangeReason changeReason)
        {
            Log("Cloud._OnCloudChange(`" + changedKeys + "`, `" + changeReason + "`)");

            // Populate latest change reason.
            latestChangeReason = changeReason;

            // Lookup delegates if any.
            if (onCloudChange != null)
            {
                Should should = onCloudChange(changedKeys, changeReason);
                if (should == Should.StopUpdateKeys)
                {
                    return;
                }
            }

            // Enumerate changed keys.
            foreach (string eachChangedKey in changedKeys)
            {
                // Lookup corresponding key value pair models.
                foreach (Model.KeyValuePair eachKeyValuePair in settings.keyValuePairs)
                {
                    // Invoke event (if any).
                    if (eachKeyValuePair.key == eachChangedKey)
                    {
                        eachKeyValuePair.InvokeOnValueChangedAction();
                    }
                }
            }
        }
Exemple #5
0
 public ReadChangeJournalOptions(Usn?initialUSN, ChangeReason reasonFilter, bool returnOnlyOnClose, TimeSpan timeout)
 {
     InitialUSN        = initialUSN;
     ReasonFilter      = reasonFilter;
     ReturnOnlyOnClose = returnOnlyOnClose;
     Timeout           = timeout < TimeSpan.Zero ? TimeSpan.Zero : timeout;
 }
Exemple #6
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="T:System.Object" /> class.
 /// </summary>
 public ChangeWithGroup(Change <TObject, TKey> change, Func <TObject, TGroupKey> keySelector)
 {
     _groupKey = keySelector(change.Current);
     _item     = change.Current;
     _key      = change.Key;
     _reason   = change.Reason;
 }
        private void InitViewBag(StockChangeComplex info)
        {
            // 異動原因
            ViewBag.ChangeReasonList =
                new SelectList(ChangeReason.GetAll(), "value", "Text", info?.StockChange?.ChangeReasonID);

            // 異動原因
            ViewBag.WarehouseList =
                new SelectList(this._GlobalService.GetWarehouseList(), "Key", "Value", null);

            // 異動原因
            ViewBag.WarehouseOldList =
                new SelectList(this._GlobalService.GetWarehouseList(), "Key", "Value", info?.StockChange?.WarehouseOldID);

            // 異動原因
            ViewBag.WarehouseNewList =
                new SelectList(this._GlobalService.GetWarehouseList(), "Key", "Value", info?.StockChange?.WarehouseOldID);

            // 使用者
            ViewBag.UserList =
                new SelectList(this._GlobalService.GetUserList(), "Key", "Value", null);

            // 經手人
            ViewBag.UserList =
                new SelectList(this._GlobalService.GetUserList(), "Value", "Display", info?.StockChange?.ChangePersonID);

            // 產品類別
            ViewBag.ProductKindList =
                new SelectList(this._GlobalService.GetProductKindList(), "Value", "Text");
        }
        Cloud.Should OnCloudChange(string[] changedKeys, ChangeReason changeReason)
        {
            if (changeReason == ChangeReason.InitialSyncChange)
            {
                PopulateElementsFromCloud();
                return(Cloud.Should.StopUpdateKeys);
            }

            if (changeReason == ChangeReason.QuotaViolationChange)
            {
                // May display error.
                return(Cloud.Should.StopUpdateKeys);
            }

            if (changeReason == ChangeReason.AccountChange)
            {
                PopulateElementsFromCloud();
                return(Cloud.Should.StopUpdateKeys);
            }

            else
            {
                // Let local states to be updated (with conflict resolution).
                return(Cloud.Should.UpdateKeys);
            }
        }
Exemple #9
0
            private static Exception CreateMissingKeyException(ChangeReason reason, TKey key)
            {
                var message = $"{key} is missing from previous group on {reason}." +
                              $"{Environment.NewLine}Object type {typeof(TObject)}, Key type {typeof(TKey)}, Group key type {typeof(TGroupKey)}";

                return(new MissingKeyException(message));
            }
        // ReSharper disable once MemberCanBePrivate.Global
        public static IEnumerable <object[]> ConstrainFirstValue(ChangeReason constraint, ChangeReason[] othersExcept)
        {
            var constrainedValue = _changes.Single(c => c.Reason == constraint);
            var others           = _changes.Where(c => c.Reason != constraint && !othersExcept.Contains(c.Reason));

            return(others.Select(other => new object[] { constrainedValue, other }));
        }
Exemple #11
0
        public string Dump()
        {
            var dump = "Change:\n";

            dump += "\tChangeReason: " + ChangeReason.ToString() + " , OwnerId: " + OwnerId + "\n";
            dump += "\tOldState: " + UndoObjectState.Dump() + "\n";
            dump += "\tNewState: " + RedoObjectState.Dump() + "\n";
            return(dump);
        }
Exemple #12
0
        public IEnumerable <JournalEntry> GetEntries(Usn currentUSN, ChangeReason reasonFilter, bool returnOnlyOnClose, TimeSpan timeout)
        {
            if (currentUSN < Data.FirstUSN || currentUSN > Data.MaximumUSN)
            {
                throw new ArgumentOutOfRangeException(nameof(currentUSN));
            }

            return(new ChangeJournalEntries(this, new ReadChangeJournalOptions(currentUSN, reasonFilter, returnOnlyOnClose, timeout)));
        }
Exemple #13
0
 private static ChangedMethod GetChangedMethod(MemberReference operand, ChangeReason changeStatus)
 {
     var changedMethod = new ChangedMethod();
     changedMethod.ChangeReason = changeStatus;
     changedMethod.AssemblyName = operand.DeclaringType.Scope.Name;
     changedMethod.NamespaceName = operand.DeclaringType.Namespace;
     changedMethod.ClassName = operand.DeclaringType.Name;
     changedMethod.MethodName = operand.Name;
     return changedMethod;
 }
Exemple #14
0
        public void TestChangeReason(string input, ChangeReason changeReason)
        {
            var target = new LocationParser();

            var result = target.Parse(input, out var message);

            Assert.IsNull(message);
            Assert.AreEqual(changeReason, result.ChangeReason);
            Assert.IsTrue(result.ChangeDetails.Length == 0);
        }
 // Remote data store calls this once its processed the OnCloudDataChanged message
 public void RemoteKeysChanged(string[] keys, ChangeReason reason)
 {
     Debug.Log("VrsCloudPrefs: RemoteKeysChanged()");
     if (automaticSync)
     {
         foreach (string key in keys)
         {
             localStore.SetString(key, remoteStore.GetString(key, localStore.GetString(key)));
         }
     }
 }
Exemple #16
0
        //
        // Constructor
        //

        public AasPayloadStructuralChangeItem(
            ulong count,
            DateTime timeStamp,
            ChangeReason reason,
            AdminShell.KeyList path = null,
            string data             = null)
        {
            Count     = count;
            TimeStamp = timeStamp;
            Reason    = reason;
            Path      = path;
            Data      = data;
        }
        public override void CloudDidChange(string message)
        {
            base.Log("Cloud_iOS.CloudDidChange(`" + message + "`)");
            UserInfo objectToOverwrite = new UserInfo();

            JsonUtility.FromJsonOverwrite(message, objectToOverwrite);
            ChangeReason nSUbiquitousKeyValueStoreChangeReasonKey = (ChangeReason)objectToOverwrite.NSUbiquitousKeyValueStoreChangeReasonKey;

            string[] nSUbiquitousKeyValueStoreChangedKeysKey = objectToOverwrite.NSUbiquitousKeyValueStoreChangedKeysKey;
            base.Log("Cloud_iOS.CloudDidChange.changeReason: `" + nSUbiquitousKeyValueStoreChangeReasonKey + "`");
            base.Log("Cloud_iOS.CloudDidChange.changedKeys: `" + nSUbiquitousKeyValueStoreChangedKeysKey + "`");
            base.cloudObject._OnCloudChange(nSUbiquitousKeyValueStoreChangedKeysKey, nSUbiquitousKeyValueStoreChangeReasonKey);
        }
Exemple #18
0
 private EPPZ.Cloud.Cloud.Should OnCloudChange(string[] changedKeys, ChangeReason changeReason)
 {
     if (changeReason == ChangeReason.InitialSyncChange)
     {
         this.PopulateElementsFromCloud();
         return(EPPZ.Cloud.Cloud.Should.StopUpdateKeys);
     }
     if (changeReason == ChangeReason.QuotaViolationChange)
     {
         return(EPPZ.Cloud.Cloud.Should.StopUpdateKeys);
     }
     if (changeReason == ChangeReason.AccountChange)
     {
         this.PopulateElementsFromCloud();
         return(EPPZ.Cloud.Cloud.Should.StopUpdateKeys);
     }
     return(EPPZ.Cloud.Cloud.Should.UpdateKeys);
 }
Exemple #19
0
 public void _OnCloudChange(string[] changedKeys, ChangeReason changeReason)
 {
     Log(string.Concat(new object[] { "Cloud._OnCloudChange(`", changedKeys, "`, `", changeReason, "`)" }));
     this.latestChangeReason = changeReason;
     if ((onCloudChange == null) || (onCloudChange(changedKeys, changeReason) != Should.StopUpdateKeys))
     {
         foreach (string str in changedKeys)
         {
             foreach (EPPZ.Cloud.Model.KeyValuePair pair in this.settings.keyValuePairs)
             {
                 if (pair.key == str)
                 {
                     pair.InvokeOnValueChangedAction();
                 }
             }
         }
     }
 }
        public override void CloudDidChange(string message)
        {
            Log("Cloud_iOS.CloudDidChange(`" + message + "`)");

            // Parse JSON.
            iOS.UserInfo userInfo = new iOS.UserInfo();
            JsonUtility.FromJsonOverwrite(message, userInfo);

            // Get notification payload.
            ChangeReason changeReason = (ChangeReason)userInfo.NSUbiquitousKeyValueStoreChangeReasonKey;

            string[] changedKeys = userInfo.NSUbiquitousKeyValueStoreChangedKeysKey;

            Log("Cloud_iOS.CloudDidChange.changeReason: `" + changeReason + "`");
            Log("Cloud_iOS.CloudDidChange.changedKeys: `" + changedKeys + "`");

            // Callback.
            cloudObject._OnCloudChange(changedKeys, changeReason);
        }
Exemple #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Change{TObject, TKey}"/> struct.
        /// </summary>
        /// <param name="reason">The reason.</param>
        /// <param name="key">The key.</param>
        /// <param name="current">The current.</param>
        /// <param name="previous">The previous.</param>
        /// <param name="currentIndex">Value of the current.</param>
        /// <param name="previousIndex">Value of the previous.</param>
        /// <exception cref="System.ArgumentException">
        /// For ChangeReason.Add, a previous value cannot be specified
        /// or
        /// For ChangeReason.Change, must supply previous value
        /// </exception>
        public Change(ChangeReason reason, TKey key, TObject current, Optional <TObject> previous, int currentIndex = -1, int previousIndex = -1)
            : this()
        {
            Current       = current;
            Previous      = previous;
            Key           = key;
            Reason        = reason;
            CurrentIndex  = currentIndex;
            PreviousIndex = previousIndex;

            if (reason == ChangeReason.Add && previous.HasValue)
            {
                throw new ArgumentException("For ChangeReason.Add, a previous value cannot be specified");
            }

            if (reason == ChangeReason.Update && !previous.HasValue)
            {
                throw new ArgumentException("For ChangeReason.Change, must supply previous value");
            }
        }
Exemple #22
0
        /// <summary>
        /// Construtor for ChangeReason.Move
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="current">The current.</param>
        /// <param name="currentIndex">The CurrentIndex.</param>
        /// <param name="previousIndex">CurrentIndex of the previous.</param>
        /// <exception cref="System.ArgumentException">
        /// CurrentIndex must be greater than or equal to zero
        /// or
        /// PreviousIndex must be greater than or equal to zero
        /// </exception>
        public Change(TKey key, TObject current, int currentIndex, int previousIndex)
            : this()
        {
            if (currentIndex < 0)
            {
                throw new ArgumentException("CurrentIndex must be greater than or equal to zero");
            }

            if (previousIndex < 0)
            {
                throw new ArgumentException("PreviousIndex must be greater than or equal to zero");
            }

            _current       = current;
            _previous      = Optional.None <TObject>();
            _key           = key;
            _reason        = ChangeReason.Moved;
            _currentIndex  = currentIndex;
            _previousIndex = previousIndex;
        }
Exemple #23
0
        public virtual bool MoveNext()
        {
            string[] fs;
            if (_IsPrefeched)
            {
                fs           = _PrefetchBuffer;
                _IsPrefeched = false;
            }
            else
            {
                if (!_Parser.ReadAndCopyTo(ref _Buffer))
                {
                    return(false);
                }
                fs = _Buffer;
            }

            CityCode = string.Intern(fs[0]);
            ZipCode5 = string.Intern(fs[1]);
            ZipCode7 = fs[2];

            PrefectureKana = string.Intern(fs[3]);
            CityKana       = string.Intern(fs[4]);
            LocalityKana   = string.Intern(fs[5]);

            Prefecture = string.Intern(fs[6]);
            City       = string.Intern(fs[7]);
            Locality   = string.Intern(fs[8]);

            LocalityHasMultipleZipCodes = _BooleanPattern.IsMatch(fs[9]);
            IsPartitionedBySublocality  = _BooleanPattern.IsMatch(fs[10]);
            HasChome = _BooleanPattern.IsMatch(fs[11]);
            ZipCodeHasMultipleLocalities = _BooleanPattern.IsMatch(fs[12]);
            ChangeType   = Enum.TryParse(fs[13], out ChangeType ct) ? ct : ChangeType.NotChanged;
            ChangeReason = Enum.TryParse(fs[14], out ChangeReason cr) ? cr : ChangeReason.NotChanged;

            OnRead();

            return(true);
        }
Exemple #24
0
 /// <summary>
 /// Ctor for InsertAt or RemoveAt
 /// </summary>
 /// <param name="changeReason"></param>
 /// <param name="ownerId"></param>
 /// <param name="objectState"></param>
 /// <param name="indexAt">Index where the object should be inserted or removed from.</param>
 public Change(ChangeReason changeReason, int ownerId, int itemId, IUndoable objectState, int indexAt)
 {
     if (changeReason == ChangeReason.InsertAt)
     {
         UndoObjectState = objectState;
         RedoObjectState = objectState;
     }
     else if (changeReason == ChangeReason.RemoveAt)
     {
         UndoObjectState = objectState;
         RedoObjectState = objectState;
     }
     else
     {
         throw new InvalidOperationException("Only " + ChangeReason.InsertAt + " and " + ChangeReason.RemoveAt +
                                             " allowed for this constructor.");
     }
     ChangeReason = changeReason;
     OwnerId      = ownerId;
     ItemId       = itemId;
     IndexAt      = indexAt;
 }
Exemple #25
0
        private static void StoreDidChangeHandler(IntPtr self, IntPtr _cmd, IntPtr notification)
        {
            storeDidChange = true;
            IntPtr userInfo = intptr_objc_msgSend(notification, selUserInfo);

            // Get change reason
            IntPtr changeReasonNSNumber = intptr_objc_msgSend(
                userInfo,
                selValueForKey,
                UTF8ToNSString("NSUbiquitousKeyValueStoreChangeReasonKey")
                );

            changeReason = (ChangeReason)long_objc_msgSend(
                changeReasonNSNumber,
                selLongLongValue
                );

            // Get changed keys
            IntPtr nsarr = intptr_objc_msgSend(
                userInfo,
                selValueForKey,
                UTF8ToNSString("NSUbiquitousKeyValueStoreChangedKeysKey")
                );
            ulong arrlen = ulong_objc_msgSend(nsarr, selCount);

            keysChanged = new string[arrlen];
            for (ulong i = 0; i < arrlen; i += 1)
            {
                IntPtr nsstr = intptr_objc_msgSend(
                    nsarr,
                    selObjectAtIndex,
                    i
                    );

                keysChanged[i] = NSStringToUTF8(nsstr);
            }
        }
Exemple #26
0
        /// <summary>
        /// Refresh the task pane based on some event.
        /// </summary>
        /// <param name="ehReason">A ChangeReason value specifying the reason for the refresh request.</param>
        /// <param name="mxnOldNode">A CustomXMLNode specifying the deleted node (if applicable).</param>
        /// <param name="mxnOldParent">A CustomXMLNode specifying the former parent node of the deleted node (if applicable).</param>
        /// <param name="mxnOldNextSibling">A CustomXMLNode specifying the former next sibling node of the affected node (if applicable).</param>
        /// <param name="mxnNewNode">A CustomXMLNode specifying the new node (if applicable).</param>
        /// <param name="cxpOldPart">A CustomXMLPart specifying the XML part being deleted (if applicable).</param>
        internal void RefreshControls(ChangeReason ehReason, Office.CustomXMLNode mxnOldNode, Office.CustomXMLNode mxnOldParent, Office.CustomXMLNode mxnOldNextSibling, Office.CustomXMLNode mxnNewNode, Office._CustomXMLPart cxpOldPart)
        {
            // determine why we've been asked to refresh the pane
            switch (ehReason)
            {
            case ChangeReason.DocumentChanged:
                Debug.WriteLine("UI refresh for document change.");
                if (!Globals.ThisAddIn.Application.ShowWindowsInTaskbar)
                {
                    EventHandler.ChangeCurrentDocument();
                }
                controlPartList.RefreshPartList(true, true, false, string.Empty, null, null);
                break;

            case ChangeReason.PartAdded:
                Debug.WriteLine("UI refresh for stream addition.");
                controlPartList.RefreshPartList(true, false, false, string.Empty, null, null);
                break;

            case ChangeReason.PartDeleted:
                Debug.WriteLine("UI refresh for stream deletion.");
                Debug.Assert(cxpOldPart != null, "We were handed a NULL cxp?");
                controlPartList.RefreshPartList(true, false, false, string.Empty, cxpOldPart.Id, null);
                break;

            case ChangeReason.PartLoaded:
                Debug.WriteLine("UI refresh for stream load.");
                controlPartList.RefreshPartList(true, false, false, string.Empty, null, null);
                break;

            case ChangeReason.NodeAdded:
                Debug.WriteLine("UI refresh for node addition.");
                controlTreeView.AddMxnToTree(mxnNewNode);
                break;

            case ChangeReason.NodeDeleted:
                Debug.WriteLine("UI refresh for node deletion.");
                controlTreeView.RemoveMxnFromTree(mxnOldNode, mxnOldParent, mxnOldNextSibling, null);
                break;

            case ChangeReason.NodeReplaced:
                Debug.WriteLine("UI refresh for node replacement.");
                controlTreeView.ReplaceMxnInTree(mxnOldNode, mxnNewNode);
                break;

            case ChangeReason.DragDrop:
                Debug.WriteLine("UI refresh for drag/drop of XML.");
                controlPartList.RefreshPartList(true, false, true, string.Empty, null, null);
                break;

            case ChangeReason.OnEnter:
                Debug.WriteLine("UI refresh for BB enter.");
                Debug.Assert(mxnNewNode != null, "No mxn for CC?");
                if ((controlTreeView.Options & ControlTreeView.cOptionsAutoSelectNode) != 0)
                {
                    controlPartList.RefreshPartList(false, false, false, mxnNewNode.OwnerPart.Id, null, mxnNewNode);
                }
                break;

            default:
                Debug.Assert(false, "Unknown refresh event", "We got called on a refresh event that doesn't exist??");
                break;
            }
        }
Exemple #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChangeSet{TObject, TKey}"/> class.
 /// </summary>
 /// <param name="reason">The reason.</param>
 /// <param name="key">The key.</param>
 /// <param name="current">The current.</param>
 /// <param name="previous">The previous.</param>
 private ChangeSet(ChangeReason reason, TKey key, TObject current, Optional <TObject> previous)
     : this()
 {
     Add(new Change <TObject, TKey>(reason, key, current, previous));
 }
Exemple #28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChangeSet{TObject, TKey}"/> class.
 /// </summary>
 /// <param name="reason">The reason.</param>
 /// <param name="key">The key.</param>
 /// <param name="current">The current.</param>
 public ChangeSet(ChangeReason reason, TKey key, TObject current)
     : this(reason, key, current, Optional.None <TObject>())
 {
 }
Exemple #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Change{TObject, TKey}"/> struct.
 /// </summary>
 /// <param name="reason">The reason.</param>
 /// <param name="key">The key.</param>
 /// <param name="current">The current.</param>
 /// <param name="index">The index.</param>
 public Change(ChangeReason reason, TKey key, TObject current, int index = -1)
     : this(reason, key, current, Optional.None <TObject>(), index, -1)
 {
 }
 public ChangeData(ChangeReason changeReason, GizmoDimension trsDimension)
 {
     ChangeReason = changeReason;
     TRSDimension = trsDimension;
 }
 public TaskChangingEventArgs(ChangeReason reason, string newTask)
 {
     Reason = reason;
     NewTaskName = newTask;
 }
Exemple #32
0
        /// <summary>
        /// Returns a list of files or folders that have changed since the recorded USN
        /// </summary>
        /// <param name="sourceFileOrFolder">The file or folder to find entries for</param>
        /// <param name="minUsn">Minimum USN of entry</param>
        /// <param name="reason">Filter expression for change reason</param>
        /// <returns>A list of tuples with changed files and folders and their type</returns>
        public IEnumerable <Tuple <string, EntryType> > GetChangedFileSystemEntries(string sourceFileOrFolder, long minUsn, ChangeReason reason)
        {
            var isFolder = sourceFileOrFolder.EndsWith(Utility.Utility.DirectorySeparatorString, StringComparison.Ordinal);

            foreach (var r in GetRecords(minUsn))
            {
                if (r.UsnRecord.Usn >= minUsn &&
                    (reason == ChangeReason.Any || (MapChangeReason(r.UsnRecord.Reason) & reason) != 0) &&
                    (r.FullPath.Equals(sourceFileOrFolder, Utility.Utility.ClientFilenameStringComparison) ||
                     isFolder && Utility.Utility.IsPathBelowFolder(r.FullPath, sourceFileOrFolder)))
                {
                    yield return(Tuple.Create(r.FullPath,
                                              r.UsnRecord.FileAttributes.HasFlag(Win32USN.FileAttributes.Directory)
                            ? EntryType.Directory
                            : EntryType.File));
                }
            }
        }
        /// <summary>
        /// Refresh the task pane based on some event.
        /// </summary>
        /// <param name="ehReason">A ChangeReason value specifying the reason for the refresh request.</param>
        /// <param name="mxnOldNode">A CustomXMLNode specifying the deleted node (if applicable).</param>
        /// <param name="mxnOldParent">A CustomXMLNode specifying the former parent node of the deleted node (if applicable).</param>
        /// <param name="mxnOldNextSibling">A CustomXMLNode specifying the former next sibling node of the affected node (if applicable).</param>
        /// <param name="mxnNewNode">A CustomXMLNode specifying the new node (if applicable).</param>
        /// <param name="cxpOldPart">A CustomXMLPart specifying the XML part being deleted (if applicable).</param>
        internal void RefreshControls(ChangeReason ehReason, Office.CustomXMLNode mxnOldNode, Office.CustomXMLNode mxnOldParent, Office.CustomXMLNode mxnOldNextSibling, Office.CustomXMLNode mxnNewNode, Office._CustomXMLPart cxpOldPart)
        {
            // determine why we've been asked to refresh the pane
            switch (ehReason)
            {
                case ChangeReason.DocumentChanged:
                    Debug.WriteLine("UI refresh for document change.");
                    if (!Globals.ThisAddIn.Application.ShowWindowsInTaskbar)
                    {
                        EventHandler.ChangeCurrentDocument();
                    }
                    controlPartList.RefreshPartList(true, true, false, string.Empty, null, null);
                    break;

                case ChangeReason.PartAdded:
                    Debug.WriteLine("UI refresh for stream addition.");
                    controlPartList.RefreshPartList(true, false, false, string.Empty, null, null);
                    break;

                case ChangeReason.PartDeleted:
                    Debug.WriteLine("UI refresh for stream deletion.");
                    Debug.Assert(cxpOldPart != null, "We were handed a NULL cxp?");
                    controlPartList.RefreshPartList(true, false, false, string.Empty, cxpOldPart.Id, null);
                    break;

                case ChangeReason.PartLoaded:
                    Debug.WriteLine("UI refresh for stream load.");
                    controlPartList.RefreshPartList(true, false, false, string.Empty, null, null);
                    break;

                case ChangeReason.NodeAdded:
                    Debug.WriteLine("UI refresh for node addition.");
                    controlTreeView.AddMxnToTree(mxnNewNode);
                    break;

                case ChangeReason.NodeDeleted:
                    Debug.WriteLine("UI refresh for node deletion.");
                    controlTreeView.RemoveMxnFromTree(mxnOldNode, mxnOldParent, mxnOldNextSibling, null);
                    break;

                case ChangeReason.NodeReplaced:
                    Debug.WriteLine("UI refresh for node replacement.");
                    controlTreeView.ReplaceMxnInTree(mxnOldNode, mxnNewNode);
                    break;

                case ChangeReason.DragDrop:
                    Debug.WriteLine("UI refresh for drag/drop of XML.");
                    controlPartList.RefreshPartList(true, false, true, string.Empty, null, null);
                    break;

                case ChangeReason.OnEnter:
                    Debug.WriteLine("UI refresh for BB enter.");
                    Debug.Assert(mxnNewNode != null, "No mxn for CC?");
                    if ((controlTreeView.Options & ControlTreeView.cOptionsAutoSelectNode) != 0)
                    {
                        controlPartList.RefreshPartList(false, false, false, mxnNewNode.OwnerPart.Id, null, mxnNewNode);
                    }
                    break;

                default:
                    Debug.Assert(false, "Unknown refresh event", "We got called on a refresh event that doesn't exist??");
                    break;
            }
        }