Code style - Omit the type in a new expressions

This commit is contained in:
SpoinkyNL committed 2020-12-18 17:54:01 +01:00
1 parent 099f56f4fe
commit 10e6cdc54b
117 files changed
+251 -252

No files matched your search

@@ -84,8 +84,8 @@
<materialDesign:Card Grid.Row="3" Grid.ColumnSpan="2" Margin="0 5 0 0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@@ -95,7 +95,12 @@
<TextBlock Grid.Row="0" Margin="10 10 0 0">
Data binding result
</TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1" Margin="0 10 10 0" TextAlignment="Right" ToolTip="Click Play to ensure all other data bindings update as well." Cursor="Help">
<TextBlock Grid.Row="0"
Grid.Column="1"
Margin="0 10 10 0"
Visibility="{Binding AlwaysApplyDataBindings.Value, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}}"
ToolTip="Click Play to ensure all other data bindings update as well or enable 'Constantly apply data bindings in editor'"
Cursor="Help">
Other data bindings not updating?
</TextBlock>
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignLightSeparator}" Margin="0" />
@@ -122,7 +122,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings.DirectDa
}
// Modifier type
ModifierTypeCategoryViewModel root = new ModifierTypeCategoryViewModel(null, null);
ModifierTypeCategoryViewModel root = new(null, null);
IEnumerable<IGrouping<string, BaseDataBindingModifierType>> modifierTypes = _dataBindingService.GetCompatibleModifierTypes(sourceType, ModifierTypePart.Value).GroupBy(t => t.Category);
foreach (IGrouping<string, BaseDataBindingModifierType> dataBindingModifierTypes in modifierTypes)
{
@@ -75,7 +75,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
public List<ITimelineKeyframeViewModel> GetAllKeyframeViewModels(bool expandedOnly)
{
List<ITimelineKeyframeViewModel> result = new List<ITimelineKeyframeViewModel>();
List<ITimelineKeyframeViewModel> result = new();
if (expandedOnly && !IsExpanded)
return result;
@@ -71,7 +71,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline.Controls
base.OnRender(drawingContext);
UpdateTimeScale();
Pen linePen = new Pen(Fill, 1);
Pen linePen = new(Fill, 1);
double width = HorizontalOffset + VisibleWidth;
int frameStart = 0;
@@ -126,8 +126,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline.Controls
private void RenderLabel(DrawingContext drawingContext, string text, double x)
{
Typeface typeFace = new Typeface(FontFamily, new FontStyle(), new FontWeight(), new FontStretch());
FormattedText formattedText = new FormattedText(text, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, typeFace, 9, Fill, null, VisualTreeHelper.GetDpi(this).PixelsPerDip);
Typeface typeFace = new(FontFamily, new FontStyle(), new FontWeight(), new FontStretch());
FormattedText formattedText = new(text, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, typeFace, 9, Fill, null, VisualTreeHelper.GetDpi(this).PixelsPerDip);
if (x == 0 && OffsetFirstValue)
drawingContext.DrawText(formattedText, new Point(2, 5));
else
@@ -42,7 +42,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline.Dialogs
public class TimelineSegmentDialogViewModelValidator : AbstractValidator<TimelineSegmentDialogViewModel>
{
private readonly Regex _inputRegex = new Regex("^[.][-|0-9]+$|^-?[0-9]*[.]{0,1}[0-9]*$");
private readonly Regex _inputRegex = new("^[.][-|0-9]+$|^-?[0-9]*[.]{0,1}[0-9]*$");
public TimelineSegmentDialogViewModelValidator()
{
@@ -31,7 +31,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline.Models
if (HasBeenPasted)
throw new ArtemisUIException("Clipboard model can only be pasted once");
List<ILayerPropertyKeyframe> results = new List<ILayerPropertyKeyframe>();
List<ILayerPropertyKeyframe> results = new();
if (!ClipboardModels.Any())
return results;
@@ -249,7 +249,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
private void CopyKeyframes(List<ILayerPropertyKeyframe> keyframes)
{
KeyframesClipboardModel clipboardModel = new KeyframesClipboardModel(keyframes);
KeyframesClipboardModel clipboardModel = new(keyframes);
JsonClipboard.SetObject(clipboardModel);
}
@@ -261,7 +261,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
private List<ILayerPropertyKeyframe> PasteClipboardData(KeyframesClipboardModel clipboardModel, TimeSpan pastePosition)
{
List<ILayerPropertyKeyframe> pasted = new List<ILayerPropertyKeyframe>();
List<ILayerPropertyKeyframe> pasted = new();
if (clipboardModel == null)
return pasted;
RenderProfileElement target = _profileEditorService.SelectedProfileElement;
@@ -368,7 +368,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
return;
Point position = e.GetPosition((IInputElement) sender);
Rect selectedRect = new Rect(_mouseDragStartPoint, position);
Rect selectedRect = new(_mouseDragStartPoint, position);
SelectionRectangle.Rect = selectedRect;
List<ITimelineKeyframeViewModel> keyframeViewModels = GetAllKeyframeViewModels();
@@ -386,7 +386,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
if (_mouseDragging && e.LeftButton == MouseButtonState.Pressed)
{
Point position = e.GetPosition((IInputElement) sender);
Rect selectedRect = new Rect(_mouseDragStartPoint, position);
Rect selectedRect = new(_mouseDragStartPoint, position);
SelectionRectangle.Rect = selectedRect;
e.Handled = true;
}
@@ -432,7 +432,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
private List<ITimelineKeyframeViewModel> GetAllKeyframeViewModels()
{
List<ITimelineKeyframeViewModel> viewModels = new List<ITimelineKeyframeViewModel>();
List<ITimelineKeyframeViewModel> viewModels = new();
foreach (LayerPropertyGroupViewModel layerPropertyGroupViewModel in LayerPropertyGroups)
viewModels.AddRange(layerPropertyGroupViewModel.GetAllKeyframeViewModels(false));
@@ -79,7 +79,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
// Find the BaseLayerBrush parameter, it is required by the base constructor so its there for sure
ParameterInfo brushParameter = constructors.First().GetParameters().First(p => typeof(BaseLayerBrush).IsAssignableFrom(p.ParameterType));
ConstructorArgument argument = new ConstructorArgument(brushParameter.Name, layerBrush);
ConstructorArgument argument = new(brushParameter.Name, layerBrush);
BrushConfigurationViewModel viewModel = (BrushConfigurationViewModel) layerBrush.Descriptor.Provider.Plugin.Kernel.Get(configurationViewModel.Type, argument);
_windowManager.ShowDialog(new LayerBrushSettingsWindowViewModel(viewModel));
@@ -105,7 +105,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
throw new ArtemisUIException("Effect configuration dialogs must have exactly one constructor");
ParameterInfo effectParameter = constructors.First().GetParameters().First(p => typeof(BaseLayerEffect).IsAssignableFrom(p.ParameterType));
ConstructorArgument argument = new ConstructorArgument(effectParameter.Name, layerEffect);
ConstructorArgument argument = new(effectParameter.Name, layerEffect);
EffectConfigurationViewModel viewModel = (EffectConfigurationViewModel) layerEffect.Descriptor.Provider.Plugin.Kernel.Get(configurationViewModel.Type, argument);
_windowManager.ShowDialog(new LayerEffectSettingsWindowViewModel(viewModel));
}
@@ -24,7 +24,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
return;
e.Handled = true;
MouseWheelEventArgs eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta)
MouseWheelEventArgs eventArg = new(e.MouseDevice, e.Timestamp, e.Delta)
{
RoutedEvent = UIElement.MouseWheelEvent,
Source = sender