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); }
private void updateUsedFiltersPanel() { Button prevBtn = null; int counter = 0; UsedFilters_Panel.Children.Clear(); foreach (var filter in filtersStack.getFilters()) { // update usedFiltersPanel Button but = new Button() { Name = "filter_" + counter + "_" + filter.getName(), Content = filter.getName().Substring(0, 1), Style = (Style)this.Resources["UsedFilter"] }; but.Click += removeUsedFilter_Click; if (prevBtn != null) { RelativePanel.SetRightOf(but, prevBtn); } UsedFilters_Panel.Children.Add(but); if (filter.GetType() == typeof(MatrixFilter)) { Match mat_dim = Regex.Match(filter.getName(), "_(.*)$"); TextBlock tb_mat = new TextBlock() { Text = mat_dim.Groups[1].Value, Style = (Style)this.Resources["UsedFilter_matrix"] }; RelativePanel.SetAlignRightWith(tb_mat, but); RelativePanel.SetAlignBottomWith(tb_mat, but); UsedFilters_Panel.Children.Add(tb_mat); } prevBtn = but; counter++; } }