コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: Leks98/ProjectJA
 public MainWindow()
 {
     InitializeComponent();
     inputLoader = new DataLoader();
     vectorX     = new SpecifiedVector();
     solver      = new MethodSolver();
 }
コード例 #2
0
 public UserControlSolve(DataLoader inputLoader, SpecifiedVector vectorX, MethodSolver solver)
 {
     InitializeComponent();
     this.inputLoader = inputLoader;
     this.vectorX     = vectorX;
     this.solver      = solver;
 }
コード例 #3
0
        void timer_Tick()
        {
            SolutionsStackPanel.Visibility = Visibility.Visible;
            Stopwatch mywatch = new Stopwatch();

            try
            {
                inputLoader = new DataLoader(ParameterProperties.Instance.inFileName);
                vectorX     = new SpecifiedVector(inputLoader.VectorB.numberOfRows);
                solver      = new MethodSolver(inputLoader.MatrixA, inputLoader.VectorB, vectorX);
            }
            catch (Exception ex)
            {
                string exceptionMessage = string.Format("A handled exception occurred: {0}", ex.Message);
                ApplicationMessageBox.Show(exceptionMessage, "Checkbox Selection Exception", "OK");
            }



            try
            {
                if (ParameterProperties.Instance.ProgrammingLanguages["C++"] == true)
                {
                    mywatch.Start();
                    lock (balanceLock)
                        ProcessWithThreadPoolMethod(solver);
                    mywatch.Stop();
                    CExecutionTime.Text = mywatch.ElapsedTicks.ToString();
                    mywatch.Reset();
                }
                if (ParameterProperties.Instance.ProgrammingLanguages["ASM"] == true)
                {
                    //wywolanie kodu dla ASM
                }
            }
            catch (Exception ex)
            {
                string exceptionMessage = string.Format("A handled exception occurred: {0}", ex.Message);
                ApplicationMessageBox.Show(exceptionMessage, "Checkbox Selection Exception", "OK");
            }
            int xIndex = 1;

            for (int row = 0; row < inputLoader.matrixA.numberOfRows; row++)
            {
                for (int column = 0; column < inputLoader.matrixA.numberOfRows; column++)
                {
                    xIndex = column + 1;
                    if (inputLoader.matrixA.Data[row, column] >= 0 && column != 0)
                    {
                        Equations.Text += "+ ";
                    }
                    Equations.Text += inputLoader.matrixA.Data[row, column] + "x";

                    Equations.Text += xIndex + " ";
                }
                Equations.Text += " = " + inputLoader.vectorB.Data[row] + "\n";
            }
            Thread.Sleep(500);
            SolutionSet.Text += "Solution set: \n";

            for (int row = 0; row < vectorX.numberOfRows; row++)
            {
                SolutionSet.Text += "x" + xIndex + " = " + vectorX.Data[row] + "\n";
                xIndex++;
            }
        }
コード例 #4
0
 static void ProcessWithThreadPoolMethod(MethodSolver solver)
 {
     ThreadPool.SetMaxThreads(1, ParameterProperties.Instance.threadsNumber);
     ThreadPool.SetMinThreads(1, ParameterProperties.Instance.threadsNumber);
     ThreadPool.QueueUserWorkItem((Process), solver);
 }