Beispiel #1
0
        private void presetList_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox src = (ComboBox)sender;

            List<System.Drawing.Color> colors = pl.getPreset((presetList.Items[presetList.SelectedIndex] as string)).getColors();
            curPreset = pl.getPreset((presetList.Items[presetList.SelectedIndex] as string));

            Helper.setColorsOnPB(colors, pbsPreset);
        }
Beispiel #2
0
 private void addPreset(AbstractPreset p)
 {
     this.presets.Add(p.getName(), p);
 }
Beispiel #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator))
            {
                MessageBox.Show("This Program does not require admin privileges and will stop now.", "Warning: Don't run as admin", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                this.Close();
                return;
            }

            if (!SDKSupport.isSDKInstalled())
            {
                MessageBox.Show("Please make sure you have the Razer Chroma SDK installed and \nmake you sure executed the Enable SDK.reg file.  \nThis Program do not work without the SDK.", "Error: Missing Razer Chroma SDK", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
                return;
            }

            Process[] pname = Process.GetProcessesByName("RzSynapse");
            if (pname.Length != 0)
            {
                MessageBox.Show("Please close Razer Synapse before running this Program.", "Error: Razer Synpase is running", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
                return;
            }

            do_StartStop.Text = "Start";
            deviceList.Enabled = true;

            // Device List
            for (int i = 0; i < _as.getDeviceList().Length; i++)
            {
                var device = _as.getDeviceList()[i];
                if (device.IsEnabled && device.IsLoopback)
                {
                    deviceList.Items.Add(string.Format("{0} - {1}", i, device.name));
                }
            }
            deviceList.SelectedIndex = 0;

            // Preset List
            pl.loadPresets();
            foreach (AbstractPreset preset in pl.getPresets())
            {
                presetList.Items.Add(preset.getName());
            }
            presetList.Text = " + Default";
            curPreset = pl.getPreset(" + Default");

            // Load Gradient colors
            List<System.Drawing.Color> colors = pl.getPreset(" + Default").getColors();
            Helper.setColorsOnPB(colors, pbsGradient);

            Settings config = Config.loadConfig();
            colorMode.SelectedIndex = config.colorMode;
            spectrumSensitivity.SelectedIndex = config.sensity;
            List<System.Drawing.Color> p = new List<System.Drawing.Color>();
            for (int x = 0; x < pbsGradient.Length; x++)
            {
                p.Add(Helper.newColor(config.gradient[x][0], config.gradient[x][1], config.gradient[x][2]));
            }

            Helper.setColorsOnPB(p, pbsGradient);

            cGradient7.BackColor = Helper.newColor(config.gBGColor[0], config.gBGColor[1], config.gBGColor[2]);

            p = null;
            config = null;
            colors = null;
        }