コード例 #1
0
ファイル: App.xaml.cs プロジェクト: apazureck/bierstrichler
 internal static void StartApplicationMainWindow()
 {
     MainWindow mw = new MainWindow();
     MainWindowViewModel = new MainWindowViewModel(mw);
     StatusBar = MainWindowViewModel.StatusBar;
     StatusBar.CurrentUser = CurrentVendor.Name;
     DashBoard = new DashBoard(Persons);
     MainWindowViewModel.CreateDashList(DashBoard);
     MainWindowViewModel.CreateQuestionList(Questions);
     BeerCharts.UpdateCharts();
     QuestionMaster.Reset();
     mw.Show();
     App.Current.ShutdownMode = ShutdownMode.OnLastWindowClose;
 }
コード例 #2
0
 public DashListViewModel(DashBoard DashBoard)
 {
     Items = new ItemListViewModel(DashBoard.Items);
     SetupDashBoard(DashBoard);
 }
コード例 #3
0
 public DashListViewModel(DashBoard DashBoard, ItemListViewModel AllItems)
 {
     this.Items = AllItems;
     SetupDashBoard(DashBoard);
 }
コード例 #4
0
        private void SetupDashBoard(DashBoard DashBoard)
        {
            this.Model = DashBoard;
            Items.ItemClicked += Items_ItemClicked;

            if(DashBoard.AllPersons is PersonList)
            {
                ((PersonList)DashBoard.AllPersons).PersonAdded += PersonAdded;
                ((PersonList)DashBoard.AllPersons).PersonRemoved += PersonRemoved;
                AllPersons = new PersonListViewModel(new List<Person>(DashBoard.AllPersons));
            }
            else
                AllPersons = new PersonListViewModel(DashBoard.AllPersons);

            PresentPersons = new PersonListViewModel(DashBoard.PresentPersons);

            BeerCharts = new BeerChartsViewModel();

            App.CurrentVendorChanged += App_CurrentVendorChanged;

            // Close Timer einstellen.
            addListCloseTimer = new DispatcherTimer();
            addListCloseTimer.Interval = new TimeSpan(0, 0, 30);
            addListCloseTimer.Tick += (object sender, EventArgs e) =>
            {
                IsAddListVisible = false;
                addListCloseTimer.Stop();
            };
            addListCloseTimer.Start();

            AllPersons.SelectionChanged += (object sender, Events.PersonViewModelEventArgs e) =>
                {
                    if (addListCloseTimer.IsEnabled)
                    {
                        addListCloseTimer.Stop();
                        addListCloseTimer.Start();
                    }
                };

            AllPersons.PersonRemovedByDrop += AllPersons_PersonRemovedByDrop;
            PresentPersons.PersonRemovedByDrop += PresentPersons_PersonRemovedByDrop;
            CreatePresentListFromSavedFile();
        }