예제 #1
0
        /// <summary>
        /// PostBack function for the overlay colorPicker
        /// </summary>
        /// <param name="sender">Object that called postback</param>
        /// <param name="e">Color and Previous color for that colorPicker</param>
        private void overlayColorChanged(Object sender, ColorPostBackEventArgs e)
        {
            ColorPicker colorPicker = (ColorPicker)sender;
            string overlayID = colorPicker.TargetId;
            overlayID = overlayID.Replace("overlay", "");
            overlayID = overlayID.Replace("color", "");

            // Check to see if the overlay color already exists in the connection
            foreach (Overlay over in conn.overlays)
            {
                if (e.Color == ("#" + over.color) && over.id != int.Parse(overlayID))
                {
                    ErrorHandler eh = new ErrorHandler("Overlay color already exists! Please choose another.", errorPanel1);
                    eh.displayError();
                    return;
                }
            }

            // if it is a unique color, save the change
            foreach (Overlay over in conn.overlays)
            {

                if(over.id == int.Parse(overlayID))
                {
                    over.color = e.Color.Replace("#","");
                    break;
                }
            }

            //Regenerate the overlay condition table
            genOverlayConditionTable(null, null);

            // Recreate overlay popup panel to display the new overlay colors.
            fillOverlayLibraryLists();
            fillOverlayPopupRemove();

            sessionSave();
        }
 public void Color_CallBack(object sender, ColorPostBackEventArgs e)
 {
     color.Style["background-color"]    = e.Color;
     previous.Style["background-color"] = e.PreviousColor;
 }