Exemple #1
0
        private void OnDataArrivalBegin(DataArrivalConfig config)
        {
            if (config == DataArrivalConfig.TimeRange)
            {
                if (!this.realTime)
                {
                    // Clear
                    foreach (string key in dataSources.Keys)
                    {
                        CurveDataContext dataContext = dataSources[key];
                        i = 0;
                        dataContext.Clear();
                        dataContext.UpdateCurves();
                    }

                    // Reset the Base time.
                    this.baseTimeSet = false;

                    /*
                     * foreach (string key in dataSources.Keys)
                     * {
                     *  CurveDataContext dataContext = dataSources[key];
                     *  //dataContext.UpdateCurves();
                     * }
                     */
                }
            }
            else if (config == DataArrivalConfig.TimeNew)
            {
                if (this.realTime)
                {
                    // Do nothing with dataContext
                }
            }
        }
        private void AddTimePoint(int index, Dictionary <string, object> entry)
        {
            UpdateResult result = UpdateResult.None;

            foreach (string key in dataSources.Keys)
            {
                // 存在这条曲线
                if (entry.ContainsKey(key))
                {
                    string v = (string)entry[key];
                    double r = 0.0;
                    if (v.Length > 0)
                    {
                        if (!double.TryParse(v, out r))
                        {
                            return;
                        }
                    }

                    CurveDataContext dataContext = dataSources[key];
                    result = dataContext.AddTimeValuePair(index * 5, r);
                }
            }

            if (UpdateResult.Overflow == result)
            {
                this.SearchChartView.UpdateTimeAxis(1);
            }
        }
 private void ChartView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if ((bool)e.NewValue) // Shown
     {
         foreach (string key in dataSources.Keys)
         {
             CurveDataContext dataContext = dataSources[key];
             dataContext.UpdateCurves();
         }
     }
 }
        public void AddLineName(string deviceKey, string lineName, string displayName)
        {
            // TODO:
            if (lineName.IndexOf("Doserate") >= 0)
            {
                displayName = displayName.Replace("μSv/h", "nSv/h");
            }

            Config      cfg   = Config.Instance();
            ConfigEntry entry = cfg[deviceKey];

            ConfigItem item = entry.GetConfigItem(lineName);

            SearchCurveView curveView = this.SearchChartView.AddCurveView(lineName, displayName);

            curveView.Max    = item.Max;
            curveView.Min    = item.Min;
            curveView.Height = item.Height;
            CurveDataContext dataContext = curveView.CreateDataContext(lineName, displayName);

            this.dataSources.Add(lineName.ToLower(), dataContext);
        }