Esempio n. 1
0
        public void SaveParam(AppParams _param)
        {
            StreamWriter saver = null;

            try
            {
                saver = new StreamWriter(paramFileName);
                saver.WriteLine($"HowLongShow={_param.HowLongShow}");
                saver.WriteLine($"Max1={_param.Max1}");
                saver.WriteLine($"Freq1={_param.Freq1}");
                saver.WriteLine($"Max2={_param.Max2}");
                saver.WriteLine($"Freq2={_param.Freq2}");
                saver.WriteLine($"Max3={_param.Max3}");
                saver.WriteLine($"Freq3={_param.Freq3}");
            }
            catch (Exception ex)
            {
                throw new FileLoadException(ex.Message);
            }
            finally
            {
                if (saver != null)
                {
                    saver.Close();
                }
            }
        }
Esempio n. 2
0
        public RememberWordsForm()
        {
            InitializeComponent();
            notifyForm = new NotifyForm();
            paramsForm = new ParamsForm();

            try
            {
                Params       = paramsForm.LoadParam();
                wordReminder = new WordReminder(Params);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            Load        += RemeberWordsForm_Load;
            FormClosing += RemeberWordsForm_FormClosing;
            Resize      += RemeberWordsForm_Resize;
            Shown       += RemeberWordsForm_Shown;
            LoadTexBoxs();
            LoadTimer();

            btnAdd.Click      += BtnAdd_Click;
            btnParam.Click    += BtnParam_Click;
            notifyIcon1.Click += NotifyIcon1_Click;
        }
Esempio n. 3
0
 public WordReminder(AppParams _param)
 {
     param           = _param;
     words           = new List <WordStruct>();
     archive         = new List <WordStruct>();
     dataFileName    = "words.txt";
     archiveFileName = "archive.txt";
     rnd             = new Random();
     LoadWords();
 }
Esempio n. 4
0
        public AppParams LoadParam()
        {
            StreamReader loader = null;

            param = new AppParams();
            try
            {
                loader = new StreamReader(paramFileName);
                string[] str = loader.ReadLine().Split("=".ToArray());
                param.HowLongShow = int.Parse(str[1]);

                str        = loader.ReadLine().Split("=".ToArray());
                param.Max1 = int.Parse(str[1]);

                str         = loader.ReadLine().Split("=".ToArray());
                param.Freq1 = int.Parse(str[1]);

                str        = loader.ReadLine().Split("=".ToArray());
                param.Max2 = int.Parse(str[1]);

                str         = loader.ReadLine().Split("=".ToArray());
                param.Freq2 = int.Parse(str[1]);

                str        = loader.ReadLine().Split("=".ToArray());
                param.Max3 = int.Parse(str[1]);

                str         = loader.ReadLine().Split("=".ToArray());
                param.Freq3 = int.Parse(str[1]);
            }
            catch
            {
                param = new AppParams();
            }
            finally
            {
                if (loader != null)
                {
                    loader.Close();
                }
            }
            return(param);
        }
Esempio n. 5
0
 public DialogResult ShowDialog(AppParams _param)
 {
     param = _param;
     SetValue();
     return(ShowDialog());
 }