public void SetWhiteBalance(WhiteBalance newbalance) {
        for (int i = 0; i < this.IP.length; i++) {
            Parent.WriteLogtoConsole(Parent.Camera.GetIP()[i] + ": Setting WhiteBalance to " + newbalance);

            this.ImageWhiteBalance = newbalance;
            float GainR, GainB, GainG, GainGB;
            String Parameters = "";
            switch (newbalance) {
                case AUTO:
                    Parameters = "WB_EN=1&framedelay=3";
                    break;
                case DAYLIGHT:
                    WB_Factor_R = 1.5f; // TODO just estimated badly
                    WB_Factor_G = 1.0f;
                    WB_Factor_B = 1.6f; // TODO just estimated badly
                    WB_Factor_GB = 1.0f;
                    GainR = this.Gain[GainIndex] * 65536 * WB_Factor_R;
                    GainG = this.Gain[GainIndex] * 65536 * WB_Factor_G;
                    GainB = this.Gain[GainIndex] * 65536 * WB_Factor_B;
                    GainGB = this.Gain[GainIndex] * 65536 * WB_Factor_GB;
                    Parameters = "WB_EN=0&framedelay=3&GAINR=" + (int) GainR + "&GAING=" + (int) GainG + "&GAINB=" + (int) GainB + "&GAINGB=" + (int) GainGB;
                    break;
                case CLOUDY:
                    WB_Factor_R = 1.4f; // TODO just estimated badly
                    WB_Factor_G = 1.0f;
                    WB_Factor_B = 1.4f; // TODO just estimated badly
                    WB_Factor_GB = 1.0f;
                    GainR = this.Gain[GainIndex] * 65536 * WB_Factor_R;
                    GainG = this.Gain[GainIndex] * 65536 * WB_Factor_G;
                    GainB = this.Gain[GainIndex] * 65536 * WB_Factor_B;
                    GainGB = this.Gain[GainIndex] * 65536 * WB_Factor_GB;
                    Parameters = "WB_EN=0&framedelay=3&GAINR=" + (int) GainR + "&GAING=" + (int) GainG + "&GAINB=" + (int) GainB + "&GAINGB=" + (int) GainGB;
                    break;
                case TUNGSTEN:
                    WB_Factor_R = 1.1286f; // TODO just estimated badly
                    WB_Factor_G = 1.0f;
                    WB_Factor_B = 2.3317f; // TODO just estimated badly
                    WB_Factor_GB = 1.0f;
                    GainR = this.Gain[GainIndex] * 65536 * WB_Factor_R;
                    GainG = this.Gain[GainIndex] * 65536 * WB_Factor_G;
                    GainB = this.Gain[GainIndex] * 65536 * WB_Factor_B;
                    GainGB = this.Gain[GainIndex] * 65536 * WB_Factor_GB;
                    Parameters = "WB_EN=0&framedelay=3&GAINR=" + (int) GainR + "&GAING=" + (int) GainG + "&GAINB=" + (int) GainB + "&GAINGB=" + (int) GainGB;
                    break;
                case FLOURESCENT:
                    WB_Factor_R = 1.2f; // TODO just estimated badly
                    WB_Factor_G = 1.0f;
                    WB_Factor_B = 1.5f; // TODO just estimated badly
                    WB_Factor_GB = 1.0f;
                    GainR = this.Gain[GainIndex] * 65536 * WB_Factor_R;
                    GainG = this.Gain[GainIndex] * 65536 * WB_Factor_G;
                    GainB = this.Gain[GainIndex] * 65536 * WB_Factor_B;
                    GainGB = this.Gain[GainIndex] * 65536 * WB_Factor_GB;
                    Parameters = "WB_EN=0&framedelay=3&GAINR=" + (int) GainR + "&GAING=" + (int) GainG + "&GAINB=" + (int) GainB + "&GAINGB=" + (int) GainGB;
                    break;
                case CUSTOM:
                    //TODO
                    //SendParametertoCamera("WB_EN=0");
                    break;
            }
            SendParametertoCamera(i, Parameters);
        }
    }