Remove warnings in MainWindow
This commit is contained in:
@@ -70,7 +70,7 @@ public class MainWindow
|
|||||||
_root.Value
|
_root.Value
|
||||||
};
|
};
|
||||||
|
|
||||||
public Grid<IRootViewModel> Initialize()
|
private Grid<IRootViewModel> Initialize()
|
||||||
{
|
{
|
||||||
var root = new Grid<IRootViewModel>
|
var root = new Grid<IRootViewModel>
|
||||||
{
|
{
|
||||||
@@ -110,15 +110,15 @@ public class MainWindow
|
|||||||
new TextBlock<IRootViewModel>()
|
new TextBlock<IRootViewModel>()
|
||||||
.Setup(t => t.Bind(
|
.Setup(t => t.Bind(
|
||||||
t,
|
t,
|
||||||
root => root.UserName,
|
root => root!.UserName,
|
||||||
tb => tb.Text
|
tb => tb.Text
|
||||||
)),
|
)),
|
||||||
new TextBlock<IRootViewModel>()
|
new TextBlock<IRootViewModel>()
|
||||||
.Setup(t => t.Bind(
|
.Setup(t => t.Bind(
|
||||||
t,
|
t,
|
||||||
root => root.MachineName,
|
root => root!.MachineName,
|
||||||
tb => tb.Text,
|
tb => tb.Text,
|
||||||
t => $"@{t}"
|
v => $"@{v}"
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -132,7 +132,7 @@ public class MainWindow
|
|||||||
}
|
}
|
||||||
.Setup(t => t.Bind(
|
.Setup(t => t.Bind(
|
||||||
t,
|
t,
|
||||||
root => root.AppState.SelectedTab.Value.CurrentLocation.Value.FullName.Path,
|
root => root!.AppState.SelectedTab.Value!.CurrentLocation.Value!.FullName!.Path,
|
||||||
tb => tb.Text
|
tb => tb.Text
|
||||||
)),
|
)),
|
||||||
new StackPanel<IRootViewModel>
|
new StackPanel<IRootViewModel>
|
||||||
@@ -149,8 +149,8 @@ public class MainWindow
|
|||||||
AsciiOnly = false
|
AsciiOnly = false
|
||||||
}.Setup(t => t.Bind(
|
}.Setup(t => t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.AdminElevationManager.IsAdminInstanceRunning,
|
dc => dc!.AdminElevationManager.IsAdminInstanceRunning,
|
||||||
t => t.IsVisible)),
|
tb => tb.IsVisible)),
|
||||||
new TextBlock<IRootViewModel>
|
new TextBlock<IRootViewModel>
|
||||||
{
|
{
|
||||||
Text = _consoleApplicationConfiguration.Value.ClipboardSingleIcon ??
|
Text = _consoleApplicationConfiguration.Value.ClipboardSingleIcon ??
|
||||||
@@ -158,8 +158,8 @@ public class MainWindow
|
|||||||
AsciiOnly = false
|
AsciiOnly = false
|
||||||
}.Setup(t => t.Bind(
|
}.Setup(t => t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.ClipboardService.Content.Count == 1,
|
dc => dc!.ClipboardService.Content.Count == 1,
|
||||||
t => t.IsVisible)),
|
tb => tb.IsVisible)),
|
||||||
new TextBlock<IRootViewModel>
|
new TextBlock<IRootViewModel>
|
||||||
{
|
{
|
||||||
Text = _consoleApplicationConfiguration.Value.ClipboardMultipleIcon ??
|
Text = _consoleApplicationConfiguration.Value.ClipboardMultipleIcon ??
|
||||||
@@ -167,8 +167,8 @@ public class MainWindow
|
|||||||
AsciiOnly = false
|
AsciiOnly = false
|
||||||
}.Setup(t => t.Bind(
|
}.Setup(t => t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.ClipboardService.Content.Count > 1,
|
dc => dc!.ClipboardService.Content.Count > 1,
|
||||||
t => t.IsVisible))
|
tb => tb.IsVisible))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
TabControl()
|
TabControl()
|
||||||
@@ -201,8 +201,8 @@ public class MainWindow
|
|||||||
TextAlignment = TextAlignment.Center
|
TextAlignment = TextAlignment.Center
|
||||||
}.Setup(t => t.Bind(
|
}.Setup(t => t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.AppState.SelectedTab.Value.CurrentItems.Value.Count == 0,
|
dc => dc!.AppState.SelectedTab.Value!.CurrentItems.Value!.Count == 0,
|
||||||
t => t.IsVisible,
|
tb => tb.IsVisible,
|
||||||
fallbackValue: true
|
fallbackValue: true
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@@ -237,13 +237,13 @@ public class MainWindow
|
|||||||
.Setup(t => t.Bind(
|
.Setup(t => t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc,
|
dc => dc,
|
||||||
t => t.Text));
|
tb => tb.Text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.Setup(i => i.Bind(
|
.Setup(i => i.Bind(
|
||||||
i,
|
i,
|
||||||
root => root.AppState.PopupTexts,
|
dc => dc!.AppState.PopupTexts,
|
||||||
c => c.ItemsSource
|
ic => ic.ItemsSource
|
||||||
)),
|
)),
|
||||||
new Grid<IRootViewModel>
|
new Grid<IRootViewModel>
|
||||||
{
|
{
|
||||||
@@ -268,14 +268,14 @@ public class MainWindow
|
|||||||
{
|
{
|
||||||
t.Bind(
|
t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.AppState.RapidTravelText.Value,
|
dc => dc!.AppState.RapidTravelText.Value,
|
||||||
t => t.Text,
|
v => v.Text,
|
||||||
v => "Filter: " + v);
|
tb => "Filter: " + tb);
|
||||||
|
|
||||||
t.Bind(
|
t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.AppState.ViewMode.Value == ViewMode.RapidTravel,
|
dc => dc!.AppState.ViewMode.Value == ViewMode.RapidTravel,
|
||||||
t => t.IsVisible);
|
tb => tb.IsVisible);
|
||||||
}),
|
}),
|
||||||
StatusLine().WithExtension(new GridPositionExtension(0, 6)),
|
StatusLine().WithExtension(new GridPositionExtension(0, 6)),
|
||||||
}
|
}
|
||||||
@@ -298,7 +298,7 @@ public class MainWindow
|
|||||||
}
|
}
|
||||||
.Setup(t => t.Bind(
|
.Setup(t => t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.AppState.SelectedTab.Value.CurrentSelectedItem.Value.Attributes,
|
dc => dc!.AppState.SelectedTab.Value!.CurrentSelectedItem.Value!.Attributes,
|
||||||
tb => tb.Text)),
|
tb => tb.Text)),
|
||||||
new TextBlock<IRootViewModel>
|
new TextBlock<IRootViewModel>
|
||||||
{
|
{
|
||||||
@@ -306,7 +306,7 @@ public class MainWindow
|
|||||||
}
|
}
|
||||||
.Setup(t => t.Bind(
|
.Setup(t => t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.AppState.SelectedTab.Value.CurrentSelectedItem.Value.ModifiedAt,
|
dc => dc!.AppState.SelectedTab.Value!.CurrentSelectedItem.Value!.ModifiedAt,
|
||||||
tb => tb.Text,
|
tb => tb.Text,
|
||||||
v => v.ToString()))
|
v => v.ToString()))
|
||||||
}
|
}
|
||||||
@@ -322,13 +322,13 @@ public class MainWindow
|
|||||||
{
|
{
|
||||||
t.Bind(
|
t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.VolumeSizeInfo.Value,
|
dc => dc!.VolumeSizeInfo.Value,
|
||||||
t => t.IsVisible,
|
tb => tb.IsVisible,
|
||||||
v => v is null ? false : v.HasValue
|
v => v.HasValue
|
||||||
);
|
);
|
||||||
t.Bind(
|
t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.VolumeSizeInfo.Value,
|
dc => dc!.VolumeSizeInfo.Value,
|
||||||
tb => tb.Text,
|
tb => tb.Text,
|
||||||
v => v.HasValue
|
v => v.HasValue
|
||||||
? $"{ByteSize.FromBytes(v.Value.FreeSize)} / {ByteSize.FromBytes(v.Value.TotalSize)} free"
|
? $"{ByteSize.FromBytes(v.Value.FreeSize)} / {ByteSize.FromBytes(v.Value.TotalSize)} free"
|
||||||
@@ -344,9 +344,9 @@ public class MainWindow
|
|||||||
new TextBlock<IRootViewModel>()
|
new TextBlock<IRootViewModel>()
|
||||||
.Setup(t => t.Bind(
|
.Setup(t => t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.AppState.SelectedTab.Value.CurrentSelectedItemIndex.Value,
|
dc => dc!.AppState.SelectedTab.Value!.CurrentSelectedItemIndex.Value,
|
||||||
tb => tb.Text,
|
tb => tb.Text,
|
||||||
v => v is null || v < 0 ? "?" : $"{v + 1}")),
|
v => v is null or < 0 ? "?" : $"{v + 1}")),
|
||||||
new TextBlock<IRootViewModel>
|
new TextBlock<IRootViewModel>
|
||||||
{
|
{
|
||||||
Foreground = _theme.MarkedItemForegroundColor,
|
Foreground = _theme.MarkedItemForegroundColor,
|
||||||
@@ -359,27 +359,27 @@ public class MainWindow
|
|||||||
{
|
{
|
||||||
t.Bind(
|
t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.AppState.SelectedTab.Value.MarkedItems.Value.Count,
|
dc => dc!.AppState.SelectedTab.Value!.MarkedItems.Value!.Count,
|
||||||
tb => tb.Text,
|
tb => tb.Text,
|
||||||
v => $"/{v}");
|
v => $"/{v}");
|
||||||
|
|
||||||
t.Bind(
|
t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.AppState.SelectedTab.Value.MarkedItems.Value.Count > 0,
|
dc => dc!.AppState.SelectedTab.Value!.MarkedItems.Value!.Count > 0,
|
||||||
s => s.IsVisible);
|
tb => tb.IsVisible);
|
||||||
}),
|
}),
|
||||||
new TextBlock<IRootViewModel>()
|
new TextBlock<IRootViewModel>()
|
||||||
.Setup(t => t.Bind(
|
.Setup(t => t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.AppState.SelectedTab.Value.CurrentItems.Value.Count,
|
dc => dc!.AppState.SelectedTab.Value!.CurrentItems.Value!.Count,
|
||||||
tb => tb.Text,
|
tb => tb.Text,
|
||||||
v => $"/{v}")),
|
v => $"/{v}")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.Setup(s => s.Bind(
|
.Setup(s => s.Bind(
|
||||||
s,
|
s,
|
||||||
dc => dc.AppState.SelectedTab.Value.CurrentItems.Value.Count > 0,
|
dc => dc!.AppState.SelectedTab.Value!.CurrentItems.Value!.Count > 0,
|
||||||
s => s.IsVisible)),
|
sp => sp.IsVisible)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -401,7 +401,7 @@ public class MainWindow
|
|||||||
.Setup(t =>
|
.Setup(t =>
|
||||||
t.Bind(
|
t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.KeysText,
|
dc => dc!.KeysText,
|
||||||
tb => tb.Text)
|
tb => tb.Text)
|
||||||
),
|
),
|
||||||
new TextBlock<IPossibleCommandEntryViewModel>
|
new TextBlock<IPossibleCommandEntryViewModel>
|
||||||
@@ -413,7 +413,7 @@ public class MainWindow
|
|||||||
}.Setup(t =>
|
}.Setup(t =>
|
||||||
t.Bind(
|
t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => dc.Title,
|
dc => dc!.Title,
|
||||||
tb => tb.Text)
|
tb => tb.Text)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -425,9 +425,8 @@ public class MainWindow
|
|||||||
|
|
||||||
commandBindings.Bind(
|
commandBindings.Bind(
|
||||||
commandBindings,
|
commandBindings,
|
||||||
root => root.PossibleCommands.PossibleCommands,
|
dc => dc!.PossibleCommands.PossibleCommands,
|
||||||
v => v.ItemsSource,
|
v => v.ItemsSource);
|
||||||
d => d);
|
|
||||||
|
|
||||||
return commandBindings;
|
return commandBindings;
|
||||||
}
|
}
|
||||||
@@ -444,14 +443,14 @@ public class MainWindow
|
|||||||
|
|
||||||
textBlock.Bind(
|
textBlock.Bind(
|
||||||
textBlock,
|
textBlock,
|
||||||
dc => dc.TabNumber.ToString(),
|
dc => dc!.TabNumber.ToString(),
|
||||||
tb => tb.Text,
|
tb => tb.Text,
|
||||||
value => $" {value}",
|
value => $" {value}",
|
||||||
fallbackValue: "?");
|
fallbackValue: "?");
|
||||||
|
|
||||||
textBlock.Bind(
|
textBlock.Bind(
|
||||||
textBlock,
|
textBlock,
|
||||||
dc => dc.IsSelected.Value ? _theme.SelectedTabBackgroundColor : null,
|
dc => dc!.IsSelected.Value ? _theme.SelectedTabBackgroundColor : null,
|
||||||
tb => tb.Background,
|
tb => tb.Background,
|
||||||
fallbackValue: null
|
fallbackValue: null
|
||||||
);
|
);
|
||||||
@@ -461,8 +460,8 @@ public class MainWindow
|
|||||||
|
|
||||||
tabList.Bind(
|
tabList.Bind(
|
||||||
tabList,
|
tabList,
|
||||||
root => root.AppState.Tabs,
|
root => root!.AppState.Tabs,
|
||||||
v => v.ItemsSource);
|
tl => tl.ItemsSource);
|
||||||
|
|
||||||
return tabList;
|
return tabList;
|
||||||
}
|
}
|
||||||
@@ -475,17 +474,17 @@ public class MainWindow
|
|||||||
Margin = "1 0 1 0"
|
Margin = "1 0 1 0"
|
||||||
};
|
};
|
||||||
|
|
||||||
list.ItemTemplate = item => ItemItemTemplate(item, new ItemViewRenderOptions(true));
|
list.ItemTemplate = _ => ItemItemTemplate(new ItemViewRenderOptions(true));
|
||||||
|
|
||||||
list.Bind(
|
list.Bind(
|
||||||
list,
|
list,
|
||||||
root => root.AppState.SelectedTab.Value.CurrentItems.Value,
|
dc => dc!.AppState.SelectedTab.Value!.CurrentItems.Value,
|
||||||
v => v.ItemsSource);
|
lv => lv.ItemsSource);
|
||||||
|
|
||||||
list.Bind(
|
list.Bind(
|
||||||
list,
|
list,
|
||||||
root => root.AppState.SelectedTab.Value.CurrentSelectedItem.Value,
|
dc => dc!.AppState.SelectedTab.Value!.CurrentSelectedItem.Value,
|
||||||
v => v.SelectedItem);
|
lv => lv.SelectedItem);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
@@ -495,20 +494,20 @@ public class MainWindow
|
|||||||
var list = new ListView<IRootViewModel, IItemViewModel>
|
var list = new ListView<IRootViewModel, IItemViewModel>
|
||||||
{
|
{
|
||||||
ListPadding = 8,
|
ListPadding = 8,
|
||||||
ItemTemplate = item => ItemItemTemplate(item, new ItemViewRenderOptions())
|
ItemTemplate = _ => ItemItemTemplate(new ItemViewRenderOptions())
|
||||||
};
|
};
|
||||||
|
|
||||||
list.Bind(
|
list.Bind(
|
||||||
list,
|
list,
|
||||||
dc =>
|
dc =>
|
||||||
dc.AppState.SelectedTab.Value.SelectedsChildren.Value.Count > 0
|
dc!.AppState.SelectedTab.Value!.SelectedsChildren.Value!.Count > 0
|
||||||
&& dc.ItemPreviewService.ItemPreview.Value == null,
|
&& dc.ItemPreviewService.ItemPreview.Value == null,
|
||||||
l => l.IsVisible,
|
l => l.IsVisible,
|
||||||
fallbackValue: false);
|
fallbackValue: false);
|
||||||
|
|
||||||
list.Bind(
|
list.Bind(
|
||||||
list,
|
list,
|
||||||
dc => dc.AppState.SelectedTab.Value.SelectedsChildren.Value,
|
dc => dc!.AppState.SelectedTab.Value!.SelectedsChildren.Value,
|
||||||
v => v.ItemsSource,
|
v => v.ItemsSource,
|
||||||
fallbackValue: null);
|
fallbackValue: null);
|
||||||
|
|
||||||
@@ -520,21 +519,18 @@ public class MainWindow
|
|||||||
var list = new ListView<IRootViewModel, IItemViewModel>
|
var list = new ListView<IRootViewModel, IItemViewModel>
|
||||||
{
|
{
|
||||||
ListPadding = 8,
|
ListPadding = 8,
|
||||||
ItemTemplate = item => ItemItemTemplate(item, new ItemViewRenderOptions())
|
ItemTemplate = _ => ItemItemTemplate(new ItemViewRenderOptions())
|
||||||
};
|
};
|
||||||
|
|
||||||
list.Bind(
|
list.Bind(
|
||||||
list,
|
list,
|
||||||
dc => dc.AppState.SelectedTab.Value.ParentsChildren.Value,
|
dc => dc!.AppState.SelectedTab.Value!.ParentsChildren.Value,
|
||||||
v => v.ItemsSource);
|
lv => lv.ItemsSource);
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IView<IItemViewModel> ItemItemTemplate(
|
private IView<IItemViewModel> ItemItemTemplate(ItemViewRenderOptions options)
|
||||||
ListViewItem<IItemViewModel, IRootViewModel> item,
|
|
||||||
ItemViewRenderOptions options
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
var root = new Grid<IItemViewModel>
|
var root = new Grid<IItemViewModel>
|
||||||
{
|
{
|
||||||
@@ -570,7 +566,7 @@ public class MainWindow
|
|||||||
t,
|
t,
|
||||||
dc => dc is ISizeProvider
|
dc => dc is ISizeProvider
|
||||||
? ((ISizeProvider) dc).Size.Value
|
? ((ISizeProvider) dc).Size.Value
|
||||||
: ((ISizeProvider) dc.BaseItem).Size.Value,
|
: ((ISizeProvider) dc!.BaseItem!).Size.Value,
|
||||||
tb => tb.Text,
|
tb => tb.Text,
|
||||||
v =>
|
v =>
|
||||||
{
|
{
|
||||||
@@ -583,16 +579,18 @@ public class MainWindow
|
|||||||
new TextBlock<IItemViewModel>()
|
new TextBlock<IItemViewModel>()
|
||||||
.Setup(t =>
|
.Setup(t =>
|
||||||
{
|
{
|
||||||
|
t.Bind(
|
||||||
|
t,
|
||||||
|
dc => dc!.BaseItem!.Type == AbsolutePathType.Container,
|
||||||
|
tb => tb.IsVisible);
|
||||||
|
|
||||||
if (!options.ShowAttributes) return;
|
if (!options.ShowAttributes) return;
|
||||||
t.Bind(
|
t.Bind(
|
||||||
t,
|
t,
|
||||||
dc => ((IContainer) dc.BaseItem).Items.Count,
|
dc => ((IContainer) dc!.BaseItem!).Items.Count,
|
||||||
tb => tb.Text,
|
tb => tb.Text,
|
||||||
t => $" {t,4}");
|
v => $" {v,4}");
|
||||||
}).Setup(s => s.Bind(
|
})
|
||||||
s,
|
|
||||||
dc => dc.BaseItem.Type == AbsolutePathType.Container,
|
|
||||||
s => s.IsVisible))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -602,13 +600,17 @@ public class MainWindow
|
|||||||
|
|
||||||
root.Bind(
|
root.Bind(
|
||||||
root,
|
root,
|
||||||
dc => dc == null ? _theme.DefaultForegroundColor : ToForegroundColor(dc.ViewMode.Value, dc.BaseItem.Type),
|
dc => dc == null
|
||||||
|
? _theme.DefaultForegroundColor
|
||||||
|
: ToForegroundColor(dc.ViewMode.Value, dc.BaseItem!.Type),
|
||||||
tb => tb.Foreground
|
tb => tb.Foreground
|
||||||
);
|
);
|
||||||
|
|
||||||
root.Bind(
|
root.Bind(
|
||||||
root,
|
root,
|
||||||
dc => dc == null ? _theme.DefaultBackgroundColor : ToBackgroundColor(dc.ViewMode.Value, dc.BaseItem.Type),
|
dc => dc == null
|
||||||
|
? _theme.DefaultBackgroundColor
|
||||||
|
: ToBackgroundColor(dc.ViewMode.Value, dc.BaseItem!.Type),
|
||||||
tb => tb.Background
|
tb => tb.Background
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user