示例#1
0
 public void  CollectionContainerPrint(DataModel.ContainersCollection Collection,PointDimensions dimension)
 {
     RichTextBox1.AppendText("Numeric Type of CollectionContainer: " + Collection.NumericType + "\n");
     RichTextBox1.AppendText("Length of CollectionContainer: " + Collection.ListLength + "\n");
     foreach (var Container in Collection)
     {
         ContainerPrint(Container,dimension);
     }
 }
示例#2
0
        private async void Button1_Click_1(object sender, RoutedEventArgs e)
        {     
            Position position = null;
            int PointCount = 0;
            List<Task> TaskList = new List<Task>();
            Stopwatch stopWatch = new Stopwatch();
            try
            {
                stopWatch.Start();
                PointCount = Convert.ToInt32(PointCountTextbox1.Text);
                LoadingLabel1.Visibility = Visibility.Visible;
                if (DimensionRadioBuuton1.IsChecked == true)
                    Dimension = PointDimensions.X;
                else if (DimensionRadioBuuton2.IsChecked == true)
                    Dimension = PointDimensions.XY;
                else
                    Dimension = PointDimensions.XYZ;

                if (NumRadioButton1.IsChecked == true)
                {
                    Task T = Task.Factory.StartNew(() =>
                    {
                        position = fill.CreatePosition<int>(Dimension, PointCount);
                    });

                    await T;

                    if (SearchEqual(Positionlist, position) == true)
                        throw new ArgumentException("There is such position already!");                    
                    Positionlist.Add(position);
                    
                }

                else if (NumRadioButton2.IsChecked == true)
                {
                    Task T = Task.Factory.StartNew(() =>
                    {
                        position = fill.CreatePosition<double>(Dimension, PointCount);
                    });

                    await T;

                    if (SearchEqual(Positionlist, position) == true)
                        throw new ArgumentException("There is such position already!");
                    Positionlist.Add(position);
                }
                else
                {
                    Task T = Task.Factory.StartNew(() =>
                    {
                        position = fill.CreatePosition<decimal>(Dimension, PointCount);
                    });

                    await T;

                    if (SearchEqual(Positionlist, position) == true)
                        throw new ArgumentException("There is such position already!");
                    Positionlist.Add(position);
                }

                PositionTypeComboBox.Items.Add("Position: C: " + position.ListLength.ToString() + " N: " + position.NumericType.Name.ToString() + " D: " + position.PositionType.ToString());
                RichTextBox1.AppendText("Added Position : " + "C: " + position.ListLength.ToString() + " N: " + position.NumericType.Name.ToString() + " D: " + position.PositionType.ToString() + " \n");
                MatrixGroupBox.IsEnabled = true;

                ChangeProgressbar(position.Size());
                Megabyte.Content = (Convert.ToInt32(LoadLabel.Content) / 1048576).ToString();
                Process process = Process.GetCurrentProcess();
                long VirtualMemory = process.WorkingSet64 / 1048576;
                ProcessMemory.Content = VirtualMemory.ToString();
                LoadingLabel1.Visibility = Visibility.Hidden;
                stopWatch.Stop();
                TimeSpan ts = stopWatch.Elapsed;
                string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);
                TimeLabel.Content = elapsedTime;
            }
            catch (FormatException)
            {
                MessageBox.Show("Enter the count Of Points");
                LoadingLabel1.Visibility = Visibility.Hidden;
                stopWatch.Stop();
            }
            catch (ArgumentException Exception)
            {
                MessageBox.Show(Exception.Message);
                LoadingLabel1.Visibility = Visibility.Hidden;
                stopWatch.Stop();
            }

        }
示例#3
0
 public void ContainerPrint(Container container,PointDimensions  dimension)
 {
     RichTextBox1.AppendText("Numeric Type of Container: " + container.NumericType + "\n");
     RichTextBox1.AppendText("Length of Container: " + container.ListLength + "\n");
     foreach (DataModel.Matrix Matrix in container.FillterByDimension(dimension))
     {
         MatrixPrint(Matrix);
     }
 }
示例#4
0
        private async void Button2_Click_1(object sender, RoutedEventArgs e)
        {
            DataModel.Matrix matrix;
            int PositionCount = 0;
            int index;
            Stopwatch stopWatch = new Stopwatch();
            try
            {
                stopWatch.Start();
                PositionCount = Convert.ToInt32(PositionCountTextbox.Text);
                LoadingLabel2.Visibility = Visibility.Visible;
                if (DimensionRadioBuuton4.IsChecked == true)
                    Dimension = PointDimensions.X;
                else if (DimensionRadioBuuton5.IsChecked == true)
                    Dimension = PointDimensions.XY;
                else
                    Dimension = PointDimensions.XYZ;

                index = PositionTypeComboBox.SelectedIndex;
                ////////////////////////////////////////////////////
                if (NumRadioButton4.IsChecked == true)
                {
                    matrix = DataModel.Matrix.CreateMatrix<int>(Dimension);
                    if (Positionlist[index].NumericType != matrix.NumericType)
                        throw new ArgumentException("Numeric Type of Matrix and Position are different");
                    if (Positionlist[index].PositionType != matrix.MatrixType)
                        throw new ArgumentException("Type of Matrix and Position are different");
                    else
                    {
                        Task T = Task.Factory.StartNew(() =>
                        {
                            for (int i = 0; i < PositionCount; i++)
                            {
                                matrix.AddPosition(fill.CreatePosition<int>(Positionlist[index].PositionType, Positionlist[index].ListLength));
                            }
                        });
                        await T;
                    }                                      
                }
                else if (NumRadioButton5.IsChecked == true)
                {
                    matrix = DataModel.Matrix.CreateMatrix<double>(Dimension);
                    if (Positionlist[index].NumericType != matrix.NumericType)
                            throw new ArgumentException("Numeric Type of Matrix and Position are different");
                    if (Positionlist[index].PositionType != matrix.MatrixType)
                        throw new ArgumentException("Type of Matrix and Position are different");
                    else
                    {
                        Task T = Task.Factory.StartNew(() =>
                        {
                            for (int i = 0; i < PositionCount; i++)
                            {
                                matrix.AddPosition(fill.CreatePosition<double>(Positionlist[index].PositionType, Positionlist[index].ListLength));
                            }
                        });
                        await T;
                    }                    
                }
                else
                {
                    matrix = DataModel.Matrix.CreateMatrix<decimal>(Dimension);
                    if (Positionlist[index].NumericType != matrix.NumericType)
                        throw new ArgumentException("Numeric Type of Matrix and Position are different");
                    if (Positionlist[index].PositionType != matrix.MatrixType)
                        throw new ArgumentException("Type of Matrix and Position are different");
                    else
                    {
                        Task T = Task.Factory.StartNew(() =>
                        {
                            for (int i = 0; i < PositionCount; i++)
                            {
                                matrix.AddPosition(fill.CreatePosition<decimal>(Positionlist[index].PositionType, Positionlist[index].ListLength));
                            }
                        });
                        await T;
                    }                   
                }
                if (SearchEqual(Matrixlist, matrix) == true)
                    throw new ArgumentException("There is such Matrix already!");
                RichTextBox1.AppendText("Added a new Matrix : C:"+matrix.ListLength+", D:"+matrix.MatrixType+" N: "+matrix.NumericType+" \n");
                MatrixTypeComboBox.Items.Add("Matrix: C: " + matrix.ListLength.ToString() + " N: " + matrix.NumericType.Name.ToString() + " D: " + matrix.MatrixType.ToString());
                Matrixlist.Add(matrix);
                ContainerGroupBox.IsEnabled = true;
                ChangeProgressbar(matrix.Size());
                Megabyte.Content = (Convert.ToInt32(LoadLabel.Content) / 1048576).ToString();
                Process process = Process.GetCurrentProcess();
                long VirtualMemory = process.WorkingSet64 / 1048576;
                ProcessMemory.Content = VirtualMemory.ToString();
                LoadingLabel2.Visibility = Visibility.Hidden;
                stopWatch.Stop();
                TimeSpan ts = stopWatch.Elapsed;
                string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);
                TimeLabel.Content = elapsedTime;
            }
            catch (FormatException)
            {
                MessageBox.Show("Enter the count Of Positions");
                LoadingLabel2.Visibility = Visibility.Hidden;
                stopWatch.Stop();
            }
            catch (ArgumentException Exception)
            {
                MessageBox.Show(Exception.Message);
                LoadingLabel2.Visibility = Visibility.Hidden;
                stopWatch.Stop();
            }
        }