Exemplo n.º 1
0
        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);
            this.Enabled = true;
            System.Windows.Input.Mouse.OverrideCursor = null;

            crviewToolbar = ViewBaseCommon.FindLogicalChildList <System.Windows.Controls.ToolBar>(this.CRVIEWER as System.Windows.DependencyObject).First();
            crviewToolbar.Items.Clear();

            if (btnPrintOut != null)
            {
                AppLogger.Instance.Debug("btnPrintOut is alive");
                btnPrintOut.Click -= ReportPreviewPrintButton_Click;
                btnPrintOut        = null;
            }
            if (btnClose != null)
            {
                AppLogger.Instance.Debug("btnClose is alive");
                btnClose.Click -= closebtn_Click;
                btnClose        = null;
            }
            if (cboxCustom != null)
            {
                AppLogger.Instance.Debug("cboxCustom is alive");
                cboxCustom.Checked   -= cbox_Checked;
                cboxCustom.UnChecked -= cbox_Unchecked;
                cboxCustom            = null;
            }
            if (targetReportDocument != null)
            {
                AppLogger.Instance.Debug("targetReportDocument is alive");
                targetReportDocument.Close();
                targetReportDocument.Dispose();
                targetReportDocument = null;
            }
            if (_ReportData is DataTable)
            {
                (_ReportData as DataTable).Dispose();
            }
            else if (_ReportData is DataSet)
            {
                var ds = (_ReportData as DataSet);
                foreach (DataTable tbl in ds.Tables)
                {
                    tbl.Dispose();
                }
                ds.Tables.Clear();
                ds.Dispose();
            }
            _ReportData = null;
        }
Exemplo n.º 2
0
 private void makeCustomButton()
 {
     if (crviewToolbar == null || originalPrintbtn == null)
     {
         return;
     }
     if (cboxCustom == null)
     {
         // カスタム用紙設定ボタン
         cboxCustom = new KyoeiSystem.Framework.Windows.Controls.UcCheckBox()
         {
             cContent                   = "カスタム用紙指定",
             Height                     = originalPrintbtn.Height,
             Margin                     = marginCustomButton,
             VerticalAlignment          = System.Windows.VerticalAlignment.Center,
             VerticalContentAlignment   = System.Windows.VerticalAlignment.Center,
             HorizontalAlignment        = originalPrintbtn.HorizontalAlignment,
             HorizontalContentAlignment = originalPrintbtn.HorizontalAlignment,
             ToolTip                    = "カスタム用紙サイズを指定します。"
                                          + "\r\nプリンターの用紙一覧に定義されていないサイズを指定できます。",
             IsChecked = this.IsCustomMode,
         };
         cboxCustom.Checked   += cbox_Checked;
         cboxCustom.UnChecked += cbox_Unchecked;
         int pos = 0;
         if (posCutomButton < crviewToolbar.Items.Count)
         {
             foreach (System.Windows.Controls.Control item in crviewToolbar.Items)
             {
                 if (item.IsEnabled)
                 {
                     pos++;
                 }
             }
             crviewToolbar.Items.Insert(posCutomButton, cboxCustom);
         }
         else
         {
             crviewToolbar.Items.Add(cboxCustom);
         }
     }
 }