Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ public ObservableCollection<InnerListColumn> Columns
{
Dispatcher.BeginInvoke(
DispatcherPriority.Background,
(DispatcherOperationCallback)delegate(object arg)
(DispatcherOperationCallback)((arg) =>
{
if (this.IsLoaded)
{
base.ScrollIntoView(arg);
}

return null;
},
}),
item);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ private static void ShowHelpWindow(PSObject helpObj, PSCmdlet cmdlet)
{
ownerWindow.Dispatcher.Invoke(
new SendOrPostCallback(
delegate(object ignored)
(_) =>
{
HelpWindow helpWindow = new HelpWindow(helpObj);
helpWindow.Owner = ownerWindow;
helpWindow.Show();

helpWindow.Closed += new EventHandler(delegate(object sender, EventArgs e) { ownerWindow.Focus(); });
helpWindow.Closed += new EventHandler((sender, e) => ownerWindow.Focus());
}),
string.Empty);
return;
Expand Down
30 changes: 15 additions & 15 deletions src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ private void AddColumns(string[] propertyNames, string[] displayNames, Type[] ty
this.managementList.Dispatcher.Invoke(
System.Windows.Threading.DispatcherPriority.Normal,
new Action(
delegate()
() =>
{
// Pick the length of the shortest incoming arrays. Normally all incoming arrays should be of the same length.
int length = propertyNames.Length;
Expand Down Expand Up @@ -461,19 +461,19 @@ private void AddColumns(string[] propertyNames, string[] displayNames, Type[] ty
// Set focus on ListView
this.managementList.List.SelectedIndex = 0;
this.managementList.List.Focus();
}
catch (Exception e)
{
// Store the exception in a local variable that will be checked later.
if (e.InnerException != null)
{
this.exception = e.InnerException;
}
else
{
this.exception = e;
}
}
}
catch (Exception e)
{
// Store the exception in a local variable that will be checked later.
if (e.InnerException != null)
{
this.exception = e.InnerException;
}
else
{
this.exception = e;
}
}
}));
}

Expand All @@ -492,7 +492,7 @@ private void AddItem(PSObject value)
this.managementList.Dispatcher.BeginInvoke(
System.Windows.Threading.DispatcherPriority.Normal,
new Action(
delegate()
() =>
{
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ internal static AllModulesViewModel GetNewAllModulesViewModel(AllModulesViewMode
}

ModuleViewModel moduleToSelect = returnValue.Modules.Find(
new Predicate<ModuleViewModel>(delegate(ModuleViewModel module)
new Predicate<ModuleViewModel>((module) =>
{
return module.Name.Equals(selectedModuleNeedingImportModule, StringComparison.OrdinalIgnoreCase) ? true : false;
}));
Expand All @@ -658,7 +658,7 @@ internal static AllModulesViewModel GetNewAllModulesViewModel(AllModulesViewMode
returnValue.SelectedModule = moduleToSelect;

CommandViewModel commandToSelect = moduleToSelect.Commands.Find(
new Predicate<CommandViewModel>(delegate(CommandViewModel command)
new Predicate<CommandViewModel>((command) =>
{
return command.ModuleName.Equals(parentModuleNeedingImportModule, StringComparison.OrdinalIgnoreCase) &&
command.Name.Equals(commandNeedingImportModule, StringComparison.OrdinalIgnoreCase) ? true : false;
Expand Down Expand Up @@ -876,11 +876,8 @@ private static void ActivateWindow(Window window)
{
window.Dispatcher.Invoke(
new SendOrPostCallback(
delegate(object ignored)
{
window.Activate();
}),
string.Empty);
(_) => window.Activate()),
string.Empty);
}

/// <summary>
Expand All @@ -896,7 +893,7 @@ private static void ActivateWindow(Window window)
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")]
private void ShowAllModulesWindow(PSCmdlet cmdlet, Dictionary<string, ShowCommandModuleInfo> importedModules, IEnumerable<ShowCommandCommandInfo> commands, bool noCommonParameter, double windowWidth, double windowHeight, bool passThrough)
{
this.methodThatReturnsDialog = new DispatcherOperationCallback(delegate(object ignored)
this.methodThatReturnsDialog = new DispatcherOperationCallback((object ignored) =>
{
ShowAllModulesWindow allModulesWindow = new ShowAllModulesWindow();
this.allModulesViewModel = new AllModulesViewModel(importedModules, commands, noCommonParameter);
Expand Down Expand Up @@ -939,7 +936,7 @@ private void CallShowDialog(PSCmdlet cmdlet)

this.hostWindow.Dispatcher.Invoke(
new SendOrPostCallback(
delegate(object ignored)
(_) =>
{
Window childWindow = (Window)this.methodThatReturnsDialog.Invoke(null);
childWindow.Owner = this.hostWindow;
Expand Down Expand Up @@ -967,7 +964,7 @@ private void PlainInvokeAndShowDialog()
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")]
private void ShowCommandWindow(PSCmdlet cmdlet, object commandViewModelObj, double windowWidth, double windowHeight, bool passThrough)
{
this.methodThatReturnsDialog = new DispatcherOperationCallback(delegate(object ignored)
this.methodThatReturnsDialog = new DispatcherOperationCallback((object ignored) =>
{
this.commandViewModel = (CommandViewModel)commandViewModelObj;
ShowCommandWindow showCommandWindow = new ShowCommandWindow();
Expand Down Expand Up @@ -1034,7 +1031,7 @@ private void ImportModuleFailed(Exception reason)
{
this.window.Dispatcher.Invoke(
new SendOrPostCallback(
delegate(object ignored)
(_) =>
{
string message = ShowCommandHelper.GetImportModuleFailedMessage(
this.commandNeedingImportModule,
Expand Down