Example #1
0
        /// <summary>
        /// Builds a relative panel containing the details of a voice memo
        /// </summary>
        /// <param name="voiceMemo">The voice memo to build the panel for</param>
        /// <param name="audioRecorder">The object that will play the voice memo's audio</param>
        /// <param name="DeleteCallBack">the callback function for when the voice memo's delete button is clicked</param>
        /// <returns></returns>
        public static RelativePanel BuildVoiceMemoPanel(VoiceMemo voiceMemo, AudioRecorder audioRecorder, Action DeleteCallBack = null)
        {
            var panel = new RelativePanel();

            panel.Margin = new Thickness(0, 10, 0, 10);
            var ellipse           = BuildMemoEllipse();
            var titleBlock        = BuildTitleBlock(voiceMemo);
            var durationBlock     = BuildDurationBlock(voiceMemo);
            var dateRecordedBlock = BuildDateRecordedBlock(voiceMemo);
            var deleteButton      = BuildDeleteButton(voiceMemo, audioRecorder, DeleteCallBack);
            var playbackButton    = BuildPlayBackButton(voiceMemo, audioRecorder);

            panel.Children.Add(ellipse);
            panel.Children.Add(titleBlock);
            panel.Children.Add(durationBlock);
            panel.Children.Add(dateRecordedBlock);
            panel.Children.Add(deleteButton);
            panel.Children.Add(playbackButton);
            // position the elements within the panel
            RelativePanel.SetRightOf(titleBlock, ellipse);
            RelativePanel.SetAlignVerticalCenterWith(titleBlock, ellipse);
            RelativePanel.SetBelow(durationBlock, titleBlock);
            RelativePanel.SetAlignLeftWith(durationBlock, titleBlock);
            RelativePanel.SetBelow(dateRecordedBlock, durationBlock);
            RelativePanel.SetAlignLeftWith(dateRecordedBlock, durationBlock);
            RelativePanel.SetBelow(deleteButton, dateRecordedBlock);
            RelativePanel.SetAlignBottomWithPanel(deleteButton, true);
            RelativePanel.SetAlignLeftWithPanel(deleteButton, true);
            RelativePanel.SetBelow(playbackButton, dateRecordedBlock);
            RelativePanel.SetAlignBottomWithPanel(playbackButton, true);
            RelativePanel.SetAlignRightWithPanel(playbackButton, true);
            return(panel);
        }
Example #2
0
 private void SetUpUI()
 {
     this.StartRecordingButton  = VoiceMemoUIHelper.BuildStartRecordingButton(this.StartRecording);
     this.StopRecordingButton   = VoiceMemoUIHelper.BuildStopRecordingButton(this.StopRecording);
     this.SaveRecordingButton   = VoiceMemoUIHelper.BuildSaveRecordingButton(this.SaveRecording);
     this.DeleteRecordingButton = VoiceMemoUIHelper.BuildDeleteRecordingButton(this.DeleteRecording);
     this.RecordingNameBox      = VoiceMemoUIHelper.BuildDisplayNameTextBox();
     // relatively place all the components
     RelativePanel.SetAlignVerticalCenterWithPanel(StartRecordingButton, true);
     RelativePanel.SetAlignHorizontalCenterWithPanel(StartRecordingButton, true);
     RelativePanel.SetAlignVerticalCenterWithPanel(StopRecordingButton, true);
     RelativePanel.SetAlignHorizontalCenterWithPanel(StopRecordingButton, true);
     RelativePanel.SetAlignVerticalCenterWithPanel(SaveRecordingButton, true);
     RelativePanel.SetAlignHorizontalCenterWithPanel(SaveRecordingButton, true);
     RelativePanel.SetAlignVerticalCenterWithPanel(DeleteRecordingButton, true);
     RelativePanel.SetAlignHorizontalCenterWithPanel(DeleteRecordingButton, true);
     // place the save and delete buttons next to each other
     RelativePanel.SetLeftOf(DeleteRecordingButton, SaveRecordingButton);
     // place the text box below the save button
     RelativePanel.SetBelow(RecordingNameBox, SaveRecordingButton);
     RelativePanel.SetAlignLeftWith(RecordingNameBox, SaveRecordingButton);
     RelativePanel.SetAlignRightWith(RecordingNameBox, SaveRecordingButton);
     // hide all our buttons except the start recording one
     this.ResetUIComponents();
     // now add everything to the dynamic area
     this.DynamicArea.Children.Add(StartRecordingButton);
     this.DynamicArea.Children.Add(StopRecordingButton);
     this.DynamicArea.Children.Add(SaveRecordingButton);
     this.DynamicArea.Children.Add(DeleteRecordingButton);
     this.DynamicArea.Children.Add(RecordingNameBox);
 }