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.ServiceProcess;
|
||||
using RGBController2.Boards;
|
||||
using RGBController2.ViewModels.LightingModes;
|
||||
|
||||
namespace RGBController2.ViewModels
|
||||
{
|
||||
|
@ -69,6 +70,7 @@ namespace RGBController2.ViewModels
|
|||
string name = "";
|
||||
string type = "";
|
||||
string device = "";
|
||||
string lightingMode = "";
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
|
@ -86,10 +88,13 @@ namespace RGBController2.ViewModels
|
|||
case "device":
|
||||
device = reader.ReadString();
|
||||
break;
|
||||
case "lightingMode":
|
||||
lightingMode = reader.ReadString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Create the tab here
|
||||
if (name != "" && type != "" && device !="")
|
||||
if (name != "" && type != "" && device != "" && lightingMode != "")
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
@ -97,6 +102,7 @@ namespace RGBController2.ViewModels
|
|||
{
|
||||
var tab = new ArduinoTab(name);
|
||||
tab.SelectedPort = device;
|
||||
tab.LightingMode = LightingModeStringToLightingModeIndex(lightingMode);
|
||||
_tabs.Add(tab);
|
||||
break;
|
||||
}
|
||||
|
@ -127,7 +133,7 @@ namespace RGBController2.ViewModels
|
|||
tab.SelectedDevice = CUE.NET.Devices.Generic.Enums.CorsairDeviceType.Mousemat;
|
||||
break;
|
||||
}
|
||||
|
||||
tab.LightingMode = LightingModeStringToLightingModeIndex(lightingMode);
|
||||
_tabs.Add(tab);
|
||||
break;
|
||||
}
|
||||
|
@ -152,6 +158,7 @@ namespace RGBController2.ViewModels
|
|||
tab.SelectedDevice = ChromaDeviceBoard.DeviceTypes.Mouse;
|
||||
break;
|
||||
}
|
||||
tab.LightingMode = LightingModeStringToLightingModeIndex(lightingMode);
|
||||
_tabs.Add(tab);
|
||||
break;
|
||||
}
|
||||
|
@ -160,12 +167,25 @@ namespace RGBController2.ViewModels
|
|||
name = "";
|
||||
type = "";
|
||||
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)
|
||||
{
|
||||
ITab tab;
|
||||
|
@ -251,6 +271,9 @@ namespace RGBController2.ViewModels
|
|||
xmlWriter.WriteStartElement("device");
|
||||
xmlWriter.WriteString(((ArduinoTab)tab).SelectedPort);
|
||||
xmlWriter.WriteEndElement();
|
||||
xmlWriter.WriteStartElement("lightingMode");
|
||||
xmlWriter.WriteString(tab.SelectedLightingMode.GetType().ToString());
|
||||
xmlWriter.WriteEndElement();
|
||||
break;
|
||||
case Tab.tabType.CUE:
|
||||
xmlWriter.WriteStartElement("type");
|
||||
|
@ -259,6 +282,9 @@ namespace RGBController2.ViewModels
|
|||
xmlWriter.WriteStartElement("device");
|
||||
xmlWriter.WriteString(((CueDeviceTab)tab).SelectedDevice.ToString());
|
||||
xmlWriter.WriteEndElement();
|
||||
xmlWriter.WriteStartElement("lightingMode");
|
||||
xmlWriter.WriteString(tab.SelectedLightingMode.GetType().ToString());
|
||||
xmlWriter.WriteEndElement();
|
||||
break;
|
||||
case Tab.tabType.Chroma:
|
||||
xmlWriter.WriteStartElement("type");
|
||||
|
@ -267,6 +293,9 @@ namespace RGBController2.ViewModels
|
|||
xmlWriter.WriteStartElement("device");
|
||||
xmlWriter.WriteString(((ChromaDeviceTab)tab).SelectedDevice.ToString());
|
||||
xmlWriter.WriteEndElement();
|
||||
xmlWriter.WriteStartElement("lightingMode");
|
||||
xmlWriter.WriteString(tab.SelectedLightingMode.GetType().ToString());
|
||||
xmlWriter.WriteEndElement();
|
||||
break;
|
||||
}
|
||||
xmlWriter.WriteEndElement();
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace RGBController2.ViewModels.Tabs
|
|||
get { return (int)_lightingMode; }
|
||||
set
|
||||
{
|
||||
if (_lightingMode != (LightingModes)value)
|
||||
if ((_lightingMode != (LightingModes)value) && (EnableSelectLightingMode))
|
||||
{
|
||||
_lightingMode = (LightingModes)value;
|
||||
switch (_lightingMode)
|
||||
|
|
Loading…
Reference in New Issue