public void IndexPropertyTest()
    {
        var MyExample = new ExampleCollection <string>();

        MyExample.Add("a");
        MyExample.Add("b");
        Assert.IsTrue(MyExample.ExampleProperty[0] == "a");
        Assert.IsTrue(MyExample.ExampleProperty[1] == "b");
        MyExample.ExampleProperty[0] = "c";
        Assert.IsTrue(MyExample.ExampleProperty[0] == "c");
    }
Esempio n. 2
0
        //The exception is not in the ViewModel code. I found it by looking at ItemsSource property of the chart from the UI thread autos

        void AddPoints()  // Adds new points to the collection
        {
            counter = 0;
            while (true)
            {
                if (Adding)
                {
                    if (i > 50)
                    {
                        plus = false;
                    }
                    if (i < -50)
                    {
                        plus = true;
                    }
                    i  = i + (plus ? 1 : -1);
                    a += 0.3;
                    b += i;
                    ExampleCollection.Add(new Point(a, -b));
                    counter++;
                    if (counter < 350)
                    {
                        Thread.Sleep(30);
                    }
                    else
                    {
                        Thread.Sleep(30);
                    }
                }
            }
        }
Esempio n. 3
0
 private void OK_Click(object sender, RoutedEventArgs e)
 {
     foreach (var example in newExamples)
     {
         examples.Add(example);
     }
     this.DialogResult = true;
     this.Close();
 }
Esempio n. 4
0
        /// <summary>
        /// 图谱初始化
        /// </summary>
        /// <param name="rowCount">行数</param>
        /// <param name="columnCount">列数</param>
        /// <param name="dic_DieState_Color">芯片状态-颜色 字典</param>
        /// <param name="initialDieState">初始状态</param>
        public void Initial(int rowCount, int columnCount, List <InspectionDataView> list_InspectionDataView)
        {
            DataCollection.Clear();
            ExampleCollection.Clear();
            double cellWidth, cellHeight;

            RowCount    = rowCount;
            ColumnCount = columnCount;
            SetCellSize(RowCount, ColumnCount, out cellWidth, out cellHeight);
            for (int i = 0; i < rowCount; i++)
            {
                for (int j = 0; j < columnCount; j++)
                {
                    MappingData data = new MappingData();
                    data.BorderThickness   = DefaultBorderThickness;
                    data.Width             = cellWidth;
                    data.Height            = cellHeight;
                    data.VariableX         = j * data.Width;
                    data.VariableY         = i * data.Height;
                    data.RowIndex          = i;
                    data.ColumnIndex       = j;
                    data.DieState          = InspectionResult.SKIP;
                    data.NormalBorderColor = DefaultBorderColor;
                    DataCollection.Add(data);
                }
            }
            foreach (InspectionDataView dataView in list_InspectionDataView)
            {
                DataCollection[dataView.RowIndex * ColumnCount + dataView.ColumnIndex].DieState = dataView.InspectionResult;
                if (dataView.List_DefectData.Count != 0)
                {
                    string[] defectTypeStrings = new string[dataView.List_DefectData.Count];
                    for (int i = 0; i < dataView.List_DefectData.Count; i++)
                    {
                        defectTypeStrings[i] = dataView.List_DefectData[i].ToString();
                    }
                    DataCollection[dataView.RowIndex * ColumnCount + dataView.ColumnIndex].DefectTypeIndexString = string.Join(";", defectTypeStrings);
                }
            }
            double fontSize = SetFontSize(cellWidth, cellHeight);

            foreach (MappingData data in DataCollection)
            {
                data.FontSize = fontSize;
            }

            foreach (KeyValuePair <InspectionResult, Color> kv in MappingData.Dict_DieState_Color)
            {
                ExampleData data = new ExampleData();
                data.DieState    = InspectionResultsConverter.ToString(kv.Key);
                data.FillColor   = kv.Value.ToString();
                data.BorderColor = DefaultBorderColor.ToString();
                data.Count       = DataCollection.Where(d => d.DieState == kv.Key).Count();
                ExampleCollection.Add(data);
            }
        }