Пример #1
0
 public void Add(StyleSheets.StyleSheet styleSheet)
 {
     StyleSheets = StyleSheets ?? new List <StyleSheets.StyleSheet>(2);
     StyleSheets.Add(styleSheet);
     ValuesChanged?.Invoke(this, ResourcesChangedEventArgs.StyleSheets);
 }
Пример #2
0
 protected virtual void OnValuesChanged(IBrush brush)
 {
     ValuesChanged?.Invoke(this, brush);
 }
Пример #3
0
 private void RaiseValuesChanged(Security security, IEnumerable <KeyValuePair <Level1Fields, object> > changes, DateTimeOffset serverTime, DateTimeOffset localTime)
 {
     ValuesChanged?.Invoke(security, changes, serverTime, localTime);
 }
Пример #4
0
 /// <summary>
 /// Called when node values set gets changed.
 /// </summary>
 public virtual void OnValuesChanged()
 {
     ValuesChanged?.Invoke();
     Surface.OnNodeValuesEdited(this);
 }
Пример #5
0
 private void OnValuesChanged()
 {
     OnValuesNeedSorting();
     ValuesChanged?.Invoke(this, EventArgs.Empty);
 }
Пример #6
0
 public void Clear()
 {
     Values.Clear();
     ValuesChanged?.Invoke(this, EventArgs.Empty);
 }
Пример #7
0
 /// <summary>
 /// Called when node values set gets changed.
 /// </summary>
 public virtual void OnValuesChanged()
 {
     ValuesChanged?.Invoke();
 }
Пример #8
0
 protected void OnValuesChanged <T>(IEnumerable <T> values) =>
 ValuesChanged?.Invoke(this, typeof(T), values.Cast <object>());
Пример #9
0
 protected void OnValuesChanged(Type type, IEnumerable <object> values) =>
 ValuesChanged?.Invoke(this, type, values);
Пример #10
0
 protected void OnValuesChanged()
 {
     ValuesChanged?.Invoke(this, EventArgs.Empty);
 }
Пример #11
0
 public void Save()
 {
     ValuesChanged?.Invoke();
     this.Save(true);
 }
Пример #12
0
        public override void ResponseReceived(byte[] parameter)
        {
            Serializer serializer;

            switch ((RegistryCommunication)parameter[0])
            {
            case RegistryCommunication.ResponseRegistrySubKeys:
                serializer = new Serializer(typeof(RegistrySubKeysPackage));
                var result = serializer.Deserialize <RegistrySubKeysPackage>(parameter, 1);

                ManualResetEvent manualResetEvent;
                var actualPath = GetPath(result.Path, result.RegistryHive);

                if (_subKeysRequests.TryGetValue(actualPath, out manualResetEvent))
                {
                    var subKeys =
                        result.RegistrySubKeys.Select(
                            x =>
                            new AdvancedRegistrySubKey
                    {
                        IsEmpty      = x.IsEmpty,
                        Name         = x.Name,
                        RegistryHive = result.RegistryHive,
                        RelativePath = string.IsNullOrEmpty(result.Path) ? x.Name : result.Path + "\\" + x.Name,
                        Path         =
                            actualPath + "\\" + x.Name
                    }).ToList();

                    if (_subKeysResults.ContainsKey(actualPath))
                    {
                        _subKeysResults[actualPath] = subKeys;
                    }
                    else
                    {
                        _subKeysResults.Add(actualPath, subKeys);
                    }

                    manualResetEvent.Set();
                }

                LogService.Receive(string.Format((string)Application.Current.Resources["ReceivedSubKeys"],
                                                 result.RegistrySubKeys.Count));
                break;

            case RegistryCommunication.ResponseRegistryValues:
                serializer = new Serializer(new List <Type>(RegistryValue.RegistryValueTypes)
                {
                    typeof(RegistryValuesPackage)
                });

                var registyValuesPackage = serializer.Deserialize <RegistryValuesPackage>(parameter, 1);
                RegistryValuesReceived?.Invoke(this,
                                               new RegistryValuesReceivedEventArgs(registyValuesPackage.Path, registyValuesPackage.RegistryHive,
                                                                                   registyValuesPackage.Values));
                LogService.Receive(string.Format((string)Application.Current.Resources["ReceivedValues"],
                                                 registyValuesPackage.Values.Count));
                break;

            case RegistryCommunication.PermissionsDeniedError:
                LogService.Error(string.Format((string)Application.Current.Resources["RegistryPermissionDenied"],
                                               Encoding.UTF8.GetString(parameter, 1, parameter.Length - 1)));
                break;

            case RegistryCommunication.Error:
                LogService.Error(Encoding.UTF8.GetString(parameter, 1, parameter.Length - 1));
                break;

            case RegistryCommunication.ResponseSubKeyCreated:
                serializer = new Serializer(typeof(RegistrySubKeyAction));
                var keyCreated = serializer.Deserialize <RegistrySubKeyAction>(parameter, 1);
                SubKeyCreated?.Invoke(this,
                                      new RegistryKeyChangedEventArgs(GetPath(keyCreated.Path, keyCreated.RegistryHive), keyCreated.RegistryHive, keyCreated.Path));
                LogService.Receive((string)Application.Current.Resources["SubKeyCreated"]);
                break;

            case RegistryCommunication.ResponseValueCreated:
                ValuesChanged?.Invoke(this, EventArgs.Empty);
                LogService.Receive((string)Application.Current.Resources["RegistryValueCreated"]);
                break;

            case RegistryCommunication.ResponseSubKeyDeleted:
                serializer = new Serializer(typeof(RegistrySubKeyAction));
                var keyDeleted = serializer.Deserialize <RegistrySubKeyAction>(parameter, 1);
                SubKeyDeleted?.Invoke(this,
                                      new RegistryKeyChangedEventArgs(GetPath(keyDeleted.Path, keyDeleted.RegistryHive), keyDeleted.RegistryHive, keyDeleted.Path));
                LogService.Receive((string)Application.Current.Resources["SubKeyDeleted"]);
                break;

            case RegistryCommunication.ResponseValueDeleted:
                LogService.Receive((string)Application.Current.Resources["RegistryValueRemoved"]);
                ValuesChanged?.Invoke(this, EventArgs.Empty);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }