added selected lighting mode to the config file
This commit is contained in:
parent
7850d957f4
commit
c14bde8d5f
Binary file not shown.
|
@ -13,6 +13,7 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.ServiceProcess;
|
using System.ServiceProcess;
|
||||||
using RGBController2.Boards;
|
using RGBController2.Boards;
|
||||||
|
using RGBController2.ViewModels.LightingModes;
|
||||||
|
|
||||||
namespace RGBController2.ViewModels
|
namespace RGBController2.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -69,6 +70,7 @@ namespace RGBController2.ViewModels
|
||||||
string name = "";
|
string name = "";
|
||||||
string type = "";
|
string type = "";
|
||||||
string device = "";
|
string device = "";
|
||||||
|
string lightingMode = "";
|
||||||
|
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
|
@ -86,10 +88,13 @@ namespace RGBController2.ViewModels
|
||||||
case "device":
|
case "device":
|
||||||
device = reader.ReadString();
|
device = reader.ReadString();
|
||||||
break;
|
break;
|
||||||
|
case "lightingMode":
|
||||||
|
lightingMode = reader.ReadString();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Create the tab here
|
// Create the tab here
|
||||||
if (name != "" && type != "" && device !="")
|
if (name != "" && type != "" && device != "" && lightingMode != "")
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -97,6 +102,7 @@ namespace RGBController2.ViewModels
|
||||||
{
|
{
|
||||||
var tab = new ArduinoTab(name);
|
var tab = new ArduinoTab(name);
|
||||||
tab.SelectedPort = device;
|
tab.SelectedPort = device;
|
||||||
|
tab.LightingMode = LightingModeStringToLightingModeIndex(lightingMode);
|
||||||
_tabs.Add(tab);
|
_tabs.Add(tab);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +133,7 @@ namespace RGBController2.ViewModels
|
||||||
tab.SelectedDevice = CUE.NET.Devices.Generic.Enums.CorsairDeviceType.Mousemat;
|
tab.SelectedDevice = CUE.NET.Devices.Generic.Enums.CorsairDeviceType.Mousemat;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
tab.LightingMode = LightingModeStringToLightingModeIndex(lightingMode);
|
||||||
_tabs.Add(tab);
|
_tabs.Add(tab);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -152,6 +158,7 @@ namespace RGBController2.ViewModels
|
||||||
tab.SelectedDevice = ChromaDeviceBoard.DeviceTypes.Mouse;
|
tab.SelectedDevice = ChromaDeviceBoard.DeviceTypes.Mouse;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
tab.LightingMode = LightingModeStringToLightingModeIndex(lightingMode);
|
||||||
_tabs.Add(tab);
|
_tabs.Add(tab);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -160,12 +167,25 @@ namespace RGBController2.ViewModels
|
||||||
name = "";
|
name = "";
|
||||||
type = "";
|
type = "";
|
||||||
device = "";
|
device = "";
|
||||||
|
lightingMode = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int LightingModeStringToLightingModeIndex(string lightingMode)
|
||||||
|
{
|
||||||
|
switch(lightingMode)
|
||||||
|
{
|
||||||
|
case "RGBController2.ViewModels.LightingModes.AnimationViewModel":
|
||||||
|
return 1;
|
||||||
|
case "RGBController2.ViewModels.LightingModes.StaticViewModel":
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Tabs_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
private void Tabs_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
ITab tab;
|
ITab tab;
|
||||||
|
@ -251,6 +271,9 @@ namespace RGBController2.ViewModels
|
||||||
xmlWriter.WriteStartElement("device");
|
xmlWriter.WriteStartElement("device");
|
||||||
xmlWriter.WriteString(((ArduinoTab)tab).SelectedPort);
|
xmlWriter.WriteString(((ArduinoTab)tab).SelectedPort);
|
||||||
xmlWriter.WriteEndElement();
|
xmlWriter.WriteEndElement();
|
||||||
|
xmlWriter.WriteStartElement("lightingMode");
|
||||||
|
xmlWriter.WriteString(tab.SelectedLightingMode.GetType().ToString());
|
||||||
|
xmlWriter.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
case Tab.tabType.CUE:
|
case Tab.tabType.CUE:
|
||||||
xmlWriter.WriteStartElement("type");
|
xmlWriter.WriteStartElement("type");
|
||||||
|
@ -259,6 +282,9 @@ namespace RGBController2.ViewModels
|
||||||
xmlWriter.WriteStartElement("device");
|
xmlWriter.WriteStartElement("device");
|
||||||
xmlWriter.WriteString(((CueDeviceTab)tab).SelectedDevice.ToString());
|
xmlWriter.WriteString(((CueDeviceTab)tab).SelectedDevice.ToString());
|
||||||
xmlWriter.WriteEndElement();
|
xmlWriter.WriteEndElement();
|
||||||
|
xmlWriter.WriteStartElement("lightingMode");
|
||||||
|
xmlWriter.WriteString(tab.SelectedLightingMode.GetType().ToString());
|
||||||
|
xmlWriter.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
case Tab.tabType.Chroma:
|
case Tab.tabType.Chroma:
|
||||||
xmlWriter.WriteStartElement("type");
|
xmlWriter.WriteStartElement("type");
|
||||||
|
@ -267,6 +293,9 @@ namespace RGBController2.ViewModels
|
||||||
xmlWriter.WriteStartElement("device");
|
xmlWriter.WriteStartElement("device");
|
||||||
xmlWriter.WriteString(((ChromaDeviceTab)tab).SelectedDevice.ToString());
|
xmlWriter.WriteString(((ChromaDeviceTab)tab).SelectedDevice.ToString());
|
||||||
xmlWriter.WriteEndElement();
|
xmlWriter.WriteEndElement();
|
||||||
|
xmlWriter.WriteStartElement("lightingMode");
|
||||||
|
xmlWriter.WriteString(tab.SelectedLightingMode.GetType().ToString());
|
||||||
|
xmlWriter.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
xmlWriter.WriteEndElement();
|
xmlWriter.WriteEndElement();
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace RGBController2.ViewModels.Tabs
|
||||||
get { return (int)_lightingMode; }
|
get { return (int)_lightingMode; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_lightingMode != (LightingModes)value)
|
if ((_lightingMode != (LightingModes)value) && (EnableSelectLightingMode))
|
||||||
{
|
{
|
||||||
_lightingMode = (LightingModes)value;
|
_lightingMode = (LightingModes)value;
|
||||||
switch (_lightingMode)
|
switch (_lightingMode)
|
||||||
|
|
Loading…
Reference in New Issue