cleaned up code base

This commit is contained in:
Conor 2020-11-08 13:08:52 +00:00
parent 7a6786ed95
commit 2cee3f4efc
34 changed files with 558 additions and 143 deletions

Binary file not shown.

View File

@ -1,16 +1,28 @@
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.IO.Ports;
using System.Text;
namespace RGBController2.Boards
{
/// <summary>
/// ArduinoBoard used for communicating with a sigle Arduino device.
/// </summary>
public class ArduinoBoard : IBoard
{
/// <summary>
/// True is communication has been established with the Arduino, false otherwise.
/// </summary>
public bool Connected { get; }
/// <summary>
/// The serial port object for communicating with the Arduino.
/// </summary>
private SerialPort _serialPort;
/// <summary>
/// Constructs an ArduinoBoard object for controlling the Arduino.
/// </summary>
/// <param name="portName">The COM port name of the arduino.</param>
/// <param name="baudRate">The baud rate at which to communicate with the arduion. Default 9600.</param>
public ArduinoBoard(string portName, int baudRate = 9600)
{
Connected = false;
@ -22,6 +34,12 @@ namespace RGBController2.Boards
Connected = true;
}
/// <summary>
/// Sets all of the LEDs to the chosen RGB colour.
/// </summary>
/// <param name="red">The red value</param>
/// <param name="green">The green value</param>
/// <param name="blue">The blue value</param>
public void SetAllLeds(byte red, byte green, byte blue)
{
string command = "a";
@ -32,12 +50,21 @@ namespace RGBController2.Boards
_serialPort.WriteLine(command);
}
/// <summary>
/// Turns off all of the LEDs connected to the board.
/// </summary>
public void TurnOffAllLeds()
{
string command = "a000000;";
_serialPort.WriteLine(command);
}
/// <summary>
/// Helper function to convert as byte to a hex string used by the arduino.
/// e.g: 255 would become FF
/// </summary>
/// <param name="b">The byte to be converted.</param>
/// <returns></returns>
private static string ByteToHexString(byte b)
{
StringBuilder hex = new StringBuilder(2);

View File

@ -1,23 +1,28 @@
using CUE.NET;
using CUE.NET.Brushes;
using CUE.NET.Devices.Generic.Enums;
using CUE.NET.Devices.Keyboard;
using CUE.NET.Devices.Keyboard.Enums;
using CUE.NET.Exceptions;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows;
using System.ComponentModel;
using CUE.NET.Devices.Generic;
namespace RGBController2.Boards
{
/// <summary>
/// CUEDeviceBoard used for communicating with a single CUE device.
/// </summary>
public class CUEDeviceBoard : IBoard
{
/// <summary>
/// The corsair CUE device to control.
/// </summary>
private AbstractCueDevice _device;
/// <summary>
/// The type of CUE device. i.e mouse or keyboard.
/// </summary>
private CorsairDeviceType _deviceType;
public CorsairDeviceType DeviceType
{
@ -25,12 +30,18 @@ namespace RGBController2.Boards
set { _deviceType = value; }
}
/// <summary>
/// An array of available CUE devices.
/// </summary>
private CorsairDeviceType[] _availableDevices;
public CorsairDeviceType[] AvailableDevices
{
get { return _availableDevices; }
}
/// <summary>
/// The connectionstatus of the CUE device.
/// </summary>
private bool _connected;
public bool Connected
{
@ -38,7 +49,8 @@ namespace RGBController2.Boards
}
/// <summary>
/// Contructs oject to control Cue devices. Note: this does not connect to a device.
/// Contructs oject to control Cue devices.
/// Note: this does not connect to a device.
/// </summary>
public CUEDeviceBoard()
{
@ -67,8 +79,7 @@ namespace RGBController2.Boards
{
try
{
CueSDK.Initialize();
CueSDK.Initialize(true);
switch(deviceType)
{
case CorsairDeviceType.Headset:

View File

@ -0,0 +1,57 @@
using Corale.Colore.Core;
using System;
using System.Collections.Generic;
using System.Text;
using ColoreColor = Corale.Colore.Core.Color;
namespace RGBController2.Boards
{
public class ChromaDeviceBoard : IBoard
{
enum deviceTypes
{
Mousepad,
Keypad,
Headset,
Keyboard,
Mouse
}
private bool _connected;
//private IChroma _device;
public bool Connected
{
get { return _connected; }
}
public ChromaDeviceBoard()
{
// ToDo add device type selection here
_connected = true;
// ConnectToDevice();
}
public async void ConnectToDevice()
{
// _device = await ColoreProvider.CreateNativeAsync();
}
/// <summary>
/// Sets all of the LEDs to the chosen RGB colour.
/// </summary>
/// <param name="red">The red value</param>
/// <param name="green">The green value</param>
/// <param name="blue">The blue value</param>
public async void SetAllLeds(byte red, byte green, byte blue)
{
//if (_device.Initialized)
//{
// var colour = new ColoreColor((byte)red, (byte)green, (byte)blue);
// await _device.Mouse.SetAllAsync(colour);
//}
var colour = new ColoreColor((byte)red, (byte)green, (byte)blue);
Chroma.Instance.SetAll(colour);
}
}
}

View File

@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace RGBController2.Boards
{
public class ChromaDeviceBoarde : IBoard
{
private bool _connected;
public bool Connected
{
get { return _connected; }
}
ChromaDeviceBoarde()
{
}
}
}

View File

@ -1,11 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace RGBController2.Boards
{
/// <summary>
/// Interface for LED devices.
/// </summary>
public interface IBoard
{
/// <summary>
/// The connection status of the device.
/// </summary>
public bool Connected { get; }
/// <summary>

View File

@ -23,6 +23,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Colore" Version="5.2.0" />
<PackageReference Include="CUE.NET" Version="1.2.0.1" />
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.0.1" />
<PackageReference Include="System.Drawing.Common" Version="5.0.0-rc.2.20475.5" />
@ -39,6 +40,9 @@
<Compile Update="Views\Tabs\CUEDeviceTabView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Views\Tabs\ChromaDeviceTabView.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
@ -51,6 +55,9 @@
<Page Update="Views\Tabs\CUEDeviceTabView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Views\Tabs\ChromaDeviceTabView.xaml">
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project>

View File

@ -39,6 +39,9 @@
<Page Update="Views\Tabs\CUEDeviceTabView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Views\Tabs\ChromaDeviceTabView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Views\Tabs\ArduinoTabView.xaml">
<SubType>Designer</SubType>
</Page>

View File

@ -5,9 +5,20 @@ using System.Text;
namespace RGBController2.ViewModels
{
/// <summary>
/// The BaeViewModel from which all view models should inherit.
/// </summary>
public class BaseViewModel : INotifyPropertyChanged
{
/// <summary>
/// An event used for when a property used by the UI is change by the view model.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Function to update the GUI View when a given property has been changed by the view model.
/// </summary>
/// <param name="propertyName">The name of the changed property.</param>
protected void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)

View File

@ -8,12 +8,24 @@ using RGBController2.Views.Dialogs;
namespace RGBController2.ViewModels.Dialogs
{
/// <summary>
/// NewTabDialogViewModel is the view model for the NewTabDialog.
/// </summary>
class NewTabDialogViewModel : BaseViewModel
{
/// <summary>
/// The NewTabDialogView
/// </summary>
private NewTabDialogView DialogWindow;
/// <summary>
/// The command used for when the user presses the add tab button.
/// </summary>
public ICommand AddTabCommand { get; }
/// <summary>
/// The device name the user has eneter on the GUI.
/// </summary>
private string _deviceName;
public string DeviceName
{
@ -21,24 +33,35 @@ namespace RGBController2.ViewModels.Dialogs
set { _deviceName = value; }
}
/// <summary>
/// The device type the user has selected in the GUI.
/// </summary>
private int _selectedDeviceType;
public int SelectedDeviceType
{
get { return _selectedDeviceType; }
set { _selectedDeviceType = value; }
}
/// <summary>
/// True if the user enetered parameters are valid, else false.
/// e.g. this will be false if the user did not select a name for the device.
/// </summary>
private bool _success;
public bool Success
{
get { return _success; }
}
/// <summary>
/// Creates a NewTabDialogViewModel used for launching the NetTabView.
/// </summary>
public NewTabDialogViewModel()
{
AddTabCommand = new ActionCommand(p => AddTab());
_success = false;
}
/// <summary>
/// Creates window instance for this dialog viewmodel and displays it, getting the dialog result.
/// </summary>
@ -72,6 +95,5 @@ namespace RGBController2.ViewModels.Dialogs
else
MessageBox.Show("Validation error\n" + errorMessage);
}
}
}

View File

@ -4,6 +4,9 @@ using System.Text;
namespace RGBController2.ViewModels.LightingModes
{
/// <summary>
/// The view model for the AnimationView.
/// </summary>
public class AnimationViewModel : BaseViewModel
{
}

View File

@ -4,6 +4,9 @@ using System.Text;
namespace RGBController2.ViewModels.LightingModes
{
/// <summary>
/// The view model for the InformationView
/// </summary>
public class InformationViewModel : BaseViewModel
{
}

View File

@ -1,7 +1,4 @@
using RGBController2.Commands;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Input;
using RGBController2.Boards;
@ -9,8 +6,14 @@ using System.Windows.Media;
namespace RGBController2.ViewModels.LightingModes
{
/// <summary>
/// The view model for the StaticView.
/// </summary>
public class StaticViewModel : BaseViewModel
{
/// <summary>
/// The Numericelector value for the red colour.
/// </summary>
private int _redColourSend;
public int RedColourSend
{
@ -22,6 +25,9 @@ namespace RGBController2.ViewModels.LightingModes
}
}
/// <summary>
/// The Numericelector value for the green colour.
/// </summary>
private int _greenColourSend;
public int GreenColourSend
{
@ -33,6 +39,9 @@ namespace RGBController2.ViewModels.LightingModes
}
}
/// <summary>
/// The Numericelector value for the blue colour.
/// </summary>
private int _blueColourSend;
public int BlueColourSend
{
@ -44,6 +53,9 @@ namespace RGBController2.ViewModels.LightingModes
}
}
/// <summary>
/// The label value for the red current colour.
/// </summary>
private int _redColourCurrent;
public int RedColourCurrent
{
@ -51,6 +63,9 @@ namespace RGBController2.ViewModels.LightingModes
set { _redColourCurrent = value; }
}
/// <summary>
/// The label value for the blue current colour.
/// </summary>
private int _blueColourCurrent;
public int BlueColourCurrent
{
@ -58,14 +73,19 @@ namespace RGBController2.ViewModels.LightingModes
set { _blueColourCurrent = value; }
}
/// <summary>
/// The label value for the green current colour.
/// </summary>
private int _greenColourCurrent;
public int GreenColourCurrent
{
get { return _greenColourCurrent; }
set { _greenColourCurrent = value; }
}
/// <summary>
/// The colour used for the current colour box.
/// </summary>
private SolidColorBrush _colourCurrent;
public SolidColorBrush ColourCurrent
{
@ -73,6 +93,9 @@ namespace RGBController2.ViewModels.LightingModes
set { _colourCurrent = value; }
}
/// <summary>
/// The colour used for the send colour box.
/// </summary>
private SolidColorBrush _colourSend;
public SolidColorBrush ColourSend
{
@ -80,9 +103,20 @@ namespace RGBController2.ViewModels.LightingModes
set { _colourSend = value; }
}
/// <summary>
/// The command used for the send button.
/// </summary>
public ICommand SendCommand { get; set; }
/// <summary>
/// The board which the class instance will control.
/// </summary>
private IBoard _ledBoard;
/// <summary>
/// Constructor for the StaticViewModel.
/// </summary>
/// <param name="ledBoard">The led device which this StaticView will control.</param>
public StaticViewModel(IBoard ledBoard)
{
SendCommand = new ActionCommand(o => SendButtonClick("SenderButton"));
@ -103,12 +137,19 @@ namespace RGBController2.ViewModels.LightingModes
// ToDo load from previous values
}
/// <summary>
/// Helper function used to update the colour of the send colour box.
/// </summary>
private void UpdateSendColour()
{
ColourSend = new SolidColorBrush(Color.FromRgb((byte)RedColourSend, (byte)GreenColourSend, (byte)BlueColourSend));
OnPropertyChanged(nameof(ColourSend));
}
/// <summary>
/// The call back function for the send button.
/// </summary>
/// <param name="sender"></param>
private void SendButtonClick(object sender)
{
if (_ledBoard != null)

View File

@ -14,6 +14,9 @@ using System.Linq;
namespace RGBController2.ViewModels
{
/// <summary>
/// The view model for the MainView.
/// </summary>
class MainViewModel
{
@ -117,6 +120,12 @@ namespace RGBController2.ViewModels
break;
}
_tabs.Add(tab);
break;
}
case "chroma":
{
var tab = new ChromaDeviceTab(name);
_tabs.Add(tab);
break;
}
@ -168,9 +177,12 @@ namespace RGBController2.ViewModels
case 0: // Arduino
Tabs.Add(new ArduinoTab(dialog.DeviceName));
break;
case 1:
case 1: // corsair
Tabs.Add(new CueDeviceTab(dialog.DeviceName));
break;
case 2: // chroma
Tabs.Add(new ChromaDeviceTab(dialog.DeviceName));
break;
}
}
}
@ -222,6 +234,14 @@ namespace RGBController2.ViewModels
xmlWriter.WriteString(((CueDeviceTab)tab).SelectedDevice.ToString());
xmlWriter.WriteEndElement();
break;
case Tab.tabType.Chroma:
xmlWriter.WriteStartElement("type");
xmlWriter.WriteString("chroma");
xmlWriter.WriteEndElement();
xmlWriter.WriteStartElement("device");
xmlWriter.WriteString("not used");
xmlWriter.WriteEndElement();
break;
}
xmlWriter.WriteEndElement();
}

View File

@ -8,19 +8,16 @@ using RGBController2.ViewModels.LightingModes;
namespace RGBController2.ViewModels.Tabs
{
/// <summary>
/// The view model for an ArduinoTab.
/// </summary>
public class ArduinoTab : Tab, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private enum LightingModes
{
StaticMode = 0,
AnimationMode,
QuakeMode
}
private ArduinoBoard _arduinoBoard;
/// <summary>
/// The array of available COM ports.
/// This is used to populate the items in the GUI.
/// </summary>
private string[] _availablePorts;
public string[] AvailablePorts
{
@ -28,13 +25,10 @@ namespace RGBController2.ViewModels.Tabs
set { _availablePorts = value; }
}
private string _conntectionStatus;
public string ConnectionStatus
{
get { return _conntectionStatus; }
set { _conntectionStatus = value; }
}
/// <summary>
/// The selected port.
/// This is the selected item from the dropdown box in the GUI.
/// </summary>
private string _selectedPort;
public string SelectedPort
{
@ -45,30 +39,32 @@ namespace RGBController2.ViewModels.Tabs
{
_selectedPort = value;
// Connect to the port here
_arduinoBoard = new ArduinoBoard(_selectedPort);
if (_arduinoBoard.Connected)
_device = new ArduinoBoard(_selectedPort);
if (_device.Connected)
{
ConnectionStatus = "Device Connected";
EnableSelectLightingMode = true;
// Set the page to static lighting mode to allow the user to change the
// lighting mode now that we are connected to the arduino
SelectedLightingMode = new StaticViewModel(_arduinoBoard);
SelectedLightingMode = new StaticViewModel(_device);
OnPropertyChanged(nameof(SelectedLightingMode));
}
else
ConnectionStatus = "Failed to Connect";
OnPropertyChanged(nameof(ConnectionStatus));
}
}
}
private LightingModes _lightingMode;
public int LightingMode
{
get { return (int)_lightingMode; }
set { _lightingMode = (LightingModes) value; }
ConnectionStatus = "Failed to Connect";
EnableSelectLightingMode = false;
}
OnPropertyChanged(nameof(ConnectionStatus));
OnPropertyChanged(nameof(EnableSelectLightingMode));
}
}
}
/// <summary>
/// Constructor for an Arduino tab.
/// </summary>
/// <param name="name">The tab header name.</param>
public ArduinoTab(string name)
{
TabType = tabType.Arduino;
@ -84,12 +80,5 @@ namespace RGBController2.ViewModels.Tabs
SelectedLightingMode = new InformationViewModel();
}
protected void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}

View File

@ -11,23 +11,19 @@ namespace RGBController2.ViewModels.Tabs
{
public class CueDeviceTab : Tab, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private enum LightingModes
{
StaticMode = 0,
AnimationMode,
QuakeMode
}
private CUEDeviceBoard _cueDeviceBoard;
/// <summary>
/// An array of the available CUE Devices
/// Use for the items of the combo box
/// </summary>
private CorsairDeviceType[] _availableDevices;
public CorsairDeviceType[] AvailableDevices
{
get { return _availableDevices; }
}
/// <summary>
/// The selected index of the combo box.
/// </summary>
private CorsairDeviceType _selectedDevice;
public CorsairDeviceType SelectedDevice
{
@ -38,40 +34,31 @@ namespace RGBController2.ViewModels.Tabs
{
_selectedDevice = value;
// Connect to the device
_cueDeviceBoard.ConnectToDevice(value);
if (_cueDeviceBoard.Connected)
((CUEDeviceBoard)_device).ConnectToDevice(value);
if (_device.Connected)
{
ConnectionStatus = "Device Connected";
EnableSelectLightingMode = true;
// Set the page to static lighting mode to allow the user to change the
// lighting mode now that we are connected to the CUE Device
SelectedLightingMode = new StaticViewModel(_cueDeviceBoard);
SelectedLightingMode = new StaticViewModel(_device);
OnPropertyChanged(nameof(SelectedLightingMode));
}
else
{
ConnectionStatus = "Failed to connect to device";
EnableSelectLightingMode = false;
}
OnPropertyChanged(nameof(ConnectionStatus));
OnPropertyChanged(nameof(EnableSelectLightingMode));
}
}
}
private string _conntectionStatus;
public string ConnectionStatus
{
get { return _conntectionStatus; }
set { _conntectionStatus = value; }
}
private LightingModes _lightingMode;
public int LightingMode
{
get { return (int)_lightingMode; }
set { _lightingMode = (LightingModes) value; }
}
private BaseViewModel _selectedLightingMode;
/// <summary>
/// Creates a tab for a CUE device.
/// </summary>
/// <param name="name">The name of the tab header.</param>
public CueDeviceTab(string name)
{
TabType = tabType.CUE;
@ -79,21 +66,14 @@ namespace RGBController2.ViewModels.Tabs
ConnectionStatus = "Device Disconnected";
// Create the device object
_cueDeviceBoard = new CUEDeviceBoard();
_device = new CUEDeviceBoard();
// Get a list of the available cue devices
_availableDevices = _cueDeviceBoard.AvailableDevices;
_availableDevices = ((CUEDeviceBoard)_device).AvailableDevices;
// This is a temporary viewmodel that is used before the user has connected to a device
_selectedLightingMode = new InformationViewModel();
SelectedLightingMode = new InformationViewModel();
}
protected void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO.Ports;
using RGBController2.Boards;
using System.ComponentModel;
using RGBController2.ViewModels.LightingModes;
namespace RGBController2.ViewModels.Tabs
{
/// <summary>
/// The view model for an ChromaDeviceTabViewModel.
/// </summary>
public class ChromaDeviceTab : Tab, INotifyPropertyChanged
{
/// <summary>
/// Construcats a ChromaDeviecTabViewModel.
/// </summary>
/// <param name="name">the name of the tab</param>
public ChromaDeviceTab(string name)
{
TabType = tabType.Chroma;
Name = name;
ConnectionStatus = "Device Disconnected";
// Create the device object
_device = new ChromaDeviceBoard();
// Get a list of the available cue devices
//_availableDevices = ((CUEDeviceBoard)_device).AvailableDevices;
// This is a temporary viewmodel that is used before the user has connected to a device
SelectedLightingMode = new InformationViewModel();
OnPropertyChanged(nameof(SelectedLightingMode));
// REMOVE ME - when fully impliment device selection
EnableSelectLightingMode = true;
OnPropertyChanged(nameof(EnableSelectLightingMode));
}
}
}

View File

@ -4,10 +4,24 @@ using System.Windows.Input;
namespace RGBController2
{
/// <summary>
/// An interface used to represent a tab.
/// </summary>
public interface ITab
{
/// <summary>
/// The name used for the tab header.
/// </summary>
string Name { get; set;}
/// <summary>
/// The command used to close the tab.
/// </summary>
ICommand CloseCommand { get; }
/// <summary>
/// The event handler to handel closing the tab.
/// </summary>
event EventHandler CloseRequested;
}
}

View File

@ -1,33 +1,130 @@
using System;
using System.Windows.Input;
using RGBController2.Commands;
using RGBController2.Boards;
using RGBController2.ViewModels.LightingModes;
namespace RGBController2.ViewModels.Tabs
{
public abstract class Tab : ITab
/// <summary>
/// An abstract class of a tab.
/// </summary>
public abstract class Tab : BaseViewModel, ITab
{
/// <summary>
/// An enum of the different types of tabs there can be.
/// Currently this is used for getting the typ0e of the tab for saving the config file.
/// </summary>
public enum tabType
{
Unknown,
Arduino,
CUE
CUE,
Chroma
}
/// <summary>
/// The type of this tab.
/// </summary>
public tabType TabType = tabType.Unknown;
public Tab()
{
CloseCommand = new ActionCommand(p => CloseRequested?.Invoke(this, EventArgs.Empty));
}
/// <summary>
/// The currently selected lighting mode view model of the tab.
/// </summary>
private BaseViewModel _selectedLightingMode;
public BaseViewModel SelectedLightingMode
{
get { return _selectedLightingMode; }
set { _selectedLightingMode = value; }
}
/// <summary>
/// The name used for the tab header.
/// </summary>
public string Name { get; set; }
/// <summary>
/// The command used to close the tab.
/// </summary>
public ICommand CloseCommand { get; }
/// <summary>
/// The event handler to handel closing the tab.
/// </summary>
public event EventHandler CloseRequested;
/// <summary>
/// The connection status string used by the UI.
/// </summary>
private string _conntectionStatus;
public string ConnectionStatus
{
get { return _conntectionStatus; }
set { _conntectionStatus = value; }
}
/// <summary>
/// THE RGB device that the tab will communicated with.
/// </summary>
public IBoard _device;
/// <summary>
/// An enum of the different types of tabs there can be.
/// Currently this is used for getting the typ0e of the tab for saving the config file.
/// </summary>
protected enum LightingModes
{
StaticMode = 0,
AnimationMode,
QuakeMode
}
/// <summary>
/// The selected lighting mode.
/// This corresponds the the selected item from the drop down box.
/// </summary>
private LightingModes _lightingMode;
public int LightingMode
{
get { return (int)_lightingMode; }
set
{
if (_lightingMode != (LightingModes)value)
{
_lightingMode = (LightingModes)value;
switch (_lightingMode)
{
case LightingModes.AnimationMode:
SelectedLightingMode = new AnimationViewModel();
break;
case LightingModes.StaticMode:
SelectedLightingMode = new StaticViewModel(_device);
break;
//case LightingModes.QuakeMode:
// SelectedLightingMode = new Q();
// break;
}
OnPropertyChanged(nameof(SelectedLightingMode));
}
}
}
/// <summary>
/// Binded to the enabled value of the SlectLightingMode combo box
/// </summary>
private bool _enableSelectLightingMode = false;
public bool EnableSelectLightingMode
{
get { return _enableSelectLightingMode; }
set { _enableSelectLightingMode = value; }
}
/// <summary>
/// Creates a tab and sets up the close command.
/// </summary>
public Tab()
{
CloseCommand = new ActionCommand(p => CloseRequested?.Invoke(this, EventArgs.Empty));
}
}
}

View File

@ -1,10 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace RGBController2.ViewModels.Tabs
{
class TabViewModel : BaseViewModel
{
}
}

View File

@ -12,6 +12,7 @@
<ComboBox VerticalAlignment="Top" HorizontalAlignment="Left" Margin="90,5,0,0" Width="150" SelectedIndex="{Binding SelectedDeviceType}">
<ComboBoxItem>Arduino</ComboBoxItem>
<ComboBoxItem>Corsair CUE Device</ComboBoxItem>
<ComboBoxItem>Razer Chroma Device</ComboBoxItem>
</ComboBox>
<Label Content="Device Name" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5,30,0,0"/>
<TextBox VerticalAlignment="Top" HorizontalAlignment="Left" Margin="90,35,0,0" Width="150" Text="{Binding DeviceName}"/>

View File

@ -38,6 +38,9 @@
<DataTemplate DataType="{x:Type tabsviewmodels:CueDeviceTab}">
<tabsviews:CUEDeviceTabView/>
</DataTemplate>
<DataTemplate DataType="{x:Type tabsviewmodels:ChromaDeviceTab}">
<tabsviews:ChromaDeviceTabView/>
</DataTemplate>
</TabControl.Resources>
<TabControl.ItemTemplate>

View File

@ -9,7 +9,7 @@
Background="White">
<Grid>
<Label Content="Lighting Mode" Margin="0,5,0,0"/>
<ComboBox VerticalAlignment="top" HorizontalAlignment="left" Margin="100,5,0,0" Width="150" x:Name="lightingModeSelectionComboBox" SelectedIndex="{Binding LightingMode}" IsEnabled="False">
<ComboBox VerticalAlignment="top" HorizontalAlignment="left" Margin="100,5,0,0" Width="150" x:Name="lightingModeSelectionComboBox" SelectedIndex="{Binding LightingMode}" IsEnabled="{Binding EnableSelectLightingMode}">
<ComboBoxItem Content="Static Colour"></ComboBoxItem>
<ComboBoxItem Content="Animations"></ComboBoxItem>
<ComboBoxItem Content="Quake Live"></ComboBoxItem>

View File

@ -9,7 +9,7 @@
Background="White">
<Grid>
<Label Content="Lighting Mode" Margin="0,5,0,0"/>
<ComboBox VerticalAlignment="top" HorizontalAlignment="left" Margin="100,5,0,0" Width="150" x:Name="lightingModeSelectionComboBox" SelectedIndex="{Binding LightingMode}" IsEnabled="False">
<ComboBox VerticalAlignment="top" HorizontalAlignment="left" Margin="100,5,0,0" Width="150" x:Name="lightingModeSelectionComboBox" SelectedIndex="{Binding LightingMode}" IsEnabled="{Binding EnableSelectLightingMode}">
<ComboBoxItem Content="Static Colour"></ComboBoxItem>
<ComboBoxItem Content="Animations"></ComboBoxItem>
<ComboBoxItem Content="Quake Live"></ComboBoxItem>

View File

@ -0,0 +1,23 @@
<UserControl x:Class="RGBController2.Views.Tabs.ChromaDeviceTabView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:RGBController2"
mc:Ignorable="d"
d:DesignHeight="280" d:DesignWidth="700"
Background="White">
<Grid>
<Label Content="Lighting Mode" Margin="0,5,0,0"/>
<ComboBox VerticalAlignment="top" HorizontalAlignment="left" Margin="100,5,0,0" Width="150" x:Name="lightingModeSelectionComboBox" SelectedIndex="{Binding LightingMode}" IsEnabled="{Binding EnableSelectLightingMode}">
<ComboBoxItem Content="Static Colour"></ComboBoxItem>
<ComboBoxItem Content="Animations"></ComboBoxItem>
<ComboBoxItem Content="Quake Live"></ComboBoxItem>
</ComboBox>
<Label Content="Device" VerticalAlignment="top" HorizontalAlignment="left" Margin="280,5,0,0"/>
<ComboBox VerticalAlignment="top" HorizontalAlignment="left" Margin="330,5,0,0" Width="150" ItemsSource="{Binding AvailableDevices}" SelectedItem="{Binding SelectedDevice}">
</ComboBox>
<Label Content="{Binding ConnectionStatus}" VerticalAlignment="top" HorizontalAlignment="left" Margin="500,5,0,0"/>
<ContentControl Content="{Binding SelectedLightingMode}" VerticalAlignment="top" HorizontalAlignment="left" Margin="0,30,0,0" Width="700" Height="250"/>
</Grid>
</UserControl>

View File

@ -0,0 +1,27 @@
using RGBController2.ViewModels.Tabs;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace RGBController2.Views.Tabs
{
/// <summary>
/// Interaction logic for ArduinoTabView.xaml
/// </summary>
public partial class ChromaDeviceTabView : UserControl
{
public ChromaDeviceTabView()
{
InitializeComponent();
}
}
}

View File

@ -56,7 +56,6 @@ C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\obj
C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\obj\Debug\netcoreapp3.1\RGBController2.pdb
C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\obj\Debug\netcoreapp3.1\RGBController2.genruntimeconfig.cache
C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\obj\Debug\netcoreapp3.1\RGBController2.csprojAssemblyReference.cache
C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\obj\Debug\netcoreapp3.1\RGBController2.csproj.CoreCompileInputs.cache
C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\bin\Debug\netcoreapp3.1\Microsoft.Win32.SystemEvents.dll
C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\bin\Debug\netcoreapp3.1\System.Drawing.Common.dll
C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\bin\Debug\netcoreapp3.1\runtimes\win\lib\netcoreapp3.0\Microsoft.Win32.SystemEvents.dll
@ -77,3 +76,7 @@ C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\bin
C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\bin\Debug\netcoreapp3.1\zh-Hans\System.Windows.Forms.resources.dll
C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\bin\Debug\netcoreapp3.1\zh-Hant\System.Windows.Forms.resources.dll
C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\bin\Debug\netcoreapp3.1\logo.ico
C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\obj\Debug\netcoreapp3.1\Views\Tabs\ChromaDeviceTabView.g.cs
C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\obj\Debug\netcoreapp3.1\Views\Tabs\ChromaDeviceTabView.baml
C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\obj\Debug\netcoreapp3.1\RGBController2.csproj.CoreCompileInputs.cache
C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\bin\Debug\netcoreapp3.1\Corale.Colore.dll

View File

@ -6,6 +6,14 @@
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v3.1": {
"Colore/5.2.0": {
"runtime": {
"lib/net35/Corale.Colore.dll": {
"assemblyVersion": "5.2.0.0",
"fileVersion": "5.2.0.0"
}
}
},
"CUE.NET/1.2.0.1": {
"runtime": {
"lib/net45/CUE.NET.dll": {
@ -265,6 +273,13 @@
}
},
"libraries": {
"Colore/5.2.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-bd7+CgSyiIX/oyBsjNpTBCzybLNG1cMHxqFFbSbfgntXrEa0wAc1/M0nSmw7J33b+KqqGrCQijhPEwp9fci5vA==",
"path": "colore/5.2.0",
"hashPath": "colore.5.2.0.nupkg.sha512"
},
"CUE.NET/1.2.0.1": {
"type": "package",
"serviceable": true,

View File

@ -10,11 +10,11 @@ none
false
TRACE;DEBUG;NETCOREAPP;NETCOREAPP3_1
C:\Users\Conor\Desktop\RGB Contorller Tabs Test\RGBController\RGBController2\App.xaml
7-119750560
8-227857051
271277810719
201556010039
Views\Dialogs\NewTabDialogView.xaml;Views\LightingModes\AnimationView.xaml;Views\LightingModes\InformationView.xaml;Views\LightingModes\StaticView.xaml;Views\MainWindow.xaml;Views\Tabs\ArduinoTabView.xaml;Views\Tabs\CUEDeviceTabView.xaml;
281574310649
202-997140824
Views\Dialogs\NewTabDialogView.xaml;Views\LightingModes\AnimationView.xaml;Views\LightingModes\InformationView.xaml;Views\LightingModes\StaticView.xaml;Views\MainWindow.xaml;Views\Tabs\ArduinoTabView.xaml;Views\Tabs\ChromaDeviceTabView.xaml;Views\Tabs\CUEDeviceTabView.xaml;
False
True

View File

@ -42,6 +42,10 @@
"target": "Package",
"version": "[1.2.0.1, )"
},
"Colore": {
"target": "Package",
"version": "[5.2.0, )"
},
"Extended.Wpf.Toolkit": {
"target": "Package",
"version": "[4.0.1, )"

View File

@ -2,6 +2,15 @@
"version": 3,
"targets": {
".NETCoreApp,Version=v3.1": {
"Colore/5.2.0": {
"type": "package",
"compile": {
"lib/net35/Corale.Colore.dll": {}
},
"runtime": {
"lib/net35/Corale.Colore.dll": {}
}
},
"CUE.NET/1.2.0.1": {
"type": "package",
"compile": {
@ -251,6 +260,19 @@
}
},
"libraries": {
"Colore/5.2.0": {
"sha512": "bd7+CgSyiIX/oyBsjNpTBCzybLNG1cMHxqFFbSbfgntXrEa0wAc1/M0nSmw7J33b+KqqGrCQijhPEwp9fci5vA==",
"type": "package",
"path": "colore/5.2.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"colore.5.2.0.nupkg.sha512",
"colore.nuspec",
"lib/net35/Corale.Colore.dll",
"lib/net35/Corale.Colore.xml"
]
},
"CUE.NET/1.2.0.1": {
"sha512": "t0Nf5jZKoZMzm4Uzk5/M/rwYrZVZ5aCXOsQUBOwjpUw+Ng1JC5/AJGrIXb75H4ml3rqRUskZSxZ08IHGoqvxRQ==",
"type": "package",
@ -649,6 +671,7 @@
"projectFileDependencyGroups": {
".NETCoreApp,Version=v3.1": [
"CUE.NET >= 1.2.0.1",
"Colore >= 5.2.0",
"Extended.Wpf.Toolkit >= 4.0.1",
"System.Drawing.Common >= 5.0.0-rc.2.20475.5",
"System.IO.Ports >= 4.7.0"
@ -695,6 +718,10 @@
"target": "Package",
"version": "[1.2.0.1, )"
},
"Colore": {
"target": "Package",
"version": "[5.2.0, )"
},
"Extended.Wpf.Toolkit": {
"target": "Package",
"version": "[4.0.1, )"
@ -731,6 +758,16 @@
}
},
"logs": [
{
"code": "NU1701",
"level": "Warning",
"warningLevel": 1,
"message": "Package 'Colore 5.2.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.",
"libraryId": "Colore",
"targetGraphs": [
".NETCoreApp,Version=v3.1"
]
},
{
"code": "NU1701",
"level": "Warning",