コード例 #1
0
        private static void ValueChangedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DataCellUC originator = d as DataCellUC;

            if (originator != null)
            {
                if (!originator.IsStop)
                {
                    originator.lblCurrent.Content = originator.ViewValueChangedState.ToString();

                    if (originator.ViewValueChangedState < originator._minValue || originator._minValue.Equals(int.MinValue))
                    {
                        originator._minValue      = originator.ViewValueChangedState;
                        originator.lblMin.Content = originator._minValue;
                    }

                    if (originator.ViewValueChangedState > originator._maxValue || originator._maxValue.Equals(int.MaxValue))
                    {
                        originator._maxValue      = originator.ViewValueChangedState;
                        originator.lblMax.Content = originator._maxValue;
                    }

                    originator._sum += originator.ViewValueChangedState;
                    originator._iter++;
                    originator._ort           = originator._sum / originator._iter;
                    originator.lblOrt.Content = originator._ort;
                }
            }
        }
コード例 #2
0
        private void AddPropertiestoCheckBox(CheckBox sender)
        {
            if (!checkedList.Contains(sender.Content.ToString()))
            {
                checkedList.Add(sender.Content.ToString());

                System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
                System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
                System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();

                legend1.Name      = "Legend" + sender.Uid;                                        /// spesific name with list iteration
                legend1.Docking   = System.Windows.Forms.DataVisualization.Charting.Docking.Left; /// legend left alignment (alternatives: right, top, bottom)
                legend1.Alignment = System.Drawing.StringAlignment.Near;                          /// legend position should be near the chart area

                //series2.ChartArea = "ChartArea2";
                series2.Legend    = "Legend" + sender.Uid;
                series2.ChartType = chartType;
                series2.Name      = sender.Name; /// spesific name with checkbox name
                this.cpuChart2.Legends.Add(legend1);
                this.cpuChart2.Series.Add(series2);

                //this.cpuChart2.TabIndex = 0;
                //this.cpuChart2.Text = "chart" + sender.Uid;
                //this.cpuChart.Name = "cpuChart";
                series1.ChartArea = "ChartArea1";

                series1.ChartType = chartType;
                series1.Name      = sender.Content.ToString();
                this.cpuChart.Series.Add(series1);

                //this.cpuChart.TabIndex = 0;
                //this.cpuChart.Text = "chart" + sender.Uid;

                DataCellUC tempDataCell = new DataCellUC();
                tempDataCell.DataContext  = UCTemp.DataContext;
                tempDataCell.BindingValue = (sender as CheckBox).Content.ToString();
                this.panelData.Children.Add(tempDataCell);
            }
        }