コード例 #1
0
        public Main()
        {
            InitializeComponent();
            btnManage.Visible = Properties.Settings.Default.UserType == "Admin" ? true : false;
            btnScores.Visible = Properties.Settings.Default.UserType == "Admin" ? true : false;
            btnDBPath.Visible = Properties.Settings.Default.UserType == "Admin" ? true : false;

            database = new Database(new OleDbConnection(Properties.Settings.Default.ConnectionString), new OleDbCommand());
            database.setAdapter(new OleDbDataAdapter());

            var materialSkinManager = MaterialSkinManager.Instance;

            materialSkinManager.AddFormToManage(this);
            materialSkinManager.Theme       = MaterialSkinManager.Themes.LIGHT;
            materialSkinManager.ColorScheme = new ColorScheme(Primary.Cyan800, Primary.Cyan900, Primary.Cyan500, Accent.LightBlue200, TextShade.WHITE);

            int i = 0;


            DataTable table = database.Select("Module_Data", null, "");

            table.DefaultView.Sort = "ID";
            table = table.DefaultView.ToTable();

            for (int a = 0; a < table.Rows.Count; a++)
            {
                ModuleOverView module = new ModuleOverView(
                    Image.FromFile(table.Rows[a]["Image_Path"].ToString()),
                    table.Rows[a]["Title"].ToString(),
                    table.Rows[a]["Description"].ToString(),
                    table.Rows[a]["PDFPath"].ToString());
                module.Top  = posY;
                module.Left = posX;
                i          += 1;
                posX        = (10 + module.Width + module.Left);
                if (0 == i % 3)
                {
                    posY = (10 + module.Height + module.Top);
                    posX = 50;
                }
                this.panel1.Controls.Add(module);
            }
            //DataTable quizScore = database.Select("Score", null, "");
            //quizScore.DefaultView.Sort = "ID";
            //quizScore = quizScore.DefaultView.ToTable();
            //int quizPosY = 4;
            //    for (int a = 0; a < quizScore.Rows.Count; a++)
            //    {

            //    Scores score = new Scores(quizScore.Rows[a]["Quiz_Title"].ToString(),
            //       quizScore.Rows[a]["Score"].ToString(),Boolean.Parse(quizScore.Rows[a]["isPass"].ToString()));
            //    score.Top = quizPosY;
            //    //  quiz.Left = 4;
            //    quizPosY = (score.Top + score.Height + 4);
            //        this.panelScores.Controls.Add(score);

            //    }
        }
コード例 #2
0
        public Main()
        {
            InitializeComponent();
            var materialSkinManager = MaterialSkinManager.Instance;

            materialSkinManager.AddFormToManage(this);
            materialSkinManager.Theme       = MaterialSkinManager.Themes.LIGHT;
            materialSkinManager.ColorScheme = new ColorScheme(Primary.Cyan800, Primary.Cyan900, Primary.Cyan500, Accent.LightBlue200, TextShade.WHITE);


            //ModuleOverView module = new ModuleOverView();
            //module.Top = posY;
            //module.Left = posX;
            //posX = (10 + module.Width + module.Left);
            //ModuleOverView module1 = new ModuleOverView();
            //module1.Top = posY;
            //module1.Left = posX;
            //posX = (10 + module1.Width + module1.Left);
            //ModuleOverView module2 = new ModuleOverView();
            //module2.Top = posY;
            //module2.Left = posX;
            //this.panel1.Controls.Add(module);
            //this.panel1.Controls.Add(module1);
            //this.panel1.Controls.Add(module2);
            var lines = File.ReadLines(@"Module_Data.txt");
            int i     = 0;

            foreach (var line in lines)
            {
                i++;
                ModuleOverView module = new ModuleOverView(new Bitmap(parseLine(line)[0]), parseLine(line)[1], parseLine(line)[2]);
                module.Top  = posY;
                module.Left = posX;
                posX        = (10 + module.Width + module.Left);
                if (0 == i % 3)
                {
                    posY = (10 + module.Height + module.Top);
                    posX = 50;
                }
                this.panel1.Controls.Add(module);
            }
        }