mirror of
https://gitcode.com/gh_mirrors/ope/OpenFace.git
synced 2025-12-30 04:52:29 +00:00
Removing a no longer needed dependency.
This commit is contained in:
@@ -40,7 +40,6 @@ using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interactivity;
|
||||
using Microsoft.WindowsAPICodePack.Dialogs;
|
||||
|
||||
// Internal libraries
|
||||
|
||||
@@ -69,7 +69,6 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -101,7 +100,6 @@
|
||||
<Compile Include="UI_items\CameraSelection.xaml.cs">
|
||||
<DependentUpon>CameraSelection.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI_items\ExclusiveMenuItemBehavior.cs" />
|
||||
<Compile Include="UI_items\MultiBarGraph.xaml.cs">
|
||||
<DependentUpon>MultiBarGraph.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace OpenFaceOffline
|
||||
{
|
||||
public class ExclusiveMenuItemBehavior : Behavior<MenuItem>
|
||||
{
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
GetCheckableSubMenuItems(AssociatedObject)
|
||||
.ToList()
|
||||
.ForEach(item => item.Click += OnClick);
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
|
||||
GetCheckableSubMenuItems(AssociatedObject)
|
||||
.ToList()
|
||||
.ForEach(item => item.Click -= OnClick);
|
||||
}
|
||||
|
||||
private static IEnumerable<MenuItem> GetCheckableSubMenuItems(ItemsControl menuItem)
|
||||
{
|
||||
var itemCollection = menuItem.Items;
|
||||
return itemCollection.OfType<MenuItem>().Where(menuItemCandidate => menuItemCandidate.IsCheckable);
|
||||
}
|
||||
|
||||
private void OnClick(object sender, RoutedEventArgs routedEventArgs)
|
||||
{
|
||||
var menuItem = (MenuItem)sender;
|
||||
|
||||
if (!menuItem.IsChecked)
|
||||
{
|
||||
menuItem.IsChecked = true;
|
||||
return;
|
||||
}
|
||||
|
||||
GetCheckableSubMenuItems(AssociatedObject)
|
||||
.Where(item => item != menuItem)
|
||||
.ToList()
|
||||
.ForEach(item => item.IsChecked = false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user