示例#1
0
        private void Load(object sender)
        {
            LoadingWindow loading = (LoadingWindow)sender;

            _log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            _log.Info("Application started");

            Hub.Instance.Storage.DataStore.InitCache(s =>
            {
                Current.Dispatcher.Invoke(() => { loading.SetMessage(s); });
            });

            // TODO: i18n
            loading.SetMessage("Loading models");

            ViewModelLocator.Instance.NotebookMenu.Loaded  = true;
            ViewModelLocator.Instance.NoteMenu.Loaded      = true;
            ViewModelLocator.Instance.NoteView.Loaded      = true;
            ViewModelLocator.Instance.Main.Loaded          = true;
            ViewModelLocator.Instance.Librarys.Loaded      = true;
            ViewModelLocator.Instance.Settings.Loaded      = true;
            ViewModelLocator.Instance.BackupManager.Loaded = true;

            loading.SetMessage("Loading main window");

            Current.Dispatcher.Invoke(ShowMainWindow);
            Current.Dispatcher.Invoke(() =>
            {
                loading.Close();
            });
        }
示例#2
0
        private void LoadLibrary(Library library)
        {
            _currentLibrary = library;
            ViewModelLocator.Cleanup();

            Hub.Instance.Init(library);
            InitLog4Net();
            SetAppTheme();

            Hub.Instance.Settings.PropertyChanged += SettingsPropertyChanged;
            _activityTimer = new DispatcherTimer
            {
                Interval  = TimeSpan.FromMinutes(Hub.Instance.Settings.AutoLockMainWindowAfter),
                IsEnabled = true
            };
            _activityTimer.Tick += OnInactivity;

            var loading = new LoadingWindow();

            SetTheme(loading);

            loading.Loaded += LoadingLoaded;
            loading.SetMessage("Initializing core");
            loading.Show();
        }
示例#3
0
        private void Load(object sender)
        {
            LoadingWindow loading = (LoadingWindow)sender;

            _log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            _log.Info("Application started");

            Hub.Instance.Storage.DataStore.InitCache(s =>
            {
                Current.Dispatcher.Invoke(() => { loading.SetMessage(s); });
            });

            loading.SetMessage("Loading main window");

            Current.Dispatcher.Invoke(ShowMainWindow);
            Current.Dispatcher.Invoke(() =>
            {
                loading.Close();
            });
        }