Skip to content

Commit

Permalink
Update to .Net 5
Browse files Browse the repository at this point in the history
  • Loading branch information
HelloWorld committed Dec 27, 2020
1 parent cbde9ed commit 1e88ea3
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 106 deletions.
2 changes: 1 addition & 1 deletion Loopback/Loopback.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<AssemblyName>Loopback</AssemblyName>
<ApplicationIcon>Application.ico</ApplicationIcon>
Expand Down
210 changes: 105 additions & 105 deletions Loopback/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,122 +16,122 @@

namespace Loopback
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private LoopUtil _loop;
private List<LoopUtil.AppContainer> appFiltered = new List<LoopUtil.AppContainer>();
private bool isDirty = false;
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private LoopUtil _loop;
private List<LoopUtil.AppContainer> appFiltered = new List<LoopUtil.AppContainer>();
private bool isDirty = false;

public MainWindow()
{
InitializeComponent();
_loop = new LoopUtil();
dgLoopback.ItemsSource = appFiltered;
Filter(String.Empty, false, null);
ICollectionView cvApps = CollectionViewSource.GetDefaultView(dgLoopback.ItemsSource);
}
public MainWindow()
{
InitializeComponent();
_loop = new LoopUtil();
dgLoopback.ItemsSource = appFiltered;
Filter(String.Empty, false, null);
ICollectionView cvApps = CollectionViewSource.GetDefaultView(dgLoopback.ItemsSource);
}

private void btnSave_Click(object sender, RoutedEventArgs e)
{
if (!isDirty)
{
Log("nothing to save");
return;
}
private void btnRefresh_Click(object sender, RoutedEventArgs e)
{
_loop.LoadApps();
Filter(String.Empty, false, null);
txtFilter.Text = "";
Loopback_Enabled.IsChecked = false;
Loopback_Disabled.IsChecked = false;
isDirty = false;
Log("refreshed");
}

isDirty = false;
if (_loop.SaveLoopbackState())
{
Log(" saved loopback excemptions");
}
else
{
Log(" ERROR SAVING");
}
}
private void btnSave_Click(object sender, RoutedEventArgs e)
{
if (!isDirty)
{
Log("nothing to save");
return;
}

private void btnRefresh_Click(object sender, RoutedEventArgs e)
{
_loop.LoadApps();
Filter(String.Empty, false, null);
txtFilter.Text = "";
Loopback_Enabled.IsChecked = false;
Loopback_Disabled.IsChecked = false;
isDirty = false;
Log("refreshed");
}
isDirty = false;
if (_loop.SaveLoopbackState())
{
Log(" saved loopback excemptions");
}
else
{
Log(" ERROR SAVING");
}
}

private void Window_Closing(object sender, CancelEventArgs e)
{
if (isDirty)
{
MessageBoxResult resp = System.Windows.MessageBox.Show("You have not saved your changes. Are you sure you want to exit ?", "Loopback Manager", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (resp == MessageBoxResult.No)
{
e.Cancel = true;
return;
}
}
//To Do
_loop.FreeResources();
}
private void dgcbLoop_Click(object sender, RoutedEventArgs e)
{
isDirty = true;
}

private void txtFilter_KeyUp(object sender, KeyEventArgs e)
{
bool isEnabledChecked = (bool)Loopback_Enabled.IsChecked;
if (isEnabledChecked)
{
Filter(txtFilter.Text, (bool)Loopback_Enabled.IsChecked, isEnabledChecked);
}
else
{
Filter(txtFilter.Text, (bool)Loopback_Disabled.IsChecked, isEnabledChecked);
}
}
private void Filter(string filter, bool Ischecked, bool? IsEnabled)
{
string appsInFilter = filter.ToUpper();
appFiltered.Clear();

private void Loopback_Click_Enabled(object sender, RoutedEventArgs e)
{
Filter(txtFilter.Text, (bool)Loopback_Enabled.IsChecked, true);
Loopback_Disabled.IsChecked = false;
}
foreach (LoopUtil.AppContainer app in _loop.Apps)
{
string appName = app.DisplayName.ToUpper();

private void Loopback_Click_Disabled(object sender, RoutedEventArgs e)
{
Filter(txtFilter.Text, (bool)Loopback_Disabled.IsChecked, false);
Loopback_Enabled.IsChecked = false;
}
if (string.IsNullOrEmpty(filter) || appName.Contains(appsInFilter))
{
if (Ischecked == false || app.LoopUtil == IsEnabled)
{
appFiltered.Add(app);
}
}
}
dgLoopback.Items.Refresh();
}

private void Filter(string filter, bool Ischecked, bool? IsEnabled)
{
string appsInFilter = filter.ToUpper();
appFiltered.Clear();
private void Log(String logtxt)
{
txtStatus.Text = DateTime.Now.ToString("hh:mm:ss.fff ") + logtxt;
}

foreach (LoopUtil.AppContainer app in _loop.Apps)
{
string appName = app.DisplayName.ToUpper();
private void Loopback_Click_Disabled(object sender, RoutedEventArgs e)
{
Filter(txtFilter.Text, (bool)Loopback_Disabled.IsChecked, false);
Loopback_Enabled.IsChecked = false;
}

if (string.IsNullOrEmpty(filter) || appName.Contains(appsInFilter))
{
if (Ischecked == false || app.LoopUtil == IsEnabled)
{
appFiltered.Add(app);
}
}
}
dgLoopback.Items.Refresh();
}
private void Loopback_Click_Enabled(object sender, RoutedEventArgs e)
{
Filter(txtFilter.Text, (bool)Loopback_Enabled.IsChecked, true);
Loopback_Disabled.IsChecked = false;
}

private void dgcbLoop_Click(object sender, RoutedEventArgs e)
{
isDirty = true;
}
private void txtFilter_KeyUp(object sender, KeyEventArgs e)
{
bool isEnabledChecked = (bool)Loopback_Enabled.IsChecked;
if (isEnabledChecked)
{
Filter(txtFilter.Text, (bool)Loopback_Enabled.IsChecked, isEnabledChecked);
}
else
{
Filter(txtFilter.Text, (bool)Loopback_Disabled.IsChecked, isEnabledChecked);
}
}

private void Log(String logtxt)
{
txtStatus.Text = DateTime.Now.ToString("hh:mm:ss.fff ") + logtxt;
}
}
private void Window_Closing(object sender, CancelEventArgs e)
{
if (isDirty)
{
MessageBoxResult resp = System.Windows.MessageBox.Show("You have not saved your changes. Are you sure you want to exit ?", "Loopback Manager", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (resp == MessageBoxResult.No)
{
e.Cancel = true;
return;
}
}
//To Do
_loop.FreeResources();
}
}
}

0 comments on commit 1e88ea3

Please sign in to comment.