Beispiel #1
0
        public MainWindow()
        {
            InitializeComponent();

            //Load in configuration data
            HumanAcceleratedLearningConfiguration.GetInstance();
            HumanAcceleratedLearningConfiguration.GetInstance().LoadAllStages();
            HumanAcceleratedLearningConfiguration.GetInstance().LoadLanguageDictionaries();

            //Determine whether to maximize the window or not
            double w = System.Windows.SystemParameters.PrimaryScreenWidth;
            double h = System.Windows.SystemParameters.PrimaryScreenHeight;

            if (w >= (h * 2))
            {
                this.WindowState = WindowState.Normal;
            }
            else
            {
                this.WindowState = WindowState.Maximized;
            }

            //Set up the UI
            Initialize_UserInterface();
        }
        /// <summary>
        /// Creates a new test block file
        /// </summary>
        public static StreamWriter CreateTestBlockFile(string username)
        {
            //Construct a file name to write
            string date_for_filename = DateTime.Now.ToString("yyyyMMdd_HHmmss");
            string file_name         = username + "_" + date_for_filename + ".txt";

            //Construct a full path and file
            string fully_qualified_path = HumanAcceleratedLearningConfiguration.GetInstance().PrimarySavePath + username + @"\Test\";

            //See if the directory already exists.  If not, then make it.
            DirectoryInfo dir_info = new DirectoryInfo(fully_qualified_path);

            if (!dir_info.Exists)
            {
                //Create the directory
                dir_info.Create();
            }

            //Create a new file for this text block
            string       fully_qualified_file = fully_qualified_path + file_name;
            StreamWriter writer = new StreamWriter(fully_qualified_file);

            //Write the username as the file header
            writer.WriteLine(username);

            //Return the StreamWriter object so that it can be used
            return(writer);
        }
        public static HumanAcceleratedLearningConfiguration GetInstance()
        {
            if (_instance == null)
            {
                lock (_instance_lock)
                {
                    if (_instance == null)
                    {
                        _instance = new HumanAcceleratedLearningConfiguration();
                    }
                }
            }

            return(_instance);
        }
        /// <summary>
        /// Creates a study block file for the specified username
        /// </summary>
        public static StreamWriter CreateStudyBlockFile(string username)
        {
            string date_for_filename = DateTime.Now.ToString("yyyyMMdd_HHmmss");
            string file_name         = username + "_" + date_for_filename + ".txt";

            string        fully_qualified_path = HumanAcceleratedLearningConfiguration.GetInstance().PrimarySavePath + username + @"\Study\";
            DirectoryInfo dir_info             = new DirectoryInfo(fully_qualified_path);

            if (!dir_info.Exists)
            {
                dir_info.Create();
            }

            string fully_qualified_file = fully_qualified_path + file_name;

            StreamWriter writer = new StreamWriter(fully_qualified_file);

            writer.WriteLine(username);

            return(writer);
        }