Added compiler directives for .NET 5

pull/180/head
dahall 2020-11-14 13:34:50 -07:00
parent c7a322c069
commit 5d479070a9
3 changed files with 11 additions and 9 deletions

View File

@ -58,7 +58,7 @@ namespace Vanara.Windows.Shell
return true;
}
#if !(NETCOREAPP3_0 || NETCOREAPP3_1)
#if !(NETCOREAPP3_0 || NETCOREAPP3_1 || NET5_0)
/// <summary>Registers the specified type as a COM Local Server.</summary>
/// <typeparam name="TComObject">The type of the COM object.</typeparam>

View File

@ -38,11 +38,11 @@ namespace Vanara.Windows.Shell
/// <value>The progress bar.</value>
public ProgressBar ProgressBar { get; set; }
#if NETFRAMEWORK || NETCOREAPP3_0
/// <summary>Gets or sets the status bar associated with the view.</summary>
/// <value>The status bar.</value>
public StatusBar StatusBar { get; set; }
#if NETFRAMEWORK || NETCOREAPP3_0
/// <summary>Gets or sets the tool bar associated with the view.</summary>
/// <value>The tool bar.</value>
public ToolBar ToolBar { get; set; }
@ -92,8 +92,8 @@ namespace Vanara.Windows.Shell
phwnd = id switch
{
FCW.FCW_PROGRESS => CheckAndLoad(ProgressBar),
FCW.FCW_STATUS => CheckAndLoad(StatusBar),
#if NETFRAMEWORK || NETCOREAPP3_0
FCW.FCW_STATUS => CheckAndLoad(StatusBar),
FCW.FCW_TOOLBAR => CheckAndLoad(ToolBar),
#endif
FCW.FCW_TREE => CheckAndLoad(TreeView),

View File

@ -178,6 +178,13 @@ namespace Vanara.Windows.Shell
ComInterface.InvokeCommand(invoke);
}
private void InvokeCommand(int index)
{
var invoke = new CMINVOKECOMMANDINFOEX(index) { nShow = ShowWindowCommand.SW_SHOWNORMAL };
m_ComInterface2.InvokeCommand(invoke);
}
#if !NET5_0
/// <summary>Populates a <see cref="Menu"/> with the context menu items for a shell item.</summary>
/// <remarks>
/// If this method is being used to populate a Form's main menu then you need to call <see cref="HandleMenuMessage"/> in the Form's
@ -204,12 +211,6 @@ namespace Vanara.Windows.Shell
}
}
private void InvokeCommand(int index)
{
var invoke = new CMINVOKECOMMANDINFOEX(index) { nShow = ShowWindowCommand.SW_SHOWNORMAL };
m_ComInterface2.InvokeCommand(invoke);
}
private void RemoveShellMenuItems(Menu menu)
{
const int tag = 0xAB;
@ -263,6 +264,7 @@ namespace Vanara.Windows.Shell
SetMenuInfo(item.Handle, info);
}
}
#endif
private class MessageWindow : Control
{