Пример #1
0
 public ThreadCreator(ProgramAttributes programAttributes)
 {
     _programAttributes = programAttributes;
     unsafe
     {
         _adressTab = new byte *[_programAttributes.AmountThreads];
     }
 }
Пример #2
0
        private void runButton_Click(object sender, RoutedEventArgs e)
        {
            ProgramAttributes.TypeOfDll dllType = ProgramAttributes.TypeOfDll.Asm;
            if (assembly.IsChecked == true)
            {
                dllType = ProgramAttributes.TypeOfDll.Asm;
            }
            else if (cpp.IsChecked == true)
            {
                dllType = ProgramAttributes.TypeOfDll.Cpp;
            }

            try
            {
                ImageConverter    imageConverter    = new ImageConverter(inputImage.Source);
                byte[]            pixelBuffer       = imageConverter.ToTab();
                int               width             = ((BitmapImage)inputImage.Source).PixelWidth;
                int               height            = ((BitmapImage)inputImage.Source).PixelHeight;
                ProgramAttributes programAttributes = new ProgramAttributes(int.Parse(amountThreds.Text),
                                                                            (int)slider.Value, dllType, pixelBuffer, height, width);
                ThreadCreator threadCreator = new ThreadCreator(programAttributes);
                threadCreator.CreateThreads();

                var watch = Stopwatch.StartNew();

                threadCreator.RunAlgorithm();

                watch.Stop();

                long elapsedTicks = watch.ElapsedTicks;

                results.Text = "Time of working algorithm: " + elapsedTicks.ToString();

                outputImage.Source = imageConverter.ToBitmapSource(pixelBuffer);
            }
            catch (NullReferenceException nullReferenceException)
            {
                MessageBox.Show("BAD PARAMETER!");
            }
        }