Exemplo n.º 1
0
        public WrapPanel GetRuntimePanel()
        {
            const int elementsHeight = 25;
            const int fontsSize      = 12;
            WrapPanel panel          = new WrapPanel();
            Button    statsButton    = new Button
            {
                Content  = "Show statistics",
                FontSize = fontsSize,
                Height   = elementsHeight
            };

            statsButton.Click += (o, e) =>
            {
                var stats          = statistics.GetStatistics();
                StatisticsWindow w = new StatisticsWindow(stats);
                w.ShowDialog();
            };

            managedButton          = new Button();
            managedButton.Width    = double.NaN;
            managedButton.Height   = elementsHeight;
            managedButton.FontSize = fontsSize;
            managedButton.Content  = "Start the break";
            managedButton.Click   += (o, e) => { BreakRequested(); StartBreak(); };

            managedText          = new TextBlock();
            managedText.Height   = elementsHeight;
            managedText.FontSize = fontsSize;
            managedText.Text     = "Break is available";
            panel.Children.Add(managedButton);
            panel.Children.Add(managedText);
            return(panel);
        }
Exemplo n.º 2
0
 public void ShowStatsWindow(object sender)
 {
     _context.Send(_ =>
     {
         var window = new StatisticsWindow {
             DataContext = sender
         };
         window.ShowDialog();
     });
 }
 private void GetStatistics(object parameter)
 {
     try
     {
         StatisticsWindow wnd = new StatisticsWindow();
         wnd.ShowDialog();
     }
     catch (Exception ex)
     {
         System.Windows.MessageBox.Show(ex.Message);
     }
 }
        private void StatsMethod(object param)
        {
            int secondsRemaining = (deadline - DateTime.Now).Seconds;

            StopTimer();
            StatisticsWindow    statsWindow         = new StatisticsWindow();
            StatisticsViewModel statisticsViewModel = new StatisticsViewModel(currentUser);

            statsWindow.DataContext = statisticsViewModel;
            statsWindow.ShowDialog();
            StartTimer(secondsRemaining);
        }
Exemplo n.º 5
0
        public void StatisticsPressed(object param)
        {
            int seconds = (deadline - DateTime.Now).Seconds;

            StopTimer();
            StatisticsWindow    statisticsWindow = new StatisticsWindow();
            StatisticsViewModel statisticsVM     = new StatisticsViewModel(user);

            statisticsWindow.DataContext = statisticsVM;
            statisticsWindow.ShowDialog();
            StartTimer(seconds);
        }
        private void StatisticsButton_Click(object sender, RoutedEventArgs e)
        {
            var allowViewStatistics = Model.UserSettings.ProfileRole == Model.ERole.Administrator ||
                                      Model.UserSettings.ProfileRole == Model.ERole.Accountant ||
                                      Model.UserSettings.ProfileRole == Model.ERole.Designer;

            if (allowViewStatistics)
            {
                var statistics = new StatisticsWindow();
                var fadeIn     = new DoubleAnimation()
                {
                    From     = 0,
                    To       = 1,
                    Duration = new Duration(statistics.AnimationDuration)
                };
                statistics.BeginAnimation(Window.OpacityProperty, fadeIn);
                statistics.ShowDialog();
            }
            ;
        }
        public void OpenStatisticsWindow(Window w)
        {
            StatisticsWindow window = new StatisticsWindow();

            window.ShowDialog();
        }
Exemplo n.º 8
0
        private void InitMessenger()
        {
            ServiceBus.Instance.Register <OpenNewCardOverViewMessage>(this, delegate()
            {
                CardOverviewWindow myWindow = new CardOverviewWindow();
                myWindow.ShowDialog();
            });

            ServiceBus.Instance.Register <OpenStatisticsWindowMessage>(this, delegate()
            {
                StatisticsWindow = new StatisticsWindow();
                StatisticsWindow.ShowDialog();
            });

            ServiceBus.Instance.Register <OpenLearningCardWindowMessage>(this, delegate()
            {
                LearningCardWindow = new LearningCardWindow();
                LearningCardWindow.ShowDialog();
            });

            ServiceBus.Instance.Register <OpenNewCardWindowMessage>(this, delegate()
            {
                NewCardWindow = new NewCardWindow();
                NewCardWindow.ShowDialog();
            });

            ServiceBus.Instance.Register <OpenNewTopicWindowMessage>(this, delegate()
            {
                NewTopicWindow = new NewTopicWindow();
                NewTopicWindow.ShowDialog();
            });

            Messenger.Instance.Register <OpenPrintWindowMessage>(this, delegate(OpenPrintWindowMessage message)
            {
                PrintWindow myPrintWindow       = new PrintWindow();
                myPrintWindow.Grid1.ItemsSource = ((DataGrid)message.Grid).ItemsSource;
                myPrintWindow.ShowDialog();
            });



            Messenger.Instance.Register <OpenStatisticsPanelMessage>(this, delegate(OpenStatisticsPanelMessage messageObject)
            {
                Frame statisticsFrame = StatisticsWindow.StatisticsFrame;
                switch (messageObject.PanelIndex)
                {
                case OpenStatisticsPanelMessage.HISTORY_PANEL:
                    statisticsFrame.Content = new StatisticsHistoryPanel();
                    break;

                case OpenStatisticsPanelMessage.TIME_PANEL:
                    statisticsFrame.Content = new StatisticsTimePanel();
                    break;

                case OpenStatisticsPanelMessage.QUALITY_PANEL:
                    statisticsFrame.Content = new StatisticsQualityPanel();
                    break;

                case OpenStatisticsPanelMessage.NO_PANEL:
                    statisticsFrame.Content = null;
                    break;
                }
            });

            Messenger.Instance.Register <OpenLearningCardPanelMessage>(this, delegate(OpenLearningCardPanelMessage messageObject)
            {
                Frame learningCardFrame = LearningCardWindow.LearningCardFrame;
                switch (messageObject.PanelIndex)
                {
                case OpenLearningCardPanelMessage.QUESTION_PANEL:
                    learningCardFrame.Content = new LearningCardQuestionPanel();
                    break;

                case OpenLearningCardPanelMessage.ANSWER_PANEL:
                    learningCardFrame.Content = new LearningCardAnswerPanel();
                    break;

                case OpenLearningCardPanelMessage.FINISH_PANEL:
                    learningCardFrame.Content = new LearningCardFinishPanel();
                    break;

                case OpenLearningCardPanelMessage.CLOSE_PANEL:
                    learningCardFrame.Content = "";
                    break;
                }
            });


            Messenger.Instance.Register <OpenTopicSelectionWindowMessage>(this, delegate(OpenTopicSelectionWindowMessage message)
            {
                StatisticsTopicSelectionWindow myWindow = new StatisticsTopicSelectionWindow();
                myWindow.ShowDialog();
            });

            Messenger.Instance.Register <SendAnswerMessage>(this, delegate(SendAnswerMessage message)
            {
            });
        }
        public void OpenStatistics()
        {
            IFactory <IColorGenerator> colorGeneratorFactory = Factory.Default <RandomColorGenerator>();

            ContainerCollection <ContainerCollection <StatisticsViewModel> > viewModel = new ContainerCollection <ContainerCollection <StatisticsViewModel> >();
            Stack <StatisticsViewModel> appendTo = new Stack <StatisticsViewModel>();

            Container <ContainerCollection <StatisticsViewModel> > allViewModel = new Container <ContainerCollection <StatisticsViewModel> >();

            allViewModel.Title = "All";
            allViewModel.Data  = new ContainerCollection <StatisticsViewModel>()
            {
                new Container <StatisticsViewModel>()
                {
                    Title = "All",
                    Data  = new StatisticsViewModel(colorGeneratorFactory.Create())
                }
            };
            appendTo.Push(allViewModel.Data[0].Data);
            viewModel.Add(allViewModel);

            foreach (IGrouping <int, Month> year in countingService.Months().OrderByDescending(m => m.Year).GroupBy(m => m.Year))
            {
                Container <ContainerCollection <StatisticsViewModel> > yearViewModel = new Container <ContainerCollection <StatisticsViewModel> >();
                yearViewModel.Title = year.Key.ToString();
                yearViewModel.Data  = new ContainerCollection <StatisticsViewModel>();

                yearViewModel.Data.Add(new Container <StatisticsViewModel>()
                {
                    Title = "All",
                    Data  = new StatisticsViewModel(colorGeneratorFactory.Create())
                });
                appendTo.Push(yearViewModel.Data[0].Data);

                foreach (Month month in year.OrderBy(m => m.Value))
                {
                    Container <StatisticsViewModel> monthViewModel = new Container <StatisticsViewModel>();
                    monthViewModel.Title = month.ToShortString();
                    monthViewModel.Data  = new StatisticsViewModel(colorGeneratorFactory.Create());

                    appendTo.Push(monthViewModel.Data);

                    foreach (ApplicationCountModel application in countingService.Applications(month, month))
                    {
                        appendTo.ForEach(vm => vm.AddApplication(application.Path, application.Count));
                    }

                    foreach (FileCountModel file in countingService.Files(month, month))
                    {
                        appendTo.ForEach(vm => vm.AddFile(file.Path, file.Count));
                    }

                    appendTo.Pop();
                    yearViewModel.Data.Add(monthViewModel);
                }

                appendTo.Pop();
                viewModel.Add(yearViewModel);
            }

            statisticsWindow           = new StatisticsWindow();
            statisticsWindow.ViewModel = viewModel;
            statisticsWindow.Owner     = configurationWindow;
            statisticsWindow.Closed   += OnStatisticsWindowClosed;
            statisticsWindow.ShowDialog();
        }