Esempio n. 1
0
        private void frmSettings_Load(object sender, EventArgs e)
        {
            start.Text         = SettingsAdapter.Starttime().ToString("HH:mm:ss tt");
            ptime.Text         = SettingsAdapter.PeriodTime().ToString();
            stime.Text         = SettingsAdapter.Songstime().ToString("HH:mm:ss tt");
            list.Text          = SettingsAdapter.Playlist();
            _path              = SettingsAdapter.Playlist();
            inttime.Text       = SettingsAdapter.Interval().ToString();
            lunch.Text         = SettingsAdapter.Lunch().ToString();
            themelight.Checked = SettingsAdapter.Theme();
            themedark.Checked  = !themelight.Checked;
            RegistryKey k = Registry.CurrentUser.OpenSubKey(
                @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);

            try
            {
                if (k != null)
                {
                    startup.Checked = !string.IsNullOrEmpty(k.GetValue("Bell").ToString());

                    k.Close();
                }
            }
            catch (Exception)
            {
                if (k != null)
                {
                    k.Close();
                }
                startup.Checked = false;
                //MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
 public FrmSettings()
 {
     InitializeComponent();
     Title = Text;
     _materialSkinManager.AddFormToManage(this);
     _materialSkinManager.Theme = SettingsAdapter.Theme()
         ? MaterialSkinManager.Themes.Light : MaterialSkinManager.Themes.Dark;
     _materialSkinManager.ColorScheme = new ColorScheme(Primary.Indigo600,
                                                        Primary.Indigo700, Primary.Indigo200, Accent.Red700, TextShade.White);
 }
Esempio n. 3
0
        public Form1()
        {
            InitializeComponent();

            var digclk = new DigitalClockCtrl
            {
                Size     = new Size(tableLayoutPanel1.GetColumnWidths()[5], tableLayoutPanel1.GetRowHeights()[8]),
                Location = new Point(0, 0),
            };

            tableLayoutPanel1.Controls.Add(digclk, 5, 8);
            digclk.SetDigitalColor    = DigitalColor.BlueColor;
            digclk.BackColor          = MaterialSkinManager.BackgroundDark;
            player.CurrentItemChange += player_CurrentItemChange;
            Icon  = Resources.ic_launcher;
            Title = SoftwareCompleteName;
            var materialSkinManager = MaterialSkinManager.Instance;

            materialSkinManager.AddFormToManage(this);

            materialSkinManager.Theme       = SettingsAdapter.Theme() ? MaterialSkinManager.Themes.Light : MaterialSkinManager.Themes.Dark;
            materialSkinManager.ColorScheme = new ColorScheme(Primary.Indigo600,
                                                              Primary.Indigo700, Primary.Indigo200, Accent.Red100, TextShade.White);

            var t = new[] { start, classmanagment, f1, f2, f3, fd,
                            p1, attendtime
                            , p2, p3, p4,
                            interval,
                            p5, p6,
                            lunch,
                            p7, p8, end8, end0, end, yo };

            foreach (var textField in t)
            {
                textField.ReadOnly = true;
            }
        }
Esempio n. 4
0
        private void FrmSettings_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (DialogResult == DialogResult.Cancel)
            {
                DialogResult dr = MessageBox.Show(@"Exit without saving?", @"Exit | Save",
                                                  MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (dr != DialogResult.Yes)
                {
                    e.Cancel = true;
                }
            }
            if (DialogResult == DialogResult.OK)
            {
                SettingsAdapter.Starttime(start.Text.ToTime());
                SettingsAdapter.PeriodTime(ptime.Text.ToInt());
                SettingsAdapter.Songstime(stime.Text.ToTime());
                SettingsAdapter.Playlist(_path);
                SettingsAdapter.Interval(inttime.Text.ToInt());
                SettingsAdapter.Lunch(lunch.Text.ToInt());
                SettingsAdapter.Theme(themelight.Checked);

                SettingsAdapter.Save();

                _materialSkinManager.Theme = SettingsAdapter.Theme() ?
                                             MaterialSkinManager.Themes.Light : MaterialSkinManager.Themes.Dark;
                //  try
                //  {
                RegistryKey k = Registry.CurrentUser.OpenSubKey(
                    @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
                if (startup.Checked)
                {
                    try
                    {
                        if (k != null)
                        {
                            k.DeleteValue("Bell");
                        }
                    }
                    catch
                    {
                        // ignored
                    }
                    if (k != null)
                    {
                        k.SetValue("Bell", Application.ExecutablePath.Replace(@"/", @"\"),
                                   RegistryValueKind.String);
                        k.Close();
                    }
                }
                else
                {
                    try
                    {
                        if (k != null)
                        {
                            k.DeleteValue("Bell");
                        }
                    }
                    catch
                    {
                        // ignored
                    }
                    if (k != null)
                    {
                        k.Close();
                    }
                }
                // }
                //// catch { }
            }
        }