示例#1
0
        private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e, MulticastPropertyValue propertyValue)
        {
            var originalValue = (IList)typeof(ObservableList <>).MakeGenericType(propertyValue.Value.GetType().GetGenericArguments()[0])
                                .GetConstructor(Type.EmptyTypes).Invoke(null);

            if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                foreach (var removed in e.OldItems)
                {
                    originalValue.Add(removed);
                }
            }

            foreach (var item in (IEnumerable)propertyValue.Value)
            {
                if (((e.Action == NotifyCollectionChangedAction.Remove) && (e.OldItems.Contains(item))) ||
                    (e.Action == NotifyCollectionChangedAction.Add))
                {
                    continue;
                }

                originalValue.Add(item);
            }

            OriginalValues.Remove(propertyValue);
            OriginalValues.Add(new MulticastPropertyValue(propertyValue.CastedType, propertyValue.Property, originalValue));
            ((IObservableCollection)sender).ClearCollectionChanged();
        }
示例#2
0
 public void SetOriginalValue(string propertyName, object value)
 {
     if (!OriginalValues.ContainsKey(propertyName))
     {
         OriginalValues.Add(propertyName, value);
     }
 }
示例#3
0
        public static void Render(FMAT material)
        {
            if (CustomCategory.Count == 0)
            {
                Init();
            }


            ShaderInfo shaderInfo = null;

            if (material.MaterialAsset is BfshaRenderer)
            {
                shaderInfo = ((BfshaRenderer)material.MaterialAsset).GLShaderInfo;
            }

            if (shaderInfo != null)
            {
                ImGui.Checkbox("Display Only Used Uniforms From Shader", ref limitUniformsUsedByShaderCode);
            }

            if (OriginalValues.Count == 0)
            {
                foreach (var param in material.ShaderParams)
                {
                    OriginalValues.Add(param.Key, param.Value.DataValue);
                }
            }


            LoadHeaders();
            if (ImGui.BeginChild("PARAM_LIST"))
            {
                int index = 0;
                foreach (var param in material.ShaderParams.Values)
                {
                    if (limitUniformsUsedByShaderCode && shaderInfo != null &&
                        !shaderInfo.UsedVertexStageUniforms.Contains(param.Name) &&
                        !shaderInfo.UsedPixelStageUniforms.Contains(param.Name))
                    {
                        continue;
                    }

                    if (material.AnimatedParams.ContainsKey(param.Name))
                    {
                        ImGui.PushStyleColor(ImGuiCol.FrameBg, new Vector4(0, 0.5f, 0, 1));
                        LoadParamColumns(material.AnimatedParams[param.Name], index++, true);
                        ImGui.PopStyleColor();
                    }
                    else
                    {
                        LoadParamColumns(param, index++);
                    }
                }
            }
            ImGui.EndChild();
        }
        /// <summary>
        /// Initialize change tracker
        /// </summary>
        /// <param name="entity">Entity to track</param>
        public void Initialize(object entity)
        {
            var infos = entity.GetType().GetRuntimeProperties();

            foreach (var info in infos)
            {
                if (info.Name != "Id" && info.Name != "InternalId")
                {
                    OriginalValues.Add(info.Name, info.GetValue(entity));
                }
            }
        }
示例#5
0
文件: DataClass.cs 项目: panchul/WPC
        /// <summary>
        /// Take the (first) four hexadecimal characters from the
        /// buffer and convert them to an unsigned short
        /// </summary>
        private static void ParseData(char[] buf)
        {
            string hex   = new string(buf, 0, 4);
            ushort value = ushort.Parse(hex, NumberStyles.HexNumber);

            if (value <= 1023)
            {
                OriginalValues.Add(value);
            }
            else
            {
                OriginalValues.Add(1023);
            }
        }
示例#6
0
        public void queryKey()
        {
            if (!hKeyQueried)
            {
                IntPtr subKeyNamesUnmanaged;
                int    cSubKeys;
                IntPtr regValuesUnmanaged;
                int    cValues;
                regQuery(hKey, out subKeyNamesUnmanaged, out cSubKeys, out regValuesUnmanaged, out cValues);

                var subKeyNames   = new KeyName[cSubKeys];
                var keyNameStride = Marshal.SizeOf(typeof(KeyName));
                for (int i = 0; i < cSubKeys; i++)
                {
                    var p = new IntPtr(subKeyNamesUnmanaged.ToInt64() + i * keyNameStride);
                    subKeyNames[i] = (KeyName)Marshal.PtrToStructure(p, typeof(KeyName));
                }

                Items.Clear();
                for (int i = 0; i < cSubKeys; i++)
                {
                    Items.Add(new RegTreeViewItem(RegTreeViewItemType.FOLDER)
                    {
                        Title = subKeyNames[i].Name, Parent = this
                    });
                }

                OriginalValues.Clear();
                Values.Clear();
                var regValueStride = Marshal.SizeOf(typeof(RegValue));
                for (int i = 0; i < cValues; i++)
                {
                    var p        = new IntPtr(regValuesUnmanaged.ToInt64() + i * regValueStride);
                    var regValue = (RegValue)Marshal.PtrToStructure(p, typeof(RegValue));
                    OriginalValues.Add(regValue);
                    Values.Add(new RegValueItem(regValue));
                }

                hKeyQueried = true;
            }
        }