예제 #1
0
 private Settings(MainWindow MainProgram)
 {
     InitializeComponent();
     main   = MainProgram;
     backup = NoteBackup.GetInstance();
     Init();
 }
예제 #2
0
 public static NoteBackup GetInstance()
 {
     if (instance == null)
     {
         instance = new NoteBackup();
     }
     return(instance);
 }
예제 #3
0
        private void Init()
        {
            check_interval = new TimeSpan(0, 0, 30);
            settings       = Settings.GetInstance(this);
            info           = Info.GetInstance();
            sorted         = false;
            lastOrder      = ListSortDirection.Descending;
            img_order_desc = new BitmapImage(new Uri("img/down.png", UriKind.Relative));
            img_order_asc  = new BitmapImage(new Uri("img/up.png", UriKind.Relative));
            player         = new MediaPlayer();
            Uri u = new Uri(AppDomain.CurrentDomain.BaseDirectory + @"sound/bell.mp3", UriKind.Absolute);

            if (!File.Exists(u.LocalPath))
            {
                MessageBox.Show(String.Format(Res("s_soundnf"), u.LocalPath));
            }
            try
            {
                player.Open(u);
                player.MediaEnded += delegate(object s, EventArgs e) { player.Stop(); };
                player.Volume      = 1;
            }
            catch (Exception e)
            {
                MessageBox.Show(String.Format(Res("s_cannotopenf"), u.LocalPath, e.Message), Res("s_error"));
                player = null;
            }
            backup = NoteBackup.GetInstance();
            notificationsEnabled = backup.GetNotificationsEnabled();
            List <NoteStruct> backups = backup.ReadSavedNotes();

            foreach (NoteStruct note in backups)
            {
                list_todos.Items.Add(note);
            }
            SetWindowHeight();
            inspector          = new DispatcherTimer();
            inspector.Interval = check_interval;
            inspector.Tick    += Inspect;
            inspector.Start();
            SwitchOrder();
        }