コード例 #1
0
        public void MarkOperation(string key, CarTimestamp ts)
        {
            RunRateDataItemSource item = items[key] as RunRateDataItemSource;

            if (item == null)
            {
                throw new KeyNotFoundException();
            }

            item.Mark(ts);
        }
コード例 #2
0
        private void InitItems(string group)
        {
            items = new Dictionary <string, IDataItemSource>(new CaseInsensitiveStringComparer());

            Type diGenType = typeof(DataItemSource <>);

            DatasetXmlParser.ParseConfig(delegate(DataItemDescriptor ds, string specialType, List <KeyValuePair <string, string> > attributes) {
                if (specialType == "runrate")
                {
                    RunRateDataItemSource runRate = new RunRateDataItemSource(ds, attributes);
                    Add(ds.Name, runRate);
                }
                else
                {
                    Type diType     = diGenType.MakeGenericType(ds.DataType);
                    object dataItem = Activator.CreateInstance(diType, ds);
                    Add(ds.Name, (IDataItemSource)dataItem);
                }
            }, group);
        }