Ejemplo n.º 1
0
 private void nextButton_Click(object sender, EventArgs e)
 {
     if (pageIndex == 0)
     {
         if (ScheduleType == 0 && procList.SelectedItem == null)
         {
             exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Please select an app");
             exitMessage.StartPosition = FormStartPosition.CenterParent;
             exitMessage.ShowDialog();
             return;
         }
     }
     else if (pageIndex == 1)
     {
         if (ScheduleType == 0 && animListApp.SelectedItem == null)
         {
             exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Please select animation");
             exitMessage.StartPosition = FormStartPosition.CenterParent;
             exitMessage.ShowDialog();
             return;
         }
         else if (ScheduleType == 1 && animListTime.SelectedItem == null)
         {
             exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Please select animation");
             exitMessage.StartPosition = FormStartPosition.CenterParent;
             exitMessage.ShowDialog();
             return;
         }
     }
     pageIndex++;
 }
Ejemplo n.º 2
0
 private void connectButton__Click(object sender, EventArgs e)
 {
     if (ipAddress.Text != "")
     {
         status.Text = "Connecting...";
         ws          = new WebSocket("ws://" + ipAddress.Text + ":81/");
         ws.OnOpen  += (wssender, wse) =>
         {
             this.Invoke(new MethodInvoker(delegate
             {
                 status.Text = "Connected";
                 disconnectButton.Visible = true;
                 connectButton_.Visible   = false;
             }));
         };
         ws.OnClose += (wssender, wse) =>
         {
             this.Invoke(new MethodInvoker(delegate
             {
                 status.Text = "Can't connect";
             }));
         };
         ws.ConnectAsync();
     }
     else
     {
         exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Enter ipaddress");
         exitMessage.StartPosition = FormStartPosition.CenterParent;
         exitMessage.ShowDialog();
     }
 }
Ejemplo n.º 3
0
        private async void firmwareUpdater_Load(object sender, EventArgs e)
        {
            ipaddressText.Text = _ipaddress;
            infoText.Text      = "";

            string        firmwarePath = Path.GetTempPath() + $"firmware_{_version}.bin";
            githubUpdater updater      = new githubUpdater("limiteddata", "ESPRGB-8266", Path.GetTempPath());

            infoText.Text += $"Downloading firmware version {_version}.\n";
            var download = await updater.downloadVersion(_version);

            if (download)
            {
                infoText.Text += "Finished downloading firmware \n";
                infoText.Text += "Unziping the archive\n";
                if (File.Exists(firmwarePath))
                {
                    File.Delete(firmwarePath);
                }
                ZipFile.ExtractToDirectory(updater.updateArchiveFileName, Path.GetTempPath());
                progress.Value = 0;

                ESPOTA ota = new ESPOTA(_ipaddress, firmwarePath);
                progress.Maximum   = ota.content_size;
                ota.progressEvent += (senderx, ex) =>
                {
                    progress.Value = ex;
                    progress.Refresh();
                };
                ota.messageEvent += (senderx, ex) =>
                {
                    infoText.Text += ex + "\n";
                    infoText.Refresh();
                };
                if (ota.Update())
                {
                    exceptions msg = new exceptions(0, "ESPRGB-FirmwareUpdate", "Firmware updated successfully!");
                    msg.StartPosition = FormStartPosition.CenterParent;
                    msg.ShowDialog();
                }
                else
                {
                    exceptions msg = new exceptions(0, "ESPRGB-FirmwareUpdate", "Failed to upload the firmware!");
                    msg.StartPosition = FormStartPosition.CenterParent;
                    msg.ShowDialog();
                }
                File.Delete(updater.updateArchiveFileName);
                File.Delete(Path.GetTempPath() + $"firmware_{_version}.bin");
                this.Close();
            }
            else
            {
                this.Close();
            }
        }
Ejemplo n.º 4
0
        private async void saveDevice()
        {
            if (ipAddress.Text == "")
            {
                exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Enter ipaddress");
                exitMessage.StartPosition = FormStartPosition.CenterParent;
                exitMessage.ShowDialog();
                return;
            }
            foreach (var item in ESPRGB._appControls)
            {
                if (item.ipaddress == ipAddress.Text)
                {
                    exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Device already exists");
                    exitMessage.StartPosition = FormStartPosition.CenterParent;
                    exitMessage.ShowDialog();
                    return;
                }
            }

            try
            {
                if (ws != null && ws.IsAlive)
                {
                    ws.Close();
                }
                var jsonString = "";
                using (StreamReader file = new StreamReader(ESPRGB.fileLocation.FullName, false)) jsonString = await file.ReadToEndAsync();
                var    dataJson = JObject.Parse(jsonString);
                JArray items    = (JArray)dataJson["Devices"];

                var newData = new JObject();

                string name;
                try
                {
                    name = (ipAddress.Text.Split('-')[1]).Split('.')[0];
                }
                catch
                {
                    name = ipAddress.Text;
                }

                newData.Add("name", name);
                newData.Add("ipaddress", ipAddress.Text);
                newData.Add("syncDevice", false);
                items.Add(newData);

                using (StreamWriter file = new StreamWriter(ESPRGB.fileLocation.FullName, false)) await file.WriteAsync(dataJson.ToString());
                ESPRGB.addThisTab(name, ipAddress.Text);
            }
            catch
            {
            }
        }
Ejemplo n.º 5
0
 private void br_addCurrentColor_Click(object sender, EventArgs e)
 {
     if (colorListResult.colorList.Count < 25)
     {
         colorListResult.addColor(colorBreathing.Color);
     }
     else
     {
         exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "25 colors limit");
         exitMessage.StartPosition = FormStartPosition.CenterParent;
         exitMessage.ShowDialog();
     }
 }
Ejemplo n.º 6
0
 private void addnewpanel_Click(object senderb, EventArgs e)
 {
     if (selectionPanels.Count < 15)
     {
         this.createPanel("Panel " + this.selectionPanels.Count, 0, 0, 200, 100, true);
         this.OnScreenChanged?.Invoke(this, e);
     }
     else
     {
         exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Selections are limited to 15");
         exitMessage.StartPosition = FormStartPosition.CenterParent;
         exitMessage.ShowDialog();
     }
 }
Ejemplo n.º 7
0
        public ESPRGB()
        {
            if (System.Diagnostics.Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetEntryAssembly().Location)).Length > 1)
            {
                exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "App is already opened!");
                exitMessage.StartPosition = FormStartPosition.CenterParent;
                exitMessage.ShowDialog();
                System.Diagnostics.Process.GetCurrentProcess().Kill();
            }
            string paths = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ESPRGB-Client\\config.json");

            fileLocation = new FileInfo(paths);
            fileLocation.Directory.Create();
            settingsWindow = new settingsWindow();
            if (File.Exists(fileLocation.FullName))
            {
                string  jsonString = File.ReadAllText(fileLocation.FullName);
                JObject loadedData = JObject.Parse(jsonString);
                if (loadedData.ContainsKey("Settings"))
                {
                    JObject settings = (JObject)loadedData["Settings"];
                    if (settings.ContainsKey("startApp"))
                    {
                        settingsWindow.startState.SelectedItem = (string)settings["startApp"];
                    }
                    if (settings.ContainsKey("closeButtonMinimize"))
                    {
                        settingsWindow.exitButtonBehavior.Checked = (bool)settings["closeButtonMinimize"];
                    }
                    if (settings.ContainsKey("savedAudioDevice"))
                    {
                        selectedaudioDevices["fullName"] = (string)settings["savedAudioDevice"];
                    }
                }
            }
            settingsWindow.StartPosition = FormStartPosition.CenterParent;
            BassNet.Registration("*****@*****.**", "2X5291323152222");
            updateAudioDevices();
            InitializeComponent();
            tabDevices.Visible = false;
            tabDevices.Visible = true;
            tabDevices.TabPages.Clear();
            _process = new WASAPIPROC(Process);
            InitializeAudioDevice((string)selectedaudioDevices["fullName"]);
            windowState = this.WindowState;
            curVersion  = typeof(ESPRGB).Assembly.GetName().Version;
            settingsWindow.versionLabel.Text = curVersion.ToString();
        }
Ejemplo n.º 8
0
 public void checkForUpdates()
 {
     try
     {
         if (CheckInternetConnection())
         {
             Console.WriteLine("Internet connection available");
             Thread updateChecker = new Thread(() => {
                 githubUpdater updater = new githubUpdater("limiteddata", "ESPRGB-Client", Path.GetTempPath());
                 Task <bool> newUpdate = updater.checkForUpdates(curVersion);
                 if (newUpdate.Result)
                 {
                     exceptions updateMessage    = new exceptions(1, "ESPRGB-Update", "Version " + updater.latestVersion.ToString() + " is available.\n Do you want to update?");
                     updateMessage.StartPosition = FormStartPosition.CenterParent;
                     updateMessage.ShowDialog();
                     if (updateMessage.DialogResult == DialogResult.Yes)
                     {
                         Task <bool> download = updater.downloadNewVersionFromExtension("msi");
                         if (download.Result)
                         {
                             exceptions msg    = new exceptions(0, "ESPRGB-Update", "Finished downloading. Continue installing the new version");
                             msg.StartPosition = FormStartPosition.CenterParent;
                             msg.ShowDialog();
                             if (msg.DialogResult == DialogResult.OK)
                             {
                                 if (updater.Install())
                                 {
                                     this.Invoke((MethodInvoker) delegate { Application.Exit(); });
                                 }
                             }
                         }
                     }
                 }
             });
             updateChecker.Start();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
         throw;
     }
 }
Ejemplo n.º 9
0
 public void openImage(string location)
 {
     try
     {
         this.image_bmp = new Bitmap(location);
         if (this.image_bmp.Width * this.image_bmp.Height > 33177600) // 8k
         {
             this.image_bmp.Dispose();
             exceptions exitMessage = new exceptions(0, "ESPRGB-Format device", "Image size is too large");
             exitMessage.StartPosition = FormStartPosition.CenterParent;
             exitMessage.ShowDialog();
             return;
         }
         this.imageFileLocation = location;
         this.selectedScreen    = this.selectedScreen;
     }
     catch
     {
     }
 }
Ejemplo n.º 10
0
 private void exitButton_Click(object sender, EventArgs e)
 {
     if (settingsWindow.exitButtonBehavior.Checked)
     {
         Hide();
         WindowState        = FormWindowState.Minimized;
         tabDevices.Visible = false;
         int old = tabDevices.SelectedIndex;
         tabDevices.SelectedIndex = old + 1;
         tabDevices.SelectedIndex = old;
         tabDevices.Visible       = true;
     }
     else
     {
         exceptions exitMessage = new exceptions(1, "ESPRGB-Exit", "Are you sure you want to close?");
         exitMessage.StartPosition = FormStartPosition.CenterParent;
         exitMessage.ShowDialog();
         if (exitMessage.DialogResult == DialogResult.Yes)
         {
             Application.Exit();
         }
     }
 }
Ejemplo n.º 11
0
        private void sendButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(SSID.Text))
            {
                exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Please enter a valid SSID");
                exitMessage.StartPosition = FormStartPosition.CenterParent;
                exitMessage.ShowDialog();
                return;
            }
            if (string.IsNullOrWhiteSpace(PASSWORD.Text) && PASSWORD.Enabled)
            {
                exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Please enter a valid PASSWORD");
                exitMessage.StartPosition = FormStartPosition.CenterParent;
                exitMessage.ShowDialog();
                return;
            }
            if (string.IsNullOrWhiteSpace(HOSTNAME.Text))
            {
                exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Please enter a HOSTNAME");
                exitMessage.StartPosition = FormStartPosition.CenterParent;
                exitMessage.ShowDialog();
                return;
            }
            if (string.IsNullOrWhiteSpace(REDPIN.Text))
            {
                exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Please enter a REDPIN");
                exitMessage.StartPosition = FormStartPosition.CenterParent;
                exitMessage.ShowDialog();
                return;
            }
            if (string.IsNullOrWhiteSpace(GREENPIN.Text))
            {
                exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Please enter a GREENPIN");
                exitMessage.StartPosition = FormStartPosition.CenterParent;
                exitMessage.ShowDialog();
                return;
            }
            if (string.IsNullOrWhiteSpace(BLUEPIN.Text))
            {
                exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Please enter a BLUEPIN");
                exitMessage.StartPosition = FormStartPosition.CenterParent;
                exitMessage.ShowDialog();
                return;
            }
            if (string.IsNullOrWhiteSpace(local_IP.Text) && local_IP.Enabled)
            {
                exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Please enter a valid local IP");
                exitMessage.StartPosition = FormStartPosition.CenterParent;
                exitMessage.ShowDialog();
                return;
            }
            if (string.IsNullOrWhiteSpace(gateway.Text) && gateway.Enabled)
            {
                exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Please enter a valid gateway");
                exitMessage.StartPosition = FormStartPosition.CenterParent;
                exitMessage.ShowDialog();
                return;
            }
            if (string.IsNullOrWhiteSpace(subnet.Text) && subnet.Enabled)
            {
                exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Please enter a valid subnet");
                exitMessage.StartPosition = FormStartPosition.CenterParent;
                exitMessage.ShowDialog();
                return;
            }
            if (string.IsNullOrWhiteSpace(dns.Text) && dns.Enabled)
            {
                exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Please enter a valid dns");
                exitMessage.StartPosition = FormStartPosition.CenterParent;
                exitMessage.ShowDialog();
                return;
            }
            exceptions confirm = new exceptions(1, "ESPRGB-Exit", "Are you sure you want to save this config?");

            confirm.StartPosition = FormStartPosition.CenterParent;
            confirm.ShowDialog();
            if (confirm.DialogResult == DialogResult.Yes)
            {
                JObject obj =
                    new JObject(
                        new JProperty("ESP_Config",
                                      new JObject(
                                          new JProperty("SSID", new JValue(SSID.Text)),
                                          new JProperty("PASSWORD", new JValue(PASSWORD.Text)),
                                          new JProperty("HOSTNAME", new JValue("esprgb-" + HOSTNAME.Text)),
                                          new JProperty("REDPIN", new JValue(REDPIN.Text)),
                                          new JProperty("GREENPIN", new JValue(GREENPIN.Text)),
                                          new JProperty("BLUEPIN", new JValue(BLUEPIN.Text)),
                                          new JProperty("BUZZERPIN", new JValue(BUZZERPIN.Text)))),
                        new JProperty("Network_Config",
                                      new JObject(
                                          new JProperty("startStatic", new JValue(startStatic.Checked)),
                                          new JProperty("local_IP", new JValue(local_IP.Text)),
                                          new JProperty("gateway", new JValue(gateway.Text)),
                                          new JProperty("subnet", new JValue(subnet.Text)),
                                          new JProperty("dns", new JValue(dns.Text)))));
                try
                {
                    var data = new StringContent(obj.ToString(), Encoding.UTF8, "application/json");
                    client.PostAsync("http://" + ipaddress + "/sendConfig", data);
                    this.Close();
                }
                catch (Exception) { }
            }
        }
Ejemplo n.º 12
0
 void loadData(JObject json)
 {
     if (json.ContainsKey("Label"))
     {
         LabelText.Text = (string)json["Label"];
     }
     if (json.ContainsKey("Days"))
     {
         SuCheckbox.Checked = (bool)json["Days"][0];
         MoCheckbox.Checked = (bool)json["Days"][1];
         TuCheckbox.Checked = (bool)json["Days"][2];
         WeCheckbox.Checked = (bool)json["Days"][3];
         ThCheckbox.Checked = (bool)json["Days"][4];
         FrCheckbox.Checked = (bool)json["Days"][5];
         SaCheckbox.Checked = (bool)json["Days"][6];
     }
     if (json.ContainsKey("Timestamp"))
     {
         System.DateTime time = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
         time            = time.AddSeconds((long)json["Timestamp"]).ToLocalTime();
         hourBox.Value   = time.Hour;
         minuteBox.Value = time.Minute;
     }
     if (json.ContainsKey("playingAnimation"))
     {
         if (ScheduleType == 0)
         {
             animListApp.SelectedItem = (string)json["playingAnimation"];
         }
         else if (ScheduleType == 1)
         {
             animListTime.SelectedItem = (string)json["playingAnimation"];
         }
     }
     if (json.ContainsKey("appName"))
     {
         procList.SelectedItem = (string)json["appName"];
     }
     if (json.ContainsKey("parameters"))
     {
         JObject animParameters = (JObject)json["parameters"];
         if (animParameters.ContainsKey("SolidColor"))
         {
             JObject SolidColor = animParameters["SolidColor"].ToObject <JObject>();
             if (SolidColor.ContainsKey("Color"))
             {
                 Color newColor = Color.FromArgb(255, (int)SolidColor["Color"][0] / 4, (int)SolidColor["Color"][1] / 4, (int)SolidColor["Color"][2] / 4);
                 colorWheel.Color              = newColor;
                 brightnessSlide.RegionColor   = newColor;
                 brightnessSlide.LeftColor     = newColor;
                 brightnessSlide.GradientColor = newColor;
                 brightnessSlide.Update();
                 SolidColorHex.Text = HexConverter(colorWheel.Color);
             }
             if (SolidColor.ContainsKey("Brightness"))
             {
                 float brightness = (float)SolidColor["Brightness"];
                 brightnessSlide.Value = (int)(brightness * 100);
                 Color newColor = Color.FromArgb(255, (int)(colorWheel.Color.R * brightness), (int)(colorWheel.Color.G * brightness), (int)(colorWheel.Color.B * brightness));
                 brightnessSlide.LeftColor     = newColor;
                 brightnessSlide.RegionColor   = newColor;
                 brightnessSlide.GradientColor = newColor;
                 brightnessSlide.Update();
             }
         }
         if (animParameters.ContainsKey("ColorCycle"))
         {
             JObject ColorCycle = animParameters["ColorCycle"].ToObject <JObject>();
             if (ColorCycle.ContainsKey("ColorCycleSpeed"))
             {
                 ColorCycleSpeed.Value    = (int)ColorCycle["ColorCycleSpeed"];
                 ColorCycleSpeedText.Text = (string)ColorCycle["ColorCycleSpeed"];
             }
         }
         if (animParameters.ContainsKey("Breathing"))
         {
             JObject Breathing = animParameters["Breathing"].ToObject <JObject>();
             if (Breathing.ContainsKey("breathingSpeed"))
             {
                 breathingSpeed.Value    = (int)Breathing["breathingSpeed"];
                 breathingSpeedText.Text = (string)Breathing["breathingSpeed"];
             }
             if (Breathing.ContainsKey("staticColorBreathing"))
             {
                 colorBreathing.Color = Color.FromArgb(255, (int)Breathing["staticColorBreathing"][0] / 4, (int)Breathing["staticColorBreathing"][1] / 4, (int)Breathing["staticColorBreathing"][2] / 4);
                 BreathingHex.Text    = HexConverter(colorBreathing.Color);
             }
             if (Breathing.ContainsKey("colorListBreathing"))
             {
                 List <Color> col      = new List <Color>();
                 JArray       colArray = (JArray)Breathing["colorListBreathing"];
                 if (colArray.Count > 0)
                 {
                     foreach (JArray item in colArray)
                     {
                         if (item.Count == 3)
                         {
                             col.Add(Color.FromArgb(255, (int)item[0] / 4, (int)item[1] / 4, (int)item[2] / 4));
                         }
                     }
                     colorListResult.addListColor(col);
                 }
             }
             if (Breathing.ContainsKey("addColortoList"))
             {
                 if (colorListResult.colorList.Count < 25)
                 {
                     colorListResult.addColor(Color.FromArgb(255, (int)Breathing["addColortoList"][0] / 4, (int)Breathing["addColortoList"][1] / 4, (int)Breathing["addColortoList"][2] / 4));
                 }
                 else
                 {
                     var exitMessage = new exceptions(0, "ESPRGB-Exception", "25 colors limit");
                     exitMessage.StartPosition = FormStartPosition.CenterParent;
                     exitMessage.ShowDialog();
                 }
             }
             if (Breathing.ContainsKey("removeLastfromList"))
             {
                 colorListResult.removeLastColor();
             }
             if (Breathing.ContainsKey("clearColorList"))
             {
                 colorListResult.clearAll();
             }
             if (Breathing.ContainsKey("useColorList"))
             {
                 useColorList.Checked = (bool)Breathing["useColorList"];
             }
         }
         if (animParameters.ContainsKey("Disco"))
         {
             JObject Disco = animParameters["Disco"].ToObject <JObject>();
             if (Disco.ContainsKey("DiscoColor_1"))
             {
                 colorslider1.color1.Color = Color.FromName((string)Disco["DiscoColor_1"]);
             }
             if (Disco.ContainsKey("DiscoColor_2"))
             {
                 colorslider1.color2.Color = Color.FromName((string)Disco["DiscoColor_2"]);
             }
             if (Disco.ContainsKey("DiscoColor_3"))
             {
                 colorslider1.color3.Color = Color.FromName((string)Disco["DiscoColor_3"]);
             }
             colorslider1.Refresh();
             if (Disco.ContainsKey("DiscoRange"))
             {
                 colorslider1.SelectedMin = (int)Disco["DiscoRange"][0];
                 colorslider1.SelectedMax = (int)Disco["DiscoRange"][1];
                 colorslider1.Refresh();
             }
             if (Disco.ContainsKey("DiscoSensitivity"))
             {
                 lowSensitivity.Value  = (int)Disco["DiscoSensitivity"][0];
                 midSensitivity.Value  = (int)Disco["DiscoSensitivity"][1];
                 highSensitivity.Value = (int)Disco["DiscoSensitivity"][2];
             }
             if (Disco.ContainsKey("DiscoBrightness"))
             {
                 lowsBrightness.Value  = (int)Disco["DiscoBrightness"][0];
                 midsBrightness.Value  = (int)Disco["DiscoBrightness"][1];
                 highsBrightness.Value = (int)Disco["DiscoBrightness"][2];
             }
         }
         if (animParameters.ContainsKey("SolidDisco"))
         {
             JObject SolidDisco = animParameters["SolidDisco"].ToObject <JObject>();
             if (SolidDisco.ContainsKey("colorSolidDisco"))
             {
                 colorWheel_SolidDisco.Color    = Color.FromArgb((int)SolidDisco["colorSolidDisco"][0] / 4, (int)SolidDisco["colorSolidDisco"][1] / 4, (int)SolidDisco["colorSolidDisco"][2] / 4);
                 colorslider_simple.color.Color = Color.FromArgb((int)SolidDisco["colorSolidDisco"][0] / 4, (int)SolidDisco["colorSolidDisco"][1] / 4, (int)SolidDisco["colorSolidDisco"][2] / 4);
                 colorslider_simple.Refresh();
                 SolidDiscoHex.Text = HexConverter(colorWheel_SolidDisco.Color);
             }
             if (SolidDisco.ContainsKey("SolidDiscoRandom"))
             {
                 randomColor.Checked = (bool)SolidDisco["SolidDiscoRandom"];
             }
             if (SolidDisco.ContainsKey("SolidDiscoRange"))
             {
                 colorslider_simple.SelectedMin = (int)SolidDisco["SolidDiscoRange"][0];
                 colorslider_simple.SelectedMax = (int)SolidDisco["SolidDiscoRange"][1];
                 colorslider_simple.Refresh();
             }
         }
         if (animParameters.ContainsKey("MorseCode"))
         {
             JObject MorseCode = animParameters["MorseCode"].ToObject <JObject>();
             if (MorseCode.ContainsKey("useBuzzer"))
             {
                 useBuzzer.Checked = (bool)MorseCode["useBuzzer"];
             }
             if (MorseCode.ContainsKey("colorMorseCode"))
             {
                 morseColor.Color  = Color.FromArgb(255, (int)MorseCode["colorMorseCode"][0] / 4, (int)MorseCode["colorMorseCode"][1] / 4, (int)MorseCode["colorMorseCode"][2] / 4);
                 MorseCodeHex.Text = HexConverter(morseColor.Color);
             }
             if (MorseCode.ContainsKey("unitTimeMorseCode"))
             {
                 unitTime.Value = (int)MorseCode["unitTimeMorseCode"];
             }
             if (MorseCode.ContainsKey("encodedMorseCode"))
             {
                 morsePlainText.Text   = decodeMessage((string)MorseCode["encodedMorseCode"]);
                 encodedMsgResult.Text = (string)MorseCode["encodedMorseCode"];
             }
         }
         if (animParameters.ContainsKey("Ambilight"))
         {
             JObject Ambilight = animParameters["Ambilight"].ToObject <JObject>();
             if (Ambilight.ContainsKey("AmbilightImage"))
             {
                 screenSampler1.openImage((string)Ambilight["AmbilightImage"]);
             }
             if (Ambilight.ContainsKey("AmbilightSelections"))
             {
                 var selections = (JArray)Ambilight["AmbilightSelections"];
                 if (selections.Count > 0)
                 {
                     screenSampler1.removeAllSelections();
                     foreach (var sel in selections)
                     {
                         screenSampler1.createPanel((string)sel["AmbilightTitle"], (int)sel["AmbilightX"], (int)sel["AmbilightY"], (int)sel["AmbilightW"], (int)sel["AmbilightH"], false);
                     }
                 }
             }
             if (Ambilight.ContainsKey("AmbilightInterval"))
             {
                 ambilightSpeed.Value = (int)Ambilight["AmbilightInterval"];
                 screenSampler1.liveTimer.Interval = (int)Ambilight["AmbilightInterval"];
             }
             if (Ambilight.ContainsKey("AmbilightScreen"))
             {
                 screenSampler1.selectedScreen = (int)Ambilight["AmbilightScreen"];
             }
         }
     }
 }