Beispiel #1
0
 internal AddinKeyValue(WatchController root, AddinKey parent, string valueName, RegistryValueKind valueKind, object value)
 {
     _root = root;
     _parent = parent;
     _valueName = valueName;
     _valueKind = valueKind;
     _value = value;
 }
 internal AddinKeyValue(WatchController root, AddinKey parent, string valueName, RegistryValueKind valueKind, object value)
 {
     _root      = root;
     _parent    = parent;
     _valueName = valueName;
     _valueKind = valueKind;
     _value     = value;
 }
        public void ShowNotification(AddinKey item, NotifyKind notfiyKind, RegistryChangeInfo changeInfo)
        {
            if (_parent.FirstRun)
            {
                return;
            }
            string message = GetMessage(notfiyKind);

            switch (notfiyKind)
            {
            case NotifyKind.AddinLoadBehaviorRestored:
                AddinValueValueRestoredInfo restoredInfo = (AddinValueValueRestoredInfo)changeInfo;
                message = string.Format(message, restoredInfo.RootKey, restoredInfo.KeyPath, restoredInfo.ValueName, restoredInfo.RestoredValue, restoredInfo.OldValue, Environment.NewLine);
                break;

            case NotifyKind.AddinValueNameIsChanged:
                AddinValueNameChangedInfo nameInfo = (AddinValueNameChangedInfo)changeInfo;
                message = string.Format(message, nameInfo.RootKey, nameInfo.KeyPath, nameInfo.OldValueName, nameInfo.NewValueName, Environment.NewLine);
                break;

            case NotifyKind.AddinValueKindIsChanged:
                AddinValueKindChangedInfo kindInfo = (AddinValueKindChangedInfo)changeInfo;
                message = string.Format(message, kindInfo.RootKey, kindInfo.KeyPath, kindInfo.ValueName, kindInfo.OldValueKind, kindInfo.NewValueKind, Environment.NewLine);
                break;

            case NotifyKind.AddinValueIsChanged:
                AddinValueValueChangedInfo valueInfo = (AddinValueValueChangedInfo)changeInfo;
                message = string.Format(message, valueInfo.RootKey, valueInfo.KeyPath, valueInfo.ValueName, valueInfo.OldValue, valueInfo.NewValue, Environment.NewLine);
                break;

            case NotifyKind.AddinValuesIncrement:
                AddinValuesIncrementInfo incrementInfo = (AddinValuesIncrementInfo)changeInfo;
                message = string.Format(message, incrementInfo.RootKey, incrementInfo.KeyPath, incrementInfo.ValueName, Environment.NewLine);
                break;

            case NotifyKind.AddinValuesDecrement:
                AddinValuesDecrementInfo decrementInfo = (AddinValuesDecrementInfo)changeInfo;
                message = string.Format(message, decrementInfo.RootKey, decrementInfo.KeyPath, decrementInfo.ValueName, Environment.NewLine);
                break;

            default:
                throw new ArgumentOutOfRangeException(notfiyKind.ToString() + " is not valid in this context");
            }

            if (_parent.NotifyType == NotificationType.MessageBox)
            {
                MessageBox.Show(message, "NetOffice.DeveloperToolbox", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                _trayIcon.ShowBalloonTip(2000, message, "NetOffice.DeveloperToolbox " + notfiyKind.ToString(), ToolTipIcon.Info);
            }

            if (null != MessageFired)
            {
                MessageFired(message, new EventArgs());
            }
        }
Beispiel #4
0
        private void treeViewRegistry_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                dataGridViewValues.Rows.Clear();
                if (e.Node.Tag is AddinKey)
                {
                    panelDeactivatedElements.Visible = false;
                    panelInfos.Visible          = false;
                    panelRegistryValues.Visible = true;

                    AddinKey addinKey = e.Node.Tag as AddinKey;
                    foreach (AddinKeyValue item in addinKey.Values)
                    {
                        dataGridViewValues.Rows.Add();
                        DataGridViewRow row = dataGridViewValues.Rows[dataGridViewValues.Rows.Count - 1];
                        row.Cells[0].Value = GetValueKindImage(item.Type);
                        row.Cells[1].Value = item.Name;
                        row.Cells[2].Value = item.Type;
                        row.Cells[3].Value = item.Value;
                    }
                }
                else if (e.Node.Tag is DisabledValue)
                {
                    panelRegistryValues.Visible      = false;
                    panelInfos.Visible               = false;
                    panelDeactivatedElements.Visible = true;
                    DisabledValue disabledValue = e.Node.Tag as DisabledValue;

                    labelOfficeProduct.Text         = disabledValue.OfficeProductVersion;
                    labelDisabledRegistryValue.Text = disabledValue.Value;
                    labelDisabledRegistryPath.Text  = disabledValue.Parent.RegistryPath + " - " + disabledValue.ValueName;
                }
                else
                {
                    panelRegistryValues.Visible      = false;
                    panelDeactivatedElements.Visible = false;
                    panelInfos.Visible = true;
                }
            }
            catch (Exception exception)
            {
                Forms.ErrorForm.ShowError(exception, ErrorCategory.NonCritical, Host.CurrentLanguageID);
            }
        }
Beispiel #5
0
        public void ShowNotification(AddinKey item, NotifyKind notfiyKind, RegistryChangeInfo changeInfo)
        {
            if (_parent.FirstRun)
                return;
            string message = GetMessage(notfiyKind);
            switch (notfiyKind)
            {
                case NotifyKind.AddinLoadBehaviorRestored:
                    AddinValueValueRestoredInfo restoredInfo = (AddinValueValueRestoredInfo)changeInfo;
                    message = string.Format(message, restoredInfo.RootKey, restoredInfo.KeyPath, restoredInfo.ValueName, restoredInfo.RestoredValue, restoredInfo.OldValue, Environment.NewLine);
                    break;
                case NotifyKind.AddinValueNameIsChanged:
                    AddinValueNameChangedInfo nameInfo = (AddinValueNameChangedInfo)changeInfo;
                    message = string.Format(message, nameInfo.RootKey, nameInfo.KeyPath, nameInfo.OldValueName, nameInfo.NewValueName, Environment.NewLine);
                    break;
                case NotifyKind.AddinValueKindIsChanged:
                    AddinValueKindChangedInfo kindInfo = (AddinValueKindChangedInfo)changeInfo;
                    message = string.Format(message, kindInfo.RootKey, kindInfo.KeyPath, kindInfo.ValueName, kindInfo.OldValueKind, kindInfo.NewValueKind, Environment.NewLine);
                    break;
                case NotifyKind.AddinValueIsChanged:
                    AddinValueValueChangedInfo valueInfo = (AddinValueValueChangedInfo)changeInfo;
                    message = string.Format(message, valueInfo.RootKey, valueInfo.KeyPath, valueInfo.ValueName, valueInfo.OldValue, valueInfo.NewValue, Environment.NewLine);
                    break;
                case NotifyKind.AddinValuesIncrement:
                    AddinValuesIncrementInfo incrementInfo = (AddinValuesIncrementInfo)changeInfo;
                    message = string.Format(message, incrementInfo.RootKey, incrementInfo.KeyPath, incrementInfo.ValueName, Environment.NewLine);
                    break;
                case NotifyKind.AddinValuesDecrement:
                    AddinValuesDecrementInfo decrementInfo = (AddinValuesDecrementInfo)changeInfo;
                    message = string.Format(message, decrementInfo.RootKey, decrementInfo.KeyPath, decrementInfo.ValueName, Environment.NewLine);
                    break;
                default:
                    throw new ArgumentOutOfRangeException(notfiyKind.ToString() + " is not valid in this context");
            }

            if (_parent.NotifyType == NotificationType.MessageBox)
                MessageBox.Show(message, "NetOffice.DeveloperToolbox", MessageBoxButtons.OK, MessageBoxIcon.Information);
            else
                _trayIcon.ShowBalloonTip(2000, message, "NetOffice.DeveloperToolbox " + notfiyKind.ToString(), ToolTipIcon.Info);

            if (null != MessageFired)
                MessageFired(message, new EventArgs());
        }
Beispiel #6
0
        private void DeleteAddinNodes(TreeNode node, RegistryKey rootKey)
        {
            List <TreeNode> deleteList = new List <TreeNode>();

            foreach (TreeNode childNode in node.Nodes)
            {
                if (childNode.Tag is AddinKey)
                {
                    AddinKey nodeKey = childNode.Tag as AddinKey;
                    if (nodeKey.Parent.RootKey == rootKey)
                    {
                        deleteList.Add(childNode);
                    }
                }
            }

            foreach (TreeNode childNode in deleteList)
            {
                node.Nodes.Remove(childNode);
            }
        }
Beispiel #7
0
 private bool CompareValueKinds(AddinKey item, RegistryValueKind kindToCompare)
 {
     return true;
 }
 private bool CompareValueKinds(AddinKey item, RegistryValueKind kindToCompare)
 {
     return(true);
 }