Beispiel #1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            Const.BackgroundColor = Const.parseStringToColor(cBoxBackground.SelectedItem.ToString());
            Const.ButtonColor     = Const.parseStringToColor(cBoxBBeckground.SelectedItem.ToString());
            Const.TextColor       = Const.parseStringToColor(cBoxBText.SelectedItem.ToString());
            Const.currentLevel    = new Level(Int32.Parse(cBoxLevel.SelectedItem.ToString()));

            if ((cBoxLeanguage.SelectedItem.ToString() == "Italiano" || cBoxLeanguage.SelectedItem.ToString() == "Italian"))
            {
                cBoxBackground.Items.Clear();
                cBoxBBeckground.Items.Clear();
                cBoxBText.Items.Clear();
                cBoxLeanguage.Items.Clear();

                Const.isItalian = 0;

                defineCBox();
            }
            else if (Const.isItalian != 1)
            {
                cBoxBackground.Items.Clear();
                cBoxBBeckground.Items.Clear();
                cBoxBText.Items.Clear();
                cBoxLeanguage.Items.Clear();

                Const.isItalian = 1;

                defineCBox();
            }


            init();

            Const.proj.init();
            Const.proj.loadCanvas();
            Const.proj.drawShape();
            Const.menu.init();
            Const.help.init();


            Const.saveSettingOnFile();
        }
Beispiel #2
0
        public static void loadSettingFile()
        {
            try
            {
                //Pass the file path and file name to the StreamReader constructor
                StreamReader sr = new StreamReader("Settings.txt");
                //Read the first line of text


                Const.isItalian    = Int32.Parse(sr.ReadLine());
                Const.currentLevel = new Level(Int32.Parse(sr.ReadLine()));


                if (Const.isItalian == 0)
                {
                    Const.ButtonColor     = Const.parseStringToColor(Const.convertTextItToIng(sr.ReadLine()));
                    Const.BackgroundColor = Const.parseStringToColor(Const.convertTextItToIng(sr.ReadLine()));
                    Const.TextColor       = Const.parseStringToColor(Const.convertTextItToIng(sr.ReadLine()));
                }
                else
                {
                    Const.ButtonColor     = Const.parseStringToColor(sr.ReadLine());
                    Const.BackgroundColor = Const.parseStringToColor(sr.ReadLine());
                    Const.TextColor       = Const.parseStringToColor(sr.ReadLine());
                }


                //Close the file
                sr.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
                Const.currentLevel = new Level(3);
            }
        }