Beispiel #1
0
 private void RefreshBtn_Click(object sender, RoutedEventArgs e)
 {
     if (PointsCountTB.Text != "Points count")
     {
         cnt = new GridStorageController(int.Parse(PointsCountTB.Text), bimage);
         cnt.LinkPoints();
         cnt.storage.DefineWaterIncome();
     }
     this.solveRiverProblemBtn.IsEnabled = false;
     setCanvas();
     setRiverCanvas();
 }
Beispiel #2
0
        public MainWindow()
        {
            InitializeComponent();
            image  = new System.Windows.Controls.Image();
            bimage = new Bitmap(@"C:\Users\Nazar\Documents\Visual Studio 2015\Projects\RiverMaker\height2smallmod.PNG");
            cnt    = new GridStorageController(25, bimage);
            cnt.LinkPoints();
            cnt.storage.DefineWaterIncome();
            //cnt.GetB(3000, bimage.Width, bimage.Height + 100);
            //var points = cnt.BuildStorage(200, bimage);
            //image = new System.Windows.Controls.Image();
            System.Windows.Media.Imaging.BitmapSource b = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
                bimage.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty,
                BitmapSizeOptions.FromWidthAndHeight(bimage.Width, bimage.Height));
            image.Source  = b;
            image.Stretch = Stretch.UniformToFill;
            //canvas.Children.Add(image);

            longestRiver = new Polyline();
        }