Public Access
Archive completed meeting assistant changes
PR and Push Build/Test / build-and-test (push) Successful in 9m19s
PR and Push Build/Test / build-and-test (push) Successful in 9m19s
This commit is contained in:
@@ -6,10 +6,12 @@ namespace MeetingAssistant.Taskbar;
|
||||
public enum MeetingTaskbarAction
|
||||
{
|
||||
EditRules,
|
||||
OpenSubmenu,
|
||||
StartRecording,
|
||||
StopRecording,
|
||||
AbortRecording,
|
||||
SwitchProfile,
|
||||
SelectMicrophone,
|
||||
Exit
|
||||
}
|
||||
|
||||
@@ -21,19 +23,29 @@ public sealed record MeetingTaskbarMenu(
|
||||
public sealed record MeetingTaskbarMenuItem(
|
||||
string Text,
|
||||
MeetingTaskbarAction Action,
|
||||
string? ProfileName = null);
|
||||
string? ProfileName = null,
|
||||
string? MicrophoneDeviceId = null,
|
||||
bool IsChecked = false,
|
||||
IReadOnlyList<MeetingTaskbarMenuItem>? Items = null);
|
||||
|
||||
public static class MeetingTaskbarMenuBuilder
|
||||
{
|
||||
public static MeetingTaskbarMenu Build(
|
||||
RecordingStatus status,
|
||||
IReadOnlyList<LaunchProfile> launchProfiles)
|
||||
IReadOnlyList<LaunchProfile> launchProfiles,
|
||||
IReadOnlyList<MicrophoneDevice>? microphones = null,
|
||||
string? currentMicrophoneDeviceId = null)
|
||||
{
|
||||
var items = new List<MeetingTaskbarMenuItem>
|
||||
{
|
||||
new("Settings and logs", MeetingTaskbarAction.EditRules)
|
||||
};
|
||||
|
||||
if (microphones is { Count: > 0 })
|
||||
{
|
||||
items.Add(BuildMicrophoneMenu(microphones, currentMicrophoneDeviceId));
|
||||
}
|
||||
|
||||
if (status.IsRecording)
|
||||
{
|
||||
items.Add(new MeetingTaskbarMenuItem(
|
||||
@@ -72,6 +84,24 @@ public static class MeetingTaskbarMenuBuilder
|
||||
items);
|
||||
}
|
||||
|
||||
private static MeetingTaskbarMenuItem BuildMicrophoneMenu(
|
||||
IReadOnlyList<MicrophoneDevice> microphones,
|
||||
string? currentMicrophoneDeviceId)
|
||||
{
|
||||
var microphoneItems = microphones
|
||||
.Select(microphone => new MeetingTaskbarMenuItem(
|
||||
microphone.Name,
|
||||
MeetingTaskbarAction.SelectMicrophone,
|
||||
MicrophoneDeviceId: microphone.Id,
|
||||
IsChecked: string.Equals(microphone.Id, currentMicrophoneDeviceId, StringComparison.Ordinal)))
|
||||
.ToArray();
|
||||
|
||||
return new MeetingTaskbarMenuItem(
|
||||
"Microphone",
|
||||
MeetingTaskbarAction.OpenSubmenu,
|
||||
Items: microphoneItems);
|
||||
}
|
||||
|
||||
private static string BuildTooltip(RecordingStatus status)
|
||||
{
|
||||
return status.State switch
|
||||
@@ -104,8 +134,8 @@ public static class MeetingTaskbarMenuBuilder
|
||||
|
||||
public static class MeetingTaskbarExitPolicy
|
||||
{
|
||||
public static bool RequiresConfirmation(RecordingStatus status)
|
||||
public static bool RequiresConfirmation(RecordingProcessState state)
|
||||
{
|
||||
return status.State != RecordingProcessState.Idle;
|
||||
return state != RecordingProcessState.Idle;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user