Skip to content

Commit

Permalink
fix wfb button available update
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecarr committed Dec 18, 2024
1 parent 8dc6591 commit 33d4be4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 3 additions & 1 deletion OpenIPC_Config/ViewModels/ViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public abstract class ViewModelBase : ObservableObject
protected readonly ILogger Logger;
protected readonly IEventSubscriptionService EventSubscriptionService;


protected ViewModelBase(
ILogger logger,
ISshClientService sshClientService,
Expand Down Expand Up @@ -41,7 +42,8 @@ public virtual void UpdateUIMessage(string message)
EventSubscriptionService.Publish<AppMessageEvent, AppMessage>(new AppMessage
{
Message = message,
UpdateLogView = false
UpdateLogView = false,
CanConnect = DeviceConfig.Instance.CanConnect
});
}
}
14 changes: 5 additions & 9 deletions OpenIPC_Config/ViewModels/WfbTabViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ private async void RestartWfb()
UpdateUIMessage("Restarting WFB...");

EventSubscriptionService.Publish<TabMessageEvent, string>("Restart Pushed");
EventSubscriptionService.Publish<AppMessageEvent, AppMessage>(
new AppMessage { Message = "Getting new content", DeviceConfig = DeviceConfig.Instance });

UpdateUIMessage("Getting new content");

var newFrequency58 = SelectedFrequency58String;
var newFrequency24 = SelectedFrequency24String;
Expand Down Expand Up @@ -265,20 +265,16 @@ private async void RestartWfb()
if (string.IsNullOrEmpty(updatedWfbConfContent))
await MessageBoxManager.GetMessageBoxStandard("Error", "WfbConfContent is empty").ShowAsync();

EventSubscriptionService.Publish<AppMessageEvent, AppMessage>(
new AppMessage { Message = $"Uploading new {OpenIPC.WfbConfFileLoc}", DeviceConfig = DeviceConfig.Instance,
UpdateLogView = true });
UpdateUIMessage($"Uploading new {OpenIPC.WfbConfFileLoc}");


Logger.Information($"Uploading new : {OpenIPC.WfbConfFileLoc}");
await SshClientService.UploadFileStringAsync(DeviceConfig.Instance, OpenIPC.WfbConfFileLoc, WfbConfContent);

EventSubscriptionService.Publish<AppMessageEvent, AppMessage>(
new AppMessage { Message = "Restarting Wfb", DeviceConfig = DeviceConfig.Instance, UpdateLogView = true });

Logger.Information("Restarting Wfb");
UpdateUIMessage("Restarting Wfb");

await SshClientService.ExecuteCommandAsync(DeviceConfig.Instance, DeviceCommands.WfbRestartCommand);
UpdateUIMessage("Restarting Wfb..done");
}

private void HandleFrequencyChange(string newValue, Dictionary<int, string> frequencyMapping)
Expand Down

0 comments on commit 33d4be4

Please sign in to comment.