Exemple #1
0
 /// <summary>
 /// Handles when the report window has been closed.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The EventArgs of the event.</param>
 void ReportWindowClosed(object sender, EventArgs e)
 {
     if (m_reportWindow != null)
     {
         m_reportWindow.Closed -= ReportWindowClosed;
         m_reportWindow         = null;
     }
 }
Exemple #2
0
        /// <summary>
        /// Displays the specified view.
        /// </summary>
        /// <param name="view">The view to display.</param>
        /// <exception cref="System.ArgumentException">view is
        /// invalid.</exception>
        public void NavigateTo(SessionSummaryView view, NavigateToArgs e)
        {
            switch (view)
            {
            case SessionSummaryView.About:
                AboutWindow aboutWin = new AboutWindow(Settings.UseAcceleration, Resources.SessionSummaryName,
                                                       EliteModule.GetVersion(Assembly.GetExecutingAssembly()),
                                                       EliteModule.GetCopyright(Assembly.GetExecutingAssembly()),
                                                       Resources.ModuleDescription);
                aboutWin.Owner = MainWindow;
                CurrentView    = aboutWin;
                aboutWin.ShowDialog();

                CurrentView = MainWindow;
                break;

            case SessionSummaryView.SessionCosts:
            {
                SessionCostsWindow sessionCostWin = new SessionCostsWindow(Settings.UseAcceleration);
                sessionCostWin.Owner       = MainWindow;
                sessionCostWin.DataContext = new SessionCostsViewModel(SessionCostsController);
                CurrentView = sessionCostWin;
                sessionCostWin.ShowDialog();

                ((IDisposable)sessionCostWin.DataContext).Dispose();
                CurrentView = MainWindow;
            }
            break;

            case SessionSummaryView.SelectSessionCosts:
            {
                SelectSessionCostsWindow sessionCostWin = new SelectSessionCostsWindow(Settings.UseAcceleration);
                sessionCostWin.Owner       = MainWindow;
                sessionCostWin.DataContext = new SelectSessionCostsViewModel(SessionCostsController, (Summary)e.Argument);
                CurrentView = sessionCostWin;
                sessionCostWin.ShowDialog();

                ((IDisposable)sessionCostWin.DataContext).Dispose();
                CurrentView = MainWindow;
            }
            break;

            case SessionSummaryView.Report:
            {
                if (m_reportWindow == null)
                {
                    m_reportWindow         = new SessionSummaryReportWindow();
                    m_reportWindow.Owner   = MainWindow;
                    m_reportWindow.Closed += ReportWindowClosed;
                    m_reportWindow.Show();
                }
                m_reportWindow.Focus();

                ArrayList args    = (ArrayList)e.Argument;
                DateTime  date    = (DateTime)args[0];
                short     session = (short)args[1];

                RefreshSessionSummaryReport(date, session);
                m_reportWindow.DisplayReport(SessionSummaryReport);
            }
            break;

            case SessionSummaryView.ActualCashCalculator:
            {
                var calcWin = new ActualCashCalculatorWindow(Settings.UseAcceleration);
                calcWin.Owner       = MainWindow;
                calcWin.DataContext = new ActualCashCalculatorViewModel(this, (Summary)e.Argument);
                CurrentView         = calcWin;
                calcWin.ShowDialog();

                var disposable = calcWin.DataContext as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }

                CurrentView = MainWindow;
            }
            break;

            case SessionSummaryView.SessionBankBreakdown:
            {
                var calcWin = new SessionBanksWindow(Settings.UseAcceleration);
                calcWin.Owner       = MainWindow;
                calcWin.DataContext = new SessionBanksViewModel(this, (List <BasicBankInfo>)e.Argument);
                CurrentView         = calcWin;
                calcWin.ShowDialog();

                var disposable = calcWin.DataContext as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }

                CurrentView = MainWindow;
            }
            break;

            default:
                throw new ArgumentException();
            }
        }