Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revit.ini File Editor #286

Merged
merged 26 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fd3ebcd
Implement basic config
Nice3point Aug 13, 2024
e84ac85
Set table width
Nice3point Aug 29, 2024
8aa3eae
Update view layout
Nice3point Sep 2, 2024
6e07ee9
Set view styles
Nice3point Sep 2, 2024
91d88be
Rename pages
Nice3point Sep 13, 2024
bd9467b
Rider design properties support
Nice3point Sep 13, 2024
d445da8
Fix info badge bindings
Nice3point Sep 13, 2024
7e3dc13
Change label default color
Nice3point Sep 13, 2024
76ff886
Pull content dialog changes
Nice3point Sep 13, 2024
6748d64
Rename pages
Nice3point Sep 13, 2024
7c33fe3
Rework dialogs registration
Nice3point Sep 13, 2024
06bbfa1
Clean update service
Nice3point Sep 13, 2024
11bfa02
Editing configuration value
Nice3point Sep 13, 2024
2588c16
Set dialog default Alignment
Nice3point Sep 13, 2024
604f6ba
Skip warning message for init data
Nice3point Sep 13, 2024
decf5ac
Add commands, load spinner
Nice3point Sep 16, 2024
2f92a9b
Merge branch 'dev' into dev_config
Nice3point Sep 16, 2024
462853a
Merge remote-tracking branch 'origin/dev' into dev_config
Nice3point Sep 19, 2024
a3ae0ce
Change scanning behaviour
Nice3point Sep 19, 2024
ac32287
Add bool parameter support
Nice3point Sep 19, 2024
771797a
Filter configuration support
Nice3point Sep 19, 2024
2d96dcd
Validation template
Nice3point Sep 21, 2024
e0296df
Availability property for the ContentDialog
Nice3point Sep 21, 2024
3b87215
Mute invalid static resource warning
Nice3point Sep 21, 2024
a9ed083
Content support fo placeholder
Nice3point Sep 21, 2024
caf8bde
Configuration saving
Nice3point Sep 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/RevitLookup.UI.Demo/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private void OnStartup(object sender, StartupEventArgs e)
var host = HostProvider.CreateHost();

Host.StartProxy(host);
Host.GetService<ILookupService>().Show<DashboardView>();
Host.GetService<ILookupService>().Show<DashboardPage>();
}

private void OnExit(object sender, ExitEventArgs e)
Expand Down
10 changes: 5 additions & 5 deletions source/RevitLookup.UI.Demo/HostProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ public static IHost CreateHost()

//Views
builder.Services.AddScoped<ISnoopVisualService, MockSnoopVisualService>();
builder.Services.AddScoped<AboutView>();
builder.Services.AddScoped<AboutPage>();
builder.Services.AddScoped<AboutViewModel>();
builder.Services.AddScoped<DashboardView>();
builder.Services.AddScoped<DashboardPage>();
builder.Services.AddScoped<IDashboardViewModel, MockDashboardViewModel>();
builder.Services.AddScoped<SettingsView>();
builder.Services.AddScoped<SettingsPage>();
builder.Services.AddScoped<SettingsViewModel>();
builder.Services.AddScoped<EventsView>();
builder.Services.AddScoped<EventsPage>();
builder.Services.AddScoped<IEventsViewModel, MockEventsViewModel>();
builder.Services.AddScoped<SnoopView>();
builder.Services.AddScoped<SnoopPage>();
builder.Services.AddScoped<ISnoopViewModel, MockSnoopViewModel>();
builder.Services.AddScoped<IWindow, RevitLookupView>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,74 +42,74 @@ private async Task NavigateSnoopPage(string parameter)
{
case "view":
await snoopVisualService.SnoopAsync(SnoopableType.View);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "document":
await snoopVisualService.SnoopAsync(SnoopableType.Document);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "application":
await snoopVisualService.SnoopAsync(SnoopableType.Application);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "uiApplication":
await snoopVisualService.SnoopAsync(SnoopableType.UiApplication);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "database":
await snoopVisualService.SnoopAsync(SnoopableType.Database);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "dependents":
await snoopVisualService.SnoopAsync(SnoopableType.DependentElements);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "selection":
await snoopVisualService.SnoopAsync(SnoopableType.Selection);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "linked":
await snoopVisualService.SnoopAsync(SnoopableType.LinkedElement);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "face":
await snoopVisualService.SnoopAsync(SnoopableType.Face);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "edge":
await snoopVisualService.SnoopAsync(SnoopableType.Edge);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "point":
await snoopVisualService.SnoopAsync(SnoopableType.Point);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "subElement":
await snoopVisualService.SnoopAsync(SnoopableType.SubElement);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "components":
await snoopVisualService.SnoopAsync(SnoopableType.ComponentManager);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "performance":
await snoopVisualService.SnoopAsync(SnoopableType.PerformanceAdviser);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "updaters":
await snoopVisualService.SnoopAsync(SnoopableType.UpdaterRegistry);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "services":
await snoopVisualService.SnoopAsync(SnoopableType.Services);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "schemas":
await snoopVisualService.SnoopAsync(SnoopableType.Schemas);
navigationService.Navigate(typeof(SnoopView));
navigationService.Navigate(typeof(SnoopPage));
break;
case "events":
navigationService.Navigate(typeof(EventsView));
navigationService.Navigate(typeof(EventsPage));
break;
default:
throw new ArgumentOutOfRangeException(nameof(parameter), parameter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public void Navigate(SnoopableObject selectedItem)
Host.GetService<ILookupService>()
.Snoop(selectedItem)
.DependsOn(ServiceProvider)
.Show<SnoopView>();
.Show<SnoopPage>();
}

public void Navigate(IList<SnoopableObject> selectedItems)
{
Host.GetService<ILookupService>()
.Snoop(selectedItems)
.DependsOn(ServiceProvider)
.Show<SnoopView>();
.Show<SnoopPage>();
}

public void RemoveObject(object obj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ public void Navigate(SnoopableObject selectedItem)
Host.GetService<ILookupService>()
.Snoop(selectedItem)
.DependsOn(ServiceProvider)
.Show<SnoopView>();
.Show<SnoopPage>();
}

public void Navigate(IList<SnoopableObject> selectedItems)
{
Host.GetService<ILookupService>()
.Snoop(selectedItems)
.DependsOn(ServiceProvider)
.Show<SnoopView>();
.Show<SnoopPage>();
}

async partial void OnSearchTextChanged(string value)
Expand Down
94 changes: 33 additions & 61 deletions source/RevitLookup.UI/ContentDialogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,99 +9,71 @@
namespace Wpf.Ui;

/// <summary>
/// Represents a contract with the service that provides global <see cref="IContentDialogService"/>.
/// Represents a contract with the service that creates <see cref="ContentDialog"/>.
/// </summary>
/// <example>
/// <code lang="xml">
/// &lt;ContentPresenter x:Name="RootContentDialogPresenter" Grid.Row="0" /&gt;
/// </code>
/// <code lang="csharp">
/// var contentDialogService = new ContentDialogService();
/// IContentDialogService contentDialogService = new ContentDialogService();
/// contentDialogService.SetContentPresenter(RootContentDialogPresenter);
///
/// await _contentDialogService.ShowSimpleDialogAsync(
/// new SimpleContentDialogCreateOptions()
/// {
/// Title = "The cake?",
/// Content = "IS A LIE!",
/// PrimaryButtonText = "Save",
/// SecondaryButtonText = "Don't Save",
/// CloseButtonText = "Cancel"
/// }
/// );
/// await _contentDialogService.ShowAsync(
/// new ContentDialog(){
/// Title = "The cake?",
/// Content = "IS A LIE!",
/// PrimaryButtonText = "Save",
/// SecondaryButtonText = "Don't Save",
/// CloseButtonText = "Cancel"
/// }
/// );
/// </code>
/// </example>
public class ContentDialogService : IContentDialogService
{
private ContentPresenter? _contentPresenter;
private ContentPresenter? _dialogHost;

private ContentDialog? _dialog;

/// <inheritdoc/>
[Obsolete("Use SetDialogHost instead.")]
public void SetContentPresenter(ContentPresenter contentPresenter)
{
_contentPresenter = contentPresenter;
SetDialogHost(contentPresenter);
}

/// <inheritdoc/>
public ContentPresenter GetContentPresenter()
[Obsolete("Use GetDialogHost instead.")]
public ContentPresenter? GetContentPresenter()
{
if (_contentPresenter is null)
{
throw new ArgumentNullException($"The ContentPresenter didn't set previously.");
}

return _contentPresenter;
return GetDialogHost();
}

/// <inheritdoc/>
public Task<ContentDialogResult> ShowAlertAsync(
string title,
string message,
string closeButtonText,
CancellationToken cancellationToken = default
)
public void SetDialogHost(ContentPresenter contentPresenter)
{
if (_contentPresenter is null)
{
throw new ArgumentNullException($"The ContentPresenter didn't set previously.");
}

_dialog ??= new ContentDialog(_contentPresenter);

_dialog.SetCurrentValue(ContentDialog.TitleProperty, title);
_dialog.SetCurrentValue(ContentControl.ContentProperty, message);
_dialog.SetCurrentValue(ContentDialog.CloseButtonTextProperty, closeButtonText);
_dialogHost = contentPresenter;
}

return _dialog.ShowAsync(cancellationToken);
/// <inheritdoc/>
public ContentPresenter? GetDialogHost()
{
return _dialogHost;
}

/// <inheritdoc/>
public Task<ContentDialogResult> ShowSimpleDialogAsync(
SimpleContentDialogCreateOptions options,
CancellationToken cancellationToken = default
)
public Task<ContentDialogResult> ShowAsync(ContentDialog dialog, CancellationToken cancellationToken)
{
if (_contentPresenter is null)
if (_dialogHost == null)
{
throw new ArgumentNullException($"The ContentPresenter didn't set previously.");
throw new InvalidOperationException("The DialogHost was never set.");
}

var dialog = new ContentDialog(_contentPresenter)
if (dialog.DialogHost != null && _dialogHost != dialog.DialogHost)
{
Title = options.Title,
Content = options.Content,
CloseButtonText = options.CloseButtonText,
PrimaryButtonText = options.PrimaryButtonText,
SecondaryButtonText = options.SecondaryButtonText,
DialogMaxWidth = options.DialogMaxWidth,
DialogMaxHeight = options.DialogMaxHeight,
HorizontalContentAlignment = options.DialogHorizontalAlignment,
VerticalContentAlignment = options.DialogVerticalAlignment
};
throw new InvalidOperationException(
"The DialogHost is not the same as the one that was previously set."
);
}

ScrollViewer.SetHorizontalScrollBarVisibility(dialog, options.HorizontalScrollVisibility);
ScrollViewer.SetVerticalScrollBarVisibility(dialog, options.VerticalScrollVisibility);
dialog.DialogHost = _dialogHost;

return dialog.ShowAsync(cancellationToken);
}
Expand Down
Loading
Loading