Esempio n. 1
0
        public static MySqlConnection CreateMySqlConnection()
        {
            string str_Conn = String.Format("server={0};user id={1}; password={2}; database={3}; port={4}; pooling=false",
                                            str_Server, str_UserID, str_Password, str_Database, str_Port);
            MySqlConnection MySql_Conn = null;

            try
            {
                MySql_Conn = new MySqlConnection(str_Conn);
                MySql_Conn.Open();
            }
            catch
            {
                //System.Windows.Forms.MessageBox.Show("Error connecting to the server: " + ex.Message);
                AuroraMessageBox msg = null;
                msg               = new AuroraMessageBox();
                msg.strCaption    = "Aurora智能提示";
                msg.strMessage    = "Aurora 服务器偷了个小懒, 请稍后再试.";
                msg.strButtonText = "确定";
                msg.StartPosition = FormStartPosition.CenterScreen;
                msg.ShowDialog();

                return(null);
            }
            return(MySql_Conn);
        }
Esempio n. 2
0
        private void dSkinButton_BackGround_Click(object sender, EventArgs e)
        {
            bool           bbb            = dSkinCheckBox_ImageFuzzy.Checked;
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter      = "Image Files(*.All Types)|*.jpg;*.jpeg;*.png;*.bmp;*.gif";
            openFileDialog.FilterIndex = 1;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                System.IO.FileInfo fl = new System.IO.FileInfo(openFileDialog.FileName);
                if (fl.Length > 1024 * 1024)
                {
                    //System.Windows.Forms.MessageBox.Show("请选择1M以内的横向图片");
                    AuroraMessageBox msg = null;
                    msg               = new AuroraMessageBox();
                    msg.strCaption    = "Aurora智能提示";
                    msg.strMessage    = "请选择1M以内的横向图片";
                    msg.strButtonText = "确定";
                    msg.StartPosition = FormStartPosition.Manual;
                    msg.Location      = new Point(this.Location.X + this.Width / 2 - msg.Width / 2, this.Location.Y + this.Height / 2 - msg.Height / 2);
                    msg.ShowDialog();
                    return;
                }
                mainFrm.str_BackGroundImage = dSkinTextBox_BackGround.Text = openFileDialog.FileName;
                mainFrm.SetPlayerBackground();
                mainFrm.ItemHoverColor = SkinTools.GetImageAverageColor(Image.FromFile(openFileDialog.FileName));
                HSL hsl = ColorConverterEx.ColorToHSL(mainFrm.ItemHoverColor);
                //hsl.Luminance += 0.2;
                //if (hsl.Luminance >= 1)
                //    hsl.Luminance = 0.99;
                hsl.Saturation += 0.2;
                if (hsl.Saturation >= 1)
                {
                    hsl.Saturation = 0.99;
                }
                mainFrm.ItemHoverColor           = ColorConverterEx.HSLToColor(hsl);
                dSkinCheckBox_ImageFuzzy.Checked = !bbb;
                dSkinCheckBox_ImageFuzzy.Checked = bbb;
                this.Invalidate();
            }
        }