Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into fix-partial-differential
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-wff authored Dec 22, 2023
2 parents 36e8673 + 2bc62ed commit 2451421
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 6 deletions.
21 changes: 19 additions & 2 deletions EasyGUI/Controls/JobDisplay.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ public partial class JobDisplay : INotifyPropertyChanged, IJobStatusSubscriber
new PropertyMetadata(default(ObservableCollection<Job>))
);

public static readonly DependencyProperty IsRemoteProperty = DependencyProperty.Register(
nameof(IsRemote),
typeof(bool),
typeof(JobDisplay),
new PropertyMetadata(default(bool))
);

private readonly object _errorMessageLock = new();

private string? _errorMessage;
Expand Down Expand Up @@ -82,6 +89,16 @@ public string JobProgressText
}
}

public bool IsRemote
{
get => (bool)GetValue(IsRemoteProperty);
set
{
SetValue(IsRemoteProperty, value);
OnPropertyChanged();
}
}

public string NameDisplay => $"#{Job.Id} - {Job.Name}";

public void OnJobStateChange(JobState state, Job job)
Expand Down Expand Up @@ -168,9 +185,9 @@ private void UpdateBreadcrumbs()
private void UpdateButtons()
{
var paused = Job.State != JobState.End && !Job.CurrentlyRunning;
SetElementVisibility(EditButton, Job.State == JobState.End);
SetElementVisibility(StartButton, Job.State == JobState.End);
SetElementVisibility(DeleteButton, Job.State == JobState.End);
SetElementVisibility(EditButton, Job.State == JobState.End && !IsRemote);
SetElementVisibility(DeleteButton, Job.State == JobState.End && !IsRemote);
SetElementVisibility(ResumeButton, paused);
SetElementVisibility(DiscardButton, paused);
SetElementVisibility(PauseButton, Job.State != JobState.End && Job.CurrentlyRunning);
Expand Down
6 changes: 3 additions & 3 deletions EasyGUI/Controls/JobsHeader.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
VerticalAlignment="Center" />

<StackPanel Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" Orientation="Horizontal">
<buttons:StartButton x:Name="StartButton" Click="StartButton_OnClick"/>
<buttons:ConnectButton x:Name="ConnectButton" Margin="8,0,0,0" Click="ConnectButton_OnClick"/>
<buttons:StartButton x:Name="StartButton" Click="StartButton_OnClick" />
<buttons:ConnectButton x:Name="ConnectButton" Margin="8,0,0,0" Click="ConnectButton_OnClick" />
<buttons:SettingsButton Margin="8,0,0,0" Click="SettingsButton_OnClick" />
<buttons:CreateButton Margin="8,0,0,0" Click="CreateButton_OnClick" />
<buttons:CreateButton x:Name="CreateButton" Margin="8,0,0,0" Click="CreateButton_OnClick" />
</StackPanel>
</Grid>
</UserControl>
1 change: 1 addition & 0 deletions EasyGUI/Controls/JobsHeader.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ private void UpdateButtonsDisplay()
: Visibility.Collapsed;

ConnectButton.Visibility = IsRemote ? Visibility.Collapsed : Visibility.Visible;
CreateButton.Visibility = IsRemote ? Visibility.Collapsed : Visibility.Visible;
}

private void ToggleButton_OnChecked(object sender, RoutedEventArgs e)
Expand Down
1 change: 1 addition & 0 deletions EasyGUI/Controls/JobsList.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<local:JobDisplay
Job="{Binding}"
SelectedJobs="{Binding SelectedJobs, RelativeSource={RelativeSource AncestorType=UserControl}}"
IsRemote="{Binding IsRemote, RelativeSource={RelativeSource AncestorType=UserControl}}"
JobEdited="JobDisplay_OnJobEdited"
JobResumed="JobDisplay_OnJobResumed"
JobDeleted="JobDisplay_OnJobDeleted"
Expand Down
17 changes: 17 additions & 0 deletions EasyGUI/Controls/JobsList.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ public partial class JobsList : INotifyPropertyChanged
new PropertyMetadata(default(ObservableCollection<Job>))
);

public static readonly DependencyProperty IsRemoteProperty = DependencyProperty.Register(
nameof(IsRemote),
typeof(bool),
typeof(JobsList),
new PropertyMetadata(default(bool))
);

public JobsList()
{
DataContext = this;
Expand All @@ -49,6 +56,16 @@ public ObservableCollection<Job> SelectedJobs
}
}

public bool IsRemote
{
get => (bool)GetValue(IsRemoteProperty);
set
{
SetValue(IsRemoteProperty, value);
OnPropertyChanged();
}
}

public event PropertyChangedEventHandler? PropertyChanged;

public event EventHandler<JobEventArgs>? JobStarted;
Expand Down
1 change: 0 additions & 1 deletion EasyGUI/Controls/RemoteConnectPopup.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public string? HostIp
set
{
SetValue(HostIpProperty, value);
Console.WriteLine(value);
OnPropertyChanged();
}
}
Expand Down
1 change: 1 addition & 0 deletions EasyGUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
ConnectButtonClick="JobsHeader_OnConnectButtonClick"
StartButtonClick="JobsHeader_OnStartButtonClick" />
<controls:JobsList
x:Name="JobsList"
Jobs="{Binding Jobs, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
SelectedJobs="{Binding SelectedJobs, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
JobEdited="JobsList_OnJobEdited"
Expand Down
1 change: 1 addition & 0 deletions EasyGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ private void RemoteConnectPopup_OnConnect(object? sender, RemoteConnectEventArgs
// Change the job manager
_jobManager = remoteJobManager;
JobsHeader.IsRemote = true;
JobsList.IsRemote = true;

// Close the popup
RemoteConnectPopup.Visibility = Visibility.Collapsed;
Expand Down

0 comments on commit 2451421

Please sign in to comment.