More TUI warning removal

This commit is contained in:
2023-09-05 20:49:15 +02:00
parent 0167ce4be9
commit ecfd0d1b93
5 changed files with 107 additions and 106 deletions

View File

@@ -87,8 +87,8 @@ public class CommandPalette
new TextBlock<ICommandPaletteEntryViewModel>() new TextBlock<ICommandPaletteEntryViewModel>()
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
d => d.Title, dc => dc!.Title,
t => t.Text)), tb => tb.Text)),
new TextBlock<ICommandPaletteEntryViewModel> new TextBlock<ICommandPaletteEntryViewModel>
{ {
Extensions = Extensions =
@@ -98,20 +98,24 @@ public class CommandPalette
} }
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
d => d.Shortcuts, dc => dc!.Shortcuts,
t => t.Text)) tb => tb.Text))
} }
}; };
item.Bind( item.Bind(
item.Parent, item.Parent,
d => d.CommandPalette.SelectedItem.Identifier == item.DataContext.Identifier ? _theme.ListViewItemTheme.SelectedBackgroundColor : null, dc => dc!.CommandPalette.SelectedItem!.Identifier == item.DataContext!.Identifier
? _theme.ListViewItemTheme.SelectedBackgroundColor
: null,
t => t.Background t => t.Background
); );
item.Bind( item.Bind(
item.Parent, item.Parent,
d => d.CommandPalette.SelectedItem.Identifier == item.DataContext.Identifier ? _theme.ListViewItemTheme.SelectedForegroundColor : null, dc => dc!.CommandPalette.SelectedItem!.Identifier == item.DataContext!.Identifier
? _theme.ListViewItemTheme.SelectedForegroundColor
: null,
t => t.Foreground t => t.Foreground
); );
@@ -119,13 +123,13 @@ public class CommandPalette
} }
}.Setup(t => t.Bind( }.Setup(t => t.Bind(
t, t,
d => d.CommandPalette.FilteredMatches, dc => dc!.CommandPalette.FilteredMatches,
t => t.ItemsSource tb => tb.ItemsSource
)) ))
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
d => d.CommandPalette.SelectedItem, dc => dc!.CommandPalette.SelectedItem,
t => t.SelectedItem tb => tb.SelectedItem
)) ))
} }
} }
@@ -146,9 +150,8 @@ public class CommandPalette
root.Bind( root.Bind(
root, root,
d => d.CommandPalette.ShowWindow.Value, dc => dc!.CommandPalette.ShowWindow.Value,
t => t.IsVisible, t => t.IsVisible);
r => r);
return root; return root;
} }

View File

@@ -18,7 +18,6 @@ namespace FileTime.ConsoleUI.App.Controls;
public class Dialogs public class Dialogs
{ {
private readonly IRootViewModel _rootViewModel; private readonly IRootViewModel _rootViewModel;
private readonly ITheme _theme;
private ItemsControl<IRootViewModel, IInputElement> _readInputs = null!; private ItemsControl<IRootViewModel, IInputElement> _readInputs = null!;
private IInputElement? _inputElementToFocus; private IInputElement? _inputElementToFocus;
@@ -30,7 +29,6 @@ public class Dialogs
public Dialogs(IRootViewModel rootViewModel, ITheme theme) public Dialogs(IRootViewModel rootViewModel, ITheme theme)
{ {
_rootViewModel = rootViewModel; _rootViewModel = rootViewModel;
_theme = theme;
_specialItemNamePartFormat = new OrFormat _specialItemNamePartFormat = new OrFormat
{ {
@@ -40,7 +38,7 @@ public class Dialogs
}, },
Format2 = new SimpleFormat Format2 = new SimpleFormat
{ {
Foreground = _theme.DefaultForegroundAccentColor Foreground = theme.DefaultForegroundAccentColor
} }
}; };
@@ -74,8 +72,8 @@ public class Dialogs
Content = new TextBlock<IRootViewModel>() Content = new TextBlock<IRootViewModel>()
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
dc => dc.DialogService.LastMessageBox.Value.OkText, dc => dc!.DialogService.LastMessageBox.Value!.OkText,
t => t.Text)), tb => tb.Text)),
}.WithClickHandler(b => b.DataContext?.DialogService.LastMessageBox.Value?.Ok()); }.WithClickHandler(b => b.DataContext?.DialogService.LastMessageBox.Value?.Ok());
var cancelButton = var cancelButton =
@@ -85,13 +83,13 @@ public class Dialogs
Content = new TextBlock<IRootViewModel>() Content = new TextBlock<IRootViewModel>()
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
dc => dc.DialogService.LastMessageBox.Value.CancelText, dc => dc!.DialogService.LastMessageBox.Value!.CancelText,
t => t.Text)), tb => tb.Text)),
} }
.Setup(b => b.Bind( .Setup(b => b.Bind(
b, b,
dc => dc.DialogService.LastMessageBox.Value.ShowCancel, dc => dc!.DialogService.LastMessageBox.Value!.ShowCancel,
b => b.IsVisible)) bt => bt.IsVisible))
.WithClickHandler(b => b.DataContext?.DialogService.LastMessageBox.Value?.Cancel()); .WithClickHandler(b => b.DataContext?.DialogService.LastMessageBox.Value?.Cancel());
var root = new Border<IRootViewModel> var root = new Border<IRootViewModel>
@@ -107,8 +105,8 @@ public class Dialogs
new TextBlock<IRootViewModel>() new TextBlock<IRootViewModel>()
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
dc => dc.DialogService.LastMessageBox.Value.Text, dc => dc!.DialogService.LastMessageBox.Value!.Text,
t => t.Text)), tb => tb.Text)),
new StackPanel<IRootViewModel> new StackPanel<IRootViewModel>
{ {
Orientation = Orientation.Horizontal, Orientation = Orientation.Horizontal,
@@ -125,8 +123,8 @@ public class Dialogs
root.Bind( root.Bind(
root, root,
d => d.DialogService.LastMessageBox.Value != null, dc => dc!.DialogService.LastMessageBox.Value != null,
v => v.IsVisible, br => br.IsVisible,
fallbackValue: false); fallbackValue: false);
((INotifyPropertyChanged) root).PropertyChanged += (_, e) => ((INotifyPropertyChanged) root).PropertyChanged += (_, e) =>
@@ -159,8 +157,8 @@ public class Dialogs
} }
.Setup(i => i.Bind( .Setup(i => i.Bind(
i, i,
dc => dc.DialogService.ReadInput.Value.Previews, dc => dc!.DialogService.ReadInput.Value!.Previews,
c => c.ItemsSource ic => ic.ItemsSource
)) ))
.WithExtension(new GridPositionExtension(0, 1)) .WithExtension(new GridPositionExtension(0, 1))
} }
@@ -169,8 +167,8 @@ public class Dialogs
root.Bind( root.Bind(
root, root,
d => d.DialogService.ReadInput.Value != null, dc => dc!.DialogService.ReadInput.Value != null,
v => v.IsVisible); br => br.IsVisible);
return root; return root;
} }
@@ -187,12 +185,12 @@ public class Dialogs
} }
.Setup(i => i.Bind( .Setup(i => i.Bind(
i, i,
dc => (PreviewType) dc.PreviewType == PreviewType.PreviewList, dc => (PreviewType) dc!.PreviewType == PreviewType.PreviewList,
c => c.IsVisible)) ic => ic.IsVisible))
.Setup(i => i.Bind( .Setup(i => i.Bind(
i, i,
dc => ((PreviewList) dc).Items, dc => ((PreviewList) dc!).Items,
c => c.ItemsSource)), ic => ic.ItemsSource)),
new Grid<IPreviewElement> new Grid<IPreviewElement>
{ {
ColumnDefinitionsObject = "* *", ColumnDefinitionsObject = "* *",
@@ -201,7 +199,7 @@ public class Dialogs
new TextBlock<IPreviewElement>() new TextBlock<IPreviewElement>()
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
dc => ((DoubleTextPreview) dc).Text1, dc => ((DoubleTextPreview) dc!).Text1,
tb => tb.Text tb => tb.Text
)), )),
new TextBlock<IPreviewElement> new TextBlock<IPreviewElement>
@@ -213,14 +211,14 @@ public class Dialogs
} }
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
dc => ((DoubleTextPreview) dc).Text2, dc => ((DoubleTextPreview) dc!).Text2,
tb => tb.Text tb => tb.Text
)) ))
} }
}.Setup(g => g.Bind( }.Setup(g => g.Bind(
g, g,
dc => (PreviewType) dc.PreviewType == PreviewType.DoubleText, dc => (PreviewType) dc!.PreviewType == PreviewType.DoubleText,
g => g.IsVisible)), gr => gr.IsVisible)),
new Grid<IPreviewElement> new Grid<IPreviewElement>
{ {
ColumnDefinitionsObject = "* *", ColumnDefinitionsObject = "* *",
@@ -232,7 +230,7 @@ public class Dialogs
ItemTemplate = ItemNamePartItemTemplate ItemTemplate = ItemNamePartItemTemplate
}.Setup(i => i.Bind( }.Setup(i => i.Bind(
i, i,
dc => ((DoubleItemNamePartListPreview) dc).ItemNameParts1, dc => ((DoubleItemNamePartListPreview) dc!).ItemNameParts1,
c => c.ItemsSource)), c => c.ItemsSource)),
new ItemsControl<IPreviewElement, ItemNamePart> new ItemsControl<IPreviewElement, ItemNamePart>
{ {
@@ -244,13 +242,13 @@ public class Dialogs
ItemTemplate = ItemNamePartItemTemplate ItemTemplate = ItemNamePartItemTemplate
}.Setup(i => i.Bind( }.Setup(i => i.Bind(
i, i,
dc => ((DoubleItemNamePartListPreview) dc).ItemNameParts2, dc => ((DoubleItemNamePartListPreview) dc!).ItemNameParts2,
c => c.ItemsSource)) c => c.ItemsSource))
} }
}.Setup(g => g.Bind( }.Setup(g => g.Bind(
g, g,
dc => (PreviewType) dc.PreviewType == PreviewType.DoubleItemNamePartList, dc => (PreviewType) dc!.PreviewType == PreviewType.DoubleItemNamePartList,
g => g.IsVisible)) gr => gr.IsVisible))
} }
}; };
@@ -261,12 +259,12 @@ public class Dialogs
var textBlock = new TextBlock<ItemNamePart>(); var textBlock = new TextBlock<ItemNamePart>();
textBlock.Bind( textBlock.Bind(
textBlock, textBlock,
dc => dc.Text, dc => dc!.Text,
tb => tb.Text tb => tb.Text
); );
textBlock.Bind( textBlock.Bind(
textBlock, textBlock,
dc => dc.IsSpecial ? _specialItemNamePartFormat : null, dc => dc!.IsSpecial ? _specialItemNamePartFormat : null,
tb => tb.TextFormat tb => tb.TextFormat
); );
@@ -289,7 +287,7 @@ public class Dialogs
new TextBlock<IInputElement>() new TextBlock<IInputElement>()
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
c => c.Label, dc => dc!.Label,
tb => tb.Text tb => tb.Text
)), )),
new Grid<IInputElement> new Grid<IInputElement>
@@ -306,14 +304,14 @@ public class Dialogs
new TextBox<IInputElement>() new TextBox<IInputElement>()
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
d => ((TextInputElement) d).Value, dc => ((TextInputElement) dc!).Value,
tb => tb.Text, tb => tb.Text,
v => v ?? string.Empty, v => v ?? string.Empty,
fallbackValue: string.Empty fallbackValue: string.Empty
)) ))
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
d => ((TextInputElement) d).Label, dc => ((TextInputElement) dc!).Label,
tb => tb.Name)) tb => tb.Name))
.WithTextHandler((tb, t) => .WithTextHandler((tb, t) =>
{ {
@@ -323,7 +321,7 @@ public class Dialogs
} }
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
d => d.Type == InputType.Text, dc => dc!.Type == InputType.Text,
tb => tb.IsVisible tb => tb.IsVisible
)), )),
new Border<IInputElement> new Border<IInputElement>
@@ -335,14 +333,14 @@ public class Dialogs
} }
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
d => ((PasswordInputElement) d).Value, d => ((PasswordInputElement) d!).Value,
tb => tb.Text, tb => tb.Text,
v => v ?? string.Empty, v => v ?? string.Empty,
fallbackValue: string.Empty fallbackValue: string.Empty
)) ))
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
d => ((PasswordInputElement) d).Label, d => ((PasswordInputElement) d!).Label,
tb => tb.Name)) tb => tb.Name))
.WithTextHandler((tb, t) => .WithTextHandler((tb, t) =>
{ {
@@ -352,7 +350,7 @@ public class Dialogs
} }
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
d => d.Type == InputType.Password, dc => dc!.Type == InputType.Password,
tb => tb.IsVisible tb => tb.IsVisible
)) ))
//TODO: OptionInputElement //TODO: OptionInputElement
@@ -366,8 +364,8 @@ public class Dialogs
} }
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
d => d.DialogService.ReadInput.Value.Inputs, dc => dc!.DialogService.ReadInput.Value!.Inputs,
c => c.ItemsSource ic => ic.ItemsSource
)); ));
readInputs.WithKeyHandler((_, e) => readInputs.WithKeyHandler((_, e) =>
@@ -413,7 +411,7 @@ public class Dialogs
void NotifyCollectionChangedEventHandler( void NotifyCollectionChangedEventHandler(
object? sender, object? sender,
NotifyCollectionChangedEventArgs e) NotifyCollectionChangedEventArgs _)
{ {
UpdateReadInputsFocus(); UpdateReadInputsFocus();
} }

View File

@@ -52,7 +52,7 @@ public class FrequencyNavigation
{ {
sender.DataContext.FrequencyNavigation.SearchText = text; sender.DataContext.FrequencyNavigation.SearchText = text;
} }
});; });
var root = new Border<IRootViewModel> var root = new Border<IRootViewModel>
{ {
@@ -86,19 +86,19 @@ public class FrequencyNavigation
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
d => d, d => d,
t => t.Text)), tb => tb.Text)),
} }
}; };
item.Bind( item.Bind(
item.Parent, item.Parent,
d => d.FrequencyNavigation.SelectedItem == item.DataContext ? _theme.ListViewItemTheme.SelectedBackgroundColor : null, dc => dc!.FrequencyNavigation.SelectedItem == item.DataContext ? _theme.ListViewItemTheme.SelectedBackgroundColor : null,
t => t.Background t => t.Background
); );
item.Bind( item.Bind(
item.Parent, item.Parent,
d => d.FrequencyNavigation.SelectedItem == item.DataContext ? _theme.ListViewItemTheme.SelectedForegroundColor : null, dc => dc!.FrequencyNavigation.SelectedItem == item.DataContext ? _theme.ListViewItemTheme.SelectedForegroundColor : null,
t => t.Foreground t => t.Foreground
); );
@@ -106,13 +106,13 @@ public class FrequencyNavigation
} }
}.Setup(t => t.Bind( }.Setup(t => t.Bind(
t, t,
d => d.FrequencyNavigation.FilteredMatches, dc => dc!.FrequencyNavigation.FilteredMatches,
t => t.ItemsSource tb => tb.ItemsSource
)) ))
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
d => d.FrequencyNavigation.SelectedItem, dc => dc!.FrequencyNavigation.SelectedItem,
t => t.SelectedItem tb => tb.SelectedItem
)) ))
} }
} }
@@ -133,7 +133,7 @@ public class FrequencyNavigation
root.Bind( root.Bind(
root, root,
d => d.FrequencyNavigation.ShowWindow.Value, dc => dc!.FrequencyNavigation.ShowWindow.Value,
t => t.IsVisible, t => t.IsVisible,
r => r); r => r);

View File

@@ -19,7 +19,7 @@ public class ItemPreviews
private readonly ITheme _theme; private readonly ITheme _theme;
private readonly IConsoleAppState _appState; private readonly IConsoleAppState _appState;
private readonly IColorProvider _colorProvider; private readonly IColorProvider _colorProvider;
private ItemsControl<ContainerPreview, ISizePreviewItem> _sizePreviews; private ItemsControl<ContainerPreview, ISizePreviewItem> _sizePreviews = null!;
public ItemPreviews( public ItemPreviews(
ITheme theme, ITheme theme,
@@ -45,16 +45,16 @@ public class ItemPreviews
Foreground = _theme.ErrorForegroundColor, Foreground = _theme.ErrorForegroundColor,
}.Setup(t => t.Bind( }.Setup(t => t.Bind(
t, t,
dc => dc.AppState.SelectedTab.Value.SelectedsChildren.Value.Count == 0, dc => dc!.AppState.SelectedTab.Value!.SelectedsChildren.Value!.Count == 0,
t => t.IsVisible, tb => tb.IsVisible,
fallbackValue: false)), fallbackValue: false)),
ElementPreviews() ElementPreviews()
.WithDataContextBinding<IRootViewModel, IElementPreviewViewModel>( .WithDataContextBinding<IRootViewModel, IElementPreviewViewModel>(
dc => (IElementPreviewViewModel) dc.ItemPreviewService.ItemPreview.Value dc => (IElementPreviewViewModel) dc!.ItemPreviewService.ItemPreview.Value!
), ),
SizeContainerPreview() SizeContainerPreview()
.WithDataContextBinding<IRootViewModel, ContainerPreview>( .WithDataContextBinding<IRootViewModel, ContainerPreview>(
dc => (ContainerPreview) dc.ItemPreviewService.ItemPreview.Value dc => (ContainerPreview) dc!.ItemPreviewService.ItemPreview.Value!
) )
} }
}; };
@@ -71,8 +71,8 @@ public class ItemPreviews
}; };
sizePreviews.Setup(c => c.Bind( sizePreviews.Setup(c => c.Bind(
c, c,
dc => dc.TopItems, dc => dc!.TopItems,
c => c.ItemsSource)); ic => ic.ItemsSource));
_sizePreviews = sizePreviews; _sizePreviews = sizePreviews;
@@ -101,8 +101,8 @@ public class ItemPreviews
} }
.Setup(r => r.Bind( .Setup(r => r.Bind(
r, r,
dc => GenerateSizeBackground(_sizePreviews.DataContext.TopItems, dc), dc => GenerateSizeBackground(_sizePreviews.DataContext!.TopItems, dc),
r => r.Fill)), rt => rt.Fill)),
new TextBlock<ISizePreviewItem> new TextBlock<ISizePreviewItem>
{ {
Extensions = {new GridPositionExtension(1, 0)}, Extensions = {new GridPositionExtension(1, 0)},
@@ -111,8 +111,8 @@ public class ItemPreviews
} }
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
dc => dc.Size.Value, dc => dc!.Size.Value,
t => t.Text, tb => tb.Text,
v => ByteSize.FromBytes(v).ToString())), v => ByteSize.FromBytes(v).ToString())),
new TextBlock<ISizePreviewItem> new TextBlock<ISizePreviewItem>
{ {
@@ -120,8 +120,8 @@ public class ItemPreviews
} }
.Setup(t => t.Bind( .Setup(t => t.Bind(
t, t,
dc => dc.Name, dc => dc!.Name,
t => t.Text)) tb => tb.Text))
} }
}; };
@@ -130,14 +130,14 @@ public class ItemPreviews
} }
.Setup(c => c.Bind( .Setup(c => c.Bind(
c, c,
dc => dc.TopItems, dc => dc!.TopItems,
c => c.ItemsSource)) ic => ic.ItemsSource))
} }
}; };
root.Bind( root.Bind(
root, root,
dc => dc.Name == ContainerPreview.PreviewName, dc => dc!.Name == ContainerPreview.PreviewName,
r => r.IsVisible); r => r.IsVisible);
return root; return root;
@@ -155,14 +155,14 @@ public class ItemPreviews
} }
.Setup(r => r.Bind( .Setup(r => r.Bind(
r, r,
dc => GenerateSizeBackground(_sizePreviews.DataContext.TopItems, dc), dc => GenerateSizeBackground(_sizePreviews.DataContext!.TopItems, dc),
r => r.Fill)) rt => rt.Fill))
} }
}; };
root.Bind( root.Bind(
root, root,
dc => GetWidth(dc.Size.Value, _sizePreviews.DataContext.TopItems, _sizePreviews.ActualWidth), dc => GetWidth(dc!.Size.Value, _sizePreviews.DataContext!.TopItems, _sizePreviews.ActualWidth),
r => r.Width); r => r.Width);
return root; return root;
@@ -193,8 +193,8 @@ public class ItemPreviews
Text = "Don't know how to preview this item.", Text = "Don't know how to preview this item.",
}.Setup(t => t.Bind( }.Setup(t => t.Bind(
t, t,
dc => dc.Mode == ItemPreviewMode.Unknown, dc => dc!.Mode == ItemPreviewMode.Unknown,
t => t.IsVisible, tb => tb.IsVisible,
fallbackValue: false)), fallbackValue: false)),
new TextBlock<IElementPreviewViewModel> new TextBlock<IElementPreviewViewModel>
{ {
@@ -202,8 +202,8 @@ public class ItemPreviews
Text = "Empty", Text = "Empty",
}.Setup(t => t.Bind( }.Setup(t => t.Bind(
t, t,
dc => dc.Mode == ItemPreviewMode.Empty, dc => dc!.Mode == ItemPreviewMode.Empty,
t => t.IsVisible, tb => tb.IsVisible,
fallbackValue: false)), fallbackValue: false)),
new Grid<IElementPreviewViewModel> new Grid<IElementPreviewViewModel>
{ {
@@ -215,14 +215,14 @@ public class ItemPreviews
{ {
t.Bind( t.Bind(
t, t,
dc => dc.TextContent, dc => dc!.TextContent,
t => t.Text, tb => tb.Text,
fallbackValue: string.Empty); fallbackValue: string.Empty);
t.Bind( t.Bind(
t, t,
dc => _appState.PreviewType, dc => _appState.PreviewType,
t => t.IsVisible, tb => tb.IsVisible,
v => v is null or ItemPreviewType.Text); v => v is null or ItemPreviewType.Text);
}), }),
new BinaryView<IElementPreviewViewModel>() new BinaryView<IElementPreviewViewModel>()
@@ -230,13 +230,13 @@ public class ItemPreviews
{ {
b.Bind( b.Bind(
b, b,
dc => dc.BinaryContent, dc => dc!.BinaryContent,
b => b.Data); bv => bv.Data);
b.Bind( b.Bind(
b, b,
dc => _appState.PreviewType, dc => _appState.PreviewType,
t => t.IsVisible, bv => bv.IsVisible,
v => v == ItemPreviewType.Binary); v => v == ItemPreviewType.Binary);
}), }),
new TextBlock<IElementPreviewViewModel> new TextBlock<IElementPreviewViewModel>
@@ -245,22 +245,22 @@ public class ItemPreviews
Extensions = {new GridPositionExtension(0, 1)} Extensions = {new GridPositionExtension(0, 1)}
}.Setup(t => t.Bind( }.Setup(t => t.Bind(
t, t,
dc => dc.TextEncoding, dc => dc!.TextEncoding,
t => t.Text, tb => tb.Text,
v => $"Encoding: {v}")) v => $"Encoding: {v}"))
} }
}.Setup(t => t.Bind( }.Setup(t => t.Bind(
t, t,
dc => dc.Mode == ItemPreviewMode.Text, dc => dc!.Mode == ItemPreviewMode.Text,
t => t.IsVisible, tb => tb.IsVisible,
fallbackValue: false)), fallbackValue: false)),
} }
}; };
view.Bind( view.Bind(
view, view,
dc => dc.Name == ElementPreviewViewModel.PreviewName, dc => dc!.Name == ElementPreviewViewModel.PreviewName,
v => v.IsVisible gr => gr.IsVisible
); );
return view; return view;

View File

@@ -42,8 +42,8 @@ public class Timeline
{ {
new TextBlock<ICommandTimeStateViewModel>().Setup(t => t.Bind( new TextBlock<ICommandTimeStateViewModel>().Setup(t => t.Bind(
t, t,
dc => dc.DisplayLabel.Value, dc => dc!.DisplayLabel.Value,
t => t.Text)), tb => tb.Text)),
new TextBlock<ICommandTimeStateViewModel> new TextBlock<ICommandTimeStateViewModel>
{ {
Width = 5, Width = 5,
@@ -51,8 +51,8 @@ public class Timeline
Extensions = {new GridPositionExtension(1, 0)} Extensions = {new GridPositionExtension(1, 0)}
}.Setup(t => t.Bind( }.Setup(t => t.Bind(
t, t,
dc => dc.TotalProgress.Value, dc => dc!.TotalProgress.Value,
t => t.Text, tb => tb.Text,
v => $"{v}%")), v => $"{v}%")),
} }
}, },
@@ -80,8 +80,8 @@ public class Timeline
} }
.Setup(p => p.Bind( .Setup(p => p.Bind(
p, p,
dc => dc.TotalProgress.Value, dc => dc!.TotalProgress.Value,
p => p.Value)), pb => pb.Value)),
} }
}; };
@@ -90,8 +90,8 @@ public class Timeline
} }
.Setup(i => i.Bind( .Setup(i => i.Bind(
i, i,
dc => dc.TimelineViewModel.ParallelCommandsGroups[0].Commands, dc => dc!.TimelineViewModel.ParallelCommandsGroups[0].Commands,
i => i.ItemsSource)) ic => ic.ItemsSource))
} }
}; };