1
0
Fork 0
mirror of https://github.com/wagesj45/butterflow-ui.git synced 2025-09-09 03:00:39 -05:00

Added compute device selection

Added a call to butterflow to get compute devices, as well as a user setting that lets them set which device they want to use. I only have a single GPU, so I am unable to test this.
This commit is contained in:
Jordan Wages 2018-09-12 21:35:06 -05:00
commit d454d7a7f0
11 changed files with 127 additions and 14 deletions

View file

@ -1,4 +1,5 @@
using System;
using butterflow_ui.Properties;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@ -21,6 +22,9 @@ namespace butterflow_ui
{
#region Properties
/// <summary> The butterflow wrapper used to call butterflow. </summary>
public ButterflowWrapper ButterflowWrapper { get; set; } = new ButterflowWrapper();
/// <summary> Gets or sets the supported languages. </summary>
/// <value> The supported languages. </value>
public List<CultureInfo> SupportedLanguages { get; set; } = new List<CultureInfo>(new[]
@ -40,6 +44,8 @@ namespace butterflow_ui
/// <summary> Default constructor. </summary>
public OptionsWindow()
{
this.ButterflowWrapper.GetDevices();
this.ButterflowWrapper.ButterflowExited += ButterflowWrapper_ButterflowExited;
InitializeComponent();
}
@ -57,6 +63,21 @@ namespace butterflow_ui
this.Close();
}
/// <summary> Butterflow wrapper butterflow exited. </summary>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> The ButterflowExitArgs to process. </param>
private void ButterflowWrapper_ButterflowExited(object sender, ButterflowWrapper.ButterflowExitArgs e)
{
if (Settings.Default.Device >= 0)
{
this.comboDeviceList.Dispatcher.Invoke(() => this.comboDeviceList.SelectedIndex = Settings.Default.Device);
}
else
{
this.comboDeviceList.Dispatcher.Invoke(() => this.comboDeviceList.SelectedIndex = 0);
}
}
#endregion
}
}