static void Main()
        {
            bool createdNew = true;

            using (Mutex mutex = new Mutex(true, "Math Monkeys", out createdNew))
            {
                if (createdNew)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Ctrl programController = new Ctrl();
                    programController.RunProgram();
                    //Application.Run(new frmLogin()); 
                }
                else
                {
                    MessageBox.Show("Math Monkeys is already running.", "Math Monkeys", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); 
                }
            }



            #region Test Code

            /* XmlDocument xd = new XmlDocument();
             xd.Load(@"\t.xml");
            // Console.WriteLine(xd.SelectSingleNode("Test/testitem/name").InnerText);
             //Console.ReadKey(); 
             * */

            #endregion


        }
        /// <summary>
        /// Jonathan Sanborn
        /// Constructor
        /// 
        /// </summary>
        /// <param name="mmControl">The controller Object</param>
        public frmLogin(Ctrl mmControl)
        {
            InitializeComponent();
            control = mmControl;

            userBindingSource.DataSource = control.AllUserList;
            this.ddlUserName.SelectedIndexChanged += new EventHandler(control.LoginSelectionChanged);

            //done so that the selected index changed event fires
            //needs more elegent solution
            ddlUserName.SelectedIndex = -1;
            ddlUserName.SelectedIndex = 0;
        }
        /// <summary>
        /// 9 April 2014
        /// Jonathan Sanborn
        /// 
        /// XML Constructor
        /// </summary>
        /// <param name="mmControl">The Control Object</param>
        /// <param name="s">The Student this assignment belongs to</param>
        /// <param name="d">An XElement that represents a Assignment</param>
        public Assignment(Ctrl mmControl, Student s, XElement d)
        {
             ID = d.Element("ID").Value;
             ProblemSet = mmControl.FileHandler.GetProblemSetByID(d.Element("ProblemSetID").Value);
             DateAssigned = DateTime.Parse( d.Element("DateAssigned").Value);
             IsCompleted = bool.Parse(d.Element("Completed").Value);

             if (d.Element("DateCompleted") != null)
             { DateCompleted = DateTime.Parse(d.Element("DateCompleted").Value); }

             Student = s;
             GetAssignmentAttempts(mmControl);
        }
        /// <summary>
        /// 22 March 2014 Jonathan Sanborn & Harvey Mercado
        /// Parameterized constructor for Assignment
        /// </summary>
        /// <param name="mmControl">The Control Object</param>
        /// <param name="id">A unique ID for the Assignment</param>
        /// <param name="student">The student that this assignment belongs to.</param>
        /// <param name="problemSet">the problem set the assignment is built on</param>
        /// <param name="isCompleted">a boolean indicating that the assignment has been Completed</param>
        public Assignment(Ctrl mmControl, string id, Student student, ProblemSet problemSet, bool isCompleted)
        {
            init();

            this.ID = id;
            this.Student = student;
            this.ProblemSet = problemSet;
            this.IsCompleted = isCompleted;
            this.DateAssigned = DateTime.Now;

            GetAssignmentAttempts(mmControl);
        }
        /// <summary>
        /// 9 April 2014
        /// Jonathan Sanborn
        /// 
        /// Gets all the assignment attempts for this assignment that are stored in the XML
        /// </summary>
        /// <param name="mmControl">The Control object</param>
        public void GetAssignmentAttempts(Ctrl mmControl)
        {
            
            assignmentAttempts = mmControl.FileHandler.GetAssignmentAttemptsByAssignment(this);

            foreach (AssignmentAttempt aa in assignmentAttempts)
            {
                aa.Assignment = this;
            }
        }
 /// </summary>
 /// Be handed control by Ctrl object
 /// </summary>
 /// <author> Jeff Bunce </author>
 internal void TakeControl(Ctrl control)
 {
     parentControl = control;
     adminControlForm.ShowDialog();
     
 }
        //#region EventHandlers for frmDrillSettings

        //#endregion
        //#region DrillSettings Logic Methods
        //#endregion


        //// Simple form ==> Logic is contained in here
        //#region EventHandlers for frmAbout

        ///// </summary>
        ///// 
        ///// </summary>
        ///// <author> Jeff Bunce </author>
        //internal void CloseAboutForm()
        //{
        //}
        //#endregion



        #region Constructors

        /// <summary> 
        /// Construct this object by instantiating all sub-forms
        /// </summary>
        /// <author>
        /// 26 April 2014
        /// Jeff Bunce
        /// </author>
        /// <changelog>
        /// Created
        /// </changelog>
        internal CtrlAdmin(Ctrl control)
        {
            init();
            LoadNumberOfAttempts();
            adminControlForm = new frmAdminControl(this);
            // parentReportForm = new frmParentReport();
            studentReportForm = new frmStudentReport(this);
            assignStudenstForm = new frmAssignStudents(this);
            addUserForm = new frmAddUser(this);
            modifyUserForm = new frmModifyUser(this);
            removeUsersForm = new frmRemoveUsers(this);
            addProblemSetForm = new frmAddProblemSet(this);
            removeProblemSetForm = new frmRemoveProblemSet(this);
            problemSetDefaultsForm = new frmProblemSetDefaults(this);
            drillScreenSettingsForm = new frmDrillScreenSettings(this);
            aboutForm = new frmAbout();
            studentDetailForm = new frmStudentDetail ( this );
            summaryReportForm = new frmSummary(this);

        }
 /// <summary>
 /// Jonathan Sanborn
 /// 
 /// Copy construct from a User object
 /// </summary>
 /// <param name="mmControl">The Controller Object</param>
 /// <param name="student">The User to copy</param>
 public Student(Ctrl mmControl, Student student)
     : base()
 {
         init();
         this.ID = student.ID;
         this.UserType = student.UserType;
         this.FirstName = student.FirstName;
         this.LastName = student.LastName;
         this.ScreenName = student.ScreenName;
         this.LoginRecords = student.LoginRecords;
         this.Password = student.Password;
         this.RewardUnits = student.RewardUnits;
         getAssignments(mmControl);
 }
         /// <summary>
        /// 31 March 2014
        /// Jonathan Sanborn
        /// 
        /// Constructor takes a user XML node and creates a user object
        /// </summary>
        /// <param name="mmControl">The Controller Object</param>
        /// <param name="d">An XElement Containing the Student data</param>
        public Student(Ctrl mmControl, XElement d)
            : base(d)
        {
            init();

            if(d.Element("DOB") !=  null)
                DOB = DateTime.Parse(d.Element("DOB").Value);

            if(d.Element("Grade") != null)
                Grade = d.Element("Grade").Value;

            getAssignments(mmControl);

            if(d.Element("Reward") != null)
                RewardUnits = uint.Parse(d.Element("Reward").Value);
        }
Exemple #10
0
 /// <summary>
 /// Jonathan Sanborn
 /// 
 /// Get the assignments for this student from the XML 
 /// </summary>
 /// <param name="mmControl"></param>
 private void getAssignments(Ctrl mmControl)
 {
     Assignments = mmControl.FileHandler.GetAssignmentsByStudent(this);
 }
Exemple #11
0
        /// <summary>
        /// 29 March 2014
        /// Jonathan Sanborn
        /// 
        /// Parameterized constructor for A Student user
        /// </summary>
        /// <param name="mmControl">The Controller Object</param>
        /// <param name="id">Unique ID for the student in the system</param>
        /// <param name="fistName">The first Name of the student</param>
        /// <param name="lastName">The last name of the student</param>
        /// <param name="screenName">A unique screen name for the student</param>
        /// <param name="password">The password for the student</param>
        /// <param name="dob">The date of birth for the student</param>
        /// <param name="grade">The grade or group the student is in.</param>
        public Student(Ctrl mmControl, string id,string fistName, string lastName, 
                string screenName, string password, DateTime? dob, string grade, uint rewardUnits)
            : base(id, UserType.Student, fistName, lastName, screenName, password)
        {
            init();

            this.DOB = dob;
            this.grade = grade;

            getAssignments(mmControl);

            this.rewardUnits = rewardUnits;
        }
        /// <summary>
        /// Ctrl object calls CtrlStudents.TakeControl() to hand control over
        ///   to this object
        /// </summary>
        internal override void TakeControl(Ctrl control)
        {
            parentControl = control;

            KeepAlive = true; // All student forms require logout to return student to login screen

            studentWelcomeForm = new frmStudentWelcome(this);
            studentWelcomeForm.ShowDialog();
        }
 /// <summary>
 /// Initialize the CtrlStudent object
 /// </summary>
 /// <author>
 /// 26 April 2014
 /// Jeff Bunce
 /// </author>
 /// <changelog>
 /// Created
 /// </changelog>
 internal CtrlStudent(Ctrl control)
 {
     init();
 }
Exemple #14
0
 /// <summary>
 /// In derived classes, allows a child class to take over
 /// </summary>
 /// <author> Jeff Bunce </author>
 internal virtual void TakeControl(Ctrl parentCtrl)
 {
 }
 /// <summary>
 /// Jonathan Sanborn
 /// 
 /// Default Constructor for file handler
 /// </summary>
 /// <param name="mmControl">The Control Object</param>
 internal FileHandler(Ctrl mmControl)
 {
     init();
     control = mmControl;
 }
Exemple #16
0
        /// <summary>
        /// Jonathan Sanborn
        /// Called when a user logs out of the system
        /// </summary>
        public void Logout(Ctrl mmControl)
        {
            currentSession.Duration = DateTime.Now - currentSession.Date;
            LoginRecords.Add(currentSession);

            mmControl.FileHandler.UpdateUser((IXMLnode)this);
        }