public TimerStartPage(PlaybackObject play, MainPage page) { // Don't show the navigation action bar NavigationPage.SetHasNavigationBar(this, false); // Get stuff Play = play; ParentPage = page; // Set up the UI stuff InitializeComponent(); sliderSessionTime.PropertyChanged += SessionSlider_Changed; updateSliderDisplay(300.0); }
public MainPage(IPlatformStorage platformStorage, IPlatformAudioPlayer audioPlayer) { // Initialise layout, and don't show the navigation action bar NavigationPage.SetHasNavigationBar(this, false); InitializeComponent(); // Don't re-create assets if the app is already running and the song etc. are already created if (PlatformStorage == null || AudioPlayer == null || Settings == null || Playback == null || song == null || timer == null) { // Stash the platform storage and audio interface object locally PlatformStorage = platformStorage; AudioPlayer = audioPlayer; // Create the settings and playback objects Settings = new SettingsObject(platformStorage); Playback = new PlaybackObject(); // Create a new default song and timer song = new Song(); timer = new Timer(TimerElapsed, 1000); } // Update the section display when MainPage size changes SizeChanged += (sender, e) => { // Get content window sizes double width = this.Width; double height = this.Height; // Size according to orientation double ctrlSize = width > height ? 0.15 * (height - 40) : 0.25 * (width - 40); BottomCtrlRow.Height = ctrlSize; CtrlColumn1.Width = ctrlSize; CtrlColumn2.Width = ctrlSize; ctrlSize = width > height ? 0.15 * (height + 20) : 0.25 * (width + 20); PlaybackCtrlPlayStop.WidthRequest = ctrlSize * 0.5; PlaybackCtrlPlayStop.HeightRequest = ctrlSize * 0.5; PlaybackCtrlRewind.WidthRequest = ctrlSize * 0.3; PlaybackCtrlRewind.HeightRequest = ctrlSize * 0.3; PlaybackCtrlForward.WidthRequest = ctrlSize * 0.3; PlaybackCtrlForward.HeightRequest = ctrlSize * 0.3; PlaybackCtrlPause.WidthRequest = ctrlSize * 0.3; PlaybackCtrlPause.HeightRequest = ctrlSize * 0.3; }; // Set image on the play-stop button if (Playback.IsPlaying) { PlaybackCtrlPlayStop.Source = "stopbutton.png"; } else { PlaybackCtrlPlayStop.Source = "playbutton.png"; }; // Populate the song display when the layout is measured layoutSectionDisplay.MeasurePerformed += UpdateDisplay; // Initialise display parameters LastProgressSection = false; LastProgressSong = false; LastProgressSession = false; // Initialise the timer-type stuff TempoSliderChanged(null, null); flashTimerRunning = false; LastTapTime = -1; }