public MemoPlayerPanel() { InitializeComponent(); _memoPlayerViewModel = new MemoPlayerViewModel(); this.DataContext = _memoPlayerViewModel; _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromMilliseconds(MaxTimer); _timer.Tick += new EventHandler(OnTimerTick); _timer.Start(); for (int i = 0; i < 32; ++i) { Bar bar = new Bar() { Margin = new Thickness(8, 0, 0, 0), Height = 220 }; BarsStackPanel.Children.Add(bar); } }
// Constructor public MainPage() { InitializeComponent(); _mode = MainPageMode.MainView; this.ApplicationBar = new ApplicationBar(); this.ApplicationBar.IsMenuEnabled = true; this.ApplicationBar.IsVisible = true; this.ApplicationBar.Opacity = 1.0; this.ApplicationBar.ForegroundColor = Colors.White; this.ApplicationBar.BackgroundColor = Color.FromArgb(255, 0, 0, 140); _memoAppbarIconButton = new ApplicationBarIconButton(new Uri("/Resources/Images/Appbar/Memo.png", UriKind.Relative)); _memoAppbarIconButton.Text = AppResources.MemoAppbarText; _memoAppbarIconButton.Click += new EventHandler(OnMemoClick); _alarmAppbarIconButton = new ApplicationBarIconButton(new Uri("/Resources/Images/Appbar/Alarm.png", UriKind.Relative)); _alarmAppbarIconButton.Text = AppResources.AlarmAppbarText; _alarmAppbarIconButton.Click += new EventHandler(OnAlarmClick); _anniversaryAppbarIconButton = new ApplicationBarIconButton(new Uri("/Resources/Images/Appbar/Anniversary.png", UriKind.Relative)); _anniversaryAppbarIconButton.Text = AppResources.AnniversaryAppbarText; _anniversaryAppbarIconButton.Click += new EventHandler(OnAnniversaryClick); _aboutAppbarIconButton = new ApplicationBarIconButton(new Uri("/Resources/Images/Appbar/About.png", UriKind.Relative)); _aboutAppbarIconButton.Text = AppResources.AboutAppbarText; _aboutAppbarIconButton.Click += new EventHandler(OnAboutClick); _stopAppbarIconButton = new ApplicationBarIconButton(new Uri("/Resources/Images/Appbar/Stop.png", UriKind.Relative)); _stopAppbarIconButton.Text = AppResources.StopAppbarText; _stopAppbarIconButton.Click += new EventHandler(OnStopClick); _pauseAppbarIconButton = new ApplicationBarIconButton(new Uri("/Resources/Images/Appbar/Pause.png", UriKind.Relative)); _pauseAppbarIconButton.Text = AppResources.PauseAppbarText; _pauseAppbarIconButton.Click += new EventHandler(OnPauseClick); _resumeAppbarIconButton = new ApplicationBarIconButton(new Uri("/Resources/Images/Appbar/Play.png", UriKind.Relative)); _resumeAppbarIconButton.Text = AppResources.ResumeAppbarText; _resumeAppbarIconButton.Click += new EventHandler(OnResumeClick); _deleteAppbarIconButton = new ApplicationBarIconButton(new Uri("/Resources/Images/Appbar/Delete.png", UriKind.Relative)); _deleteAppbarIconButton.Text = AppResources.DeleteAppbarText; _deleteAppbarIconButton.Click += new EventHandler(OnDeleteClick); this.ApplicationBar.Buttons.Add(_memoAppbarIconButton); this.ApplicationBar.Buttons.Add(_alarmAppbarIconButton); this.ApplicationBar.Buttons.Add(_anniversaryAppbarIconButton); this.ApplicationBar.Buttons.Add(_aboutAppbarIconButton); _mainViewModel = new MainViewModel(); _listbox.ItemsSource = _mainViewModel.Items; _calendarMonthView.MonthViewVisibleRowUpdated += OnMonthViewVisibleRowUpdated; _calendarMonthView.MonthViewCurrentDayUpdated += OnMonthViewCurrentDayUpdated; _calendarPanelViewModel = _calendarPanel.DataContext as CalendarPanelViewModel; _calendarPanelViewModel.CurrentDayUpdated += OnCurrentDayUpdated; _memoRecorderViewModel = _memoRecorderPanel.DataContext as MemoRecorderViewModel; _memoRecorderViewModel.RecorderInitialized += OnRecorderInitialized; _memoRecorderPanel.RecordingTimeout += OnRecordingTimeout; _memoPlayerViewModel = _memoPlayerPanel.DataContext as MemoPlayerViewModel; _memoPlayerViewModel.PlayCompleted += OnPlayCompleted; BeginRecorderStoryboard.Completed += OnBeginRecorderStoryboardCompleted; StopRecorderStoryboard.Completed += OnStopRecorderStoryboardCompleted; BeginPlayerStoryboard.Completed += OnBeginPlayerStoryboardCompleted; StopPlayerStoryboard.Completed += OnStopPlayerStoryboardCompleted; }