// Creates a new form that is invoked on the card click and
        // shows the chart displaying client data.
        void DisplayDetailedChart(string title, DataTable dataSource)
        {
            XtraForm form = new XtraForm();

            form.Text   = title;
            form.Bounds = new Rectangle(100, 100, 700, 350);

            ChartControl chart = new ChartControl();

            chart.Parent = form; chart.Dock = DockStyle.Fill;

            Series series1 = new Series("Actual", ViewType.SplineArea);
            Series series2 = new Series("Target", ViewType.Spline);

            chart.Series.AddRange(new Series[] { series1, series2 });

            foreach (Series series in chart.Series)
            {
                series.DataSource     = dataSource; series.ArgumentDataMember = "Argument";
                series.ValueScaleType = ScaleType.Numerical;
            }
            series1.ValueDataMembers.AddRange(new string[] { "Actual" });
            series2.ValueDataMembers.AddRange(new string[] { "Target" });
            ((XYDiagram)chart.Diagram).AxisY.Label.TextPattern = "{V:$0}";

            form.ShowDialog();
            form.Dispose();
        }
Ejemplo n.º 2
0
        private void dashboardViewer1_DashboardItemDoubleClick(object sender, DashboardItemMouseActionEventArgs e)
        {
            XtraForm form = new XtraForm {
                Text = "Underlying Data"
            };
            DashboardUnderlyingDataSet underlyingData = e.GetUnderlyingData();

            if (underlyingData != null && underlyingData.RowCount > 0)
            {
                DevExpress.XtraGrid.GridControl grid = new DevExpress.XtraGrid.GridControl {
                    Parent     = form,
                    Dock       = DockStyle.Fill,
                    DataSource = underlyingData,
                };
            }
            else
            {
                LabelControl lbl = new LabelControl {
                    Text   = "No Data",
                    Parent = form,
                };
                lbl.AutoSizeMode = LabelAutoSizeMode.None;
                lbl.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
                lbl.Appearance.TextOptions.VAlignment = VertAlignment.Center;
                lbl.Dock = DockStyle.Fill;
            }

            form.ShowDialog();
            form.Dispose();
        }
Ejemplo n.º 3
0
        private void PivotGrid_CellDoubleClick(object sender, PivotCellEventArgs e)
        {
            XtraForm form = new XtraForm();

            form.Icon            = Marbid.Module.Win.Properties.Resources.mareinico;
            form.Height          = 800;
            form.Width           = 600;
            form.StartPosition   = FormStartPosition.CenterScreen;
            form.Owner           = pivotForm;
            form.Text            = "Drill Down: " + ReportName;
            drillGrid            = new GridControl();
            drillView            = new DevExpress.XtraGrid.Views.Grid.GridView();
            drillGrid.DataSource = e.CreateDrillDownDataSource();
            drillGrid.ViewCollection.Add(drillView);
            drillGrid.ForceInitialize();
            drillGrid.Parent = form;
            drillGrid.Dock   = DockStyle.Fill;
            DevExpress.XtraGrid.Views.Grid.GridView view = (DevExpress.XtraGrid.Views.Grid.GridView)drillGrid.MainView;
            view.PopulateColumns();
            foreach (GridColumn col in view.Columns)
            {
                if (col.GetType() == typeof(System.Decimal) || col.GetType() == typeof(System.Double))
                {
                    col.DisplayFormat.FormatType   = FormatType.Numeric;
                    col.DisplayFormat.FormatString = "n2";
                }
            }
            view.PopupMenuShowing           += DrillGrid_PopupMenuShowing;
            view.OptionsView.ColumnAutoWidth = false;
            view.BestFitColumns(true);
            form.ShowDialog();
            form.Dispose();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 关闭窗体
        /// </summary>
        private void CloseForm()
        {
            if (tabAnalysisTemplateManage.Controls.Count > 0)
            {
                XtraForm itemForm = tabAnalysisTemplateManage.Controls[0] as XtraForm;
                itemForm.Close();
                itemForm.Dispose();
            }
            if (TabLargedataAnalysisManage.Controls.Count > 0)
            {
                XtraForm itemForm = TabLargedataAnalysisManage.Controls[0] as XtraForm;
                itemForm.Close();
                itemForm.Dispose();
            }
            if (TabSetAlarmNotificationPersonnelMange.Controls.Count > 0)
            {
                XtraForm itemForm = TabSetAlarmNotificationPersonnelMange.Controls[0] as XtraForm;
                itemForm.Close();
                itemForm.Dispose();
            }
            if (TabSetRegionOutageManage.Controls.Count > 0)
            {
                XtraForm itemForm = TabSetRegionOutageManage.Controls[0] as XtraForm;
                itemForm.Close();
                itemForm.Dispose();
            }
            if (TabSetEmergencyLinkage.Controls.Count > 0)
            {
                XtraForm itemForm = TabSetEmergencyLinkage.Controls[0] as XtraForm;
                itemForm.Close();
                itemForm.Dispose();
            }

            if (TabCurvilinearQuery.Controls.Count > 0)
            {
                XtraForm itemForm = TabCurvilinearQuery.Controls[0] as XtraForm;
                itemForm.Close();
                itemForm.Dispose();
            }
            if (TabAnalysisResultsInRealtime.Controls.Count > 0)
            {
                XtraForm itemForm = TabAnalysisResultsInRealtime.Controls[0] as XtraForm;
                itemForm.Close();
                itemForm.Dispose();
            }
            if (TabViewEmergencyLinkage.Controls.Count > 0)
            {
                XtraForm itemForm = TabViewEmergencyLinkage.Controls[0] as XtraForm;
                if (itemForm != null)
                {
                    itemForm.Close();
                    itemForm.Dispose();
                }
            }
        }
 public void Dispose()
 {
     if (this.chromium != null)
     {
         chromium.LoadingStateChanged         -= OnLoadingStateChanged;
         chromium.AddressChanged              -= OnAddressChanged;
         chromium.IsBrowserInitializedChanged -= OnBrowserInitializedChanged;
     }
     if (Form != null)
     {
         Form.Dispose();
     }
 }
Ejemplo n.º 6
0
        private static bool CheckOpened(string name, XtraForm form)
        {
            FormCollection fc = Application.OpenForms;

            foreach (Form frm in fc)
            {
                if (frm.Name == name)
                {
                    form.Dispose();
                    frm.Focus();
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 7
0
        public void LoadTrainerForm(XtraForm loaderForm, SimpleButton btn, Timer tmr)
        {
            XtraForm CreateForm(XtraForm loader)
            {
                if (_trainerForm != null)
                {
                    return(_trainerForm);
                }
                _trainerForm         = new XtraForm1();
                _trainerForm.Text    = $"{apis.Data.SRFName}";
                _trainerForm.Tag     = $"{apis.Data.SRFVersion}";
                _trainerForm.Closed += (sender, args) =>
                {
                    tmr.Interval = 1000;
                    _trainerForm.Dispose();
                    loader.Show();
                };
                return(_trainerForm);
            }

            // CreateForm().Show();
            // var tm = new Timer {Interval = 1000};
            // tm.Tick += (sender, args) =>
            // {
            //     Debug.WriteLine("Still Working");
            //     if (!CreateForm().IsDisposed) return;
            //     loaderForm.Show();
            //     tm.Stop();
            // };
            void OnBtnOnClick(object sender, EventArgs args)
            {
                _trainerForm = null;
                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
                // tm.Enabled = true;
                // tm.Start();
                jr = SRMain.Instance;
                jr.activeTrainer = ActiveTrainer.Instance;
                SRMain.Instance.Load(apis.Data);
                CreateForm(loaderForm).Show();
                loaderForm.Hide();
                tmr.Interval = 7000;
            }

            btn.Click += OnBtnOnClick;
        }
Ejemplo n.º 8
0
 private void dashboardViewer1_DashboardItemClick(object sender,
                                                  DashboardItemMouseActionEventArgs e)
 {
     if (e.DashboardItemName == "chartDashboardItem1" && e.GetAxisPoint() != null)
     {
         XtraForm form = new XtraForm();
         form.Text = e.GetAxisPoint(DashboardDataAxisNames.ChartArgumentAxis).
                     DimensionValue.Value.ToString() + " - " +
                     e.GetAxisPoint(DashboardDataAxisNames.ChartSeriesAxis).
                     DimensionValue.Value.ToString();
         DataGrid grid = new DataGrid();
         grid.Parent     = form; grid.Dock = DockStyle.Fill;
         grid.DataSource = e.GetUnderlyingData();
         form.ShowDialog();
         form.Dispose();
     }
 }
Ejemplo n.º 9
0
        private void fncCallFormInTab(XtraForm xtraForm)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                xtraForm.LookAndFeel.SetSkinStyle(DevExpress.LookAndFeel.UserLookAndFeel.Default.ActiveSkinName);
                if (xtraTabbedMdiManager1.Pages.Count > 0)
                {
                    int  i    = 0;
                    bool flag = false;
                    foreach (DevExpress.XtraTabbedMdi.XtraMdiTabPage obj in xtraTabbedMdiManager1.Pages)
                    {
                        if (obj.Text == xtraForm.Text)
                        {
                            flag = true;
                            break;
                        }
                        i++;
                    }
                    if (flag)
                    {
                        xtraTabbedMdiManager1.Pages.RemoveAt(i);
                    }
                }

                xtraForm.FormClosing  += new FormClosingEventHandler(xtraForm_FormClosing);
                xtraForm.MdiParent     = this;
                xtraForm.ShowInTaskbar = false;
                xtraForm.WindowState   = FormWindowState.Maximized;
                xtraForm.Show();
            }
            catch
            {
                xtraForm.Close();
                xtraForm.Dispose();
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 10
0
 /// <summary>Đóng màn hình khi nạp màn hình bị lỗi.
 /// Phát sinh: Dùng trong tất cả các phiếu. Ví dụ khi chọn xem 1 phiếu trong khi đó 
 /// có 1 người đã vừa mới xóa thông tin phiếu
 /// </summary>
 /// <param name="frm"></param>
 public static void CloseFormWhenLoadError(XtraForm frm)
 {
     HelpMsgBox.ShowNotificationMessage("Chức năng này không hoạt động.\nVui lòng liên hệ Công ty P R O T O C O L.");
     frm.Hide();
     frm.Dispose();
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Hỗ trợ hiện thị 1 form với nhiều tiêu chí tùy biến
        /// </summary>
        public static void ShowForm(XtraForm mainForm, XtraForm form,
            bool isWaitForm,
            bool isModal,
            bool ignoreCheckShowForm,
            bool IsInTaskbar,
            bool IsFixForm)
        {
            //Kiểm tra quyền.
            if (ignoreCheckShowForm == false)
            {
                if (HelpPermission.CanShowForm(form) == false)
                {
                    ApplyPermissionAction.getPermissionFormFail().ShowDialog();
                    form.Dispose();
                    return;
                }
            }

            try
            {
                if (form.IsDisposed) return;

                HelpUserLog.logOpenForm(form);

                PLPlugin.HookShowAllPlugin(form);

                form.FormClosed += new FormClosedEventHandler(form_FormClosed);

                ProtocolForm.pl_wrapper(ref form);

                EventHandler showEvent = new EventHandler(wait);
                form.Shown += showEvent;

                //DEVEXPRESS
                if (FrameworkParams.UsingRightClickForm)
                    HelpXtraForm.PopupRightClickForm(form);

                if (FrameworkParams.wait != null)
                    FrameworkParams.wait.Finish();

                HelpXtraForm.SetModal(mainForm, form, isModal, IsInTaskbar, IsFixForm);
            }
            catch (Exception ex)
            {
                PLException.AddException(ex);
                PLMessageBox.ShowSystemErrorMessage(ex.ToString());
            }
        }
        private void PrintReport(ReportParametersObjectBase GetReportParametersObject)
        {
            var fileName = String.Empty;

            ProcessedfileNameAddress = String.Empty;
            try
            {
                using (SaveFileDialog sfd = new SaveFileDialog())
                {
                    var agora = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
                    fileName = $"{currentReport.DisplayName} {agora}";

                    sfd.FileName = fileName;
                    sfd.Filter   = "Formato Excel (*.xlsx)|*.xlsx";

                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        CriteriaOperator filter = string.Empty;
                        if (GetReportParametersObject != null)
                        {
                            filter = XpoObjectInCriteriaProcessingHelper.ParseCriteria(((XPObjectSpace)ObjectSpace).Session, GetReportParametersObject?.GetCriteria()?.LegacyToString());
                        }
                        else
                        {
                            filter = string.Empty;
                        }

                        var sorting = GetReportParametersObject?.GetSorting();

                        XtraReport      report        = ReportDataProvider.ReportsStorage.LoadReport(currentReport);
                        ReportsModuleV2 reportsModule = ReportsModuleV2.FindReportsModule(Application.Modules);

                        if (reportsModule != null && reportsModule.ReportsDataSourceHelper != null)
                        {
                            if (GetReportParametersObject == null)
                            {
                                reportsModule.ReportsDataSourceHelper.SetupBeforePrint(report, null, null, true, null, true);
                            }
                            else
                            {
                                reportsModule.ReportsDataSourceHelper.SetupBeforePrint(report, null, filter, true, sorting, true);
                            }

                            XtraForm form = new XtraForm()
                            {
                                FormBorderStyle = FormBorderStyle.None,
                                Size            = new System.Drawing.Size(400, 20),
                                ShowInTaskbar   = false,
                                StartPosition   = FormStartPosition.CenterScreen,
                                TopMost         = true
                            };

                            ProgressBarControl progressBar  = new ProgressBarControl();
                            ReflectorBar       reflectorBar = new ReflectorBar(progressBar);

                            form.Controls.Add(progressBar);
                            progressBar.Dock = DockStyle.Fill;

                            XlsxExportOptions options = new XlsxExportOptions {
                                ExportMode = XlsxExportMode.SingleFile, ShowGridLines = true, RawDataMode = false
                            };

                            form.Show();
                            report.PrintingSystem.ProgressReflector = reflectorBar;
                            report.ExportToXlsx(sfd.FileName, options);
                            report.PrintingSystem.ResetProgressReflector();
                            form.Close();
                            form.Dispose();
                            ProcessedfileNameAddress = sfd.FileName;
                        }
                    }
                }
            }
            catch (Exception)
            {
            }

            if (!String.IsNullOrEmpty(ProcessedfileNameAddress))
            {
                FileInfo fi = new FileInfo(ProcessedfileNameAddress);
                if (fi.Exists)
                {
                    Form      mainForm = (Form)Application.MainWindow.Template;
                    AlertInfo info     = new AlertInfo("Processo Finalizado!", $"{fileName} (Clique aqui para abrir");
                    alertControlCore.Show(mainForm, info);
                }
            }
        }