Exemplo n.º 1
0
        public static void Main_SetSettings(Form_Main frm)
        {
            Thread P_thread = new Thread(
                () => //lambda表达式(参数列表)=>{执行语句}  lambda表达式是比匿名方法更加简洁的一种匿名函数语法
            {
                frm.Invoke(new MethodInvoker(delegate()
                {
                    ///////////////设置style
                    frm.label1.ForeColor   = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetMainColor();
                    frm.panel1.BackColor   = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetMainColor();
                    frm.tabPage1.BackColor = frm.tabPage2.BackColor = frm.tabPage3.BackColor = frm.tabPage4.BackColor = frm.tabPage5.BackColor = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetPanelColor();
                    frm.flowLayoutPanel_usepings.BackColor = frm.flowLayoutPanel1.BackColor = frm.flowLayoutPanel2.BackColor = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetPanelColor();
                    frm.panel2.BackColor = frm.panel7.BackColor = frm.panel8.BackColor = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetPanelColor();
                    frm.BackColor        = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetPanelColor();
                    ///////////////////logo
                    frm.myModernButton2.ButtonSmallLogo = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.FunctionLogo, "S01", false);
                    frm.myModernButton4.ButtonBackImage = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.FunctionLogo, "S06", false);
                    frm.myModernButton5.ButtonBackImage = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.FunctionLogo, "S05", false);
                    frm.myModernButton6.ButtonBackImage = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.FunctionLogo, "S02", false);
                    //frm.myModernButton7.ButtonBackImage = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.Skins.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.Skins.GetSkin_GetImageType.FunctionLogo, "S03", false);
                    frm.myModernButton8.ButtonBackImage  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.FunctionLogo, "S01", false);
                    frm.myModernButton12.ButtonBackImage = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.FunctionLogo, "S03", false);
                    frm.myModernButton9.ButtonBackImage  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.FunctionLogo, "S08", false);
                    frm.myModernButton10.ButtonBackImage = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.FunctionLogo, "S04", false);
                    frm.myModernButton11.ButtonBackImage = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.FunctionLogo, "S07", false);
                    frm.myModernButton1.ButtonSmallLogo  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.FunctionLogo, "S03", false);
                    // frm.myModernButton1.ButtonBackImage = Class_SystemStyle.SystemStyle_SortingFile_LoadConditionToTile();
                }));
            });    //new thread

            P_thread.IsBackground = true;
            P_thread.Start();
        }
Exemplo n.º 2
0
        public static void Main_Enter(int FirstFunctionIndex, int SecondFunctionIndex, Form_Main frm)
        {
            Thread P_thread = new Thread(
                () => //lambda表达式(参数列表)=>{执行语句}  lambda表达式是比匿名方法更加简洁的一种匿名函数语法
            {
                frm.Invoke(new MethodInvoker(delegate()
                {
                    try
                    {
                        frm.myNormalButton1.ButtonBackColor  = frm.myNormalButton2.ButtonBackColor = frm.myNormalButton3.ButtonBackColor = frm.myNormalButton4.ButtonBackColor = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetMainColor();
                        frm.myNormalButton1.ButtonForceColor = frm.myNormalButton2.ButtonForceColor = frm.myNormalButton3.ButtonForceColor = frm.myNormalButton4.ButtonForceColor = Color.White;
                        frm.myNormalButton1.ButtonBackImage  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.MainForm, "m01", true);
                        frm.myNormalButton2.ButtonBackImage  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.MainForm, "m02", true);
                        frm.myNormalButton3.ButtonBackImage  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.MainForm, "m03", true);
                        frm.myNormalButton4.ButtonBackImage  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.MainForm, "m04", true);
                        frm.tabControl1.SelectedIndex        = FirstFunctionIndex - 1;
                        switch (FirstFunctionIndex)
                        {
                        case 4:
                            frm.ChooseFunction_CommandLine = "/M=04,01";
                            frm.ChooseFunction_Icon_Ico    = @"M04";
                            frm.ChooseFunction_Icon_Logo   = "M04";
                            frm.ChooseFunction_Info        = "系统齿轮的有关信息";
                            frm.ChooseFunction_Name        = frm.myNormalButton4.ButtonText;
                            //frm.button4.BackColor = Color.White;
                            frm.label8.Text = Application.ProductVersion;
                            frm.label7.Text = "系统齿轮 V" + Application.ProductVersion.Substring(0, 3) + " 正式版";
                            //frm.button4.Image = Properties.Resources.M04_Choose;
                            frm.myNormalButton4.ButtonBackColor  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetForceColor();
                            frm.myNormalButton4.ButtonForceColor = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.GetApplicationSetting_MainColor();
                            frm.myNormalButton4.ButtonBackImage  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.MainForm, "m04", false);
                            break;

                        case 2:
                            frm.myNormalButton2.ButtonBackColor  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetForceColor();
                            frm.myNormalButton2.ButtonForceColor = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.GetApplicationSetting_MainColor();
                            frm.myNormalButton2.ButtonBackImage  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.MainForm, "m02", false);
                            frm.ChooseFunction_CommandLine       = "/M=02,01";
                            frm.ChooseFunction_Icon_Ico          = "M02";
                            frm.ChooseFunction_Icon_Logo         = "M02";
                            frm.ChooseFunction_Info = "系统齿轮的所有的设置";
                            frm.ChooseFunction_Name = frm.myNormalButton2.ButtonText;
                            break;

                        case 3:
                            frm.myNormalButton3.ButtonBackColor  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetForceColor();
                            frm.myNormalButton3.ButtonForceColor = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.GetApplicationSetting_MainColor();
                            frm.myNormalButton3.ButtonBackImage  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.MainForm, "m03", false);
                            frm.textBox1.Text = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.GetApplicationSetting_StartCommand();
                            frm.ChooseFunction_CommandLine = "/M=03,01";
                            frm.ChooseFunction_Icon_Ico    = "M03";
                            frm.ChooseFunction_Icon_Logo   = "M03";
                            frm.ChooseFunction_Info        = "系统齿轮的设置";
                            frm.ChooseFunction_Name        = frm.myNormalButton3.ButtonText;

                            if (MyFunctions.StreamAndTextOperate.ConfigFileOperate.SGCFFileOperate_GetValue("mainsettings", "MinBoxChoose", "TaskBar", false, Application.StartupPath + @"\Config\MainProgram.sgcf").ToUpper() == "TASKBAR")
                            {
                                frm.radioButton1.Checked = true;
                            }
                            else
                            {
                                frm.radioButton2.Checked = true;
                            }
                            if (MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.GetApplicationSetting_ClickCloseBoxToOperate().ToUpper() == "CLOSE")
                            {
                                frm.radioButton4.Checked = true;
                            }
                            else
                            {
                                if (MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.GetApplicationSetting_ClickCloseBoxToOperate().ToUpper() == "HIDE")
                                {
                                    frm.radioButton3.Checked = true;
                                }
                            }
                            break;

                        default:
                            frm.myNormalButton1.ButtonBackColor  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetForceColor();
                            frm.myNormalButton1.ButtonForceColor = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.GetApplicationSetting_MainColor();
                            frm.myNormalButton1.ButtonBackImage  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageLocationWithPicture(MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetImageType.MainForm, "m01", false);
                            frm.label2.ForeColor = frm.label3.ForeColor = Color.Black;
                            switch (SecondFunctionIndex)
                            {
                            case 2:
                                frm.MainPanel_Choose                 = "TOOLS";
                                frm.label23.ForeColor                = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetM01TitleColor_Choose();
                                frm.label2.ForeColor                 = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetM01TitleColor_Normal();
                                frm.label3.ForeColor                 = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetM01TitleColor_Normal();
                                frm.flowLayoutPanel2.Visible         = true;
                                frm.flowLayoutPanel2.Location        = new Point(8, 27);
                                frm.flowLayoutPanel2.Size            = new Size(671, 413);
                                frm.flowLayoutPanel_usepings.Visible = false;
                                frm.flowLayoutPanel1.Visible         = false;
                                frm.ChooseFunction_CommandLine       = "/M=01,02";
                                Main_LoadUserPing(frm);
                                frm.ChooseFunction_Icon_Ico  = "M01";
                                frm.ChooseFunction_Icon_Logo = "M01";
                                frm.ChooseFunction_Info      = "系统齿轮所有的实用工具";
                                frm.ChooseFunction_Name      = "所有工具";
                                break;

                            case 3:
                                frm.MainPanel_Choose                  = "USERPING";
                                frm.label3.ForeColor                  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetM01TitleColor_Choose();
                                frm.label2.ForeColor                  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetM01TitleColor_Normal();
                                frm.label23.ForeColor                 = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetM01TitleColor_Normal();
                                frm.flowLayoutPanel1.Visible          = false;
                                frm.flowLayoutPanel2.Visible          = false;
                                frm.flowLayoutPanel_usepings.Location = new Point(8, 27);
                                frm.flowLayoutPanel_usepings.Size     = new Size(671, 413);
                                frm.flowLayoutPanel_usepings.Visible  = true;
                                frm.ChooseFunction_CommandLine        = "/M=01,03";
                                Main_LoadUserPing(frm);
                                frm.ChooseFunction_Icon_Ico  = "M01";
                                frm.ChooseFunction_Icon_Logo = "M01";
                                frm.ChooseFunction_Info      = "系统齿轮用户自定义固定的选项";
                                frm.ChooseFunction_Name      = "用户自定义";
                                break;

                            default:
                                frm.MainPanel_Choose  = "SG";
                                frm.label2.ForeColor  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetM01TitleColor_Choose();
                                frm.label23.ForeColor = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetM01TitleColor_Normal();
                                frm.label3.ForeColor  = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.SkinsAndResources.GetSkin_GetM01TitleColor_Normal();

                                /*
                                 *  UserControl_FormMain_SGPrograms sg = new UserControl_FormMain_SGPrograms();
                                 *  frm.tabPage1.Controls.Add(sg);
                                 *  sg.MouseDown += new MouseEventHandler(frm.Form_Main_MouseDown);
                                 *  sg.flowLayoutPanel1.MouseDown += new MouseEventHandler(frm.Form_Main_MouseDown);
                                 *  sg.Location = new Point(8, 27);
                                 * */
                                frm.flowLayoutPanel1.Visible         = true;
                                frm.flowLayoutPanel1.Location        = new Point(8, 27);
                                frm.flowLayoutPanel1.Size            = new Size(671, 413);
                                frm.flowLayoutPanel_usepings.Visible = false;
                                frm.flowLayoutPanel2.Visible         = false;
                                frm.ChooseFunction_CommandLine       = "/M=01,01";
                                frm.ChooseFunction_Icon_Ico          = "M01";
                                frm.ChooseFunction_Icon_Logo         = "M01";
                                frm.ChooseFunction_Info = "系统齿轮推荐的设置";
                                frm.ChooseFunction_Name = "系统齿轮推荐";

                                break;
                            }
                            break;
                        }
                        Main_SetSettings(frm);
                    }
                    catch
                    {
                    }
                }));
            });    //new thread

            P_thread.IsBackground = true;
            P_thread.Start();
        }