Skip to content

Commit

Permalink
Added button for refreshing list of available cameras
Browse files Browse the repository at this point in the history
  • Loading branch information
sajmons committed Oct 16, 2024
1 parent 8ebd18d commit f852d76
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 13 deletions.
39 changes: 26 additions & 13 deletions CollimationCircles/Controls/StreamUserControl.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,32 @@
Orientation="Vertical"
IsEnabled="{Binding !IsPlaying}">
<TextBlock Text="{DynamicResource Text.CameraType}"/>
<ComboBox
ItemsSource="{Binding CameraList}"
SelectedItem="{Binding SelectedCamera}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding APIType}" />
<TextBlock Text=": " />
<TextBlock Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<DockPanel>
<ComboBox
Width="180"
HorizontalAlignment="Left"
ItemsSource="{Binding CameraList}"
SelectedItem="{Binding SelectedCamera}"
DockPanel.Dock="Left">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding APIType}" />
<TextBlock Text=": " />
<TextBlock Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button
HorizontalAlignment="Right"
Command="{Binding CameraRefreshCommand}"
ToolTip.Tip="{DynamicResource Text.RefreshCameras}">
<PathIcon
Foreground="{DynamicResource Color2}"
Data="{StaticResource IconData.Reset}" />
</Button>
</DockPanel>
<StackPanel
Orientation="Vertical"
IsVisible="{Binding RemoteConnection}">
Expand Down
1 change: 1 addition & 0 deletions CollimationCircles/Resources/Lang/en-US.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
<system:String x:Key="Text.CameraControls">Camera controls</system:String>
<system:String x:Key="Text.Default">Default</system:String>
<system:String x:Key="Text.EnterRemoteAddress">Enter address</system:String>
<system:String x:Key="Text.RefreshCameras">Refresh camera list</system:String>

<!-- Non translatable -->
<system:String x:Key="Text.StarChar">*</system:String>
Expand Down
7 changes: 7 additions & 0 deletions CollimationCircles/ViewModels/StreamViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ private void CameraSettings()
}
}

[RelayCommand]
private void CameraRefresh()
{
CameraList = new ObservableCollection<ICamera>(cameraControlService.GetCameraList());
SelectedCamera = CameraList.FirstOrDefault(c => c.Name == settingsViewModel.LastSelectedCamera) ?? CameraList.First();
}

public void OnClosed()
{
SettingsDialogViewModel = null;
Expand Down

0 comments on commit f852d76

Please sign in to comment.