Exemple #1
0
 public static void UpdateLabelDesignInDb(Control pb)
 {
     SQLClass.Delete("DELETE FROM " + Tables.UNIQUE +
                     " WHERE type = 'Label'" +
                     " AND name = '" + pb.Name +
                     "' AND FormFrom = '" + pb.FindForm().Name + "'");
     SQLClass.Insert("INSERT INTO " + Tables.UNIQUE +
                     " (type, design, author, name, FormFrom) VALUES " +
                     "('Label', " +
                     "'ForeColor = " + ButtonUniqueForm.ColorToJSON(pb.ForeColor) +
                     ", FontName = " + pb.Font.Name +
                     ", FontSize = " + pb.Font.Size +
                     ", Text = " + pb.Text +
                     "', 'admin', '" + pb.Name + "', '" + pb.FindForm().Name + "')");
 }
        public static Dictionary <string, JObject> typeSerialize()
        {
            Dictionary <string, JObject> AllTypesData = new Dictionary <string, JObject>();

            #region Button
            Dictionary <string, string> ButtonData = new Dictionary <string, string>();
            if (DesignClass.BUTTON_BACKGROUND_IMG_ADRESS != null)
            {
                ButtonData.Add("BackgroundImage", DesignClass.BUTTON_BACKGROUND_IMG_ADRESS.ToString());
            }

            //ButtonData.Add("BackgroundImageLayout", button1.BackgroundImageLayout.ToString());

            if (DesignClass.BUTTON_TEXT_COLOR != null)
            {
                ButtonData.Add("ForeColor", ButtonUniqueForm.ColorToJSON(DesignClass.BUTTON_TEXT_COLOR));//DesignClass.BUTTON_TEXT_COLOR.ToString());
            }
            if (DesignClass.BUTTON_FONT != null)
            {
                ButtonData.Add("Font", DesignClass.BUTTON_FONT.ToString());
            }
            if (DesignClass.BUTTON_COLOR != null)
            {
                ButtonData.Add("Color", ButtonUniqueForm.ColorToJSON(DesignClass.BUTTON_COLOR));//.ToString());
            }

            ButtonData.Add("ImageAlign", DesignClass.BUTTONIMAGE_ALLINE.ToString());   //.ToString());
            ButtonData.Add("FlatStyle", Convert.ToString(DesignClass.FLAT_OF_BUTTON)); //.ToString());

            #endregion
            AllTypesData.Add("button", JObject.FromObject(ButtonData));

            foreach (string type in AllTypesData.Keys)
            {
                SQLClass.Delete("DELETE FROM " + Tables.DEFAULT + " WHERE type = '" + type + "'");
                SQLClass.Insert(String.Format("INSERT INTO " + Tables.DEFAULT + "(type, design, author) VALUES ('{0}','{1}','{2}')",
                                              type, AllTypesData[type].ToString(), "test"));
            }

            return(AllTypesData);
        }
Exemple #3
0
        private void ИзменитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            switch (((ContextMenuStrip)((ToolStripMenuItem)sender).Owner).SourceControl.GetType().Name)
            {
            case "label":
                Label           pb = (Label)((ContextMenuStrip)((ToolStripMenuItem)sender).Owner).SourceControl;
                LabelUniqueForm f  = new LabelUniqueForm(pb);
                f.ShowDialog();
                pb = f.newLabel;
                LabelUniqueForm.UpdateLabelDesignInDb(pb);
                break;

            case "Button":
                Button           pb1 = (Button)((ContextMenuStrip)((ToolStripMenuItem)sender).Owner).SourceControl;
                ButtonUniqueForm f1  = new ButtonUniqueForm(pb1);
                f1.ShowDialog();
                pb1 = f1.newButton;
                LabelUniqueForm.UpdateLabelDesignInDb(pb1);
                break;
            }
        }