Ejemplo n.º 1
0
        private void OnClickBtnShowHistgram(object sender, RoutedEventArgs e)
        {
            if (m_bitmap == null)
            {
                return;
            }

            if (m_histgram != null)
            {
                m_histgram.Close();
                m_histgram = null;
#if CHART_LIVE_CHART
                m_histgram = new HistgramLiveCharts();
#elif CHART_OXY_PLOT
                m_histgram = new HistgramOxyPlot();
#else
                m_histgram = new HistgramOxyPlot();
#endif
            }

            m_histgram.Bitmap  = m_bitmap;
            m_histgram.WBitmap = SelectGetBitmap(m_strCurImgName);
            m_histgram.DrawHistgram();
            m_histgram.IsOpen = true;
            m_histgram.Show();

            return;
        }
Ejemplo n.º 2
0
        private void OnClosingWindow(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (m_tokenSource != null)
            {
                e.Cancel = true;
            }

            if (m_histgram != null)
            {
                m_histgram.Close();
                m_histgram = null;
            }

            return;
        }
Ejemplo n.º 3
0
        private void OnClickBtnFileSelect(object sender, RoutedEventArgs e)
        {
            ComOpenFileDialog openFileDlg = new ComOpenFileDialog();

            openFileDlg.Filter = "JPG|*.jpg|PNG|*.png";
            openFileDlg.Title  = "Open the file";
            if (openFileDlg.ShowDialog() == true)
            {
                pictureBoxOriginal.Source = null;
                pictureBoxAfter.Source    = null;
                m_strOpenFileName         = openFileDlg.FileName;
                try
                {
                    LoadImage();
                }
                catch (Exception)
                {
                    MessageBox.Show(this, "Open File Error", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                pictureBoxOriginal.Source = m_bitmap;
                btnStart.IsEnabled        = true;
                textBoxTime.Text          = "";

                if (m_histgram == null)
                {
#if CHART_LIVE_CHART
                    m_histgram = new HistgramLiveCharts();
#elif CHART_OXY_PLOT
                    m_histgram = new HistgramOxyPlot();
#else
                    m_histgram = new HistgramOxyPlot();
#endif
                }

                m_histgram.Bitmap  = m_bitmap;
                m_histgram.WBitmap = SelectGetBitmap(m_strCurImgName);
                if (m_histgram.IsOpen == true)
                {
                    m_histgram.DrawHistgram();
                }
            }
            return;
        }