}
public override bool Equals(object obj)
- {
- var info = obj as MediaInfo;
- return info != null &&
- info.Url == this.Url &&
- info.VideoUrl == this.VideoUrl;
- }
+ => obj is MediaInfo info && info.Url == this.Url && info.VideoUrl == this.VideoUrl;
public override int GetHashCode()
{
private void DrawPlayableMark(PaintEventArgs pe)
{
- var thumb = this.Tag as ThumbnailInfo;
- if (thumb == null || !thumb.IsPlayable) return;
+ if (!(this.Tag is ThumbnailInfo thumb && thumb.IsPlayable)) return;
if (base.Image == base.InitialImage || base.Image == base.ErrorImage) return;
var overlayImage = Properties.Resources.PlayableOverlayImage;
}
public TabModel SelectedTab
- {
- get
- {
- var item = this.TabList.SelectedItem as TabListItem;
- if (item == null) return null;
-
- return item.Tab;
- }
- }
+ => this.TabList.SelectedItem is TabListItem item ? item.Tab : null;
public TabModel[] SelectedTabs
{
private void pictureBox_DoubleClick(object sender, EventArgs e)
{
- var thumb = ((PictureBox)sender).Tag as ThumbnailInfo;
-
- if (thumb == null) return;
-
- this.OpenImage(thumb);
+ if (((PictureBox)sender).Tag is ThumbnailInfo thumb)
+ this.OpenImage(thumb);
}
private void contextMenuStrip_Opening(object sender, CancelEventArgs e)