private void btnOperation(object sender, RoutedEventArgs e)
        {
            var master = sender as System.Windows.Controls.Button;

            switch (master.Name)
            {
            case ("btnThreshold"):
                var parmTh = (int)nudThreshold.Value;
                SrcMImg = SrcMImg.Add(Threshold.Apply(parmTh), StrThreshold.With(parmTh));
                break;

            case ("btnAdpThreshold"):
                var parmAdTh = (int)nudAdpThreshold.Value;
                SrcMImg = SrcMImg.Add(AdpTHreshold.Apply(parmAdTh), StrAdpTHreashold.With(parmAdTh));
                break;

            case ("btnMedian"):
                var parmMdn = (int)nudMedian.Value;
                SrcMImg = SrcMImg.Add(Median.Apply(parmMdn), StrMedian.With(parmMdn));
                break;

            case ("btnNormalize"):
                var parmNorm = (int)nudNormalize.Value;
                SrcMImg = SrcMImg.Add(Normalize.Apply(parmNorm), StrNormalize.With(parmNorm));
                break;
            }
            imgBack.Source        = ToBitmapSource(SrcMImg.GetLastValue());
            txbLog.Selection.Text = SrcMImg.GetLastPaper().Paper2TextHistory();
            var temp = SrcMImg.GetLastPaper().Paper2TextHistory();
        }
 private void btnBack_Click(object sender, RoutedEventArgs e)
 {
     if (SrcMImg.Count() > 1)
     {
         SrcMImg               = SrcMImg.Restore();
         imgBack.Source        = ToBitmapSource(SrcMImg.GetLastValue());
         txbLog.Selection.Text = SrcMImg.GetLastPaper().Paper2TextHistory();
     }
 }
        private void btnLoad_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                imgBack.Source = new BitmapImage(new Uri(ofd.FileName));


                var offsetH = (imgBack.ActualHeight - brdimg.ActualHeight) / 2.0;
                var offsetW = (imgBack.ActualWidth - brdimg.ActualWidth) / 2.0;


                brdimg.ActualHeight.Print("border H");
                brdimg.ActualWidth.Print("border W");


                canvas_Zoom.ActualHeight.Print("canvas_Zoom H");
                canvas_Zoom.ActualWidth.Print("canvas_Zoom W");


                canvas_Draw.ActualHeight.Print("canvas_Draw H");
                canvas_Draw.ActualWidth.Print("canvas_Draw W");


                imgBack.ActualHeight.Print("img H");
                imgBack.ActualWidth.Print("img W");

                Canvas.SetLeft(imgBack, offsetW);
                Canvas.SetTop(imgBack, offsetH);
                imgBack.Stretch = Stretch.Fill;

                SrcMImg = Accmululatable(new Img(ofd.FileName), "Start", PLImagingWriter);

                imgBack.Source        = ToBitmapSource(SrcMImg.GetLastValue());
                txbLog.Selection.Text = SrcMImg.GetLastPaper().Paper2TextHistory();

                //Canvas.SetLeft(imgBack, offsetW);
                //Canvas.SetTop(imgBack, offsetH);
            }
        }