Inheritance: CancellableOperationEventArgs
示例#1
0
        private void OnFormClosing(object sender, FormClosingEventArgs e)
        {
            if (this.DvfRelease != null)
            {
                DvfContextEventArgs args = new DvfContextEventArgs(this,
                                                                   m_pbData, m_strDataDesc, m_tscViewers);
                this.DvfRelease(sender, args);
                if (args.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
            }

            m_picBox.Image = null;
            if (m_img != null)
            {
                m_img.Dispose(); m_img = null;
            }
            if (m_imgResized != null)
            {
                m_imgResized.Dispose(); m_imgResized = null;
            }

            m_ctxText.Detach();
            GlobalWindowManager.RemoveWindow(this);
        }
示例#2
0
        private void OnFormClosing(object sender, FormClosingEventArgs e)
        {
            if (this.DvfRelease != null)
            {
                DvfContextEventArgs args = new DvfContextEventArgs(this,
                                                                   m_pbData, m_strDataDesc, m_tscViewers);
                this.DvfRelease(sender, args);
                if (args.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
            }

            string strRect = UIUtil.GetWindowScreenRect(this);

            if (strRect != m_strInitialFormRect)            // Don't overwrite ""
            {
                Program.Config.UI.DataViewerRect = strRect;
            }

            m_picBox.Image = null;
            if (m_img != null)
            {
                m_img.Dispose(); m_img = null;
            }
            if (m_imgResized != null)
            {
                m_imgResized.Dispose(); m_imgResized = null;
            }

            m_ctxText.Detach();
            GlobalWindowManager.RemoveWindow(this);
        }
示例#3
0
        private void UpdateDataView()
        {
            if (m_bInitializing)
            {
                return;
            }

            string strViewer = m_tscViewers.Text;
            bool   bText     = ((strViewer == m_strViewerText) ||
                                (strViewer == m_strViewerWeb));
            bool bImage = (strViewer == m_strViewerImage);

            UpdateVisibility(strViewer, false);
            m_tssSeparator0.Visible = (bText || bImage);
            m_tslEncoding.Visible   = m_tscEncoding.Visible = bText;
            m_tslZoom.Visible       = m_tscZoom.Visible = m_tsbZoomOut.Visible =
                m_tsbZoomIn.Visible = bImage;

            try
            {
                if (this.DvfUpdating != null)
                {
                    DvfContextEventArgs args = new DvfContextEventArgs(this,
                                                                       m_pbData, m_strDataDesc, m_tscViewers);
                    this.DvfUpdating(this, args);
                    if (args.Cancel)
                    {
                        return;
                    }
                }

                if (strViewer == m_strViewerHex)
                {
                    UpdateHexView();
                }
                else if (strViewer == m_strViewerText)
                {
                    string strData = BinaryDataToString(true);
                    SetRtbData(strData, (m_bdc == BinaryDataClass.RichText), false);
                }
                else if (strViewer == m_strViewerImage)
                {
                    if (m_img == null)
                    {
                        m_img = GfxUtil.LoadImage(m_pbData);
                    }
                    UpdateImageView();
                }
                else if (strViewer == m_strViewerWeb)
                {
                    string strData = BinaryDataToString(false);
                    UIUtil.SetWebBrowserDocument(m_webBrowser, strData);
                }
            }
            catch (Exception) { }

            UpdateVisibility(strViewer, true);
        }
示例#4
0
        private void OnFormClosing(object sender, FormClosingEventArgs e)
        {
            if (this.Uninitializing != null)
            {
                DvfContextEventArgs args = new DvfContextEventArgs(this,
                                                                   m_pbData, m_strDataDesc, m_tscViewers);
                this.Uninitializing(sender, args);
                if (args.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
            }

            m_ctxText.Detach();
            GlobalWindowManager.RemoveWindow(this);
        }
示例#5
0
        private void OnFormClosing(object sender, FormClosingEventArgs e)
        {
            if (this.DvfRelease != null)
            {
                DvfContextEventArgs args = new DvfContextEventArgs(this,
                                                                   m_pbData, m_strDataDesc, m_tscViewers);
                this.DvfRelease(sender, args);
                if (args.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
            }

            string strRect = UIUtil.GetWindowScreenRect(this);

            if (strRect != m_strInitialFormRect)            // Don't overwrite ""
            {
                Program.Config.UI.DataViewerRect = strRect;
            }
        }
示例#6
0
        private void UpdateDataView(Encoding enc)
        {
            if(m_bInitializing) return;

            m_rtbText.Visible = false;
            m_webBrowser.Visible = false;
            m_picBox.Visible = false;
            m_pnlImageViewer.Visible = false;

            string strViewer = m_tscViewers.Text;

            m_tssSeparator0.Visible = m_tslEncoding.Visible =
                m_tscEncoding.Visible = !(strViewer == KPRes.ImageViewer);

            try
            {
                if(this.UpdatingDataView != null)
                {
                    DvfContextEventArgs args = new DvfContextEventArgs(this,
                        m_pbData, m_strDataDesc, m_tscViewers);
                    this.UpdatingDataView(this, args);
                    if(args.Cancel) return;
                }

                if(strViewer == KPRes.TextViewer)
                {
                    string strData = BinaryDataToString(enc);

                    if(m_bdc == BinaryDataClass.RichText) m_rtbText.Rtf = strData;
                    else m_rtbText.Text = strData;

                    m_rtbText.Visible = true;
                }
                else if(strViewer == KPRes.ImageViewer)
                {
                    Image img = UIUtil.LoadImage(m_pbData);
                    m_picBox.Image = img;

                    m_pnlImageViewer.Visible = true;
                    m_picBox.Visible = true;

                    OnFormSizeChanged(null, null);
                }
                else if(strViewer == KPRes.WebBrowser)
                {
                    string strData = BinaryDataToString(enc);

                    UIUtil.SetWebBrowserDocument(m_webBrowser, strData);

                    m_webBrowser.Visible = true;
                }
            }
            catch(Exception) { }
        }
示例#7
0
        private void OnFormClosing(object sender, FormClosingEventArgs e)
        {
            if(this.Uninitializing != null)
            {
                DvfContextEventArgs args = new DvfContextEventArgs(this,
                    m_pbData, m_strDataDesc, m_tscViewers);
                this.Uninitializing(sender, args);
                if(args.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
            }

            m_ctxText.Detach();
            GlobalWindowManager.RemoveWindow(this);
        }
示例#8
0
        private void UpdateDataView(Encoding enc)
        {
            if (m_bInitializing)
            {
                return;
            }

            m_rtbText.Visible        = false;
            m_webBrowser.Visible     = false;
            m_picBox.Visible         = false;
            m_pnlImageViewer.Visible = false;

            string strViewer = m_tscViewers.Text;

            m_tssSeparator0.Visible   = m_tslEncoding.Visible =
                m_tscEncoding.Visible = !(strViewer == KPRes.ImageViewer);

            try
            {
                if (this.UpdatingDataView != null)
                {
                    DvfContextEventArgs args = new DvfContextEventArgs(this,
                                                                       m_pbData, m_strDataDesc, m_tscViewers);
                    this.UpdatingDataView(this, args);
                    if (args.Cancel)
                    {
                        return;
                    }
                }

                if (strViewer == KPRes.TextViewer)
                {
                    string strData = BinaryDataToString(enc);

                    if (m_bdc == BinaryDataClass.RichText)
                    {
                        m_rtbText.Rtf = strData;
                    }
                    else
                    {
                        m_rtbText.Text = strData;
                    }

                    m_rtbText.Visible = true;
                }
                else if (strViewer == KPRes.ImageViewer)
                {
                    Image img = UIUtil.LoadImage(m_pbData);
                    m_picBox.Image = img;

                    m_pnlImageViewer.Visible = true;
                    m_picBox.Visible         = true;

                    OnFormSizeChanged(null, null);
                }
                else if (strViewer == KPRes.WebBrowser)
                {
                    string strData = BinaryDataToString(enc);

                    UIUtil.SetWebBrowserDocument(m_webBrowser, strData);

                    m_webBrowser.Visible = true;
                }
            }
            catch (Exception) { }
        }
        private void UpdateDataView()
        {
            if(m_bInitializing) return;

            m_rtbText.Visible = false;
            m_webBrowser.Visible = false;
            m_picBox.Visible = false;
            m_pnlImageViewer.Visible = false;

            string strViewer = m_tscViewers.Text;

            bool bText = ((strViewer == KPRes.TextViewer) ||
                (strViewer == KPRes.WebBrowser));
            bool bImage = (strViewer == KPRes.ImageViewer);

            m_tssSeparator0.Visible = (bText || bImage);
            m_tslEncoding.Visible = m_tscEncoding.Visible = bText;
            m_tslZoom.Visible = m_tscZoom.Visible = bImage;

            try
            {
                if(this.DvfUpdating != null)
                {
                    DvfContextEventArgs args = new DvfContextEventArgs(this,
                        m_pbData, m_strDataDesc, m_tscViewers);
                    this.DvfUpdating(this, args);
                    if(args.Cancel) return;
                }

                if(strViewer == KPRes.TextViewer)
                {
                    string strData = BinaryDataToString();

                    m_rtbText.Clear(); // Clear formatting
                    if(m_bdc == BinaryDataClass.RichText) m_rtbText.Rtf = strData;
                    else m_rtbText.Text = strData;

                    m_rtbText.Visible = true;
                }
                else if(strViewer == KPRes.ImageViewer)
                {
                    if(m_img == null) m_img = GfxUtil.LoadImage(m_pbData);
                    // m_picBox.Image = m_img;

                    m_pnlImageViewer.Visible = true;
                    m_picBox.Visible = true;

                    UpdateImageView();
                }
                else if(strViewer == KPRes.WebBrowser)
                {
                    string strData = BinaryDataToString();

                    UIUtil.SetWebBrowserDocument(m_webBrowser, strData);

                    m_webBrowser.Visible = true;
                }
            }
            catch(Exception) { }
        }
示例#10
0
        private void OnFormClosing(object sender, FormClosingEventArgs e)
        {
            if(this.DvfRelease != null)
            {
                DvfContextEventArgs args = new DvfContextEventArgs(this,
                    m_pbData, m_strDataDesc, m_tscViewers);
                this.DvfRelease(sender, args);
                if(args.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
            }

            m_picBox.Image = null;
            if(m_img != null) { m_img.Dispose(); m_img = null; }
            if(m_imgResized != null) { m_imgResized.Dispose(); m_imgResized = null; }

            m_ctxText.Detach();
            GlobalWindowManager.RemoveWindow(this);
        }
示例#11
0
        private void UpdateDataView()
        {
            if(m_bInitializing) return;

            string strViewer = m_tscViewers.Text;
            bool bText = ((strViewer == m_strViewerText) ||
                (strViewer == m_strViewerWeb));
            bool bImage = (strViewer == m_strViewerImage);

            UpdateVisibility(strViewer, false);
            m_tssSeparator0.Visible = (bText || bImage);
            m_tslEncoding.Visible = m_tscEncoding.Visible = bText;
            m_tslZoom.Visible = m_tscZoom.Visible = bImage;

            try
            {
                if(this.DvfUpdating != null)
                {
                    DvfContextEventArgs args = new DvfContextEventArgs(this,
                        m_pbData, m_strDataDesc, m_tscViewers);
                    this.DvfUpdating(this, args);
                    if(args.Cancel) return;
                }

                if(strViewer == m_strViewerHex)
                    UpdateHexView();
                else if(strViewer == m_strViewerText)
                {
                    string strData = BinaryDataToString();
                    SetRtbData(strData, (m_bdc == BinaryDataClass.RichText), false);
                }
                else if(strViewer == m_strViewerImage)
                {
                    if(m_img == null) m_img = GfxUtil.LoadImage(m_pbData);
                    UpdateImageView();
                }
                else if(strViewer == m_strViewerWeb)
                {
                    string strData = BinaryDataToString();
                    UIUtil.SetWebBrowserDocument(m_webBrowser, strData);
                }
            }
            catch(Exception) { }

            UpdateVisibility(strViewer, true);
        }
示例#12
0
        private void UpdateDataView()
        {
            if (m_bInitializing)
            {
                return;
            }

            m_rtbText.Visible        = false;
            m_webBrowser.Visible     = false;
            m_picBox.Visible         = false;
            m_pnlImageViewer.Visible = false;

            string strViewer = m_tscViewers.Text;

            bool bText = ((strViewer == KPRes.TextViewer) ||
                          (strViewer == KPRes.WebBrowser));
            bool bImage = (strViewer == KPRes.ImageViewer);

            m_tssSeparator0.Visible = (bText || bImage);
            m_tslEncoding.Visible   = m_tscEncoding.Visible = bText;
            m_tslZoom.Visible       = m_tscZoom.Visible = bImage;

            try
            {
                if (this.DvfUpdating != null)
                {
                    DvfContextEventArgs args = new DvfContextEventArgs(this,
                                                                       m_pbData, m_strDataDesc, m_tscViewers);
                    this.DvfUpdating(this, args);
                    if (args.Cancel)
                    {
                        return;
                    }
                }

                if (strViewer == KPRes.TextViewer)
                {
                    string strData = BinaryDataToString();

                    m_rtbText.Clear();                     // Clear formatting
                    if (m_bdc == BinaryDataClass.RichText)
                    {
                        m_rtbText.Rtf = strData;
                    }
                    else
                    {
                        m_rtbText.Text = strData;
                    }

                    m_rtbText.Visible = true;
                }
                else if (strViewer == KPRes.ImageViewer)
                {
                    if (m_img == null)
                    {
                        m_img = UIUtil.LoadImage(m_pbData);
                    }
                    // m_picBox.Image = m_img;

                    m_pnlImageViewer.Visible = true;
                    m_picBox.Visible         = true;

                    UpdateImageView();
                }
                else if (strViewer == KPRes.WebBrowser)
                {
                    string strData = BinaryDataToString();

                    UIUtil.SetWebBrowserDocument(m_webBrowser, strData);

                    m_webBrowser.Visible = true;
                }
            }
            catch (Exception) { }
        }